qa-prevention-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/createVectorTilePolylines.js

2 lines
3.1 KiB
JavaScript
Raw Normal View History

2023-12-17 15:30:40 +08:00
define(["./Cartesian3-e0307675","./combine-3c023bda","./AttributeCompression-8f752c03","./Cartesian2-bd414876","./Math-e73894ab","./IndexDatatype-3f3c99e8","./Rectangle-cf3e0e3e","./createTaskProcessorWorker","./Check-741c5f3c","./defaultValue-81eec7ed","./ComponentDatatype-aaeec80f","./WebGLConstants-508b9636","./Matrix4-4c545f70","./RuntimeError-26acdd3b","./Matrix2-dc0c61cc","./when-422ea0ae"],(function(e,a,t,n,r,s,i,c,o,u,f,d,p,l,C,b){"use strict";const h=32767,w=new n.Cartographic,y=new e.Cartesian3;const k=new i.Rectangle,g=new n.Ellipsoid,m=new e.Cartesian3,A={min:void 0,max:void 0};const x=new e.Cartesian3,D=new e.Cartesian3,E=new e.Cartesian3,I=new e.Cartesian3,P=new e.Cartesian3;return c((function(c,o){const u=new Uint16Array(c.positions),f=new Uint16Array(c.widths),d=new Uint32Array(c.counts),p=new Uint16Array(c.batchIds);!function(a){a=new Float64Array(a);let t=0;A.min=a[t++],A.max=a[t++],i.Rectangle.unpack(a,t,k),t+=i.Rectangle.packedLength,n.Ellipsoid.unpack(a,t,g),t+=n.Ellipsoid.packedLength,e.Cartesian3.unpack(a,t,m)}(c.packedBuffer);const l=g,C=m,b=function(a,s,i,c,o){const u=a.length/3,f=a.subarray(0,u),d=a.subarray(u,2*u),p=a.subarray(2*u,3*u);t.AttributeCompression.zigZagDeltaDecode(f,d,p);const l=new Float64Array(a.length);for(let a=0;a<u;++a){const t=f[a],u=d[a],C=p[a],b=r.CesiumMath.lerp(s.west,s.east,t/h),k=r.CesiumMath.lerp(s.south,s.north,u/h),g=r.CesiumMath.lerp(i,c,C/h),m=n.Cartographic.fromRadians(b,k,g,w),A=o.cartographicToCartesian(m,y);e.Cartesian3.pack(A,l,3*a)}return l}(u,k,A.min,A.max,l),R=b.length/3,U=4*R-4,M=new Float32Array(3*U),T=new Float32Array(3*U),F=new Float32Array(3*U),N=new Float32Array(2*U),L=new Uint16Array(U);let S,_=0,v=0,G=0,W=0,B=d.length;for(S=0;S<B;++S){const a=d[S],t=f[S],n=p[S];for(let r=0;r<a;++r){let s;if(0===r){const a=e.Cartesian3.unpack(b,3*W,x),t=e.Cartesian3.unpack(b,3*(W+1),D);s=e.Cartesian3.subtract(a,t,E),e.Cartesian3.add(a,s,s)}else s=e.Cartesian3.unpack(b,3*(W+r-1),E);const i=e.Cartesian3.unpack(b,3*(W+r),I);let c;if(r===a-1){const t=e.Cartesian3.unpack(b,3*(W+a-1),x),n=e.Cartesian3.unpack(b,3*(W+a-2),D);c=e.Cartesian3.subtract(t,n,P),e.Cartesian3.add(t,c,c)}else c=e.Cartesian3.unpack(b,3*(W+r+1),P);e.Cartesian3.subtract(s,C,s),e.Cartesian3.subtract(i,C,i),e.Cartesian3.subtract(c,C,c);const o=r===a-1?2:4;for(let a=0===r?2:0;a<o;++a){e.Cartesian3.pack(i,M,_),e.Cartesian3.pack(s,T,_),e.Cartesian3.pack(c,F,_),_+=3;const r=a-2<0?-1:1;N[v++]=a%2*2-1,N[v++]=r*t,L[G++]=n}}W+=a}const O=s.IndexDatatype.createTypedArray(U,6*R-6);let z=0,H=0;for(B=R-1,S=0;S<B;++S)O[H++]=z,O[H++]=z+2,O[H++]=z+1,O[H++]=z+1,O[H++]=z+2,O[H++]=z+3,z+=4;o.push(M.buffer,T.buffer,F.buffer),o.push(N.buffer,L.buffer,O.buffer);let V={indexDatatype:2===O.BYTES_PER_ELEMENT?s.IndexDatatype.UNSIGNED_SHORT:s.IndexDatatype.UNSIGNED_INT,currentPositions:M.buffer,previousPositions:T.buffer,nextPositions:F.buffer,expandAndWidth:N.buffer,batchIds:L.buffer,indices:O.buffer};if(c.keepDecodedPositions){const e=function(e){const a=e.length,t=new Uint32Array(a+1);let n=0;for(let r=0;r<a;++r)t[r]=n,n+=e[r];return t[a]=n,t}(d);o.push(b.buffer,e.buffer),V=a.combine(V,{decodedPositions:b.buffer,decodedPositionOffsets:e.buffer})}return V}))}));