/** * SmartEarth WebSDK - https://websdk.terra-it.cn * Version 5.4.1 */ import{a as Oe}from"./chunk-JOO5BKHH.js";import{a as W}from"./chunk-R6MANQZ2.js";import{a as Nt}from"./chunk-YCO6GHZ4.js";import{a as De}from"./chunk-YME4CS4F.js";import{a as Le}from"./chunk-DA6K763I.js";import{a as ee}from"./chunk-TWEYJPY7.js";import{b as te}from"./chunk-5HPENZ6M.js";import{a as Ft}from"./chunk-SY6XZLBE.js";import{c as Ce,d as jt}from"./chunk-6SNQZF7I.js";import{a as Pt,d as U}from"./chunk-CLGTNV2A.js";import{d as _e,e as Ne,f as Qt,h as Y}from"./chunk-RQCJJCAO.js";import{a as zt}from"./chunk-7J4RJR4J.js";import{a as Rt,b as t,c as u,d as At,e as B,f as vt,g as Bt}from"./chunk-UMC5CP2H.js";import{a as p}from"./chunk-72V3KRTJ.js";import"./chunk-7M2TDEJ6.js";import"./chunk-W5CDIT4C.js";import{a as wt,b as tt}from"./chunk-VJ26MOOM.js";import{e as m}from"./chunk-E3YQ3WWZ.js";function it(e){e=e??Bt.EMPTY_OBJECT,this._ellipsoid=e.ellipsoid??B.default,this._rectangle=e.rectangle??Y.MAX_VALUE,this._bounds=e.bounds??[],this._projection=new Pt(this._ellipsoid),this._numberOfLevelZeroTilesX=e.numberOfLevelZeroTilesX??2,this._numberOfLevelZeroTilesY=e.numberOfLevelZeroTilesY??1,this._tileInfo=e.tileInfo}Object.defineProperties(it.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},bounds:{get:function(){return this._bounds}},projection:{get:function(){return this._projection}}});it.prototype.getNumberOfXTilesAtLevel=function(e){if(!m(this._tileInfo))return this._numberOfLevelZeroTilesX<=i&&(d=i-1);let h=(n.north-e.latitude)/l|0;return h>=a&&(h=a-1),m(r)?(r.x=d,r.y=h,r):new At(d,h)};var Ie=it;var He=new t,ye=new t,ke=new u,ne=new t,pn=new t,Me=new U,dn=new Ie,Ct=[new u,new u,new u,new u],Ot=new At,w={};w.initialize=function(){let e=w._initPromise;return m(e)||(e=_e.fetchJson(Ne("Assets/approximateTerrainHeights.json")).then(function(o){if(Rt.changeApproximateTerrainHeights===!0)for(let r in o)o.hasOwnProperty(r)&&(o[r][0]=Rt.minTerrainHeight,o[r][1]=Rt.maxTerrainHeight);w._terrainHeights=o}),w._initPromise=e),e};w.getMinimumMaximumHeights=function(e,o){if(tt.defined("rectangle",e),!m(w._terrainHeights))throw new wt("You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function");o=o??B.default;let r=be(e),n=w._defaultMinTerrainHeight,i=w._defaultMaxTerrainHeight;if(m(r)){let a=`${r.level}-${r.x}-${r.y}`,c=w._terrainHeights[a];m(c)&&(n=c[0],i=c[1]),o.cartographicToCartesian(Y.northeast(e,ke),He),o.cartographicToCartesian(Y.southwest(e,ke),ye),t.midpoint(ye,He,ne);let l=o.scaleToGeodeticSurface(ne,pn);if(m(l)){let s=t.distance(ne,l);n=Math.min(n,-s)}else n=w._defaultMinTerrainHeight}return n=Math.max(w._defaultMinTerrainHeight,n),{minimumTerrainHeight:n,maximumTerrainHeight:i}};w.getBoundingSphere=function(e,o){if(tt.defined("rectangle",e),!m(w._terrainHeights))throw new wt("You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function");o=o??B.default;let r=be(e),n=w._defaultMaxTerrainHeight;if(m(r)){let a=`${r.level}-${r.x}-${r.y}`,c=w._terrainHeights[a];m(c)&&(n=c[1])}let i=U.fromRectangle3D(e,o,0);return U.fromRectangle3D(e,o,n,Me),U.union(i,Me,i)};function be(e){u.fromRadians(e.east,e.north,0,Ct[0]),u.fromRadians(e.west,e.north,0,Ct[1]),u.fromRadians(e.east,e.south,0,Ct[2]),u.fromRadians(e.west,e.south,0,Ct[3]);let o=0,r=0,n=0,i=0,a=w._terrainHeightsMaxLevel,c;for(c=0;c<=a;++c){let l=!1;for(let s=0;s<4;++s){let d=Ct[s];if(dn.positionToTileXY(d,c,Ot),s===0)n=Ot.x,i=Ot.y;else if(n!==Ot.x||i!==Ot.y){l=!0;break}}if(l)break;o=n,r=i}if(c!==0)return{x:o,y:r,level:c>a?a:c-1}}w._terrainHeightsMaxLevel=6;w._defaultMaxTerrainHeight=9e3;w._defaultMinTerrainHeight=-1e5;w._terrainHeights=void 0;w._initPromise=void 0;Object.defineProperties(w,{initialized:{get:function(){return m(w._terrainHeights)}}});var Xt=w;var he=[Pt,Oe],fn=he.length,Qe=Math.cos(p.toRadians(30)),Re=Math.cos(p.toRadians(150)),tn=0,en=1e3;function at(e){e=e??Bt.EMPTY_OBJECT;let o=e.positions;if(!m(o)||o.length<2)throw new wt("At least two positions are required.");if(m(e.arcType)&&e.arcType!==W.GEODESIC&&e.arcType!==W.RHUMB)throw new wt("Valid options for arcType are ArcType.GEODESIC and ArcType.RHUMB.");this.width=e.width??1,this._positions=o,this.granularity=e.granularity??9999,this.loop=e.loop??!1,this.arcType=e.arcType??W.GEODESIC,this._ellipsoid=B.default,this._projectionIndex=0,this._workerName="createGroundPolylineGeometry",this._scene3DOnly=!1}Object.defineProperties(at.prototype,{packedLength:{get:function(){return 1+this._positions.length*3+1+1+1+B.packedLength+1+1}}});at.setProjectionAndEllipsoid=function(e,o){let r=0;for(let n=0;nQe||ap.PI_OVER_TWO&&(l=!0,c=t.subtract(a,r,Xe),d=s.cartesianToCartographic(c,Fe)),d.height=0;let h=e.project(d,i);return i=t.subtract(h,n,i),i.z=0,i=t.normalize(i,i),l&&t.negate(i,i),i}var bn=new t,Ye=new t;function Ue(e,o,r,n,i,a){let c=t.subtract(o,e,bn);t.normalize(c,c);let l=r-tn,s=t.multiplyByScalar(c,l,Ye);t.add(e,s,i);let d=n-en;s=t.multiplyByScalar(c,d,Ye),t.add(o,s,a)}var Rn=new t;function Gt(e,o){let r=Ft.getPointDistance(qt,e),n=Ft.getPointDistance(qt,o),i=Rn;p.equalsEpsilon(r,0,p.EPSILON2)?(i=et(o,e,i),t.multiplyByScalar(i,p.EPSILON2,i),t.add(e,i,e)):p.equalsEpsilon(n,0,p.EPSILON2)&&(i=et(e,o,i),t.multiplyByScalar(i,p.EPSILON2,i),t.add(o,i,o))}function An(e,o){let r=Math.abs(e.longitude),n=Math.abs(o.longitude);if(p.equalsEpsilon(r,p.PI,p.EPSILON11)){let i=p.sign(o.longitude);return e.longitude=i*(r-p.EPSILON11),1}else if(p.equalsEpsilon(n,p.PI,p.EPSILON11)){let i=p.sign(e.longitude);return o.longitude=i*(n-p.EPSILON11),2}return 0}var on=new u,rn=new u,Ge=new t,ae=new t,qe=new t,We=new t,Pn=new t,Ze=new t,vn=[on,rn],Bn=new Y,zn=new t,jn=new t,Fn=new t,Xn=new t,Yn=new t,Un=new t,ce=new t,se=new t,Gn=new t,qn=new t,Wn=new t,Ve=new t,Zn=new t,Vn=new t,$n=new Nt,Jn=new Nt,$e=new t,Kn=new t,Je=new t,Qn=[new U,new U],an=[0,2,1,0,3,2,0,7,3,0,4,7,0,5,4,0,1,5,5,7,4,5,6,7,5,2,6,5,1,2,3,6,2,3,7,6],Ke=an.length;function to(e,o,r,n,i,a,c){let l,s,d=o._ellipsoid,h=r.length/3-1,_=h*8,S=_*4,b=h*36,L=_>65535?new Uint32Array(b):new Uint16Array(b),D=new Float64Array(_*3),z=new Float32Array(S),G=new Float32Array(S),f=new Float32Array(S),j=new Float32Array(S),P=new Float32Array(S),y,I,N,H;c&&(y=new Float32Array(S),I=new Float32Array(S),N=new Float32Array(S),H=new Float32Array(_*2));let A=a.length/2,v=0,E=on;E.height=0;let x=rn;x.height=0;let O=Ge,C=ae;if(c)for(s=0,l=1;lQe?(nt=Lt(o,E,ft,ht,ce),ot=Lt(o,x,q,mt,se)):T===1?(ot=Lt(o,x,q,mt,se),nt.x=0,nt.y=p.sign(E.longitude-Math.abs(x.longitude)),nt.z=0):(nt=Lt(o,E,ft,ht,ce),ot.x=0,ot.y=p.sign(E.longitude-x.longitude),ot.z=0)}let ue=t.distance(Vt,st),we=Nt.fromCartesian(lt,$n),It=t.subtract(ct,lt,Gn),cn=t.normalize(It,Ve),Et=t.subtract(Vt,lt,qn);Et=t.normalize(Et,Et);let gt=t.cross(cn,Et,Ve);gt=t.normalize(gt,gt);let Ht=t.cross(Et,ft,Zn);Ht=t.normalize(Ht,Ht);let yt=t.subtract(st,ct,Wn);yt=t.normalize(yt,yt);let kt=t.cross(q,yt,Vn);kt=t.normalize(kt,kt);let sn=ue/k,ln=de/k,$t=0,xt,Mt,pt,Se=0,Te=0;if(c){$t=t.distance(ht,mt),xt=Nt.fromCartesian(ht,Jn),Mt=t.subtract(mt,ht,$e),pt=t.normalize(Mt,Kn);let T=pt.x;pt.x=pt.y,pt.y=-T,Se=$t/v,Te=fe/v}for(g=0;g<8;g++){let T=St+g*4,ut=Dt+g*2,_t=T+3,xe=g<4?1:-1,bt=g===2||g===3||g===6||g===7?1:-1;t.pack(we.high,z,T),z[_t]=It.x,t.pack(we.low,G,T),G[_t]=It.y,t.pack(Ht,f,T),f[_t]=It.z,t.pack(kt,j,T),j[_t]=sn*xe,t.pack(gt,P,T);let dt=ln*bt;dt===0&&bt<0&&(dt=9),P[_t]=dt,c&&(y[T]=xt.high.x,y[T+1]=xt.high.y,y[T+2]=xt.low.x,y[T+3]=xt.low.y,N[T]=-nt.y,N[T+1]=nt.x,N[T+2]=ot.y,N[T+3]=-ot.x,I[T]=Mt.x,I[T+1]=Mt.y,I[T+2]=pt.x,I[T+3]=pt.y,H[ut]=Se*xe,dt=Te*bt,dt===0&&bt<0&&(dt=9),H[ut+1]=dt)}let V=Fn,$=Xn,J=zn,K=jn,hn=Y.fromCartographicArray(vn,Bn),Ee=Xt.getMinimumMaximumHeights(hn,d),Jt=Ee.minimumTerrainHeight,Kt=Ee.maximumTerrainHeight;Wt+=Math.abs(Jt),Wt+=Math.abs(Kt),Ue(lt,Vt,Jt,Kt,V,J),Ue(ct,st,Jt,Kt,$,K);let Q=t.multiplyByScalar(gt,p.EPSILON5,Je);t.add(V,Q,V),t.add($,Q,$),t.add(J,Q,J),t.add(K,Q,K),Gt(V,$),Gt(J,K),t.pack(V,D,M),t.pack($,D,M+3),t.pack(K,D,M+6),t.pack(J,D,M+9),Q=t.multiplyByScalar(gt,-2*p.EPSILON5,Je),t.add(V,Q,V),t.add($,Q,$),t.add(J,Q,J),t.add(K,Q,K),Gt(V,$),Gt(J,K),t.pack(V,D,M+12),t.pack($,D,M+15),t.pack(K,D,M+18),t.pack(J,D,M+21),Z+=2,s+=3,Dt+=16,M+=24,St+=32,de+=ue,fe+=$t}s=0;let me=0;for(l=0;l