| | |
| | | define(["./defaultValue-865ac579","./Matrix3-293ae7b3","./ArcType-68098157","./BoundingRectangle-735493ea","./Transforms-36e0c57f","./Matrix2-7f5bbd54","./ComponentDatatype-985dcc38","./EllipsoidGeodesic-2155b3b0","./EllipsoidTangentPlane-7a62129b","./GeometryAttribute-df0cc42c","./GeometryInstance-0f6ca825","./GeometryOffsetAttribute-06264989","./GeometryPipeline-d395f1f6","./IndexDatatype-16f6b4a1","./Math-76ce6367","./PolygonGeometryLibrary-90e667ef","./PolygonPipeline-8986342f","./VertexFormat-20b5279f","./combine-5e110d09","./RuntimeError-9e0724f9","./WebGLConstants-258cf3a0","./AxisAlignedBoundingBox-6806540a","./IntersectionTests-3a8233fc","./Plane-a7f8aee2","./AttributeCompression-e34a188e","./EncodedCartesian3-d8932345","./arrayRemoveDuplicates-398390b2","./EllipsoidRhumbLine-2feb918c","./GeometryAttributes-75794475"],(function(t,e,o,r,i,n,a,s,l,u,c,p,y,d,m,g,h,f,b,_,P,C,x,w,T,A,I,v,E){"use strict";const G=new e.Cartographic,O=new e.Cartographic;function L(t,e,o,r){const i=r.cartesianToCartographic(t,G).height,n=r.cartesianToCartographic(e,O);n.height=i,r.cartographicToCartesian(n,e);const a=r.cartesianToCartographic(o,O);a.height=i-100,r.cartographicToCartesian(a,o)}const V=new r.BoundingRectangle,D=new e.Cartesian3,H=new e.Cartesian3,F=new e.Cartesian3,N=new e.Cartesian3,R=new e.Cartesian3,M=new e.Cartesian3;let S=new e.Cartesian3,B=new e.Cartesian3,k=new e.Cartesian3;const z=new n.Cartesian2,W=new n.Cartesian2,Y=new e.Cartesian3,U=new i.Quaternion,j=new e.Matrix3,Q=new e.Matrix3;function q(o){const r=o.vertexFormat,s=o.geometry,l=o.shadowVolume,c=s.attributes.position.values,y=t.defined(s.attributes.st)?s.attributes.st.values:void 0;let d=c.length;const g=o.wall,h=o.top||g,f=o.bottom||g;if(r.st||r.normal||r.tangent||r.bitangent||l){const p=o.boundingRectangle,b=o.tangentPlane,_=o.ellipsoid,P=o.stRotation,C=o.perPositionHeight,x=z;x.x=p.x,x.y=p.y;const w=r.st?new Float32Array(d/3*2):void 0,T=new Float32Array(d/3);let A,I=0;r.normal&&(A=C&&h&&!g?s.attributes.normal.values:new Float32Array(d));const v=r.tangent?new Float32Array(d):void 0,E=r.bitangent?new Float32Array(d):void 0,G=l?new Float32Array(d):void 0;let O=0,V=0,q=H,K=F,Z=N,J=!0,X=j,$=Q;if(0!==P){let t=i.Quaternion.fromAxisAngle(b._plane.normal,P,U);X=e.Matrix3.fromQuaternion(t,X),t=i.Quaternion.fromAxisAngle(b._plane.normal,-P,U),$=e.Matrix3.fromQuaternion(t,$)}else X=e.Matrix3.clone(e.Matrix3.IDENTITY,X),$=e.Matrix3.clone(e.Matrix3.IDENTITY,$);let tt=0,et=0;h&&f&&(tt=d/2,et=d/3,d/=2);for(let i=0;i<d;i+=3){const a=e.Cartesian3.fromArray(c,i,Y);if(r.st&&!t.defined(y)){let t=e.Matrix3.multiplyByVector(X,a,D);t=_.scaleToGeodeticSurface(t,t);const o=b.projectPointOntoPlane(t,W);n.Cartesian2.subtract(o,x,o);const r=m.CesiumMath.clamp(o.x/p.width,0,1),i=m.CesiumMath.clamp(o.y/p.height,0,1);f&&(w[O+et]=r,w[O+1+et]=i),h&&(w[O]=r,w[O+1]=i);const s=e.Cartographic.fromCartesian(a);T[I++]=Math.floor(s.height+1e-5),O+=2}if(r.normal||r.tangent||r.bitangent||l){const t=V+1,n=V+2;if(g){if(i+3<d){const t=e.Cartesian3.fromArray(c,i+3,R);if(J){const o=e.Cartesian3.fromArray(c,i+d,M);C&&L(a,t,o,_),e.Cartesian3.subtract(t,a,t),e.Cartesian3.subtract(o,a,o),q=e.Cartesian3.normalize(e.Cartesian3.cross(o,t,q),q),J=!1}e.Cartesian3.equalsEpsilon(t,a,m.CesiumMath.EPSILON10)&&(J=!0)}(r.tangent||r.bitangent)&&(Z=_.geodeticSurfaceNormal(a,Z),r.tangent&&(K=e.Cartesian3.normalize(e.Cartesian3.cross(Z,q,K),K)))}else q=_.geodeticSurfaceNormal(a,q),(r.tangent||r.bitangent)&&(C&&(S=e.Cartesian3.fromArray(A,V,S),B=e.Cartesian3.cross(e.Cartesian3.UNIT_Z,S,B),B=e.Cartesian3.normalize(e.Matrix3.multiplyByVector($,B,B),B),r.bitangent&&(k=e.Cartesian3.normalize(e.Cartesian3.cross(S,B,k),k))),K=e.Cartesian3.cross(e.Cartesian3.UNIT_Z,q,K),K=e.Cartesian3.normalize(e.Matrix3.multiplyByVector($,K,K),K),r.bitangent&&(Z=e.Cartesian3.normalize(e.Cartesian3.cross(q,K,Z),Z)));r.normal&&(o.wall?(A[V+tt]=q.x,A[t+tt]=q.y,A[n+tt]=q.z):f&&(A[V+tt]=-q.x,A[t+tt]=-q.y,A[n+tt]=-q.z),(h&&!C||g)&&(A[V]=q.x,A[t]=q.y,A[n]=q.z)),l&&(g&&(q=_.geodeticSurfaceNormal(a,q)),G[V+tt]=-q.x,G[t+tt]=-q.y,G[n+tt]=-q.z),r.tangent&&(o.wall?(v[V+tt]=K.x,v[t+tt]=K.y,v[n+tt]=K.z):f&&(v[V+tt]=-K.x,v[t+tt]=-K.y,v[n+tt]=-K.z),h&&(C?(v[V]=B.x,v[t]=B.y,v[n]=B.z):(v[V]=K.x,v[t]=K.y,v[n]=K.z))),r.bitangent&&(f&&(E[V+tt]=Z.x,E[t+tt]=Z.y,E[n+tt]=Z.z),h&&(C?(E[V]=k.x,E[t]=k.y,E[n]=k.z):(E[V]=Z.x,E[t]=Z.y,E[n]=Z.z))),V+=3}}r.st&&!t.defined(y)&&(s.attributes.st=new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:w}),s.attributes.height=new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:1,values:T})),r.normal&&(s.attributes.normal=new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:A})),r.tangent&&(s.attributes.tangent=new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:v})),r.bitangent&&(s.attributes.bitangent=new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:E})),l&&(s.attributes.extrudeDirection=new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:G}))}if(o.extrude&&t.defined(o.offsetAttribute)){const t=c.length/3;let e=new Uint8Array(t);if(o.offsetAttribute===p.GeometryOffsetAttribute.TOP)h&&f||g?e=e.fill(1,0,t/2):h&&(e=e.fill(1));else{const t=o.offsetAttribute===p.GeometryOffsetAttribute.NONE?0:1;e=e.fill(t)}s.attributes.applyOffset=new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:e})}return s}const K=new e.Cartographic,Z=new e.Cartographic,J={westOverIDL:0,eastOverIDL:0};let X=new s.EllipsoidGeodesic;function $(e,r,i,a,l){if(l=t.defaultValue(l,new n.Rectangle),!t.defined(e)||e.length<3)return l.west=0,l.north=0,l.south=0,l.east=0,l;if(i===o.ArcType.RHUMB)return n.Rectangle.fromCartesianArray(e,r,l);X.ellipsoid.equals(r)||(X=new s.EllipsoidGeodesic(void 0,void 0,r)),l.west=Number.POSITIVE_INFINITY,l.east=Number.NEGATIVE_INFINITY,l.south=Number.POSITIVE_INFINITY,l.north=Number.NEGATIVE_INFINITY,J.westOverIDL=Number.POSITIVE_INFINITY,J.eastOverIDL=Number.NEGATIVE_INFINITY;const u=1/m.CesiumMath.chordLength(a,r.maximumRadius),c=e.length;let p,y=r.cartesianToCartographic(e[0],Z),d=K;for(let t=1;t<c;t++)p=d,d=y,y=r.cartesianToCartographic(e[t],p),X.setEndPoints(d,y),et(X,u,l,J);return p=d,d=y,y=r.cartesianToCartographic(e[0],p),X.setEndPoints(d,y),et(X,u,l,J),l.east-l.west>J.eastOverIDL-J.westOverIDL&&(l.west=J.westOverIDL,l.east=J.eastOverIDL,l.east>m.CesiumMath.PI&&(l.east=l.east-m.CesiumMath.TWO_PI),l.west>m.CesiumMath.PI&&(l.west=l.west-m.CesiumMath.TWO_PI)),l}const tt=new e.Cartographic;function et(t,e,o,r){const i=t.surfaceDistance,n=Math.ceil(i*e),a=n>0?i/(n-1):Number.POSITIVE_INFINITY;let s=0;for(let e=0;e<n;e++){const e=t.interpolateUsingSurfaceDistance(s,tt);s+=a;const i=e.longitude,n=e.latitude;o.west=Math.min(o.west,i),o.east=Math.max(o.east,i),o.south=Math.min(o.south,n),o.north=Math.max(o.north,n);const l=i>=0?i:i+m.CesiumMath.TWO_PI;r.westOverIDL=Math.min(r.westOverIDL,l),r.eastOverIDL=Math.max(r.eastOverIDL,l)}}const ot=[];function rt(e,o,r,i,n,a,s,u,p,y){const m={walls:[]};let f;if(s||u){const n=g.PolygonGeometryLibrary.createGeometryFromPositions(e,o,r,i,a,p,y),l=n.attributes.position.values,h=n.indices;let b,_;if(s&&u){const e=l.concat(l);b=e.length/3,_=d.IndexDatatype.createTypedArray(b,2*h.length),_.set(h);const o=h.length,i=b/2;for(f=0;f<o;f+=3){const t=_[f]+i,e=_[f+1]+i,r=_[f+2]+i;_[f+o]=r,_[f+1+o]=e,_[f+2+o]=t}if(n.attributes.position.values=e,a&&p.normal){const t=n.attributes.normal.values;n.attributes.normal.values=new Float32Array(e.length),n.attributes.normal.values.set(t)}if(p.st&&t.defined(r)){const t=n.attributes.st.values;n.attributes.st.values=new Float32Array(2*b),n.attributes.st.values=t.concat(t)}n.indices=_}else if(u){for(b=l.length/3,_=d.IndexDatatype.createTypedArray(b,h.length),f=0;f<h.length;f+=3)_[f]=h[f+2],_[f+1]=h[f+1],_[f+2]=h[f];n.indices=_}m.topAndBottom=new c.GeometryInstance({geometry:n})}let b=n.outerRing,_=l.EllipsoidTangentPlane.fromPoints(b,e),P=_.projectPointsOntoPlane(b,ot),C=h.PolygonPipeline.computeWindingOrder2D(P);C===h.WindingOrder.CLOCKWISE&&(b=b.slice().reverse());let x=g.PolygonGeometryLibrary.computeWallGeometry(b,r,e,i,a,y);m.walls.push(new c.GeometryInstance({geometry:x}));const w=n.holes;for(f=0;f<w.length;f++){let t=w[f];_=l.EllipsoidTangentPlane.fromPoints(t,e),P=_.projectPointsOntoPlane(t,ot),C=h.PolygonPipeline.computeWindingOrder2D(P),C===h.WindingOrder.COUNTER_CLOCKWISE&&(t=t.slice().reverse()),x=g.PolygonGeometryLibrary.computeWallGeometry(t,r,e,i,a,y),m.walls.push(new c.GeometryInstance({geometry:x}))}return m}function it(r){const i=r.polygonHierarchy,a=t.defaultValue(r.vertexFormat,f.VertexFormat.DEFAULT),s=t.defaultValue(r.ellipsoid,e.Ellipsoid.WGS84),l=t.defaultValue(r.granularity,m.CesiumMath.RADIANS_PER_DEGREE),u=t.defaultValue(r.stRotation,0),c=r.textureCoordinates,p=t.defaultValue(r.perPositionHeight,!1),y=p&&t.defined(r.extrudedHeight);let d=t.defaultValue(r.height,0),h=t.defaultValue(r.extrudedHeight,d);if(!y){const t=Math.max(d,h);h=Math.min(d,h),d=t}this._vertexFormat=f.VertexFormat.clone(a),this._ellipsoid=e.Ellipsoid.clone(s),this._granularity=l,this._stRotation=u,this._height=d,this._extrudedHeight=h,this._closeTop=t.defaultValue(r.closeTop,!0),this._closeBottom=t.defaultValue(r.closeBottom,!0),this._polygonHierarchy=i,this._perPositionHeight=p,this._perPositionHeightExtrude=y,this._shadowVolume=t.defaultValue(r.shadowVolume,!1),this._workerName="createPolygonGeometry",this._offsetAttribute=r.offsetAttribute,this._arcType=t.defaultValue(r.arcType,o.ArcType.GEODESIC),this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0,this._textureCoordinates=c,this.packedLength=g.PolygonGeometryLibrary.computeHierarchyPackedLength(i,e.Cartesian3)+e.Ellipsoid.packedLength+f.VertexFormat.packedLength+(c?g.PolygonGeometryLibrary.computeHierarchyPackedLength(c,n.Cartesian2):1)+12}it.fromPositions=function(e){return new it({polygonHierarchy:{positions:(e=t.defaultValue(e,t.defaultValue.EMPTY_OBJECT)).positions},height:e.height,extrudedHeight:e.extrudedHeight,vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid,granularity:e.granularity,perPositionHeight:e.perPositionHeight,closeTop:e.closeTop,closeBottom:e.closeBottom,offsetAttribute:e.offsetAttribute,arcType:e.arcType,textureCoordinates:e.textureCoordinates})},it.pack=function(o,r,i){return i=t.defaultValue(i,0),i=g.PolygonGeometryLibrary.packPolygonHierarchy(o._polygonHierarchy,r,i,e.Cartesian3),e.Ellipsoid.pack(o._ellipsoid,r,i),i+=e.Ellipsoid.packedLength,f.VertexFormat.pack(o._vertexFormat,r,i),i+=f.VertexFormat.packedLength,r[i++]=o._height,r[i++]=o._extrudedHeight,r[i++]=o._granularity,r[i++]=o._stRotation,r[i++]=o._perPositionHeightExtrude?1:0,r[i++]=o._perPositionHeight?1:0,r[i++]=o._closeTop?1:0,r[i++]=o._closeBottom?1:0,r[i++]=o._shadowVolume?1:0,r[i++]=t.defaultValue(o._offsetAttribute,-1),r[i++]=o._arcType,t.defined(o._textureCoordinates)?i=g.PolygonGeometryLibrary.packPolygonHierarchy(o._textureCoordinates,r,i,n.Cartesian2):r[i++]=-1,r[i++]=o.packedLength,r};const nt=e.Ellipsoid.clone(e.Ellipsoid.UNIT_SPHERE),at=new f.VertexFormat,st={polygonHierarchy:{}};return it.unpack=function(o,r,i){r=t.defaultValue(r,0);const a=g.PolygonGeometryLibrary.unpackPolygonHierarchy(o,r,e.Cartesian3);r=a.startingIndex,delete a.startingIndex;const s=e.Ellipsoid.unpack(o,r,nt);r+=e.Ellipsoid.packedLength;const l=f.VertexFormat.unpack(o,r,at);r+=f.VertexFormat.packedLength;const u=o[r++],c=o[r++],p=o[r++],y=o[r++],d=1===o[r++],m=1===o[r++],h=1===o[r++],b=1===o[r++],_=1===o[r++],P=o[r++],C=o[r++],x=-1===o[r]?void 0:g.PolygonGeometryLibrary.unpackPolygonHierarchy(o,r,n.Cartesian2);t.defined(x)?(r=x.startingIndex,delete x.startingIndex):r++;const w=o[r++];return t.defined(i)||(i=new it(st)),i._polygonHierarchy=a,i._ellipsoid=e.Ellipsoid.clone(s,i._ellipsoid),i._vertexFormat=f.VertexFormat.clone(l,i._vertexFormat),i._height=u,i._extrudedHeight=c,i._granularity=p,i._stRotation=y,i._perPositionHeightExtrude=d,i._perPositionHeight=m,i._closeTop=h,i._closeBottom=b,i._shadowVolume=_,i._offsetAttribute=-1===P?void 0:P,i._arcType=C,i._textureCoordinates=x,i.packedLength=w,i},it.computeRectangle=function(r,i){const n=t.defaultValue(r.granularity,m.CesiumMath.RADIANS_PER_DEGREE),a=t.defaultValue(r.arcType,o.ArcType.GEODESIC),s=r.polygonHierarchy,l=t.defaultValue(r.ellipsoid,e.Ellipsoid.WGS84);return $(s.positions,l,a,n,i)},it.createGeometry=function(e){const o=e._vertexFormat,r=e._ellipsoid,n=e._granularity,s=e._stRotation,f=e._polygonHierarchy,b=e._perPositionHeight,_=e._closeTop,P=e._closeBottom,C=e._arcType,x=e._textureCoordinates,w=t.defined(x);let T=f.positions;if(T.length<3)return;const A=l.EllipsoidTangentPlane.fromPoints(T,r),I=g.PolygonGeometryLibrary.polygonsFromHierarchy(f,w,A.projectPointsOntoPlane.bind(A),!b,r),v=I.hierarchy,E=I.polygons,G=w?g.PolygonGeometryLibrary.polygonsFromHierarchy(x,!0,(function(t){return t}),!1).polygons:void 0;if(0===v.length)return;T=v[0].outerRing;const O=g.PolygonGeometryLibrary.computeBoundingRectangle(A.plane.normal,A.projectPointOntoPlane.bind(A),T,s,V),L=[],D=e._height,H=e._extrudedHeight,F={perPositionHeight:b,vertexFormat:o,geometry:void 0,tangentPlane:A,boundingRectangle:O,ellipsoid:r,stRotation:s,textureCoordinates:void 0,bottom:!1,top:!0,wall:!1,extrude:!1,arcType:C};let N;if(e._perPositionHeightExtrude||!m.CesiumMath.equalsEpsilon(D,H,0,m.CesiumMath.EPSILON2))for(F.extrude=!0,F.top=_,F.bottom=P,F.shadowVolume=e._shadowVolume,F.offsetAttribute=e._offsetAttribute,N=0;N<E.length;N++){const t=rt(r,E[N],w?G[N]:void 0,n,v[N],b,_,P,o,C);let e;_&&P?(e=t.topAndBottom,F.geometry=g.PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(e.geometry,D,H,r,b)):_?(e=t.topAndBottom,e.geometry.attributes.position.values=h.PolygonPipeline.scaleToGeodeticHeight(e.geometry.attributes.position.values,D,r,!b),F.geometry=e.geometry):P&&(e=t.topAndBottom,e.geometry.attributes.position.values=h.PolygonPipeline.scaleToGeodeticHeight(e.geometry.attributes.position.values,H,r,!0),F.geometry=e.geometry),(_||P)&&(F.wall=!1,e.geometry=q(F),L.push(e));const i=t.walls;F.wall=!0;for(let t=0;t<i.length;t++){const e=i[t];F.geometry=g.PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(e.geometry,D,H,r,b),e.geometry=q(F),L.push(e)}}else for(N=0;N<E.length;N++){const i=new c.GeometryInstance({geometry:g.PolygonGeometryLibrary.createGeometryFromPositions(r,E[N],w?G[N]:void 0,n,b,o,C)});if(i.geometry.attributes.position.values=h.PolygonPipeline.scaleToGeodeticHeight(i.geometry.attributes.position.values,D,r,!b),F.geometry=i.geometry,i.geometry=q(F),t.defined(e._offsetAttribute)){const t=i.geometry.attributes.position.values.length,o=e._offsetAttribute===p.GeometryOffsetAttribute.NONE?0:1,r=new Uint8Array(t/3).fill(o);i.geometry.attributes.applyOffset=new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:r})}L.push(i)}const R=y.GeometryPipeline.combineInstances(L)[0];R.attributes.position.values=new Float64Array(R.attributes.position.values),R.indices=d.IndexDatatype.createTypedArray(R.attributes.position.values.length/3,R.indices);const M=R.attributes,S=i.BoundingSphere.fromVertices(M.position.values);return o.position||delete M.position,new u.Geometry({attributes:M,indices:R.indices,primitiveType:R.primitiveType,boundingSphere:S,offsetAttribute:e._offsetAttribute})},it.createShadowVolume=function(t,e,o){const r=t._granularity,i=t._ellipsoid,n=e(r,i),a=o(r,i);return new it({polygonHierarchy:t._polygonHierarchy,ellipsoid:i,stRotation:t._stRotation,granularity:r,perPositionHeight:!1,extrudedHeight:n,height:a,vertexFormat:f.VertexFormat.POSITION_ONLY,shadowVolume:!0,arcType:t._arcType})},Object.defineProperties(it.prototype,{rectangle:{get:function(){if(!t.defined(this._rectangle)){const t=this._polygonHierarchy.positions;this._rectangle=$(t,this._ellipsoid,this._arcType,this._granularity)}return this._rectangle}},textureCoordinateRotationPoints:{get:function(){return t.defined(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=function(t){const e=-t._stRotation;if(0===e)return[0,0,0,1,1,0];const o=t._ellipsoid,r=t._polygonHierarchy.positions,i=t.rectangle;return u.Geometry._textureCoordinateRotationPoints(r,e,o,i)}(this)),this._textureCoordinateRotationPoints}}}),function(o,r){return t.defined(r)&&(o=it.unpack(o,r)),o._ellipsoid=e.Ellipsoid.clone(o._ellipsoid),it.createGeometry(o)}})); |
| | | define(["./defaultValue-865ac579","./Matrix3-c381b58e","./ArcType-68098157","./BoundingRectangle-99781f85","./Transforms-ea9ca02d","./Matrix2-f88429ba","./ComponentDatatype-985dcc38","./EllipsoidGeodesic-bce49915","./EllipsoidTangentPlane-5e19e0df","./GeometryAttribute-d025250e","./GeometryInstance-8b896a8b","./GeometryOffsetAttribute-06264989","./GeometryPipeline-f311ba05","./IndexDatatype-16f6b4a1","./Math-76ce6367","./PolygonGeometryLibrary-b8b50d0d","./PolygonPipeline-f926cb86","./VertexFormat-20b5279f","./combine-5e110d09","./RuntimeError-9e0724f9","./WebGLConstants-258cf3a0","./AxisAlignedBoundingBox-2a402bb9","./IntersectionTests-c82940c4","./Plane-c6962071","./AttributeCompression-194a7de3","./EncodedCartesian3-7da52f0b","./arrayRemoveDuplicates-398390b2","./EllipsoidRhumbLine-62d76d47","./GeometryAttributes-75794475"],(function(t,e,o,r,i,n,a,s,l,u,c,p,y,d,m,g,h,f,b,_,P,C,x,w,T,A,I,v,E){"use strict";const G=new e.Cartographic,O=new e.Cartographic;function L(t,e,o,r){const i=r.cartesianToCartographic(t,G).height,n=r.cartesianToCartographic(e,O);n.height=i,r.cartographicToCartesian(n,e);const a=r.cartesianToCartographic(o,O);a.height=i-100,r.cartographicToCartesian(a,o)}const V=new r.BoundingRectangle,D=new e.Cartesian3,H=new e.Cartesian3,F=new e.Cartesian3,N=new e.Cartesian3,R=new e.Cartesian3,M=new e.Cartesian3;let S=new e.Cartesian3,B=new e.Cartesian3,k=new e.Cartesian3;const z=new n.Cartesian2,W=new n.Cartesian2,Y=new e.Cartesian3,U=new i.Quaternion,j=new e.Matrix3,Q=new e.Matrix3;function q(o){const r=o.vertexFormat,s=o.geometry,l=o.shadowVolume,c=s.attributes.position.values,y=t.defined(s.attributes.st)?s.attributes.st.values:void 0;let d=c.length;const g=o.wall,h=o.top||g,f=o.bottom||g;if(r.st||r.normal||r.tangent||r.bitangent||l){const p=o.boundingRectangle,b=o.tangentPlane,_=o.ellipsoid,P=o.stRotation,C=o.perPositionHeight,x=z;x.x=p.x,x.y=p.y;const w=r.st?new Float32Array(d/3*2):void 0,T=new Float32Array(d/3);let A,I=0;r.normal&&(A=C&&h&&!g?s.attributes.normal.values:new Float32Array(d));const v=r.tangent?new Float32Array(d):void 0,E=r.bitangent?new Float32Array(d):void 0,G=l?new Float32Array(d):void 0;let O=0,V=0,q=H,K=F,Z=N,J=!0,X=j,$=Q;if(0!==P){let t=i.Quaternion.fromAxisAngle(b._plane.normal,P,U);X=e.Matrix3.fromQuaternion(t,X),t=i.Quaternion.fromAxisAngle(b._plane.normal,-P,U),$=e.Matrix3.fromQuaternion(t,$)}else X=e.Matrix3.clone(e.Matrix3.IDENTITY,X),$=e.Matrix3.clone(e.Matrix3.IDENTITY,$);let tt=0,et=0;h&&f&&(tt=d/2,et=d/3,d/=2);for(let i=0;i<d;i+=3){const a=e.Cartesian3.fromArray(c,i,Y);if(r.st&&!t.defined(y)){let t=e.Matrix3.multiplyByVector(X,a,D);t=_.scaleToGeodeticSurface(t,t);const o=b.projectPointOntoPlane(t,W);n.Cartesian2.subtract(o,x,o);const r=m.CesiumMath.clamp(o.x/p.width,0,1),i=m.CesiumMath.clamp(o.y/p.height,0,1);f&&(w[O+et]=r,w[O+1+et]=i),h&&(w[O]=r,w[O+1]=i);const s=e.Cartographic.fromCartesian(a);T[I++]=Math.floor(s.height+1e-5),O+=2}if(r.normal||r.tangent||r.bitangent||l){const t=V+1,n=V+2;if(g){if(i+3<d){const t=e.Cartesian3.fromArray(c,i+3,R);if(J){const o=e.Cartesian3.fromArray(c,i+d,M);C&&L(a,t,o,_),e.Cartesian3.subtract(t,a,t),e.Cartesian3.subtract(o,a,o),q=e.Cartesian3.normalize(e.Cartesian3.cross(o,t,q),q),J=!1}e.Cartesian3.equalsEpsilon(t,a,m.CesiumMath.EPSILON10)&&(J=!0)}(r.tangent||r.bitangent)&&(Z=_.geodeticSurfaceNormal(a,Z),r.tangent&&(K=e.Cartesian3.normalize(e.Cartesian3.cross(Z,q,K),K)))}else q=_.geodeticSurfaceNormal(a,q),(r.tangent||r.bitangent)&&(C&&(S=e.Cartesian3.fromArray(A,V,S),B=e.Cartesian3.cross(e.Cartesian3.UNIT_Z,S,B),B=e.Cartesian3.normalize(e.Matrix3.multiplyByVector($,B,B),B),r.bitangent&&(k=e.Cartesian3.normalize(e.Cartesian3.cross(S,B,k),k))),K=e.Cartesian3.cross(e.Cartesian3.UNIT_Z,q,K),K=e.Cartesian3.normalize(e.Matrix3.multiplyByVector($,K,K),K),r.bitangent&&(Z=e.Cartesian3.normalize(e.Cartesian3.cross(q,K,Z),Z)));r.normal&&(o.wall?(A[V+tt]=q.x,A[t+tt]=q.y,A[n+tt]=q.z):f&&(A[V+tt]=-q.x,A[t+tt]=-q.y,A[n+tt]=-q.z),(h&&!C||g)&&(A[V]=q.x,A[t]=q.y,A[n]=q.z)),l&&(g&&(q=_.geodeticSurfaceNormal(a,q)),G[V+tt]=-q.x,G[t+tt]=-q.y,G[n+tt]=-q.z),r.tangent&&(o.wall?(v[V+tt]=K.x,v[t+tt]=K.y,v[n+tt]=K.z):f&&(v[V+tt]=-K.x,v[t+tt]=-K.y,v[n+tt]=-K.z),h&&(C?(v[V]=B.x,v[t]=B.y,v[n]=B.z):(v[V]=K.x,v[t]=K.y,v[n]=K.z))),r.bitangent&&(f&&(E[V+tt]=Z.x,E[t+tt]=Z.y,E[n+tt]=Z.z),h&&(C?(E[V]=k.x,E[t]=k.y,E[n]=k.z):(E[V]=Z.x,E[t]=Z.y,E[n]=Z.z))),V+=3}}r.st&&!t.defined(y)&&(s.attributes.st=new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:w}),s.attributes.height=new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:1,values:T})),r.normal&&(s.attributes.normal=new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:A})),r.tangent&&(s.attributes.tangent=new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:v})),r.bitangent&&(s.attributes.bitangent=new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:E})),l&&(s.attributes.extrudeDirection=new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:G}))}if(o.extrude&&t.defined(o.offsetAttribute)){const t=c.length/3;let e=new Uint8Array(t);if(o.offsetAttribute===p.GeometryOffsetAttribute.TOP)h&&f||g?e=e.fill(1,0,t/2):h&&(e=e.fill(1));else{const t=o.offsetAttribute===p.GeometryOffsetAttribute.NONE?0:1;e=e.fill(t)}s.attributes.applyOffset=new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:e})}return s}const K=new e.Cartographic,Z=new e.Cartographic,J={westOverIDL:0,eastOverIDL:0};let X=new s.EllipsoidGeodesic;function $(e,r,i,a,l){if(l=t.defaultValue(l,new n.Rectangle),!t.defined(e)||e.length<3)return l.west=0,l.north=0,l.south=0,l.east=0,l;if(i===o.ArcType.RHUMB)return n.Rectangle.fromCartesianArray(e,r,l);X.ellipsoid.equals(r)||(X=new s.EllipsoidGeodesic(void 0,void 0,r)),l.west=Number.POSITIVE_INFINITY,l.east=Number.NEGATIVE_INFINITY,l.south=Number.POSITIVE_INFINITY,l.north=Number.NEGATIVE_INFINITY,J.westOverIDL=Number.POSITIVE_INFINITY,J.eastOverIDL=Number.NEGATIVE_INFINITY;const u=1/m.CesiumMath.chordLength(a,r.maximumRadius),c=e.length;let p,y=r.cartesianToCartographic(e[0],Z),d=K;for(let t=1;t<c;t++)p=d,d=y,y=r.cartesianToCartographic(e[t],p),X.setEndPoints(d,y),et(X,u,l,J);return p=d,d=y,y=r.cartesianToCartographic(e[0],p),X.setEndPoints(d,y),et(X,u,l,J),l.east-l.west>J.eastOverIDL-J.westOverIDL&&(l.west=J.westOverIDL,l.east=J.eastOverIDL,l.east>m.CesiumMath.PI&&(l.east=l.east-m.CesiumMath.TWO_PI),l.west>m.CesiumMath.PI&&(l.west=l.west-m.CesiumMath.TWO_PI)),l}const tt=new e.Cartographic;function et(t,e,o,r){const i=t.surfaceDistance,n=Math.ceil(i*e),a=n>0?i/(n-1):Number.POSITIVE_INFINITY;let s=0;for(let e=0;e<n;e++){const e=t.interpolateUsingSurfaceDistance(s,tt);s+=a;const i=e.longitude,n=e.latitude;o.west=Math.min(o.west,i),o.east=Math.max(o.east,i),o.south=Math.min(o.south,n),o.north=Math.max(o.north,n);const l=i>=0?i:i+m.CesiumMath.TWO_PI;r.westOverIDL=Math.min(r.westOverIDL,l),r.eastOverIDL=Math.max(r.eastOverIDL,l)}}const ot=[];function rt(e,o,r,i,n,a,s,u,p,y){const m={walls:[]};let f;if(s||u){const n=g.PolygonGeometryLibrary.createGeometryFromPositions(e,o,r,i,a,p,y),l=n.attributes.position.values,h=n.indices;let b,_;if(s&&u){const e=l.concat(l);b=e.length/3,_=d.IndexDatatype.createTypedArray(b,2*h.length),_.set(h);const o=h.length,i=b/2;for(f=0;f<o;f+=3){const t=_[f]+i,e=_[f+1]+i,r=_[f+2]+i;_[f+o]=r,_[f+1+o]=e,_[f+2+o]=t}if(n.attributes.position.values=e,a&&p.normal){const t=n.attributes.normal.values;n.attributes.normal.values=new Float32Array(e.length),n.attributes.normal.values.set(t)}if(p.st&&t.defined(r)){const t=n.attributes.st.values;n.attributes.st.values=new Float32Array(2*b),n.attributes.st.values=t.concat(t)}n.indices=_}else if(u){for(b=l.length/3,_=d.IndexDatatype.createTypedArray(b,h.length),f=0;f<h.length;f+=3)_[f]=h[f+2],_[f+1]=h[f+1],_[f+2]=h[f];n.indices=_}m.topAndBottom=new c.GeometryInstance({geometry:n})}let b=n.outerRing,_=l.EllipsoidTangentPlane.fromPoints(b,e),P=_.projectPointsOntoPlane(b,ot),C=h.PolygonPipeline.computeWindingOrder2D(P);C===h.WindingOrder.CLOCKWISE&&(b=b.slice().reverse());let x=g.PolygonGeometryLibrary.computeWallGeometry(b,r,e,i,a,y);m.walls.push(new c.GeometryInstance({geometry:x}));const w=n.holes;for(f=0;f<w.length;f++){let t=w[f];_=l.EllipsoidTangentPlane.fromPoints(t,e),P=_.projectPointsOntoPlane(t,ot),C=h.PolygonPipeline.computeWindingOrder2D(P),C===h.WindingOrder.COUNTER_CLOCKWISE&&(t=t.slice().reverse()),x=g.PolygonGeometryLibrary.computeWallGeometry(t,r,e,i,a,y),m.walls.push(new c.GeometryInstance({geometry:x}))}return m}function it(r){const i=r.polygonHierarchy,a=t.defaultValue(r.vertexFormat,f.VertexFormat.DEFAULT),s=t.defaultValue(r.ellipsoid,e.Ellipsoid.WGS84),l=t.defaultValue(r.granularity,m.CesiumMath.RADIANS_PER_DEGREE),u=t.defaultValue(r.stRotation,0),c=r.textureCoordinates,p=t.defaultValue(r.perPositionHeight,!1),y=p&&t.defined(r.extrudedHeight);let d=t.defaultValue(r.height,0),h=t.defaultValue(r.extrudedHeight,d);if(!y){const t=Math.max(d,h);h=Math.min(d,h),d=t}this._vertexFormat=f.VertexFormat.clone(a),this._ellipsoid=e.Ellipsoid.clone(s),this._granularity=l,this._stRotation=u,this._height=d,this._extrudedHeight=h,this._closeTop=t.defaultValue(r.closeTop,!0),this._closeBottom=t.defaultValue(r.closeBottom,!0),this._polygonHierarchy=i,this._perPositionHeight=p,this._perPositionHeightExtrude=y,this._shadowVolume=t.defaultValue(r.shadowVolume,!1),this._workerName="createPolygonGeometry",this._offsetAttribute=r.offsetAttribute,this._arcType=t.defaultValue(r.arcType,o.ArcType.GEODESIC),this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0,this._textureCoordinates=c,this.packedLength=g.PolygonGeometryLibrary.computeHierarchyPackedLength(i,e.Cartesian3)+e.Ellipsoid.packedLength+f.VertexFormat.packedLength+(c?g.PolygonGeometryLibrary.computeHierarchyPackedLength(c,n.Cartesian2):1)+12}it.fromPositions=function(e){return new it({polygonHierarchy:{positions:(e=t.defaultValue(e,t.defaultValue.EMPTY_OBJECT)).positions},height:e.height,extrudedHeight:e.extrudedHeight,vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid,granularity:e.granularity,perPositionHeight:e.perPositionHeight,closeTop:e.closeTop,closeBottom:e.closeBottom,offsetAttribute:e.offsetAttribute,arcType:e.arcType,textureCoordinates:e.textureCoordinates})},it.pack=function(o,r,i){return i=t.defaultValue(i,0),i=g.PolygonGeometryLibrary.packPolygonHierarchy(o._polygonHierarchy,r,i,e.Cartesian3),e.Ellipsoid.pack(o._ellipsoid,r,i),i+=e.Ellipsoid.packedLength,f.VertexFormat.pack(o._vertexFormat,r,i),i+=f.VertexFormat.packedLength,r[i++]=o._height,r[i++]=o._extrudedHeight,r[i++]=o._granularity,r[i++]=o._stRotation,r[i++]=o._perPositionHeightExtrude?1:0,r[i++]=o._perPositionHeight?1:0,r[i++]=o._closeTop?1:0,r[i++]=o._closeBottom?1:0,r[i++]=o._shadowVolume?1:0,r[i++]=t.defaultValue(o._offsetAttribute,-1),r[i++]=o._arcType,t.defined(o._textureCoordinates)?i=g.PolygonGeometryLibrary.packPolygonHierarchy(o._textureCoordinates,r,i,n.Cartesian2):r[i++]=-1,r[i++]=o.packedLength,r};const nt=e.Ellipsoid.clone(e.Ellipsoid.UNIT_SPHERE),at=new f.VertexFormat,st={polygonHierarchy:{}};return it.unpack=function(o,r,i){r=t.defaultValue(r,0);const a=g.PolygonGeometryLibrary.unpackPolygonHierarchy(o,r,e.Cartesian3);r=a.startingIndex,delete a.startingIndex;const s=e.Ellipsoid.unpack(o,r,nt);r+=e.Ellipsoid.packedLength;const l=f.VertexFormat.unpack(o,r,at);r+=f.VertexFormat.packedLength;const u=o[r++],c=o[r++],p=o[r++],y=o[r++],d=1===o[r++],m=1===o[r++],h=1===o[r++],b=1===o[r++],_=1===o[r++],P=o[r++],C=o[r++],x=-1===o[r]?void 0:g.PolygonGeometryLibrary.unpackPolygonHierarchy(o,r,n.Cartesian2);t.defined(x)?(r=x.startingIndex,delete x.startingIndex):r++;const w=o[r++];return t.defined(i)||(i=new it(st)),i._polygonHierarchy=a,i._ellipsoid=e.Ellipsoid.clone(s,i._ellipsoid),i._vertexFormat=f.VertexFormat.clone(l,i._vertexFormat),i._height=u,i._extrudedHeight=c,i._granularity=p,i._stRotation=y,i._perPositionHeightExtrude=d,i._perPositionHeight=m,i._closeTop=h,i._closeBottom=b,i._shadowVolume=_,i._offsetAttribute=-1===P?void 0:P,i._arcType=C,i._textureCoordinates=x,i.packedLength=w,i},it.computeRectangle=function(r,i){const n=t.defaultValue(r.granularity,m.CesiumMath.RADIANS_PER_DEGREE),a=t.defaultValue(r.arcType,o.ArcType.GEODESIC),s=r.polygonHierarchy,l=t.defaultValue(r.ellipsoid,e.Ellipsoid.WGS84);return $(s.positions,l,a,n,i)},it.createGeometry=function(e){const o=e._vertexFormat,r=e._ellipsoid,n=e._granularity,s=e._stRotation,f=e._polygonHierarchy,b=e._perPositionHeight,_=e._closeTop,P=e._closeBottom,C=e._arcType,x=e._textureCoordinates,w=t.defined(x);let T=f.positions;if(T.length<3)return;const A=l.EllipsoidTangentPlane.fromPoints(T,r),I=g.PolygonGeometryLibrary.polygonsFromHierarchy(f,w,A.projectPointsOntoPlane.bind(A),!b,r),v=I.hierarchy,E=I.polygons,G=w?g.PolygonGeometryLibrary.polygonsFromHierarchy(x,!0,(function(t){return t}),!1).polygons:void 0;if(0===v.length)return;T=v[0].outerRing;const O=g.PolygonGeometryLibrary.computeBoundingRectangle(A.plane.normal,A.projectPointOntoPlane.bind(A),T,s,V),L=[],D=e._height,H=e._extrudedHeight,F={perPositionHeight:b,vertexFormat:o,geometry:void 0,tangentPlane:A,boundingRectangle:O,ellipsoid:r,stRotation:s,textureCoordinates:void 0,bottom:!1,top:!0,wall:!1,extrude:!1,arcType:C};let N;if(e._perPositionHeightExtrude||!m.CesiumMath.equalsEpsilon(D,H,0,m.CesiumMath.EPSILON2))for(F.extrude=!0,F.top=_,F.bottom=P,F.shadowVolume=e._shadowVolume,F.offsetAttribute=e._offsetAttribute,N=0;N<E.length;N++){const t=rt(r,E[N],w?G[N]:void 0,n,v[N],b,_,P,o,C);let e;_&&P?(e=t.topAndBottom,F.geometry=g.PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(e.geometry,D,H,r,b)):_?(e=t.topAndBottom,e.geometry.attributes.position.values=h.PolygonPipeline.scaleToGeodeticHeight(e.geometry.attributes.position.values,D,r,!b),F.geometry=e.geometry):P&&(e=t.topAndBottom,e.geometry.attributes.position.values=h.PolygonPipeline.scaleToGeodeticHeight(e.geometry.attributes.position.values,H,r,!0),F.geometry=e.geometry),(_||P)&&(F.wall=!1,e.geometry=q(F),L.push(e));const i=t.walls;F.wall=!0;for(let t=0;t<i.length;t++){const e=i[t];F.geometry=g.PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(e.geometry,D,H,r,b),e.geometry=q(F),L.push(e)}}else for(N=0;N<E.length;N++){const i=new c.GeometryInstance({geometry:g.PolygonGeometryLibrary.createGeometryFromPositions(r,E[N],w?G[N]:void 0,n,b,o,C)});if(i.geometry.attributes.position.values=h.PolygonPipeline.scaleToGeodeticHeight(i.geometry.attributes.position.values,D,r,!b),F.geometry=i.geometry,i.geometry=q(F),t.defined(e._offsetAttribute)){const t=i.geometry.attributes.position.values.length,o=e._offsetAttribute===p.GeometryOffsetAttribute.NONE?0:1,r=new Uint8Array(t/3).fill(o);i.geometry.attributes.applyOffset=new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:r})}L.push(i)}const R=y.GeometryPipeline.combineInstances(L)[0];R.attributes.position.values=new Float64Array(R.attributes.position.values),R.indices=d.IndexDatatype.createTypedArray(R.attributes.position.values.length/3,R.indices);const M=R.attributes,S=i.BoundingSphere.fromVertices(M.position.values);return o.position||delete M.position,new u.Geometry({attributes:M,indices:R.indices,primitiveType:R.primitiveType,boundingSphere:S,offsetAttribute:e._offsetAttribute})},it.createShadowVolume=function(t,e,o){const r=t._granularity,i=t._ellipsoid,n=e(r,i),a=o(r,i);return new it({polygonHierarchy:t._polygonHierarchy,ellipsoid:i,stRotation:t._stRotation,granularity:r,perPositionHeight:!1,extrudedHeight:n,height:a,vertexFormat:f.VertexFormat.POSITION_ONLY,shadowVolume:!0,arcType:t._arcType})},Object.defineProperties(it.prototype,{rectangle:{get:function(){if(!t.defined(this._rectangle)){const t=this._polygonHierarchy.positions;this._rectangle=$(t,this._ellipsoid,this._arcType,this._granularity)}return this._rectangle}},textureCoordinateRotationPoints:{get:function(){return t.defined(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=function(t){const e=-t._stRotation;if(0===e)return[0,0,0,1,1,0];const o=t._ellipsoid,r=t._polygonHierarchy.positions,i=t.rectangle;return u.Geometry._textureCoordinateRotationPoints(r,e,o,i)}(this)),this._textureCoordinateRotationPoints}}}),function(o,r){return t.defined(r)&&(o=it.unpack(o,r)),o._ellipsoid=e.Ellipsoid.clone(o._ellipsoid),it.createGeometry(o)}})); |