qa-regulatory-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/createVectorTileClampedPoly...

2 lines
5.9 KiB
JavaScript

define(["./AttributeCompression-8f752c03","./Cartesian3-e0307675","./Cartesian2-bd414876","./combine-3c023bda","./IndexDatatype-3f3c99e8","./Math-e73894ab","./Rectangle-cf3e0e3e","./createTaskProcessorWorker","./ComponentDatatype-aaeec80f","./defaultValue-81eec7ed","./Check-741c5f3c","./WebGLConstants-508b9636","./Matrix4-4c545f70","./RuntimeError-26acdd3b","./Matrix2-dc0c61cc","./when-422ea0ae"],(function(t,e,a,s,n,r,i,o,c,d,l,f,h,u,C,p){"use strict";const m=32767,b=Math.cos(r.CesiumMath.toRadians(150)),A=new a.Cartographic,w=new e.Cartesian3;const g=new a.Cartographic,y=new a.Cartographic;function N(t){const e=8*t,a=3*e,s=4*e;this.startEllipsoidNormals=new Float32Array(a),this.endEllipsoidNormals=new Float32Array(a),this.startPositionAndHeights=new Float32Array(s),this.startFaceNormalAndVertexCornerIds=new Float32Array(s),this.endPositionAndHeights=new Float32Array(s),this.endFaceNormalAndHalfWidths=new Float32Array(s),this.vertexBatchIds=new Uint16Array(e),this.indices=n.IndexDatatype.createTypedArray(e,36*t),this.vec3Offset=0,this.vec4Offset=0,this.batchIdOffset=0,this.indexOffset=0,this.volumeStartIndex=0}const k=new e.Cartesian3,x=new e.Cartesian3;function I(t,a,s,n,r){const i=e.Cartesian3.subtract(s,a,x);let o=e.Cartesian3.subtract(a,t,k);return e.Cartesian3.normalize(i,i),e.Cartesian3.normalize(o,o),e.Cartesian3.dot(i,o)<b&&(o=e.Cartesian3.multiplyByScalar(o,-1,k)),e.Cartesian3.add(i,o,r),e.Cartesian3.equals(r,e.Cartesian3.ZERO)&&(r=e.Cartesian3.subtract(t,a)),e.Cartesian3.cross(r,n,r),e.Cartesian3.cross(n,r,r),e.Cartesian3.normalize(r,r),r}const E=[0,2,6,0,6,4,0,1,3,0,3,2,0,4,5,0,5,1,5,3,1,5,7,3,7,5,4,7,4,6,7,6,2,7,2,3],F=E.length,H=new e.Cartesian3,O=new e.Cartesian3,P=new e.Cartesian3,v=new e.Cartesian3,D=new e.Cartesian3;N.prototype.addVolume=function(t,a,s,n,r,i,o,c,d,l){let f=e.Cartesian3.add(a,d,H);const h=l.geodeticSurfaceNormal(f,O);f=e.Cartesian3.add(s,d,H);const u=l.geodeticSurfaceNormal(f,v),C=I(t,a,s,h,P),p=I(n,s,a,u,D),m=this.startEllipsoidNormals,b=this.endEllipsoidNormals,A=this.startPositionAndHeights,w=this.startFaceNormalAndVertexCornerIds,g=this.endPositionAndHeights,y=this.endFaceNormalAndHalfWidths,N=this.vertexBatchIds;let k,x=this.batchIdOffset,M=this.vec3Offset,R=this.vec4Offset;for(k=0;k<8;k++)e.Cartesian3.pack(h,m,M),e.Cartesian3.pack(u,b,M),e.Cartesian3.pack(a,A,R),A[R+3]=r,e.Cartesian3.pack(s,g,R),g[R+3]=i,e.Cartesian3.pack(C,w,R),w[R+3]=k,e.Cartesian3.pack(p,y,R),y[R+3]=o,N[x++]=c,M+=3,R+=4;this.batchIdOffset=x,this.vec3Offset=M,this.vec4Offset=R;const S=this.indices,U=this.volumeStartIndex,B=this.indexOffset;for(k=0;k<F;k++)S[B+k]=E[k]+U;this.volumeStartIndex+=8,this.indexOffset+=F};const M=new i.Rectangle,R=new a.Ellipsoid,S=new e.Cartesian3,U=new e.Cartesian3,B=new e.Cartesian3,V=new e.Cartesian3,T=new e.Cartesian3;return o((function(o,c){const d=new Uint16Array(o.positions),l=new Uint16Array(o.widths),f=new Uint32Array(o.counts),h=new Uint16Array(o.batchIds),u=M,C=R,p=S,b=new Float64Array(o.packedBuffer);let k=0;const x=b[k++],I=b[k++];let E;i.Rectangle.unpack(b,k,u),k+=i.Rectangle.packedLength,a.Ellipsoid.unpack(b,k,C),k+=a.Ellipsoid.packedLength,e.Cartesian3.unpack(b,k,p);let F=d.length/3;const H=d.subarray(0,F),O=d.subarray(F,2*F),P=d.subarray(2*F,3*F);t.AttributeCompression.zigZagDeltaDecode(H,O,P),function(t,e,s,n){const r=n.length,i=t.length,o=new Uint8Array(i),c=g,d=y;let l=0;for(let s=0;s<r;s++){const r=n[s];let i=r;for(let s=1;s<r;s++){const n=l+s,r=n-1;d.longitude=t[n],d.latitude=e[n],c.longitude=t[r],c.latitude=e[r],a.Cartographic.equals(d,c)&&(i--,o[r]=1)}n[s]=i,l+=r}let f=0;for(let a=0;a<i;a++)1!==o[a]&&(t[f]=t[a],e[f]=e[a],s[f]=s[a],f++)}(H,O,P,f);const v=f.length;let D=0;for(E=0;E<v;E++){D+=f[E]-1}const W=new N(D),z=function(t,s,n,i,o,c,d){const l=t.length,f=new Float64Array(3*l);for(let h=0;h<l;++h){const l=t[h],u=s[h],C=n[h],p=r.CesiumMath.lerp(i.west,i.east,l/m),b=r.CesiumMath.lerp(i.south,i.north,u/m),g=r.CesiumMath.lerp(o,c,C/m),y=a.Cartographic.fromRadians(p,b,g,A),N=d.cartographicToCartesian(y,w);e.Cartesian3.pack(N,f,3*h)}return f}(H,O,P,u,x,I,C);F=H.length;const q=new Float32Array(3*F);for(E=0;E<F;++E)q[3*E]=z[3*E]-p.x,q[3*E+1]=z[3*E+1]-p.y,q[3*E+2]=z[3*E+2]-p.z;let L=0,_=0;for(E=0;E<v;E++){const t=f[E]-1,a=.5*l[E],s=h[E],n=L;for(let i=0;i<t;i++){const o=e.Cartesian3.unpack(q,L,B),c=e.Cartesian3.unpack(q,L+3,V);let d=P[_],l=P[_+1];d=r.CesiumMath.lerp(x,I,d/m),l=r.CesiumMath.lerp(x,I,l/m),_++;let f=U,h=T;if(0===i){const a=n+3*t,s=e.Cartesian3.unpack(q,a,U);if(e.Cartesian3.equals(s,o))e.Cartesian3.unpack(q,a-3,f);else{const t=e.Cartesian3.subtract(o,c,U);f=e.Cartesian3.add(t,o,U)}}else e.Cartesian3.unpack(q,L-3,f);if(i===t-1){const t=e.Cartesian3.unpack(q,n,T);if(e.Cartesian3.equals(t,c))e.Cartesian3.unpack(q,n+3,h);else{const t=e.Cartesian3.subtract(c,o,T);h=e.Cartesian3.add(t,c,T)}}else e.Cartesian3.unpack(q,L+6,h);W.addVolume(f,o,c,h,d,l,a,s,p,C),L+=3}L+=3,_++}const G=W.indices;c.push(W.startEllipsoidNormals.buffer),c.push(W.endEllipsoidNormals.buffer),c.push(W.startPositionAndHeights.buffer),c.push(W.startFaceNormalAndVertexCornerIds.buffer),c.push(W.endPositionAndHeights.buffer),c.push(W.endFaceNormalAndHalfWidths.buffer),c.push(W.vertexBatchIds.buffer),c.push(G.buffer);let Z={indexDatatype:2===G.BYTES_PER_ELEMENT?n.IndexDatatype.UNSIGNED_SHORT:n.IndexDatatype.UNSIGNED_INT,startEllipsoidNormals:W.startEllipsoidNormals.buffer,endEllipsoidNormals:W.endEllipsoidNormals.buffer,startPositionAndHeights:W.startPositionAndHeights.buffer,startFaceNormalAndVertexCornerIds:W.startFaceNormalAndVertexCornerIds.buffer,endPositionAndHeights:W.endPositionAndHeights.buffer,endFaceNormalAndHalfWidths:W.endFaceNormalAndHalfWidths.buffer,vertexBatchIds:W.vertexBatchIds.buffer,indices:G.buffer};if(o.keepDecodedPositions){const t=function(t){const e=t.length,a=new Uint32Array(e+1);let s=0;for(let n=0;n<e;++n)a[n]=s,s+=t[n];return a[e]=s,a}(f);c.push(z.buffer,t.buffer),Z=s.combine(Z,{decodedPositions:z.buffer,decodedPositionOffsets:t.buffer})}return Z}))}));