/** * @license * Cesium - https://github.com/CesiumGS/cesium * Version 1.110.1 * * Copyright 2011-2022 Cesium Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Columbus View (Pat. Pend.) * * Portions licensed separately. * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details. */ import{a as _e}from"./chunk-5BUS3425.js";import{a as Z}from"./chunk-LEGXNNON.js";import{a as _t}from"./chunk-WNXNCTQK.js";import{a as Oe}from"./chunk-ML5MKDLJ.js";import{a as Le}from"./chunk-FO3UCCVP.js";import{a as te}from"./chunk-GTKXIG42.js";import{b as Qt}from"./chunk-EVUMPJJC.js";import{a as jt}from"./chunk-BXMC6F3B.js";import{c as Ce,d as zt}from"./chunk-ADEEKX5Q.js";import{a as Pt,d as U,f as Kt,g as xe,h as Ne}from"./chunk-O5E7EBKP.js";import"./chunk-LEJDAZA7.js";import{c as G,d as Bt}from"./chunk-GMFQULD7.js";import{a as vt}from"./chunk-IS523WNE.js";import{a as t,b as u,c as z,d as bt}from"./chunk-4ZQSV4FU.js";import{a as p}from"./chunk-CLQ5X6HS.js";import"./chunk-6Y3U6IMI.js";import"./chunk-7DENS74L.js";import{a as O}from"./chunk-FOJGNIAW.js";import{a as St,b as et}from"./chunk-UGI536VH.js";import{e as g}from"./chunk-BQUQ5TPM.js";function rt(e){e=O(e,O.EMPTY_OBJECT),this._ellipsoid=O(e.ellipsoid,z.WGS84),this._rectangle=O(e.rectangle,G.MAX_VALUE),this._projection=new Pt(this._ellipsoid),this._numberOfLevelZeroTilesX=O(e.numberOfLevelZeroTilesX,2),this._numberOfLevelZeroTilesY=O(e.numberOfLevelZeroTilesY,1)}Object.defineProperties(rt.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}});rt.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<=o&&(d=o-1);let h=(n.north-e.latitude)/l|0;return h>=a&&(h=a-1),g(r)?(r.x=d,r.y=h,r):new Bt(d,h)};var De=rt;var Ie=new t,He=new t,ke=new u,ee=new t,hn=new t,ye=new U,pn=new De,Lt=[new u,new u,new u,new u],Ot=new Bt,w={};w.initialize=function(){let e=w._initPromise;return g(e)||(e=xe.fetchJson(Ne("Assets/approximateTerrainHeights.json")).then(function(i){w._terrainHeights=i}),w._initPromise=e),e};w.getMinimumMaximumHeights=function(e,i){if(et.defined("rectangle",e),!g(w._terrainHeights))throw new St("You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function");i=O(i,z.WGS84);let r=Ae(e),n=w._defaultMinTerrainHeight,o=w._defaultMaxTerrainHeight;if(g(r)){let a=`${r.level}-${r.x}-${r.y}`,c=w._terrainHeights[a];g(c)&&(n=c[0],o=c[1]),i.cartographicToCartesian(G.northeast(e,ke),Ie),i.cartographicToCartesian(G.southwest(e,ke),He),t.midpoint(He,Ie,ee);let l=i.scaleToGeodeticSurface(ee,hn);if(g(l)){let s=t.distance(ee,l);n=Math.min(n,-s)}else n=w._defaultMinTerrainHeight}return n=Math.max(w._defaultMinTerrainHeight,n),{minimumTerrainHeight:n,maximumTerrainHeight:o}};w.getBoundingSphere=function(e,i){if(et.defined("rectangle",e),!g(w._terrainHeights))throw new St("You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function");i=O(i,z.WGS84);let r=Ae(e),n=w._defaultMaxTerrainHeight;if(g(r)){let a=`${r.level}-${r.x}-${r.y}`,c=w._terrainHeights[a];g(c)&&(n=c[1])}let o=U.fromRectangle3D(e,i,0);return U.fromRectangle3D(e,i,n,ye),U.union(o,ye,o)};function Ae(e){u.fromRadians(e.east,e.north,0,Lt[0]),u.fromRadians(e.west,e.north,0,Lt[1]),u.fromRadians(e.east,e.south,0,Lt[2]),u.fromRadians(e.west,e.south,0,Lt[3]);let i=0,r=0,n=0,o=0,a=w._terrainHeightsMaxLevel,c;for(c=0;c<=a;++c){let l=!1;for(let s=0;s<4;++s){let d=Lt[s];if(pn.positionToTileXY(d,c,Ot),s===0)n=Ot.x,o=Ot.y;else if(n!==Ot.x||o!==Ot.y){l=!0;break}}if(l)break;i=n,r=o}if(c!==0)return{x:i,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 g(w._terrainHeights)}}});var Xt=w;var le=[Pt,_e],dn=le.length,Ke=Math.cos(p.toRadians(30)),Me=Math.cos(p.toRadians(150)),Qe=0,tn=1e3;function ct(e){e=O(e,O.EMPTY_OBJECT);let i=e.positions;if(!g(i)||i.length<2)throw new St("At least two positions are required.");if(g(e.arcType)&&e.arcType!==Z.GEODESIC&&e.arcType!==Z.RHUMB)throw new St("Valid options for arcType are ArcType.GEODESIC and ArcType.RHUMB.");this.width=O(e.width,1),this._positions=i,this.granularity=O(e.granularity,9999),this.loop=O(e.loop,!1),this.arcType=O(e.arcType,Z.GEODESIC),this._ellipsoid=z.WGS84,this._projectionIndex=0,this._workerName="createGroundPolylineGeometry",this._scene3DOnly=!1}Object.defineProperties(ct.prototype,{packedLength:{get:function(){return 1+this._positions.length*3+1+1+1+z.packedLength+1+1}}});ct.setProjectionAndEllipsoid=function(e,i){let r=0;for(let n=0;nKe||ap.PI_OVER_TWO&&(l=!0,c=t.subtract(a,r,Xe),d=s.cartesianToCartographic(c,je)),d.height=0;let h=e.project(d,o);return o=t.subtract(h,n,o),o.z=0,o=t.normalize(o,o),l&&t.negate(o,o),o}var An=new t,Ye=new t;function Fe(e,i,r,n,o,a){let c=t.subtract(i,e,An);t.normalize(c,c);let l=r-Qe,s=t.multiplyByScalar(c,l,Ye);t.add(e,s,o);let d=n-tn;s=t.multiplyByScalar(c,d,Ye),t.add(i,s,a)}var Mn=new t;function Gt(e,i){let r=jt.getPointDistance(Ut,e),n=jt.getPointDistance(Ut,i),o=Mn;p.equalsEpsilon(r,0,p.EPSILON2)?(o=nt(i,e,o),t.multiplyByScalar(o,p.EPSILON2,o),t.add(e,o,e)):p.equalsEpsilon(n,0,p.EPSILON2)&&(o=nt(e,i,o),t.multiplyByScalar(o,p.EPSILON2,o),t.add(i,o,i))}function Rn(e,i){let r=Math.abs(e.longitude),n=Math.abs(i.longitude);if(p.equalsEpsilon(r,p.PI,p.EPSILON11)){let o=p.sign(i.longitude);return e.longitude=o*(r-p.EPSILON11),1}else if(p.equalsEpsilon(n,p.PI,p.EPSILON11)){let o=p.sign(e.longitude);return i.longitude=o*(n-p.EPSILON11),2}return 0}var nn=new u,on=new u,Ge=new t,re=new t,Ue=new t,We=new t,Pn=new t,qe=new t,bn=[nn,on],vn=new G,Bn=new t,zn=new t,jn=new t,Xn=new t,Yn=new t,Fn=new t,ae=new t,ce=new t,Gn=new t,Un=new t,Wn=new t,Ze=new t,qn=new t,Zn=new t,Vn=new _t,$n=new _t,Ve=new t,Jn=new t,$e=new t,Kn=[new U,new U],rn=[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],Je=rn.length;function Qn(e,i,r,n,o,a,c){let l,s,d=i._ellipsoid,h=r.length/3-1,N=h*8,S=N*4,R=h*36,D=N>65535?new Uint32Array(R):new Uint16Array(R),I=new Float64Array(N*3),j=new Float32Array(S),W=new Float32Array(S),f=new Float32Array(S),X=new Float32Array(S),v=new Float32Array(S),y,H,C,k;c&&(y=new Float32Array(S),H=new Float32Array(S),C=new Float32Array(S),k=new Float32Array(N*2));let b=a.length/2,B=0,E=nn;E.height=0;let x=on;x.height=0;let L=Ge,_=re;if(c)for(s=0,l=1;lKe?(ot=Dt(i,E,mt,pt,ae),it=Dt(i,x,q,gt,ce)):T===1?(it=Dt(i,x,q,gt,ce),ot.x=0,ot.y=p.sign(E.longitude-Math.abs(x.longitude)),ot.z=0):(ot=Dt(i,E,mt,pt,ae),it.x=0,it.y=p.sign(E.longitude-x.longitude),it.z=0)}let ge=t.distance(Zt,lt),ue=_t.fromCartesian(ht,Vn),Ht=t.subtract(st,ht,Gn),an=t.normalize(Ht,Ze),xt=t.subtract(Zt,ht,Un);xt=t.normalize(xt,xt);let ut=t.cross(an,xt,Ze);ut=t.normalize(ut,ut);let kt=t.cross(xt,mt,qn);kt=t.normalize(kt,kt);let yt=t.subtract(lt,st,Wn);yt=t.normalize(yt,yt);let At=t.cross(q,yt,Zn);At=t.normalize(At,At);let cn=ge/A,sn=pe/A,Vt=0,Nt,Mt,dt,we=0,Se=0;if(c){Vt=t.distance(pt,gt),Nt=_t.fromCartesian(pt,$n),Mt=t.subtract(gt,pt,Ve),dt=t.normalize(Mt,Jn);let T=dt.x;dt.x=dt.y,dt.y=-T,we=Vt/B,Se=de/B}for(m=0;m<8;m++){let T=Tt+m*4,wt=It+m*2,Ct=T+3,Ee=m<4?1:-1,Rt=m===2||m===3||m===6||m===7?1:-1;t.pack(ue.high,j,T),j[Ct]=Ht.x,t.pack(ue.low,W,T),W[Ct]=Ht.y,t.pack(kt,f,T),f[Ct]=Ht.z,t.pack(At,X,T),X[Ct]=cn*Ee,t.pack(ut,v,T);let ft=sn*Rt;ft===0&&Rt<0&&(ft=9),v[Ct]=ft,c&&(y[T]=Nt.high.x,y[T+1]=Nt.high.y,y[T+2]=Nt.low.x,y[T+3]=Nt.low.y,C[T]=-ot.y,C[T+1]=ot.x,C[T+2]=it.y,C[T+3]=-it.x,H[T]=Mt.x,H[T+1]=Mt.y,H[T+2]=dt.x,H[T+3]=dt.y,k[wt]=we*Ee,ft=Se*Rt,ft===0&&Rt<0&&(ft=9),k[wt+1]=ft)}let $=jn,J=Xn,K=Bn,Q=zn,ln=G.fromCartographicArray(bn,vn),Te=Xt.getMinimumMaximumHeights(ln,d),$t=Te.minimumTerrainHeight,Jt=Te.maximumTerrainHeight;Wt+=Math.abs($t),Wt+=Math.abs(Jt),Fe(ht,Zt,$t,Jt,$,K),Fe(st,lt,$t,Jt,J,Q);let tt=t.multiplyByScalar(ut,p.EPSILON5,$e);t.add($,tt,$),t.add(J,tt,J),t.add(K,tt,K),t.add(Q,tt,Q),Gt($,J),Gt(K,Q),t.pack($,I,M),t.pack(J,I,M+3),t.pack(Q,I,M+6),t.pack(K,I,M+9),tt=t.multiplyByScalar(ut,-2*p.EPSILON5,$e),t.add($,tt,$),t.add(J,tt,J),t.add(K,tt,K),t.add(Q,tt,Q),Gt($,J),Gt(K,Q),t.pack($,I,M+12),t.pack(J,I,M+15),t.pack(Q,I,M+18),t.pack(K,I,M+21),V+=2,s+=3,It+=16,M+=24,Tt+=32,pe+=ge,de+=Vt}s=0;let fe=0;for(l=0;l