cong-gis-viewer
Version:
The minimal recommended setup for an app using Cesium with Webpack 5
2 lines • 6.44 kB
JavaScript
/*! For license information please see chunk-VESZT4HP.js.LICENSE.txt */
import{a as wt}from"./chunk-P3CVPV5A.js";import{a as k}from"./chunk-IQ5VZFOA.js";import{a as kt}from"./chunk-UENNBKKY.js";import{a as Ct}from"./chunk-ZV2BSYVW.js";import{b as dt,c as _t,d as R}from"./chunk-3WTHA73F.js";import{d as ht}from"./chunk-MEAQKBL7.js";import{a as N}from"./chunk-K3VQHMI6.js";import{a as s,c as pt,d as ot}from"./chunk-UTRPTI5S.js";import{a as M}from"./chunk-TFNGIACM.js";import{a as p}from"./chunk-OW23VKVW.js";import{a as z}from"./chunk-LKAZ42NI.js";import{e as E}from"./chunk-MYHWD27O.js";var yt=new s,vt=new s,Et=new s,Mt=new s,Nt=new s,Rt=new s(1,1,1),Pt=Math.cos,At=Math.sin;function O(t){t=p(t,p.EMPTY_OBJECT);let e=p(t.radii,Rt),i=p(t.innerRadii,e),n=p(t.minimumClock,0),a=p(t.maximumClock,M.TWO_PI),r=p(t.minimumCone,0),o=p(t.maximumCone,M.PI),m=Math.round(p(t.stackPartitions,64)),c=Math.round(p(t.slicePartitions,64)),u=p(t.vertexFormat,k.DEFAULT);if(c<3)throw new z("options.slicePartitions cannot be less than three.");if(m<3)throw new z("options.stackPartitions cannot be less than three.");this._radii=s.clone(e),this._innerRadii=s.clone(i),this._minimumClock=n,this._maximumClock=a,this._minimumCone=r,this._maximumCone=o,this._stackPartitions=m,this._slicePartitions=c,this._vertexFormat=k.clone(u),this._offsetAttribute=t.offsetAttribute,this._workerName="createEllipsoidGeometry"}O.packedLength=2*s.packedLength+k.packedLength+7,O.pack=function(t,e,i){if(!E(t))throw new z("value is required");if(!E(e))throw new z("array is required");return i=p(i,0),s.pack(t._radii,e,i),i+=s.packedLength,s.pack(t._innerRadii,e,i),i+=s.packedLength,k.pack(t._vertexFormat,e,i),i+=k.packedLength,e[i++]=t._minimumClock,e[i++]=t._maximumClock,e[i++]=t._minimumCone,e[i++]=t._maximumCone,e[i++]=t._stackPartitions,e[i++]=t._slicePartitions,e[i]=p(t._offsetAttribute,-1),e};var mt,bt=new s,xt=new s,Ot=new k,y={radii:bt,innerRadii:xt,vertexFormat:Ot,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,offsetAttribute:void 0};O.unpack=function(t,e,i){if(!E(t))throw new z("array is required");e=p(e,0);let n=s.unpack(t,e,bt);e+=s.packedLength;let a=s.unpack(t,e,xt);e+=s.packedLength;let r=k.unpack(t,e,Ot);e+=k.packedLength;let o=t[e++],m=t[e++],c=t[e++],u=t[e++],l=t[e++],f=t[e++],h=t[e];return E(i)?(i._radii=s.clone(n,i._radii),i._innerRadii=s.clone(a,i._innerRadii),i._vertexFormat=k.clone(r,i._vertexFormat),i._minimumClock=o,i._maximumClock=m,i._minimumCone=c,i._maximumCone=u,i._stackPartitions=l,i._slicePartitions=f,i._offsetAttribute=-1===h?void 0:h,i):(y.minimumClock=o,y.maximumClock=m,y.minimumCone=c,y.maximumCone=u,y.stackPartitions=l,y.slicePartitions=f,y.offsetAttribute=-1===h?void 0:h,new O(y))},O.createGeometry=function(t){let e=t._radii;if(e.x<=0||e.y<=0||e.z<=0)return;let i=t._innerRadii;if(i.x<=0||i.y<=0||i.z<=0)return;let n=t._minimumClock,a=t._maximumClock,r=t._minimumCone,o=t._maximumCone,m=t._vertexFormat,c=t._slicePartitions+1,u=t._stackPartitions+1;c=Math.round(c*Math.abs(a-n)/M.TWO_PI),u=Math.round(u*Math.abs(o-r)/M.PI),c<2&&(c=2),u<2&&(u=2);let l,f,p=0,k=[r],h=[n];for(l=0;l<u;l++)k.push(r+l*(o-r)/(u-1));for(k.push(o),f=0;f<c;f++)h.push(n+f*(a-n)/(c-1));h.push(a);let _=k.length,d=h.length,y=0,w=1,A=i.x!==e.x||i.y!==e.y||i.z!==e.z,P=!1,x=!1,C=!1;A&&(w=2,r>0&&(P=!0,y+=c-1),o<Math.PI&&(x=!0,y+=c-1),(a-n)%M.TWO_PI?(C=!0,y+=2*(u-1)+1):y+=1);let v=d*_*w,b=new Float64Array(3*v),O=new Array(v).fill(!1),g=new Array(v).fill(!1),T=c*u*w,F=6*(T+y+1-(c+u)*w),I=kt.createTypedArray(T,F),L=m.normal?new Float32Array(3*v):void 0,z=m.tangent?new Float32Array(3*v):void 0,j=m.bitangent?new Float32Array(3*v):void 0,D=m.st?new Float32Array(2*v):void 0,U=new Array(_),W=new Array(_);for(l=0;l<_;l++)U[l]=At(k[l]),W[l]=Pt(k[l]);let K=new Array(d),V=new Array(d);for(f=0;f<d;f++)V[f]=Pt(h[f]),K[f]=At(h[f]);for(l=0;l<_;l++)for(f=0;f<d;f++)b[p++]=e.x*U[l]*V[f],b[p++]=e.y*U[l]*K[f],b[p++]=e.z*W[l];let S,B,G,Y,Z=v/2;if(A)for(l=0;l<_;l++)for(f=0;f<d;f++)b[p++]=i.x*U[l]*V[f],b[p++]=i.y*U[l]*K[f],b[p++]=i.z*W[l],O[Z]=!0,l>0&&l!==_-1&&0!==f&&f!==d-1&&(g[Z]=!0),Z++;for(p=0,l=1;l<_-2;l++)for(S=l*d,B=(l+1)*d,f=1;f<d-2;f++)I[p++]=B+f,I[p++]=B+f+1,I[p++]=S+f+1,I[p++]=B+f,I[p++]=S+f+1,I[p++]=S+f;if(A){let t=_*d;for(l=1;l<_-2;l++)for(S=t+l*d,B=t+(l+1)*d,f=1;f<d-2;f++)I[p++]=B+f,I[p++]=S+f,I[p++]=S+f+1,I[p++]=B+f,I[p++]=S+f+1,I[p++]=B+f+1}if(A){if(P)for(Y=_*d,l=1;l<d-2;l++)I[p++]=l,I[p++]=l+1,I[p++]=Y+l+1,I[p++]=l,I[p++]=Y+l+1,I[p++]=Y+l;if(x)for(G=_*d-d,Y=_*d*w-d,l=1;l<d-2;l++)I[p++]=G+l+1,I[p++]=G+l,I[p++]=Y+l,I[p++]=G+l+1,I[p++]=Y+l,I[p++]=Y+l+1}if(C){for(l=1;l<_-2;l++)Y=d*_+d*l,G=d*l,I[p++]=Y,I[p++]=G+d,I[p++]=G,I[p++]=Y,I[p++]=Y+d,I[p++]=G+d;for(l=1;l<_-2;l++)Y=d*_+d*(l+1)-1,G=d*(l+1)-1,I[p++]=G+d,I[p++]=Y,I[p++]=G,I[p++]=G+d,I[p++]=Y+d,I[p++]=Y}let q=new Ct;m.position&&(q.position=new R({componentDatatype:N.DOUBLE,componentsPerAttribute:3,values:b}));let H,Q=0,J=0,X=0,$=0,tt=v/2,et=ot.fromCartesian3(e),it=ot.fromCartesian3(i);if(m.st||m.normal||m.tangent||m.bitangent){for(l=0;l<v;l++){H=O[l]?it:et;let t=s.fromArray(b,3*l,yt),e=H.geodeticSurfaceNormal(t,vt);if(g[l]&&s.negate(e,e),m.st){let t=pt.negate(e,Nt);D[Q++]=Math.atan2(t.y,t.x)/M.TWO_PI+.5,D[Q++]=Math.asin(e.z)/Math.PI+.5}if(m.normal&&(L[J++]=e.x,L[J++]=e.y,L[J++]=e.z),m.tangent||m.bitangent){let t,i=Et,n=0;if(O[l]&&(n=tt),t=!P&&l>=n&&l<n+2*d?s.UNIT_X:s.UNIT_Z,s.cross(t,e,i),s.normalize(i,i),m.tangent&&(z[X++]=i.x,z[X++]=i.y,z[X++]=i.z),m.bitangent){let t=s.cross(e,i,Mt);s.normalize(t,t),j[$++]=t.x,j[$++]=t.y,j[$++]=t.z}}}m.st&&(q.st=new R({componentDatatype:N.FLOAT,componentsPerAttribute:2,values:D})),m.normal&&(q.normal=new R({componentDatatype:N.FLOAT,componentsPerAttribute:3,values:L})),m.tangent&&(q.tangent=new R({componentDatatype:N.FLOAT,componentsPerAttribute:3,values:z})),m.bitangent&&(q.bitangent=new R({componentDatatype:N.FLOAT,componentsPerAttribute:3,values:j}))}if(E(t._offsetAttribute)){let e=b.length,i=t._offsetAttribute===wt.NONE?0:1,n=new Uint8Array(e/3).fill(i);q.applyOffset=new R({componentDatatype:N.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}return new _t({attributes:q,indices:I,primitiveType:dt.TRIANGLES,boundingSphere:ht.fromEllipsoid(et),offsetAttribute:t._offsetAttribute})},O.getUnitEllipsoid=function(){return E(mt)||(mt=O.createGeometry(new O({radii:new s(1,1,1),vertexFormat:k.POSITION_ONLY}))),mt};var Kt=O;export{Kt as a};