createGroundPolylineGeometry.js 18 KB

1
  1. define(["./Transforms-98ffa11d","./Matrix2-e3fb4559","./Cartesian3-7e9cc2ff","./Check-741c5f3c","./defaultValue-81eec7ed","./Math-5f585871","./ArcType-fc72c06c","./arrayRemoveDuplicates-85770175","./ComponentDatatype-aaeec80f","./EllipsoidGeodesic-6de45192","./EllipsoidRhumbLine-9c6b32ea","./EncodedCartesian3-aac44514","./GeometryAttribute-b025f9a8","./IntersectionTests-73b87d72","./Matrix4-d34187af","./Plane-4f75b3df","./WebMercatorProjection-f5706bbf","./_commonjsHelpers-3aae1032-26891ab7","./combine-3c023bda","./RuntimeError-26acdd3b","./WebGLConstants-508b9636"],(function(e,t,a,n,i,r,s,o,l,c,u,C,p,d,h,g,f,m,w,y,M){"use strict";function T(a){a=i.defaultValue(a,i.defaultValue.EMPTY_OBJECT),this._ellipsoid=i.defaultValue(a.ellipsoid,t.Ellipsoid.WGS84),this._rectangle=i.defaultValue(a.rectangle,t.Rectangle.MAX_VALUE),this._projection=new e.GeographicProjection(this._ellipsoid),this._numberOfLevelZeroTilesX=i.defaultValue(a.numberOfLevelZeroTilesX,2),this._numberOfLevelZeroTilesY=i.defaultValue(a.numberOfLevelZeroTilesY,1)}Object.defineProperties(T.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}}),T.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e},T.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e},T.prototype.rectangleToNativeRectangle=function(e,a){const n=r.CesiumMath.toDegrees(e.west),s=r.CesiumMath.toDegrees(e.south),o=r.CesiumMath.toDegrees(e.east),l=r.CesiumMath.toDegrees(e.north);return i.defined(a)?(a.west=n,a.south=s,a.east=o,a.north=l,a):new t.Rectangle(n,s,o,l)},T.prototype.tileXYToNativeRectangle=function(e,t,a,n){const i=this.tileXYToRectangle(e,t,a,n);return i.west=r.CesiumMath.toDegrees(i.west),i.south=r.CesiumMath.toDegrees(i.south),i.east=r.CesiumMath.toDegrees(i.east),i.north=r.CesiumMath.toDegrees(i.north),i},T.prototype.tileXYToRectangle=function(e,a,n,r){const s=this._rectangle,o=this.getNumberOfXTilesAtLevel(n),l=this.getNumberOfYTilesAtLevel(n),c=s.width/o,u=e*c+s.west,C=(e+1)*c+s.west,p=s.height/l,d=s.north-a*p,h=s.north-(a+1)*p;return i.defined(r)||(r=new t.Rectangle(u,h,C,d)),r.west=u,r.south=h,r.east=C,r.north=d,r},T.prototype.positionToTileXY=function(e,a,n){const s=this._rectangle;if(!t.Rectangle.contains(s,e))return;const o=this.getNumberOfXTilesAtLevel(a),l=this.getNumberOfYTilesAtLevel(a),c=s.width/o,u=s.height/l;let C=e.longitude;s.east<s.west&&(C+=r.CesiumMath.TWO_PI);let p=(C-s.west)/c|0;p>=o&&(p=o-1);let d=(s.north-e.latitude)/u|0;return d>=l&&(d=l-1),i.defined(n)?(n.x=p,n.y=d,n):new t.Cartesian2(p,d)};const E=new a.Cartesian3,_=new a.Cartesian3,O=new t.Cartographic,b=new a.Cartesian3,P=new a.Cartesian3,k=new e.BoundingSphere,A=new T,L=[new t.Cartographic,new t.Cartographic,new t.Cartographic,new t.Cartographic],S=new t.Cartesian2,x={};function I(e){t.Cartographic.fromRadians(e.east,e.north,0,L[0]),t.Cartographic.fromRadians(e.west,e.north,0,L[1]),t.Cartographic.fromRadians(e.east,e.south,0,L[2]),t.Cartographic.fromRadians(e.west,e.south,0,L[3]);let a=0,n=0,i=0,r=0;const s=x._terrainHeightsMaxLevel;let o;for(o=0;o<=s;++o){let e=!1;for(let t=0;t<4;++t){const a=L[t];if(A.positionToTileXY(a,o,S),0===t)i=S.x,r=S.y;else if(i!==S.x||r!==S.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}}x.initialize=function(){let t=x._initPromise;return i.defined(t)||(t=e.Resource.fetchJson(e.buildModuleUrl("Assets/approximateTerrainHeights.json")).then((function(e){x._terrainHeights=e})),x._initPromise=t),t},x.getMinimumMaximumHeights=function(e,n){n=i.defaultValue(n,t.Ellipsoid.WGS84);const r=I(e);let s=x._defaultMinTerrainHeight,o=x._defaultMaxTerrainHeight;if(i.defined(r)){const l=`${r.level}-${r.x}-${r.y}`,c=x._terrainHeights[l];i.defined(c)&&(s=c[0],o=c[1]),n.cartographicToCartesian(t.Rectangle.northeast(e,O),E),n.cartographicToCartesian(t.Rectangle.southwest(e,O),_),a.Cartesian3.midpoint(_,E,b);const u=n.scaleToGeodeticSurface(b,P);if(i.defined(u)){const e=a.Cartesian3.distance(b,u);s=Math.min(s,-e)}else s=x._defaultMinTerrainHeight}return s=Math.max(x._defaultMinTerrainHeight,s),{minimumTerrainHeight:s,maximumTerrainHeight:o}},x.getBoundingSphere=function(a,n){n=i.defaultValue(n,t.Ellipsoid.WGS84);const r=I(a);let s=x._defaultMaxTerrainHeight;if(i.defined(r)){const e=`${r.level}-${r.x}-${r.y}`,t=x._terrainHeights[e];i.defined(t)&&(s=t[1])}const o=e.BoundingSphere.fromRectangle3D(a,n,0);return e.BoundingSphere.fromRectangle3D(a,n,s,k),e.BoundingSphere.union(o,k,o)},x._terrainHeightsMaxLevel=6,x._defaultMaxTerrainHeight=9e3,x._defaultMinTerrainHeight=-1e5,x._terrainHeights=void 0,x._initPromise=void 0,Object.defineProperties(x,{initialized:{get:function(){return i.defined(x._terrainHeights)}}});const N=[e.GeographicProjection,f.WebMercatorProjection],R=N.length,D=Math.cos(r.CesiumMath.toRadians(30)),v=Math.cos(r.CesiumMath.toRadians(150));function z(e){const a=(e=i.defaultValue(e,i.defaultValue.EMPTY_OBJECT)).positions;this.width=i.defaultValue(e.width,1),this._positions=a,this.granularity=i.defaultValue(e.granularity,9999),this.loop=i.defaultValue(e.loop,!1),this.arcType=i.defaultValue(e.arcType,s.ArcType.GEODESIC),this._ellipsoid=t.Ellipsoid.WGS84,this._projectionIndex=0,this._workerName="createGroundPolylineGeometry",this._scene3DOnly=!1}Object.defineProperties(z.prototype,{packedLength:{get:function(){return 1+3*this._positions.length+1+1+1+t.Ellipsoid.packedLength+1+1}}}),z.setProjectionAndEllipsoid=function(e,t){let a=0;for(let e=0;e<R;e++)if(t instanceof N[e]){a=e;break}e._projectionIndex=a,e._ellipsoid=t.ellipsoid};const H=new a.Cartesian3,j=new a.Cartesian3,B=new a.Cartesian3;function V(e,t,n,i,r){const s=U(i,e,0,H),o=U(i,e,n,j),l=U(i,t,0,B),c=Z(o,s,j),u=Z(l,s,B);return a.Cartesian3.cross(u,c,r),a.Cartesian3.normalize(r,r)}const G=new t.Cartographic,Y=new a.Cartesian3,F=new a.Cartesian3,q=new a.Cartesian3;function X(e,t,n,i,r,o,l,C,p,d,h){if(0===r)return;let g;o===s.ArcType.GEODESIC?g=new c.EllipsoidGeodesic(e,t,l):o===s.ArcType.RHUMB&&(g=new u.EllipsoidRhumbLine(e,t,l));const f=g.surfaceDistance;if(f<r)return;const m=V(e,t,i,l,q),w=Math.ceil(f/r),y=f/w;let M=y;const T=w-1;let E=C.length;for(let e=0;e<T;e++){const e=g.interpolateUsingSurfaceDistance(M,G),t=U(l,e,n,Y),r=U(l,e,i,F);a.Cartesian3.pack(m,C,E),a.Cartesian3.pack(t,p,E),a.Cartesian3.pack(r,d,E),h.push(e.latitude),h.push(e.longitude),E+=3,M+=y}}const W=new t.Cartographic;function U(e,a,n,i){return t.Cartographic.clone(a,W),W.height=n,t.Cartographic.toCartesian(W,e,i)}function Z(e,t,n){return a.Cartesian3.subtract(e,t,n),a.Cartesian3.normalize(n,n),n}function $(e,t,n,i){return i=Z(e,t,i),i=a.Cartesian3.cross(i,n,i),i=a.Cartesian3.normalize(i,i),i=a.Cartesian3.cross(n,i,i)}z.pack=function(e,n,r){let s=i.defaultValue(r,0);const o=e._positions,l=o.length;n[s++]=l;for(let e=0;e<l;++e){const t=o[e];a.Cartesian3.pack(t,n,s),s+=3}return n[s++]=e.granularity,n[s++]=e.loop?1:0,n[s++]=e.arcType,t.Ellipsoid.pack(e._ellipsoid,n,s),s+=t.Ellipsoid.packedLength,n[s++]=e._projectionIndex,n[s++]=e._scene3DOnly?1:0,n},z.unpack=function(e,n,r){let s=i.defaultValue(n,0);const o=e[s++],l=new Array(o);for(let t=0;t<o;t++)l[t]=a.Cartesian3.unpack(e,s),s+=3;const c=e[s++],u=1===e[s++],C=e[s++],p=t.Ellipsoid.unpack(e,s);s+=t.Ellipsoid.packedLength;const d=e[s++],h=1===e[s++];return i.defined(r)||(r=new z({positions:l})),r._positions=l,r.granularity=c,r.loop=u,r.arcType=C,r._ellipsoid=p,r._projectionIndex=d,r._scene3DOnly=h,r};const J=new a.Cartesian3,Q=new a.Cartesian3,K=new a.Cartesian3,ee=new a.Cartesian3;function te(e,t,n,i,s){const o=Z(n,t,ee),l=$(e,t,o,J),c=$(i,t,o,Q);if(r.CesiumMath.equalsEpsilon(a.Cartesian3.dot(l,c),-1,r.CesiumMath.EPSILON5))return s=a.Cartesian3.cross(o,l,s),s=a.Cartesian3.normalize(s,s);s=a.Cartesian3.add(c,l,s),s=a.Cartesian3.normalize(s,s);const u=a.Cartesian3.cross(o,s,K);return a.Cartesian3.dot(c,u)<0&&(s=a.Cartesian3.negate(s,s)),s}const ae=g.Plane.fromPointNormal(a.Cartesian3.ZERO,a.Cartesian3.UNIT_Y),ne=new a.Cartesian3,ie=new a.Cartesian3,re=new a.Cartesian3,se=new a.Cartesian3,oe=new a.Cartesian3,le=new a.Cartesian3,ce=new t.Cartographic,ue=new t.Cartographic,Ce=new t.Cartographic;z.createGeometry=function(n){const c=!n._scene3DOnly;let h=n.loop;const g=n._ellipsoid,f=n.granularity,m=n.arcType,w=new N[n._projectionIndex](g),y=1e3;let M,T;const E=n._positions,_=E.length;let O,b,P,k;2===_&&(h=!1);const A=new u.EllipsoidRhumbLine(void 0,void 0,g);let L,S,I;const R=[E[0]];for(T=0;T<_-1;T++)O=E[T],b=E[T+1],L=d.IntersectionTests.lineSegmentPlane(O,b,ae,le),!i.defined(L)||a.Cartesian3.equalsEpsilon(L,O,r.CesiumMath.EPSILON7)||a.Cartesian3.equalsEpsilon(L,b,r.CesiumMath.EPSILON7)||(n.arcType===s.ArcType.GEODESIC?R.push(a.Cartesian3.clone(L)):n.arcType===s.ArcType.RHUMB&&(I=g.cartesianToCartographic(L,ce).longitude,P=g.cartesianToCartographic(O,ce),k=g.cartesianToCartographic(b,ue),A.setEndPoints(P,k),S=A.findIntersectionWithLongitude(I,Ce),L=g.cartographicToCartesian(S,le),!i.defined(L)||a.Cartesian3.equalsEpsilon(L,O,r.CesiumMath.EPSILON7)||a.Cartesian3.equalsEpsilon(L,b,r.CesiumMath.EPSILON7)||R.push(a.Cartesian3.clone(L)))),R.push(b);h&&(O=E[_-1],b=E[0],L=d.IntersectionTests.lineSegmentPlane(O,b,ae,le),!i.defined(L)||a.Cartesian3.equalsEpsilon(L,O,r.CesiumMath.EPSILON7)||a.Cartesian3.equalsEpsilon(L,b,r.CesiumMath.EPSILON7)||(n.arcType===s.ArcType.GEODESIC?R.push(a.Cartesian3.clone(L)):n.arcType===s.ArcType.RHUMB&&(I=g.cartesianToCartographic(L,ce).longitude,P=g.cartesianToCartographic(O,ce),k=g.cartesianToCartographic(b,ue),A.setEndPoints(P,k),S=A.findIntersectionWithLongitude(I,Ce),L=g.cartographicToCartesian(S,le),!i.defined(L)||a.Cartesian3.equalsEpsilon(L,O,r.CesiumMath.EPSILON7)||a.Cartesian3.equalsEpsilon(L,b,r.CesiumMath.EPSILON7)||R.push(a.Cartesian3.clone(L)))));let v=R.length,z=new Array(v);for(T=0;T<v;T++){const e=t.Cartographic.fromCartesian(R[T],g);e.height=0,z[T]=e}if(z=o.arrayRemoveDuplicates(z,t.Cartographic.equalsEpsilon),v=z.length,v<2)return;const H=[],j=[],B=[],G=[];let Y=ne,F=ie,q=re,W=se,$=oe;const J=z[0],Q=z[1];for(Y=U(g,z[v-1],0,Y),W=U(g,Q,0,W),F=U(g,J,0,F),q=U(g,J,y,q),$=h?te(Y,F,q,W,$):V(J,Q,y,g,$),a.Cartesian3.pack($,j,0),a.Cartesian3.pack(F,B,0),a.Cartesian3.pack(q,G,0),H.push(J.latitude),H.push(J.longitude),X(J,Q,0,y,f,m,g,j,B,G,H),T=1;T<v-1;++T){Y=a.Cartesian3.clone(F,Y),F=a.Cartesian3.clone(W,F);const e=z[T];U(g,e,y,q),U(g,z[T+1],0,W),te(Y,F,q,W,$),M=j.length,a.Cartesian3.pack($,j,M),a.Cartesian3.pack(F,B,M),a.Cartesian3.pack(q,G,M),H.push(e.latitude),H.push(e.longitude),X(z[T],z[T+1],0,y,f,m,g,j,B,G,H)}const K=z[v-1],ee=z[v-2];if(F=U(g,K,0,F),q=U(g,K,y,q),h){const e=z[0];Y=U(g,ee,0,Y),W=U(g,e,0,W),$=te(Y,F,q,W,$)}else $=V(ee,K,y,g,$);if(M=j.length,a.Cartesian3.pack($,j,M),a.Cartesian3.pack(F,B,M),a.Cartesian3.pack(q,G,M),H.push(K.latitude),H.push(K.longitude),h){for(X(K,J,0,y,f,m,g,j,B,G,H),M=j.length,T=0;T<3;++T)j[M+T]=j[T],B[M+T]=B[T],G[M+T]=G[T];H.push(J.latitude),H.push(J.longitude)}return function(n,i,s,o,c,u,d){let h,g;const f=i._ellipsoid,m=s.length/3-1,w=8*m,y=4*w,M=36*m,T=w>65535?new Uint32Array(M):new Uint16Array(M),E=new Float64Array(3*w),_=new Float32Array(y),O=new Float32Array(y),b=new Float32Array(y),P=new Float32Array(y),k=new Float32Array(y);let A,L,S,I;d&&(A=new Float32Array(y),L=new Float32Array(y),S=new Float32Array(y),I=new Float32Array(2*w));const N=u.length/2;let R=0;const v=Pe;v.height=0;const z=ke;z.height=0;let H=Ae,j=Le;if(d)for(g=0,h=1;h<N;h++)v.latitude=u[g],v.longitude=u[g+1],z.latitude=u[g+2],z.longitude=u[g+3],H=i.project(v,H),j=i.project(z,j),R+=a.Cartesian3.distance(H,j),g+=2;const B=o.length/3;j=a.Cartesian3.unpack(o,0,j);let V,G=0;for(g=3,h=1;h<B;h++)H=a.Cartesian3.clone(j,H),j=a.Cartesian3.unpack(o,g,j),G+=a.Cartesian3.distance(H,j),g+=3;g=3;let Y=0,F=0,q=0,X=0,W=!1,U=a.Cartesian3.unpack(s,0,xe),$=a.Cartesian3.unpack(o,0,Le),J=a.Cartesian3.unpack(c,0,Ne);if(n){ge(J,a.Cartesian3.unpack(s,s.length-6,Se),U,$)&&(J=a.Cartesian3.negate(J,J))}let Q=0,K=0,ee=0;for(h=0;h<m;h++){const e=a.Cartesian3.clone(U,Se),n=a.Cartesian3.clone($,Ae);let l,p,h,m,w=a.Cartesian3.clone(J,Ie);if(W&&(w=a.Cartesian3.negate(w,w)),U=a.Cartesian3.unpack(s,g,xe),$=a.Cartesian3.unpack(o,g,Le),J=a.Cartesian3.unpack(c,g,Ne),W=ge(J,e,U,$),v.latitude=u[Y],v.longitude=u[Y+1],z.latitude=u[Y+2],z.longitude=u[Y+3],d){const e=be(v,z);l=i.project(v,Be),p=i.project(z,Ve);const t=Z(p,l,Qe);t.y=Math.abs(t.y),h=Ge,m=Ye,0===e||a.Cartesian3.dot(t,a.Cartesian3.UNIT_Y)>D?(h=ye(i,v,w,l,Ge),m=ye(i,z,J,p,Ye)):1===e?(m=ye(i,z,J,p,Ye),h.x=0,h.y=r.CesiumMath.sign(v.longitude-Math.abs(z.longitude)),h.z=0):(h=ye(i,v,w,l,Ge),m.x=0,m.y=r.CesiumMath.sign(v.longitude-z.longitude),m.z=0)}const y=a.Cartesian3.distance(n,$),M=C.EncodedCartesian3.fromCartesian(e,$e),T=a.Cartesian3.subtract(U,e,Fe),N=a.Cartesian3.normalize(T,We);let H=a.Cartesian3.subtract(n,e,qe);H=a.Cartesian3.normalize(H,H);let j=a.Cartesian3.cross(N,H,We);j=a.Cartesian3.normalize(j,j);let B=a.Cartesian3.cross(H,w,Ue);B=a.Cartesian3.normalize(B,B);let te=a.Cartesian3.subtract($,U,Xe);te=a.Cartesian3.normalize(te,te);let ae=a.Cartesian3.cross(J,te,Ze);ae=a.Cartesian3.normalize(ae,ae);const ne=y/G,ie=Q/G;let re,se,oe,le=0,ce=0,ue=0;if(d){le=a.Cartesian3.distance(l,p),re=C.EncodedCartesian3.fromCartesian(l,Je),se=a.Cartesian3.subtract(p,l,Qe),oe=a.Cartesian3.normalize(se,Ke);const e=oe.x;oe.x=oe.y,oe.y=-e,ce=le/R,ue=K/R}for(V=0;V<8;V++){const e=X+4*V,t=F+2*V,n=e+3,i=V<4?1:-1,r=2===V||3===V||6===V||7===V?1:-1;a.Cartesian3.pack(M.high,_,e),_[n]=T.x,a.Cartesian3.pack(M.low,O,e),O[n]=T.y,a.Cartesian3.pack(B,b,e),b[n]=T.z,a.Cartesian3.pack(ae,P,e),P[n]=ne*i,a.Cartesian3.pack(j,k,e);let s=ie*r;0===s&&r<0&&(s=9),k[n]=s,d&&(A[e]=re.high.x,A[e+1]=re.high.y,A[e+2]=re.low.x,A[e+3]=re.low.y,S[e]=-h.y,S[e+1]=h.x,S[e+2]=m.y,S[e+3]=-m.x,L[e]=se.x,L[e+1]=se.y,L[e+2]=oe.x,L[e+3]=oe.y,I[t]=ce*i,s=ue*r,0===s&&r<0&&(s=9),I[t+1]=s)}const Ce=He,pe=je,de=ve,he=ze,fe=t.Rectangle.fromCartographicArray(Re,De),me=x.getMinimumMaximumHeights(fe,f),we=me.minimumTerrainHeight,Me=me.maximumTerrainHeight;ee+=we,ee+=Me,Ee(e,n,we,Me,Ce,de),Ee(U,$,we,Me,pe,he);let Te=a.Cartesian3.multiplyByScalar(j,r.CesiumMath.EPSILON5,et);a.Cartesian3.add(Ce,Te,Ce),a.Cartesian3.add(pe,Te,pe),a.Cartesian3.add(de,Te,de),a.Cartesian3.add(he,Te,he),Oe(Ce,pe),Oe(de,he),a.Cartesian3.pack(Ce,E,q),a.Cartesian3.pack(pe,E,q+3),a.Cartesian3.pack(he,E,q+6),a.Cartesian3.pack(de,E,q+9),Te=a.Cartesian3.multiplyByScalar(j,-2*r.CesiumMath.EPSILON5,et),a.Cartesian3.add(Ce,Te,Ce),a.Cartesian3.add(pe,Te,pe),a.Cartesian3.add(de,Te,de),a.Cartesian3.add(he,Te,he),Oe(Ce,pe),Oe(de,he),a.Cartesian3.pack(Ce,E,q+12),a.Cartesian3.pack(pe,E,q+15),a.Cartesian3.pack(he,E,q+18),a.Cartesian3.pack(de,E,q+21),Y+=2,g+=3,F+=16,q+=24,X+=32,Q+=y,K+=le}g=0;let te=0;for(h=0;h<m;h++){for(V=0;V<nt;V++)T[g+V]=at[V]+te;te+=8,g+=nt}const ae=tt;e.BoundingSphere.fromVertices(s,a.Cartesian3.ZERO,3,ae[0]),e.BoundingSphere.fromVertices(o,a.Cartesian3.ZERO,3,ae[1]);const ne=e.BoundingSphere.fromBoundingSpheres(ae);ne.radius+=ee/(2*m);const ie={position:new p.GeometryAttribute({componentDatatype:l.ComponentDatatype.DOUBLE,componentsPerAttribute:3,normalize:!1,values:E}),startHiAndForwardOffsetX:it(_),startLoAndForwardOffsetY:it(O),startNormalAndForwardOffsetZ:it(b),endNormalAndTextureCoordinateNormalizationX:it(P),rightNormalAndTextureCoordinateNormalizationY:it(k)};d&&(ie.startHiLo2D=it(A),ie.offsetAndRight2D=it(L),ie.startEndNormals2D=it(S),ie.texcoordNormalization2D=new p.GeometryAttribute({componentDatatype:l.ComponentDatatype.FLOAT,componentsPerAttribute:2,normalize:!1,values:I}));return new p.Geometry({attributes:ie,indices:T,boundingSphere:ne})}(h,w,B,G,j,H,c)};const pe=new a.Cartesian3,de=new h.Matrix3,he=new e.Quaternion;function ge(t,n,i,s){const o=Z(i,n,pe),l=a.Cartesian3.dot(o,t);if(l>D||l<v){const a=Z(s,i,ee),n=l<v?r.CesiumMath.PI_OVER_TWO:-r.CesiumMath.PI_OVER_TWO,o=e.Quaternion.fromAxisAngle(a,n,he),c=h.Matrix3.fromQuaternion(o,de);return h.Matrix3.multiplyByVector(c,t,t),!0}return!1}const fe=new t.Cartographic,me=new a.Cartesian3,we=new a.Cartesian3;function ye(e,n,i,s,o){const l=t.Cartographic.toCartesian(n,e._ellipsoid,me);let c=a.Cartesian3.add(l,i,we),u=!1;const C=e._ellipsoid;let p=C.cartesianToCartographic(c,fe);Math.abs(n.longitude-p.longitude)>r.CesiumMath.PI_OVER_TWO&&(u=!0,c=a.Cartesian3.subtract(l,i,we),p=C.cartesianToCartographic(c,fe)),p.height=0;const d=e.project(p,o);return(o=a.Cartesian3.subtract(d,s,o)).z=0,o=a.Cartesian3.normalize(o,o),u&&a.Cartesian3.negate(o,o),o}const Me=new a.Cartesian3,Te=new a.Cartesian3;function Ee(e,t,n,i,r,s){const o=a.Cartesian3.subtract(t,e,Me);a.Cartesian3.normalize(o,o);const l=n-0;let c=a.Cartesian3.multiplyByScalar(o,l,Te);a.Cartesian3.add(e,c,r);const u=i-1e3;c=a.Cartesian3.multiplyByScalar(o,u,Te),a.Cartesian3.add(t,c,s)}const _e=new a.Cartesian3;function Oe(e,t){const n=g.Plane.getPointDistance(ae,e),i=g.Plane.getPointDistance(ae,t);let s=_e;r.CesiumMath.equalsEpsilon(n,0,r.CesiumMath.EPSILON2)?(s=Z(t,e,s),a.Cartesian3.multiplyByScalar(s,r.CesiumMath.EPSILON2,s),a.Cartesian3.add(e,s,e)):r.CesiumMath.equalsEpsilon(i,0,r.CesiumMath.EPSILON2)&&(s=Z(e,t,s),a.Cartesian3.multiplyByScalar(s,r.CesiumMath.EPSILON2,s),a.Cartesian3.add(t,s,t))}function be(e,t){const a=Math.abs(e.longitude),n=Math.abs(t.longitude);if(r.CesiumMath.equalsEpsilon(a,r.CesiumMath.PI,r.CesiumMath.EPSILON11)){const n=r.CesiumMath.sign(t.longitude);return e.longitude=n*(a-r.CesiumMath.EPSILON11),1}if(r.CesiumMath.equalsEpsilon(n,r.CesiumMath.PI,r.CesiumMath.EPSILON11)){const a=r.CesiumMath.sign(e.longitude);return t.longitude=a*(n-r.CesiumMath.EPSILON11),2}return 0}const Pe=new t.Cartographic,ke=new t.Cartographic,Ae=new a.Cartesian3,Le=new a.Cartesian3,Se=new a.Cartesian3,xe=new a.Cartesian3,Ie=new a.Cartesian3,Ne=new a.Cartesian3,Re=[Pe,ke],De=new t.Rectangle,ve=new a.Cartesian3,ze=new a.Cartesian3,He=new a.Cartesian3,je=new a.Cartesian3,Be=new a.Cartesian3,Ve=new a.Cartesian3,Ge=new a.Cartesian3,Ye=new a.Cartesian3,Fe=new a.Cartesian3,qe=new a.Cartesian3,Xe=new a.Cartesian3,We=new a.Cartesian3,Ue=new a.Cartesian3,Ze=new a.Cartesian3,$e=new C.EncodedCartesian3,Je=new C.EncodedCartesian3,Qe=new a.Cartesian3,Ke=new a.Cartesian3,et=new a.Cartesian3,tt=[new e.BoundingSphere,new e.BoundingSphere],at=[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],nt=at.length;function it(e){return new p.GeometryAttribute({componentDatatype:l.ComponentDatatype.FLOAT,componentsPerAttribute:4,normalize:!1,values:e})}return z._projectNormal=ye,function(e,t){return x.initialize().then((function(){return i.defined(t)&&(e=z.unpack(e,t)),z.createGeometry(e)}))}}));