/** * @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-f305a473","./Matrix2-7dfd434a","./defaultValue-50f7432c","./ComponentDatatype-9b23164a","./ArcType-24f44850","./arrayRemoveDuplicates-fd3a3f4e","./EllipsoidGeodesic-8f07d257","./EllipsoidRhumbLine-5454653c","./EncodedCartesian3-5efd45c3","./GeometryAttribute-4d82fade","./IntersectionTests-4a7694f7","./Plane-3d30b188","./WebMercatorProjection-70f51d9f","./combine-8462e002","./RuntimeError-48e1f06d","./WebGLConstants-58abc51a"],(function(e,t,a,n,i,r,s,o,l,c,u,C,p,d,h,g){"use strict";function f(n){n=a.defaultValue(n,a.defaultValue.EMPTY_OBJECT),this._ellipsoid=a.defaultValue(n.ellipsoid,t.Ellipsoid.WGS84),this._rectangle=a.defaultValue(n.rectangle,t.Rectangle.MAX_VALUE),this._projection=new e.GeographicProjection(this._ellipsoid),this._numberOfLevelZeroTilesX=a.defaultValue(n.numberOfLevelZeroTilesX,2),this._numberOfLevelZeroTilesY=a.defaultValue(n.numberOfLevelZeroTilesY,1)}Object.defineProperties(f.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}}),f.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<=o&&(p=o-1);let d=(s.north-e.latitude)/u|0;return d>=l&&(d=l-1),a.defined(r)?(r.x=p,r.y=d,r):new t.Cartesian2(p,d)};const m=new t.Cartesian3,w=new t.Cartesian3,y=new t.Cartographic,M=new t.Cartesian3,T=new t.Cartesian3,E=new e.BoundingSphere,_=new f,O=[new t.Cartographic,new t.Cartographic,new t.Cartographic,new t.Cartographic],P=new t.Cartesian2,b={};function A(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=b._terrainHeightsMaxLevel;let o;for(o=0;o<=s;++o){let e=!1;for(let t=0;t<4;++t){const a=O[t];if(_.positionToTileXY(a,o,P),0===t)i=P.x,r=P.y;else if(i!==P.x||r!==P.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}}b.initialize=function(){let t=b._initPromise;return a.defined(t)||(t=e.Resource.fetchJson(e.buildModuleUrl("Assets/approximateTerrainHeights.json")).then((function(e){b._terrainHeights=e})),b._initPromise=t),t},b.getMinimumMaximumHeights=function(e,n){n=a.defaultValue(n,t.Ellipsoid.WGS84);const i=A(e);let r=b._defaultMinTerrainHeight,s=b._defaultMaxTerrainHeight;if(a.defined(i)){const o=`${i.level}-${i.x}-${i.y}`,l=b._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=b._defaultMinTerrainHeight}return r=Math.max(b._defaultMinTerrainHeight,r),{minimumTerrainHeight:r,maximumTerrainHeight:s}},b.getBoundingSphere=function(n,i){i=a.defaultValue(i,t.Ellipsoid.WGS84);const r=A(n);let s=b._defaultMaxTerrainHeight;if(a.defined(r)){const e=`${r.level}-${r.x}-${r.y}`,t=b._terrainHeights[e];a.defined(t)&&(s=t[1])}const o=e.BoundingSphere.fromRectangle3D(n,i,0);return e.BoundingSphere.fromRectangle3D(n,i,s,E),e.BoundingSphere.union(o,E,o)},b._terrainHeightsMaxLevel=6,b._defaultMaxTerrainHeight=9e3,b._defaultMinTerrainHeight=-1e5,b._terrainHeights=void 0,b._initPromise=void 0,Object.defineProperties(b,{initialized:{get:function(){return a.defined(b._terrainHeights)}}});var k=b;const L=[e.GeographicProjection,p.WebMercatorProjection],S=L.length,x=Math.cos(n.CesiumMath.toRadians(30)),I=Math.cos(n.CesiumMath.toRadians(150));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*f),T=new Float32Array(m),E=new Float32Array(m),_=new Float32Array(m),O=new Float32Array(m),P=new Float32Array(m);let b,A,L,S;C&&(b=new Float32Array(m),A=new Float32Array(m),L=new Float32Array(m),S=new Float32Array(2*f));const I=u.length/2;let N=0;const R=Ee;R.height=0;const D=_e;D.height=0;let v=Oe,z=Pe;if(C)for(d=0,p=1;px?(g=ge(i,R,m,c,He),f=ge(i,D,Z,p,Be)):1===e?(f=ge(i,D,Z,p,Be),g.x=0,g.y=n.CesiumMath.sign(R.longitude-Math.abs(D.longitude)),g.z=0):(g=ge(i,R,m,c,He),f.x=0,f.y=n.CesiumMath.sign(R.longitude-D.longitude),f.z=0)}const w=t.Cartesian3.distance(a,U),y=l.EncodedCartesian3.fromCartesian(e,Xe),I=t.Cartesian3.subtract(W,e,Ve),v=t.Cartesian3.normalize(I,Ye);let z=t.Cartesian3.subtract(a,e,je);z=t.Cartesian3.normalize(z,z);let H=t.Cartesian3.cross(v,z,Ye);H=t.Cartesian3.normalize(H,H);let K=t.Cartesian3.cross(z,m,Fe);K=t.Cartesian3.normalize(K,K);let ee=t.Cartesian3.subtract(U,W,Ge);ee=t.Cartesian3.normalize(ee,ee);let te=t.Cartesian3.cross(Z,ee,qe);te=t.Cartesian3.normalize(te,te);const ae=w/V,ne=$/V;let ie,re,se,oe=0,le=0,ce=0;if(C){oe=t.Cartesian3.distance(c,p),ie=l.EncodedCartesian3.fromCartesian(c,We),re=t.Cartesian3.subtract(p,c,Ue),se=t.Cartesian3.normalize(re,Ze);const e=se.x;se.x=se.y,se.y=-e,le=oe/N,ce=J/N}for(B=0;B<8;B++){const e=F+4*B,a=G+2*B,n=e+3,i=B<4?1:-1,r=2===B||3===B||6===B||7===B?1:-1;t.Cartesian3.pack(y.high,T,e),T[n]=I.x,t.Cartesian3.pack(y.low,E,e),E[n]=I.y,t.Cartesian3.pack(K,_,e),_[n]=I.z,t.Cartesian3.pack(te,O,e),O[n]=ae*i,t.Cartesian3.pack(H,P,e);let s=ne*r;0===s&&r<0&&(s=9),P[n]=s,C&&(b[e]=ie.high.x,b[e+1]=ie.high.y,b[e+2]=ie.low.x,b[e+3]=ie.low.y,L[e]=-g.y,L[e+1]=g.x,L[e+2]=f.y,L[e+3]=-f.x,A[e]=re.x,A[e+1]=re.y,A[e+2]=se.x,A[e+3]=se.y,S[a]=le*i,s=ce*r,0===s&&r<0&&(s=9),S[a+1]=s)}const ue=Re,pe=De,de=Ie,he=Ne,fe=t.Rectangle.fromCartographicArray(Se,xe),me=k.getMinimumMaximumHeights(fe,h),ye=me.minimumTerrainHeight,Ee=me.maximumTerrainHeight;Q+=ye,Q+=Ee,we(e,a,ye,Ee,ue,de),we(W,U,ye,Ee,pe,he);let _e=t.Cartesian3.multiplyByScalar(H,n.CesiumMath.EPSILON5,$e);t.Cartesian3.add(ue,_e,ue),t.Cartesian3.add(pe,_e,pe),t.Cartesian3.add(de,_e,de),t.Cartesian3.add(he,_e,he),Me(ue,pe),Me(de,he),t.Cartesian3.pack(ue,M,Y),t.Cartesian3.pack(pe,M,Y+3),t.Cartesian3.pack(he,M,Y+6),t.Cartesian3.pack(de,M,Y+9),_e=t.Cartesian3.multiplyByScalar(H,-2*n.CesiumMath.EPSILON5,$e),t.Cartesian3.add(ue,_e,ue),t.Cartesian3.add(pe,_e,pe),t.Cartesian3.add(de,_e,de),t.Cartesian3.add(he,_e,he),Me(ue,pe),Me(de,he),t.Cartesian3.pack(ue,M,Y+12),t.Cartesian3.pack(pe,M,Y+15),t.Cartesian3.pack(he,M,Y+18),t.Cartesian3.pack(de,M,Y+21),j+=2,d+=3,G+=16,Y+=24,F+=32,$+=w,J+=oe}d=0;let K=0;for(p=0;px||ln.CesiumMath.PI_OVER_TWO&&(c=!0,l=t.Cartesian3.subtract(o,i,he),C=u.cartesianToCartographic(l,pe)),C.height=0;const p=e.project(C,s);return(s=t.Cartesian3.subtract(p,r,s)).z=0,s=t.Cartesian3.normalize(s,s),c&&t.Cartesian3.negate(s,s),s}const fe=new t.Cartesian3,me=new t.Cartesian3;function we(e,a,n,i,r,s){const o=t.Cartesian3.subtract(a,e,fe);t.Cartesian3.normalize(o,o);const l=n-0;let c=t.Cartesian3.multiplyByScalar(o,l,me);t.Cartesian3.add(e,c,r);const u=i-1e3;c=t.Cartesian3.multiplyByScalar(o,u,me),t.Cartesian3.add(a,c,s)}const ye=new t.Cartesian3;function Me(e,a){const i=C.Plane.getPointDistance(Q,e),r=C.Plane.getPointDistance(Q,a);let s=ye;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 Te(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 Ee=new t.Cartographic,_e=new t.Cartographic,Oe=new t.Cartesian3,Pe=new t.Cartesian3,be=new t.Cartesian3,Ae=new t.Cartesian3,ke=new t.Cartesian3,Le=new t.Cartesian3,Se=[Ee,_e],xe=new t.Rectangle,Ie=new t.Cartesian3,Ne=new t.Cartesian3,Re=new t.Cartesian3,De=new t.Cartesian3,ve=new t.Cartesian3,ze=new t.Cartesian3,He=new t.Cartesian3,Be=new t.Cartesian3,Ve=new t.Cartesian3,je=new t.Cartesian3,Ge=new t.Cartesian3,Ye=new t.Cartesian3,Fe=new t.Cartesian3,qe=new t.Cartesian3,Xe=new l.EncodedCartesian3,We=new l.EncodedCartesian3,Ue=new t.Cartesian3,Ze=new t.Cartesian3,$e=new t.Cartesian3,Je=[new e.BoundingSphere,new e.BoundingSphere],Qe=[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=Qe.length;function et(e){return new c.GeometryAttribute({componentDatatype:n.ComponentDatatype.FLOAT,componentsPerAttribute:4,normalize:!1,values:e})}return N._projectNormal=ge,function(e,t){return k.initialize().then((function(){return a.defined(t)&&(e=N.unpack(e,t)),N.createGeometry(e)}))}}));