/** * @license * Cesium - https://github.com/CesiumGS/cesium * Version 1.142.0 * * 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-RI3TXBVT.js";import{a as W}from"./chunk-ITSDUOWL.js";import{a as Nt}from"./chunk-3R3BCVRR.js";import{a as De}from"./chunk-K3YIAZU7.js";import{a as Le}from"./chunk-RH3WVPDR.js";import{a as Qt}from"./chunk-MUI5QV7K.js";import{b as Kt}from"./chunk-H6AHPUMX.js";import{a as zt}from"./chunk-FMWRN5G2.js";import{c as Ce,d as Bt}from"./chunk-LTHJTGXC.js";import{a as Rt,c as U}from"./chunk-XEBZTQHW.js";import"./chunk-6LZUEMFX.js";import{f as xe,g as Ne,h as Jt,j as Y}from"./chunk-AZCCS55A.js";import"./chunk-V74K6IQF.js";import{a as vt}from"./chunk-5HZ2G332.js";import"./chunk-LKQXJXNV.js";import"./chunk-VXS2FTO4.js";import{a as w,b as Mt,c as B}from"./chunk-ZQTDDQLY.js";import{a as t,b as Pt,c as bt}from"./chunk-U4VWQPTS.js";import{a as p}from"./chunk-GZABERXA.js";import{a as ut,b as tt}from"./chunk-WM6AKY6B.js";import{f as u}from"./chunk-6K4BWAPV.js";var te=class{constructor(o){o=o??bt.EMPTY_OBJECT,this._ellipsoid=o.ellipsoid??B.default,this._rectangle=o.rectangle??Y.MAX_VALUE,this._projection=new Rt(this._ellipsoid),this._numberOfLevelZeroTilesX=o.numberOfLevelZeroTilesX??2,this._numberOfLevelZeroTilesY=o.numberOfLevelZeroTilesY??1}get ellipsoid(){return this._ellipsoid}get rectangle(){return this._rectangle}get projection(){return this._projection}getNumberOfXTilesAtLevel(o){return this._numberOfLevelZeroTilesX<=a&&(h=a-1);let f=(i.north-o.latitude)/s|0;return f>=c&&(f=c-1),u(e)?(e.x=h,e.y=f,e):new Mt(h,f)}},Oe=te;var Ie=new t,He=new t,ke=new w,ee=new t,hn=new t,ye=new U,pn=new Oe,Ct=[new w,new w,new w,new w],_t=new Mt,S={};S.initialize=function(){let n=S._initPromise;return u(n)||(n=xe.fetchJson(Ne("Assets/approximateTerrainHeights.json")).then(function(o){S._terrainHeights=o}),S._initPromise=n),n};S.getMinimumMaximumHeights=function(n,o){if(tt.defined("rectangle",n),!u(S._terrainHeights))throw new ut("You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function");o=o??B.default;let r=Ae(n),e=S._defaultMinTerrainHeight,i=S._defaultMaxTerrainHeight;if(u(r)){let a=`${r.level}-${r.x}-${r.y}`,c=S._terrainHeights[a];u(c)&&(e=c[0],i=c[1]),o.cartographicToCartesian(Y.northeast(n,ke),Ie),o.cartographicToCartesian(Y.southwest(n,ke),He),t.midpoint(He,Ie,ee);let l=o.scaleToGeodeticSurface(ee,hn);if(u(l)){let s=t.distance(ee,l);e=Math.min(e,-s)}else e=S._defaultMinTerrainHeight}return e=Math.max(S._defaultMinTerrainHeight,e),{minimumTerrainHeight:e,maximumTerrainHeight:i}};S.getBoundingSphere=function(n,o){if(tt.defined("rectangle",n),!u(S._terrainHeights))throw new ut("You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function");o=o??B.default;let r=Ae(n),e=S._defaultMaxTerrainHeight;if(u(r)){let a=`${r.level}-${r.x}-${r.y}`,c=S._terrainHeights[a];u(c)&&(e=c[1])}let i=U.fromRectangle3D(n,o,0);return U.fromRectangle3D(n,o,e,ye),U.union(i,ye,i)};function Ae(n){w.fromRadians(n.east,n.north,0,Ct[0]),w.fromRadians(n.west,n.north,0,Ct[1]),w.fromRadians(n.east,n.south,0,Ct[2]),w.fromRadians(n.west,n.south,0,Ct[3]);let o=0,r=0,e=0,i=0,a=S._terrainHeightsMaxLevel,c;for(c=0;c<=a;++c){let l=!1;for(let s=0;s<4;++s){let d=Ct[s];if(pn.positionToTileXY(d,c,_t),s===0)e=_t.x,i=_t.y;else if(e!==_t.x||i!==_t.y){l=!0;break}}if(l)break;o=e,r=i}if(c!==0)return{x:o,y:r,level:c>a?a:c-1}}S._terrainHeightsMaxLevel=6;S._defaultMaxTerrainHeight=9e3;S._defaultMinTerrainHeight=-1e5;S._terrainHeights=void 0;S._initPromise=void 0;Object.defineProperties(S,{initialized:{get:function(){return u(S._terrainHeights)}}});var jt=S;var le=[Rt,_e],dn=le.length,Ke=Math.cos(p.toRadians(30)),Me=Math.cos(p.toRadians(150)),Qe=0,tn=1e3;function rt(n){n=n??bt.EMPTY_OBJECT;let o=n.positions;if(!u(o)||o.length<2)throw new ut("At least two positions are required.");if(u(n.arcType)&&n.arcType!==W.GEODESIC&&n.arcType!==W.RHUMB)throw new ut("Valid options for arcType are ArcType.GEODESIC and ArcType.RHUMB.");this.width=n.width??1,this._positions=o,this.granularity=n.granularity??9999,this.loop=n.loop??!1,this.arcType=n.arcType??W.GEODESIC,this._ellipsoid=B.default,this._projectionIndex=0,this._workerName="createGroundPolylineGeometry",this._scene3DOnly=!1}Object.defineProperties(rt.prototype,{packedLength:{get:function(){return 1+this._positions.length*3+1+1+1+B.packedLength+1+1}}});rt.setProjectionAndEllipsoid=function(n,o){let r=0;for(let e=0;eKe||ap.PI_OVER_TWO&&(l=!0,c=t.subtract(a,r,Fe),d=s.cartesianToCartographic(c,je)),d.height=0;let h=n.project(d,i);return i=t.subtract(h,e,i),i.z=0,i=t.normalize(i,i),l&&t.negate(i,i),i}var An=new t,Xe=new t;function Ye(n,o,r,e,i,a){let c=t.subtract(o,n,An);t.normalize(c,c);let l=r-Qe,s=t.multiplyByScalar(c,l,Xe);t.add(n,s,i);let d=e-tn;s=t.multiplyByScalar(c,d,Xe),t.add(o,s,a)}var Mn=new t;function Yt(n,o){let r=zt.getPointDistance(Ut,n),e=zt.getPointDistance(Ut,o),i=Mn;p.equalsEpsilon(r,0,p.EPSILON2)?(i=et(o,n,i),t.multiplyByScalar(i,p.EPSILON2,i),t.add(n,i,n)):p.equalsEpsilon(e,0,p.EPSILON2)&&(i=et(n,o,i),t.multiplyByScalar(i,p.EPSILON2,i),t.add(o,i,o))}function Rn(n,o){let r=Math.abs(n.longitude),e=Math.abs(o.longitude);if(p.equalsEpsilon(r,p.PI,p.EPSILON11)){let i=p.sign(o.longitude);return n.longitude=i*(r-p.EPSILON11),1}else if(p.equalsEpsilon(e,p.PI,p.EPSILON11)){let i=p.sign(n.longitude);return o.longitude=i*(e-p.EPSILON11),2}return 0}var nn=new w,on=new w,Ue=new t,re=new t,qe=new t,Ge=new t,Pn=new t,We=new t,bn=[nn,on],vn=new Y,Bn=new t,zn=new t,jn=new t,Fn=new t,Xn=new t,Yn=new t,ae=new t,ce=new t,Un=new t,qn=new t,Gn=new t,Ze=new t,Wn=new t,Zn=new t,Vn=new Nt,$n=new Nt,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(n,o,r,e,i,a,c){let l,s,d=o._ellipsoid,h=r.length/3-1,f=h*8,T=f*4,D=h*36,O=f>65535?new Uint32Array(D):new Uint16Array(D),I=new Float64Array(f*3),z=new Float32Array(T),q=new Float32Array(T),m=new Float32Array(T),j=new Float32Array(T),b=new Float32Array(T),y,H,C,k;c&&(y=new Float32Array(T),H=new Float32Array(T),C=new Float32Array(T),k=new Float32Array(f*2));let P=a.length/2,v=0,x=nn;x.height=0;let N=on;N.height=0;let L=Ue,_=re;if(c)for(s=0,l=1;lKe?(nt=Lt(o,x,dt,lt,ae),ot=Lt(o,N,G,mt,ce)):E===1?(ot=Lt(o,N,G,mt,ce),nt.x=0,nt.y=p.sign(x.longitude-Math.abs(N.longitude)),nt.z=0):(nt=Lt(o,x,dt,lt,ae),ot.x=0,ot.y=p.sign(x.longitude-N.longitude),ot.z=0)}let ge=t.distance(Wt,ct),ue=Nt.fromCartesian(st,Vn),Ot=t.subtract(at,st,Un),an=t.normalize(Ot,Ze),Tt=t.subtract(Wt,st,qn);Tt=t.normalize(Tt,Tt);let ft=t.cross(an,Tt,Ze);ft=t.normalize(ft,ft);let It=t.cross(Tt,dt,Wn);It=t.normalize(It,It);let Ht=t.subtract(ct,at,Gn);Ht=t.normalize(Ht,Ht);let kt=t.cross(G,Ht,Zn);kt=t.normalize(kt,kt);let cn=ge/A,sn=pe/A,Zt=0,Et,yt,ht,we=0,Se=0;if(c){Zt=t.distance(lt,mt),Et=Nt.fromCartesian(lt,$n),yt=t.subtract(mt,lt,Ve),ht=t.normalize(yt,Jn);let E=ht.x;ht.x=ht.y,ht.y=-E,we=Zt/v,Se=de/v}for(g=0;g<8;g++){let E=wt+g*4,gt=Dt+g*2,xt=E+3,Ee=g<4?1:-1,At=g===2||g===3||g===6||g===7?1:-1;t.pack(ue.high,z,E),z[xt]=Ot.x,t.pack(ue.low,q,E),q[xt]=Ot.y,t.pack(It,m,E),m[xt]=Ot.z,t.pack(kt,j,E),j[xt]=cn*Ee,t.pack(ft,b,E);let pt=sn*At;pt===0&&At<0&&(pt=9),b[xt]=pt,c&&(y[E]=Et.high.x,y[E+1]=Et.high.y,y[E+2]=Et.low.x,y[E+3]=Et.low.y,C[E]=-nt.y,C[E+1]=nt.x,C[E+2]=ot.y,C[E+3]=-ot.x,H[E]=yt.x,H[E+1]=yt.y,H[E+2]=ht.x,H[E+3]=ht.y,k[gt]=we*Ee,pt=Se*At,pt===0&&At<0&&(pt=9),k[gt+1]=pt)}let V=jn,$=Fn,J=Bn,K=zn,ln=Y.fromCartographicArray(bn,vn),Te=jt.getMinimumMaximumHeights(ln,d),Vt=Te.minimumTerrainHeight,$t=Te.maximumTerrainHeight;qt+=Math.abs(Vt),qt+=Math.abs($t),Ye(st,Wt,Vt,$t,V,J),Ye(at,ct,Vt,$t,$,K);let Q=t.multiplyByScalar(ft,p.EPSILON5,$e);t.add(V,Q,V),t.add($,Q,$),t.add(J,Q,J),t.add(K,Q,K),Yt(V,$),Yt(J,K),t.pack(V,I,M),t.pack($,I,M+3),t.pack(K,I,M+6),t.pack(J,I,M+9),Q=t.multiplyByScalar(ft,-2*p.EPSILON5,$e),t.add(V,Q,V),t.add($,Q,$),t.add(J,Q,J),t.add(K,Q,K),Yt(V,$),Yt(J,K),t.pack(V,I,M+12),t.pack($,I,M+15),t.pack(K,I,M+18),t.pack(J,I,M+21),Z+=2,s+=3,Dt+=16,M+=24,wt+=32,pe+=ge,de+=Zt}s=0;let me=0;for(l=0;l