/** * @license * Cesium - https://github.com/CesiumGS/cesium * Version 1.98 * * 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. */ define(["./Transforms-c9e418cb","./Matrix2-cf4c6e69","./defaultValue-50f7432c","./ComponentDatatype-9b23164a","./ArcType-24f44850","./arrayRemoveDuplicates-fd3a3f4e","./EllipsoidGeodesic-759beff8","./EllipsoidRhumbLine-0cc30625","./EncodedCartesian3-0b8c686b","./GeometryAttribute-b84ffce6","./IntersectionTests-d662a125","./Plane-b9f0711b","./WebMercatorProjection-019b6547","./combine-8462e002","./RuntimeError-48e1f06d","./WebGLConstants-58abc51a"],(function(e,t,a,n,i,r,s,o,l,c,u,C,d,h,p,f){"use strict";function g(n){n=a.defaultValue(n,a.defaultValue.EMPTY_OBJECT),a.defined(n.tileInfo)&&a.defined(n.tileInfo.spatialReference)&&a.defined(n.tileInfo.spatialReference.wkid)&&4490==n.tileInfo.spatialReference.wkid?(this._tileInfo=n.tileInfo,this._ellipsoid=a.defaultValue(n.ellipsoid,t.Ellipsoid.CGCS2000),this._rectangle=a.defaultValue(n.rectangle,t.Rectangle.fromDegrees(-180,-90,180,90)),this._numberOfLevelZeroTilesX=a.defaultValue(n.numberOfLevelZeroTilesX,4),this._numberOfLevelZeroTilesY=a.defaultValue(n.numberOfLevelZeroTilesY,2)):(this._ellipsoid=a.defaultValue(n.ellipsoid,t.Ellipsoid.WGS84),this._rectangle=a.defaultValue(n.rectangle,t.Rectangle.MAX_VALUE),this._numberOfLevelZeroTilesX=a.defaultValue(n.numberOfLevelZeroTilesX,2),this._numberOfLevelZeroTilesY=a.defaultValue(n.numberOfLevelZeroTilesY,1)),this._projection=new e.GeographicProjection(this._ellipsoid)}Object.defineProperties(g.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}}),g.prototype.getNumberOfXTilesAtLevel=function(e){if(a.defined(this._tileInfo)){var t=this._tileInfo.lods.filter((function(t){return t.level===e}))[0].resolution;return Math.round(n.CesiumMath.toDegrees(n.CesiumMath.TWO_PI)/(this._tileInfo.rows*t))}return this._numberOfLevelZeroTilesX<=o&&(d=o-1);let h=(s.north-e.latitude)/u|0;return h>=l&&(h=l-1),a.defined(r)?(r.x=d,r.y=h,r):new t.Cartesian2(d,h)};const m=new t.Cartesian3,w=new t.Cartesian3,y=new t.Cartographic,M=new t.Cartesian3,T=new t.Cartesian3,_=new e.BoundingSphere,E=new g,O=[new t.Cartographic,new t.Cartographic,new t.Cartographic,new t.Cartographic],b=new t.Cartesian2,I={};function P(e){t.Cartographic.fromRadians(e.east,e.north,0,O[0]),t.Cartographic.fromRadians(e.west,e.north,0,O[1]),t.Cartographic.fromRadians(e.east,e.south,0,O[2]),t.Cartographic.fromRadians(e.west,e.south,0,O[3]);let a=0,n=0,i=0,r=0;const s=I._terrainHeightsMaxLevel;let o;for(o=0;o<=s;++o){let e=!1;for(let t=0;t<4;++t){const a=O[t];if(E.positionToTileXY(a,o,b),0===t)i=b.x,r=b.y;else if(i!==b.x||r!==b.y){e=!0;break}}if(e)break;a=i,n=r}if(0!==o)return{x:a,y:n,level:o>s?s:o-1}}I.initialize=function(){let t=I._initPromise;return a.defined(t)||(t=e.Resource.fetchJson(e.buildModuleUrl("Assets/approximateTerrainHeights.json")).then((function(e){I._terrainHeights=e})),I._initPromise=t),t},I.getMinimumMaximumHeights=function(e,n){n=a.defaultValue(n,t.Ellipsoid.WGS84);const i=P(e);let r=I._defaultMinTerrainHeight,s=I._defaultMaxTerrainHeight;if(a.defined(i)){const o=`${i.level}-${i.x}-${i.y}`,l=I._terrainHeights[o];a.defined(l)&&(r=l[0],s=l[1]),n.cartographicToCartesian(t.Rectangle.northeast(e,y),m),n.cartographicToCartesian(t.Rectangle.southwest(e,y),w),t.Cartesian3.midpoint(w,m,M);const c=n.scaleToGeodeticSurface(M,T);if(a.defined(c)){const e=t.Cartesian3.distance(M,c);r=Math.min(r,-e)}else r=I._defaultMinTerrainHeight}return r=Math.max(I._defaultMinTerrainHeight,r),{minimumTerrainHeight:r,maximumTerrainHeight:s}},I.getBoundingSphere=function(n,i){i=a.defaultValue(i,t.Ellipsoid.WGS84);const r=P(n);let s=I._defaultMaxTerrainHeight;if(a.defined(r)){const e=`${r.level}-${r.x}-${r.y}`,t=I._terrainHeights[e];a.defined(t)&&(s=t[1])}const o=e.BoundingSphere.fromRectangle3D(n,i,0);return e.BoundingSphere.fromRectangle3D(n,i,s,_),e.BoundingSphere.union(o,_,o)},I._terrainHeightsMaxLevel=6,I._defaultMaxTerrainHeight=9e3,I._defaultMinTerrainHeight=-1e5,I._terrainHeights=void 0,I._initPromise=void 0,Object.defineProperties(I,{initialized:{get:function(){return a.defined(I._terrainHeights)}}});var L=I;const k=[e.GeographicProjection,d.WebMercatorProjection],A=k.length,S=Math.cos(n.CesiumMath.toRadians(30)),x=Math.cos(n.CesiumMath.toRadians(150)),R=0,D=1e3;function N(e){const n=(e=a.defaultValue(e,a.defaultValue.EMPTY_OBJECT)).positions;this.width=a.defaultValue(e.width,1),this._positions=n,this.granularity=a.defaultValue(e.granularity,9999),this.loop=a.defaultValue(e.loop,!1),this.arcType=a.defaultValue(e.arcType,i.ArcType.GEODESIC),this._ellipsoid=t.Ellipsoid.WGS84,this._projectionIndex=0,this._workerName="createGroundPolylineGeometry",this._scene3DOnly=!1}Object.defineProperties(N.prototype,{packedLength:{get:function(){return 1+3*this._positions.length+1+1+1+t.Ellipsoid.packedLength+1+1}}}),N.setProjectionAndEllipsoid=function(e,t){let a=0;for(let e=0;e65535?new Uint32Array(w):new Uint16Array(w),M=new Float64Array(3*g),T=new Float32Array(m),_=new Float32Array(m),E=new Float32Array(m),O=new Float32Array(m),b=new Float32Array(m);let I,P,k,A;C&&(I=new Float32Array(m),P=new Float32Array(m),k=new Float32Array(m),A=new Float32Array(2*g));const x=u.length/2;let R=0;const D=Oe;D.height=0;const N=be;N.height=0;let v=Ie,V=Pe;if(C)for(h=0,d=1;dS?(f=me(i,D,m,c,Be),g=me(i,N,U,d,Ge)):1===e?(g=me(i,N,U,d,Ge),f.x=0,f.y=n.CesiumMath.sign(D.longitude-Math.abs(N.longitude)),f.z=0):(f=me(i,D,m,c,Be),g.x=0,g.y=n.CesiumMath.sign(D.longitude-N.longitude),g.z=0)}const w=t.Cartesian3.distance(a,Z),y=l.EncodedCartesian3.fromCartesian(e,Ze),x=t.Cartesian3.subtract(W,e,je),v=t.Cartesian3.normalize(x,Fe);let V=t.Cartesian3.subtract(a,e,Ye);V=t.Cartesian3.normalize(V,V);let z=t.Cartesian3.cross(v,V,Fe);z=t.Cartesian3.normalize(z,z);let K=t.Cartesian3.cross(V,m,We);K=t.Cartesian3.normalize(K,K);let ee=t.Cartesian3.subtract(Z,W,Xe);ee=t.Cartesian3.normalize(ee,ee);let te=t.Cartesian3.cross(U,ee,qe);te=t.Cartesian3.normalize(te,te);const ae=w/B,ne=$/B;let ie,re,se,oe=0,le=0,ce=0;if(C){oe=t.Cartesian3.distance(c,d),ie=l.EncodedCartesian3.fromCartesian(c,Ue),re=t.Cartesian3.subtract(d,c,$e),se=t.Cartesian3.normalize(re,Je);const e=se.x;se.x=se.y,se.y=-e,le=oe/R,ce=J/R}for(H=0;H<8;H++){const e=X+4*H,a=j+2*H,n=e+3,i=H<4?1:-1,r=2===H||3===H||6===H||7===H?1:-1;t.Cartesian3.pack(y.high,T,e),T[n]=x.x,t.Cartesian3.pack(y.low,_,e),_[n]=x.y,t.Cartesian3.pack(K,E,e),E[n]=x.z,t.Cartesian3.pack(te,O,e),O[n]=ae*i,t.Cartesian3.pack(z,b,e);let s=ne*r;0===s&&r<0&&(s=9),b[n]=s,C&&(I[e]=ie.high.x,I[e+1]=ie.high.y,I[e+2]=ie.low.x,I[e+3]=ie.low.y,k[e]=-f.y,k[e+1]=f.x,k[e+2]=g.y,k[e+3]=-g.x,P[e]=re.x,P[e+1]=re.y,P[e+2]=se.x,P[e+3]=se.y,A[a]=le*i,s=ce*r,0===s&&r<0&&(s=9),A[a+1]=s)}const ue=ve,Ce=Ve,de=De,pe=Ne,fe=t.Rectangle.fromCartographicArray(xe,Re),ge=L.getMinimumMaximumHeights(fe,p),we=ge.minimumTerrainHeight,ye=ge.maximumTerrainHeight;Q+=we,Q+=ye,Me(e,a,we,ye,ue,de),Me(W,Z,we,ye,Ce,pe);let Te=t.Cartesian3.multiplyByScalar(z,n.CesiumMath.EPSILON5,Qe);t.Cartesian3.add(ue,Te,ue),t.Cartesian3.add(Ce,Te,Ce),t.Cartesian3.add(de,Te,de),t.Cartesian3.add(pe,Te,pe),_e(ue,Ce),_e(de,pe),t.Cartesian3.pack(ue,M,Y),t.Cartesian3.pack(Ce,M,Y+3),t.Cartesian3.pack(pe,M,Y+6),t.Cartesian3.pack(de,M,Y+9),Te=t.Cartesian3.multiplyByScalar(z,-2*n.CesiumMath.EPSILON5,Qe),t.Cartesian3.add(ue,Te,ue),t.Cartesian3.add(Ce,Te,Ce),t.Cartesian3.add(de,Te,de),t.Cartesian3.add(pe,Te,pe),_e(ue,Ce),_e(de,pe),t.Cartesian3.pack(ue,M,Y+12),t.Cartesian3.pack(Ce,M,Y+15),t.Cartesian3.pack(pe,M,Y+18),t.Cartesian3.pack(de,M,Y+21),G+=2,h+=3,j+=16,Y+=24,X+=32,$+=w,J+=oe}h=0;let K=0;for(d=0;dS||ln.CesiumMath.PI_OVER_TWO&&(c=!0,l=t.Cartesian3.subtract(o,i,ge),C=u.cartesianToCartographic(l,pe)),C.height=0;const d=e.project(C,s);return(s=t.Cartesian3.subtract(d,r,s)).z=0,s=t.Cartesian3.normalize(s,s),c&&t.Cartesian3.negate(s,s),s}const we=new t.Cartesian3,ye=new t.Cartesian3;function Me(e,a,n,i,r,s){const o=t.Cartesian3.subtract(a,e,we);t.Cartesian3.normalize(o,o);const l=n-R;let c=t.Cartesian3.multiplyByScalar(o,l,ye);t.Cartesian3.add(e,c,r);const u=i-D;c=t.Cartesian3.multiplyByScalar(o,u,ye),t.Cartesian3.add(a,c,s)}const Te=new t.Cartesian3;function _e(e,a){const i=C.Plane.getPointDistance(ee,e),r=C.Plane.getPointDistance(ee,a);let s=Te;n.CesiumMath.equalsEpsilon(i,0,n.CesiumMath.EPSILON2)?(s=q(a,e,s),t.Cartesian3.multiplyByScalar(s,n.CesiumMath.EPSILON2,s),t.Cartesian3.add(e,s,e)):n.CesiumMath.equalsEpsilon(r,0,n.CesiumMath.EPSILON2)&&(s=q(e,a,s),t.Cartesian3.multiplyByScalar(s,n.CesiumMath.EPSILON2,s),t.Cartesian3.add(a,s,a))}function Ee(e,t){const a=Math.abs(e.longitude),i=Math.abs(t.longitude);if(n.CesiumMath.equalsEpsilon(a,n.CesiumMath.PI,n.CesiumMath.EPSILON11)){const i=n.CesiumMath.sign(t.longitude);return e.longitude=i*(a-n.CesiumMath.EPSILON11),1}if(n.CesiumMath.equalsEpsilon(i,n.CesiumMath.PI,n.CesiumMath.EPSILON11)){const a=n.CesiumMath.sign(e.longitude);return t.longitude=a*(i-n.CesiumMath.EPSILON11),2}return 0}const Oe=new t.Cartographic,be=new t.Cartographic,Ie=new t.Cartesian3,Pe=new t.Cartesian3,Le=new t.Cartesian3,ke=new t.Cartesian3,Ae=new t.Cartesian3,Se=new t.Cartesian3,xe=[Oe,be],Re=new t.Rectangle,De=new t.Cartesian3,Ne=new t.Cartesian3,ve=new t.Cartesian3,Ve=new t.Cartesian3,ze=new t.Cartesian3,He=new t.Cartesian3,Be=new t.Cartesian3,Ge=new t.Cartesian3,je=new t.Cartesian3,Ye=new t.Cartesian3,Xe=new t.Cartesian3,Fe=new t.Cartesian3,We=new t.Cartesian3,qe=new t.Cartesian3,Ze=new l.EncodedCartesian3,Ue=new l.EncodedCartesian3,$e=new t.Cartesian3,Je=new t.Cartesian3,Qe=new t.Cartesian3,Ke=[new e.BoundingSphere,new e.BoundingSphere],et=[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],tt=et.length;function at(e){return new c.GeometryAttribute({componentDatatype:n.ComponentDatatype.FLOAT,componentsPerAttribute:4,normalize:!1,values:e})}return N._projectNormal=me,function(e,t){return L.initialize().then((function(){return a.defined(t)&&(e=N.unpack(e,t)),N.createGeometry(e)}))}}));