UNPKG

cong-gis-viewer

Version:

The minimal recommended setup for an app using Cesium with Webpack 5

2 lines 7.01 kB
/*! For license information please see createVerticesFromGoogleEarthEnterpriseBuffer.js.LICENSE.txt */ import{a as Gt,b as Xt}from"./chunk-4KEHULIR.js";import{a as kt}from"./chunk-RKXUFMEE.js";import{a as lt}from"./chunk-JUQJQNK3.js";import{a as Dt}from"./chunk-NSYXLK76.js";import"./chunk-EU6MOGEX.js";import"./chunk-ZS2W345Z.js";import{a as qt}from"./chunk-XS3SI335.js";import"./chunk-MQA5R2TD.js";import"./chunk-BNIMZJFI.js";import{d as Lt}from"./chunk-MEAQKBL7.js";import{b as $,g as Ot,i as zt}from"./chunk-RKBLQ2M4.js";import"./chunk-K3VQHMI6.js";import{a as P,b as N,c as wt,d as Ht}from"./chunk-UTRPTI5S.js";import{a as r}from"./chunk-TFNGIACM.js";import"./chunk-ISVCOS3X.js";import{a as Vt}from"./chunk-XUAQFAMT.js";import{a as Ut}from"./chunk-OW23VKVW.js";import"./chunk-LKAZ42NI.js";import{e as ht}from"./chunk-MYHWD27O.js";var te=Uint16Array.BYTES_PER_ELEMENT,mt=Int32Array.BYTES_PER_ELEMENT,Pt=Uint32Array.BYTES_PER_ELEMENT,ee=Float32Array.BYTES_PER_ELEMENT,H=Float64Array.BYTES_PER_ELEMENT;function tt(t,e,n){n=Ut(n,r);let i=t.length;for(let o=0;o<i;++o)if(n.equalsEpsilon(t[o],e,r.EPSILON12))return o;return-1}function oe(t,e){t.ellipsoid=Ht.clone(t.ellipsoid),t.rectangle=zt.clone(t.rectangle);let n=se(t.buffer,t.relativeToCenter,t.ellipsoid,t.rectangle,t.nativeRectangle,t.exaggeration,t.exaggerationRelativeHeight,t.skirtHeight,t.includeWebMercatorT,t.negativeAltitudeExponentBias,t.negativeElevationThreshold),i=n.vertices;e.push(i.buffer);let r=n.indices;return e.push(r.buffer),{vertices:i.buffer,indices:r.buffer,numberOfAttributes:n.encoding.stride,minimumHeight:n.minimumHeight,maximumHeight:n.maximumHeight,boundingSphere3D:n.boundingSphere3D,orientedBoundingBox:n.orientedBoundingBox,occludeePointInScaledSpace:n.occludeePointInScaledSpace,encoding:n.encoding,vertexCountWithoutSkirts:n.vertexCountWithoutSkirts,indexCountWithoutSkirts:n.indexCountWithoutSkirts,westIndicesSouthToNorth:n.westIndicesSouthToNorth,southIndicesEastToWest:n.southIndicesEastToWest,eastIndicesNorthToSouth:n.eastIndicesNorthToSouth,northIndicesWestToEast:n.northIndicesWestToEast}}var u=new N,G=new P,ne=new P,ie=new P,re=new $;function se(t,e,n,i,o,a,s,l,h,c,d){let m,g,p,I,E,f;ht(i)?(m=i.west,g=i.south,p=i.east,I=i.north,E=i.width,f=i.height):(m=r.toRadians(o.west),g=r.toRadians(o.south),p=r.toRadians(o.east),I=r.toRadians(o.north),E=r.toRadians(i.width),f=r.toRadians(i.height));let T,S,x=[g,I],w=[m,p],A=Ot.eastNorthUpToFixedFrame(e,n),M=$.inverseTransformation(A,re);h&&(T=lt.geodeticLatitudeToMercatorAngle(g),S=1/(lt.geodeticLatitudeToMercatorAngle(I)-T));let k=1!==a,R=new DataView(t),b=Number.POSITIVE_INFINITY,y=Number.NEGATIVE_INFINITY,B=ne;B.x=Number.POSITIVE_INFINITY,B.y=Number.POSITIVE_INFINITY,B.z=Number.POSITIVE_INFINITY;let F=ie;F.x=Number.NEGATIVE_INFINITY,F.y=Number.NEGATIVE_INFINITY,F.z=Number.NEGATIVE_INFINITY;let v,_,U=0,j=0,W=0;for(_=0;_<4;++_){let t=U;v=R.getUint32(t,!0),t+=Pt;let e=r.toRadians(180*R.getFloat64(t,!0));t+=H,-1===tt(w,e)&&w.push(e);let n=r.toRadians(180*R.getFloat64(t,!0));t+=H,-1===tt(x,n)&&x.push(n),t+=2*H;let i=R.getInt32(t,!0);t+=mt,j+=i,i=R.getInt32(t,!0),W+=3*i,U+=v+Pt}let V=[],C=[],L=new Array(j),O=new Array(j),Y=new Array(j),K=h?new Array(j):[],D=k?new Array(j):[],X=new Array(W),Q=[],z=[],Z=[],q=[],J=0,et=0;for(U=0,_=0;_<4;++_){v=R.getUint32(U,!0),U+=Pt;let t=U,e=r.toRadians(180*R.getFloat64(U,!0));U+=H;let i=r.toRadians(180*R.getFloat64(U,!0));U+=H;let o=r.toRadians(180*R.getFloat64(U,!0)),a=.5*o;U+=H;let s=r.toRadians(180*R.getFloat64(U,!0)),l=.5*s;U+=H;let E=R.getInt32(U,!0);U+=mt;let f=R.getInt32(U,!0);U+=mt,U+=mt;let A=new Array(E);for(let t=0;t<E;++t){let E=e+R.getUint8(U++)*o;u.longitude=E;let f=i+R.getUint8(U++)*s;u.latitude=f;let H=R.getFloat32(U,!0);if(U+=ee,0!==H&&H<d&&(H*=-Math.pow(2,c)),H*=6371010,u.height=H,-1!==tt(w,E)||-1!==tt(x,f)){let e=tt(V,u,N);if(-1!==e){A[t]=C[e];continue}V.push(N.clone(u)),C.push(J)}A[t]=J,Math.abs(E-m)<a?Q.push({index:J,cartographic:N.clone(u)}):Math.abs(E-p)<a?Z.push({index:J,cartographic:N.clone(u)}):Math.abs(f-g)<l?z.push({index:J,cartographic:N.clone(u)}):Math.abs(f-I)<l&&q.push({index:J,cartographic:N.clone(u)}),b=Math.min(H,b),y=Math.max(H,y),Y[J]=H;let v=n.cartographicToCartesian(u);if(L[J]=v,h&&(K[J]=(lt.geodeticLatitudeToMercatorAngle(f)-T)*S),k){let t=n.geodeticSurfaceNormal(v);D[J]=t}$.multiplyByPoint(M,v,G),P.minimumByComponent(G,B,B),P.maximumByComponent(G,F,F);let _=(E-m)/(p-m);_=r.clamp(_,0,1);let j=(f-g)/(I-g);j=r.clamp(j,0,1),O[J]=new wt(_,j),++J}let _=3*f;for(let t=0;t<_;++t,++et)X[et]=A[R.getUint16(U,!0)],U+=te;if(v!==U-t)throw new Vt("Invalid terrain tile.")}L.length=J,O.length=J,Y.length=J,h&&(K.length=J),k&&(D.length=J);let nt=J,it=et,rt={hMin:b,lastBorderPoint:void 0,skirtHeight:l,toENU:M,ellipsoid:n,minimum:B,maximum:F};Q.sort((function(t,e){return e.cartographic.latitude-t.cartographic.latitude})),z.sort((function(t,e){return t.cartographic.longitude-e.cartographic.longitude})),Z.sort((function(t,e){return t.cartographic.latitude-e.cartographic.latitude})),q.sort((function(t,e){return e.cartographic.longitude-t.cartographic.longitude}));let ot=1e-5;if(gt(L,Y,O,K,D,X,rt,Q,-ot*E,!0,-ot*f),gt(L,Y,O,K,D,X,rt,z,-ot*f,!1),gt(L,Y,O,K,D,X,rt,Z,ot*E,!0,ot*f),gt(L,Y,O,K,D,X,rt,q,ot*f,!1),Q.length>0&&q.length>0){let t=Q[0].index,e=nt,n=q[q.length-1].index,i=L.length-1;X.push(n,i,e,e,t,n)}j=L.length;let at,ut=Lt.fromPoints(L);ht(i)&&(at=Dt.fromRectangle(i,b,y,n));let st=new Gt(n).computeHorizonCullingPointPossiblyUnderEllipsoid(e,L,b),ct=new qt(B,F,e),dt=new Xt(e,ct,rt.hMin,y,A,!1,h,k,a,s),pt=new Float32Array(j*dt.stride),It=0;for(let t=0;t<j;++t)It=dt.encode(pt,It,L[t],O[t],Y[t],void 0,K[t],D[t]);let Et=Q.map((function(t){return t.index})).reverse(),Nt=z.map((function(t){return t.index})).reverse(),ft=Z.map((function(t){return t.index})).reverse(),Tt=q.map((function(t){return t.index})).reverse();return Nt.unshift(ft[ft.length-1]),Nt.push(Et[0]),Tt.unshift(Et[Et.length-1]),Tt.push(ft[0]),{vertices:pt,indices:new Uint16Array(X),maximumHeight:y,minimumHeight:b,encoding:dt,boundingSphere3D:ut,orientedBoundingBox:at,occludeePointInScaledSpace:st,vertexCountWithoutSkirts:nt,indexCountWithoutSkirts:it,westIndicesSouthToNorth:Et,southIndicesEastToWest:Nt,eastIndicesNorthToSouth:ft,northIndicesWestToEast:Tt}}function gt(t,e,n,i,o,a,s,l,h,c,d){let m=l.length;for(let g=0;g<m;++g){let p=l[g],I=p.cartographic,E=p.index,f=t.length,T=I.longitude,S=I.latitude;S=r.clamp(S,-r.PI_OVER_TWO,r.PI_OVER_TWO);let x=I.height-s.skirtHeight;s.hMin=Math.min(s.hMin,x),N.fromRadians(T,S,x,u),c&&(u.longitude+=h),c?g===m-1?u.latitude+=d:0===g&&(u.latitude-=d):u.latitude+=h;let w=s.ellipsoid.cartographicToCartesian(u);t.push(w),e.push(x),n.push(wt.clone(n[E])),i.length>0&&i.push(i[E]),o.length>0&&o.push(o[E]),$.multiplyByPoint(s.toENU,w,G);let A=s.minimum,M=s.maximum;P.minimumByComponent(G,A,A),P.maximumByComponent(G,M,M);let k=s.lastBorderPoint;if(ht(k)){let t=k.index;a.push(t,f-1,f,f,E,t)}s.lastBorderPoint=p}}var Ae=kt(oe);export{Ae as default};