| | |
| | | define(["./defaultValue-865ac579","./Matrix3-6e56fbc7","./ArcType-68098157","./BoundingRectangle-f7002576","./Transforms-f3654378","./Matrix2-23dd5853","./ComponentDatatype-985dcc38","./EllipsoidGeodesic-3e762525","./EllipsoidTangentPlane-2129690e","./GeometryAttribute-e3f63a02","./GeometryInstance-54a3e3b6","./GeometryOffsetAttribute-06264989","./GeometryPipeline-3f4d7db4","./IndexDatatype-16f6b4a1","./Math-76ce6367","./PolygonGeometryLibrary-e0e45e51","./PolygonPipeline-47fb81c6","./VertexFormat-20b5279f","./combine-5e110d09","./RuntimeError-9e0724f9","./WebGLConstants-258cf3a0","./AxisAlignedBoundingBox-d1a0c6e6","./IntersectionTests-63574cfd","./Plane-4befcca0","./AttributeCompression-b9d605fe","./EncodedCartesian3-2008251f","./arrayRemoveDuplicates-398390b2","./EllipsoidRhumbLine-b175af48","./GeometryAttributes-75794475"],(function(e,t,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 t.Cartographic,O=new t.Cartographic;function L(e,t,o,r){const i=r.cartesianToCartographic(e,G).height,n=r.cartesianToCartographic(t,O);n.height=i,r.cartographicToCartesian(n,t);const a=r.cartesianToCartographic(o,O);a.height=i-100,r.cartographicToCartesian(a,o)}const V=new r.BoundingRectangle,D=new t.Cartesian3,H=new t.Cartesian3,F=new t.Cartesian3,N=new t.Cartesian3,R=new t.Cartesian3,M=new t.Cartesian3;let S=new t.Cartesian3,B=new t.Cartesian3,k=new t.Cartesian3;const z=new n.Cartesian2,W=new n.Cartesian2,Y=new t.Cartesian3,U=new i.Quaternion,j=new t.Matrix3,Q=new t.Matrix3;function q(o){const r=o.vertexFormat,s=o.geometry,l=o.shadowVolume,c=s.attributes.position.values,y=e.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 e=i.Quaternion.fromAxisAngle(b._plane.normal,P,U);X=t.Matrix3.fromQuaternion(e,X),e=i.Quaternion.fromAxisAngle(b._plane.normal,-P,U),$=t.Matrix3.fromQuaternion(e,$)}else X=t.Matrix3.clone(t.Matrix3.IDENTITY,X),$=t.Matrix3.clone(t.Matrix3.IDENTITY,$);let ee=0,te=0;h&&f&&(ee=d/2,te=d/3,d/=2);for(let i=0;i<d;i+=3){const a=t.Cartesian3.fromArray(c,i,Y);if(r.st&&!e.defined(y)){let e=t.Matrix3.multiplyByVector(X,a,D);e=_.scaleToGeodeticSurface(e,e);const o=b.projectPointOntoPlane(e,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+te]=r,w[O+1+te]=i),h&&(w[O]=r,w[O+1]=i);const s=t.Cartographic.fromCartesian(a);T[I++]=Math.floor(s.height+1e-5),O+=2}if(r.normal||r.tangent||r.bitangent||l){const e=V+1,n=V+2;if(g){if(i+3<d){const e=t.Cartesian3.fromArray(c,i+3,R);if(J){const o=t.Cartesian3.fromArray(c,i+d,M);C&&L(a,e,o,_),t.Cartesian3.subtract(e,a,e),t.Cartesian3.subtract(o,a,o),q=t.Cartesian3.normalize(t.Cartesian3.cross(o,e,q),q),J=!1}t.Cartesian3.equalsEpsilon(e,a,m.CesiumMath.EPSILON10)&&(J=!0)}(r.tangent||r.bitangent)&&(Z=_.geodeticSurfaceNormal(a,Z),r.tangent&&(K=t.Cartesian3.normalize(t.Cartesian3.cross(Z,q,K),K)))}else q=_.geodeticSurfaceNormal(a,q),(r.tangent||r.bitangent)&&(C&&(S=t.Cartesian3.fromArray(A,V,S),B=t.Cartesian3.cross(t.Cartesian3.UNIT_Z,S,B),B=t.Cartesian3.normalize(t.Matrix3.multiplyByVector($,B,B),B),r.bitangent&&(k=t.Cartesian3.normalize(t.Cartesian3.cross(S,B,k),k))),K=t.Cartesian3.cross(t.Cartesian3.UNIT_Z,q,K),K=t.Cartesian3.normalize(t.Matrix3.multiplyByVector($,K,K),K),r.bitangent&&(Z=t.Cartesian3.normalize(t.Cartesian3.cross(q,K,Z),Z)));r.normal&&(o.wall?(A[V+ee]=q.x,A[e+ee]=q.y,A[n+ee]=q.z):f&&(A[V+ee]=-q.x,A[e+ee]=-q.y,A[n+ee]=-q.z),(h&&!C||g)&&(A[V]=q.x,A[e]=q.y,A[n]=q.z)),l&&(g&&(q=_.geodeticSurfaceNormal(a,q)),G[V+ee]=-q.x,G[e+ee]=-q.y,G[n+ee]=-q.z),r.tangent&&(o.wall?(v[V+ee]=K.x,v[e+ee]=K.y,v[n+ee]=K.z):f&&(v[V+ee]=-K.x,v[e+ee]=-K.y,v[n+ee]=-K.z),h&&(C?(v[V]=B.x,v[e]=B.y,v[n]=B.z):(v[V]=K.x,v[e]=K.y,v[n]=K.z))),r.bitangent&&(f&&(E[V+ee]=Z.x,E[e+ee]=Z.y,E[n+ee]=Z.z),h&&(C?(E[V]=k.x,E[e]=k.y,E[n]=k.z):(E[V]=Z.x,E[e]=Z.y,E[n]=Z.z))),V+=3}}r.st&&!e.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&&e.defined(o.offsetAttribute)){const e=c.length/3;let t=new Uint8Array(e);if(o.offsetAttribute===p.GeometryOffsetAttribute.TOP)h&&f||g?t=t.fill(1,0,e/2):h&&(t=t.fill(1));else{const e=o.offsetAttribute===p.GeometryOffsetAttribute.NONE?0:1;t=t.fill(e)}s.attributes.applyOffset=new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:t})}return s}const K=new t.Cartographic,Z=new t.Cartographic,J={westOverIDL:0,eastOverIDL:0};let X=new s.EllipsoidGeodesic;function $(t,r,i,a,l){if(l=e.defaultValue(l,new n.Rectangle),!e.defined(t)||t.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(t,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=t.length;let p,y=r.cartesianToCartographic(t[0],Z),d=K;for(let e=1;e<c;e++)p=d,d=y,y=r.cartesianToCartographic(t[e],p),X.setEndPoints(d,y),te(X,u,l,J);return p=d,d=y,y=r.cartesianToCartographic(t[0],p),X.setEndPoints(d,y),te(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 ee=new t.Cartographic;function te(e,t,o,r){const i=e.surfaceDistance,n=Math.ceil(i*t),a=n>0?i/(n-1):Number.POSITIVE_INFINITY;let s=0;for(let t=0;t<n;t++){const t=e.interpolateUsingSurfaceDistance(s,ee);s+=a;const i=t.longitude,n=t.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 oe=[];function re(t,o,r,i,n,a,s,u,p,y){const m={walls:[]};let f;if(s||u){const n=g.PolygonGeometryLibrary.createGeometryFromPositions(t,o,r,i,a,p,y),l=n.attributes.position.values,h=n.indices;let b,_;if(s&&u){const t=l.concat(l);b=t.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 e=_[f]+i,t=_[f+1]+i,r=_[f+2]+i;_[f+o]=r,_[f+1+o]=t,_[f+2+o]=e}if(n.attributes.position.values=t,a&&p.normal){const e=n.attributes.normal.values;n.attributes.normal.values=new Float32Array(t.length),n.attributes.normal.values.set(e)}if(p.st&&e.defined(r)){const e=n.attributes.st.values;n.attributes.st.values=new Float32Array(2*b),n.attributes.st.values=e.concat(e)}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,t),P=_.projectPointsOntoPlane(b,oe),C=h.PolygonPipeline.computeWindingOrder2D(P);C===h.WindingOrder.CLOCKWISE&&(b=b.slice().reverse());let x=g.PolygonGeometryLibrary.computeWallGeometry(b,r,t,i,a,y);m.walls.push(new c.GeometryInstance({geometry:x}));const w=n.holes;for(f=0;f<w.length;f++){let e=w[f];_=l.EllipsoidTangentPlane.fromPoints(e,t),P=_.projectPointsOntoPlane(e,oe),C=h.PolygonPipeline.computeWindingOrder2D(P),C===h.WindingOrder.COUNTER_CLOCKWISE&&(e=e.slice().reverse()),x=g.PolygonGeometryLibrary.computeWallGeometry(e,r,t,i,a,y),m.walls.push(new c.GeometryInstance({geometry:x}))}return m}function ie(r){const i=r.polygonHierarchy,a=e.defaultValue(r.vertexFormat,f.VertexFormat.DEFAULT),s=e.defaultValue(r.ellipsoid,t.Ellipsoid.WGS84),l=e.defaultValue(r.granularity,m.CesiumMath.RADIANS_PER_DEGREE),u=e.defaultValue(r.stRotation,0),c=r.textureCoordinates,p=e.defaultValue(r.perPositionHeight,!1),y=p&&e.defined(r.extrudedHeight);let d=e.defaultValue(r.height,0),h=e.defaultValue(r.extrudedHeight,d);if(!y){const e=Math.max(d,h);h=Math.min(d,h),d=e}this._vertexFormat=f.VertexFormat.clone(a),this._ellipsoid=t.Ellipsoid.clone(s),this._granularity=l,this._stRotation=u,this._height=d,this._extrudedHeight=h,this._closeTop=e.defaultValue(r.closeTop,!0),this._closeBottom=e.defaultValue(r.closeBottom,!0),this._polygonHierarchy=i,this._perPositionHeight=p,this._perPositionHeightExtrude=y,this._shadowVolume=e.defaultValue(r.shadowVolume,!1),this._workerName="createPolygonGeometry",this._offsetAttribute=r.offsetAttribute,this._arcType=e.defaultValue(r.arcType,o.ArcType.GEODESIC),this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0,this._textureCoordinates=c,this.packedLength=g.PolygonGeometryLibrary.computeHierarchyPackedLength(i,t.Cartesian3)+t.Ellipsoid.packedLength+f.VertexFormat.packedLength+(c?g.PolygonGeometryLibrary.computeHierarchyPackedLength(c,n.Cartesian2):1)+12}ie.fromPositions=function(t){return new ie({polygonHierarchy:{positions:(t=e.defaultValue(t,e.defaultValue.EMPTY_OBJECT)).positions},height:t.height,extrudedHeight:t.extrudedHeight,vertexFormat:t.vertexFormat,stRotation:t.stRotation,ellipsoid:t.ellipsoid,granularity:t.granularity,perPositionHeight:t.perPositionHeight,closeTop:t.closeTop,closeBottom:t.closeBottom,offsetAttribute:t.offsetAttribute,arcType:t.arcType,textureCoordinates:t.textureCoordinates})},ie.pack=function(o,r,i){return i=e.defaultValue(i,0),i=g.PolygonGeometryLibrary.packPolygonHierarchy(o._polygonHierarchy,r,i,t.Cartesian3),t.Ellipsoid.pack(o._ellipsoid,r,i),i+=t.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++]=e.defaultValue(o._offsetAttribute,-1),r[i++]=o._arcType,e.defined(o._textureCoordinates)?i=g.PolygonGeometryLibrary.packPolygonHierarchy(o._textureCoordinates,r,i,n.Cartesian2):r[i++]=-1,r[i++]=o.packedLength,r};const ne=t.Ellipsoid.clone(t.Ellipsoid.UNIT_SPHERE),ae=new f.VertexFormat,se={polygonHierarchy:{}};return ie.unpack=function(o,r,i){r=e.defaultValue(r,0);const a=g.PolygonGeometryLibrary.unpackPolygonHierarchy(o,r,t.Cartesian3);r=a.startingIndex,delete a.startingIndex;const s=t.Ellipsoid.unpack(o,r,ne);r+=t.Ellipsoid.packedLength;const l=f.VertexFormat.unpack(o,r,ae);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);e.defined(x)?(r=x.startingIndex,delete x.startingIndex):r++;const w=o[r++];return e.defined(i)||(i=new ie(se)),i._polygonHierarchy=a,i._ellipsoid=t.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},ie.computeRectangle=function(r,i){const n=e.defaultValue(r.granularity,m.CesiumMath.RADIANS_PER_DEGREE),a=e.defaultValue(r.arcType,o.ArcType.GEODESIC),s=r.polygonHierarchy,l=e.defaultValue(r.ellipsoid,t.Ellipsoid.WGS84);return $(s.positions,l,a,n,i)},ie.createGeometry=function(t){const o=t._vertexFormat,r=t._ellipsoid,n=t._granularity,s=t._stRotation,f=t._polygonHierarchy,b=t._perPositionHeight,_=t._closeTop,P=t._closeBottom,C=t._arcType,x=t._textureCoordinates,w=e.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(e){return e}),!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=t._height,H=t._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(t._perPositionHeightExtrude||!m.CesiumMath.equalsEpsilon(D,H,0,m.CesiumMath.EPSILON2))for(F.extrude=!0,F.top=_,F.bottom=P,F.shadowVolume=t._shadowVolume,F.offsetAttribute=t._offsetAttribute,N=0;N<E.length;N++){const e=re(r,E[N],w?G[N]:void 0,n,v[N],b,_,P,o,C);let t;_&&P?(t=e.topAndBottom,F.geometry=g.PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(t.geometry,D,H,r,b)):_?(t=e.topAndBottom,t.geometry.attributes.position.values=h.PolygonPipeline.scaleToGeodeticHeight(t.geometry.attributes.position.values,D,r,!b),F.geometry=t.geometry):P&&(t=e.topAndBottom,t.geometry.attributes.position.values=h.PolygonPipeline.scaleToGeodeticHeight(t.geometry.attributes.position.values,H,r,!0),F.geometry=t.geometry),(_||P)&&(F.wall=!1,t.geometry=q(F),L.push(t));const i=e.walls;F.wall=!0;for(let e=0;e<i.length;e++){const t=i[e];F.geometry=g.PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(t.geometry,D,H,r,b),t.geometry=q(F),L.push(t)}}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),e.defined(t._offsetAttribute)){const e=i.geometry.attributes.position.values.length,o=t._offsetAttribute===p.GeometryOffsetAttribute.NONE?0:1,r=new Uint8Array(e/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:t._offsetAttribute})},ie.createShadowVolume=function(e,t,o){const r=e._granularity,i=e._ellipsoid,n=t(r,i),a=o(r,i);return new ie({polygonHierarchy:e._polygonHierarchy,ellipsoid:i,stRotation:e._stRotation,granularity:r,perPositionHeight:!1,extrudedHeight:n,height:a,vertexFormat:f.VertexFormat.POSITION_ONLY,shadowVolume:!0,arcType:e._arcType})},Object.defineProperties(ie.prototype,{rectangle:{get:function(){if(!e.defined(this._rectangle)){const e=this._polygonHierarchy.positions;this._rectangle=$(e,this._ellipsoid,this._arcType,this._granularity)}return this._rectangle}},textureCoordinateRotationPoints:{get:function(){return e.defined(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=function(e){const t=-e._stRotation;if(0===t)return[0,0,0,1,1,0];const o=e._ellipsoid,r=e._polygonHierarchy.positions,i=e.rectangle;return u.Geometry._textureCoordinateRotationPoints(r,t,o,i)}(this)),this._textureCoordinateRotationPoints}}}),function(o,r){return e.defined(r)&&(o=ie.unpack(o,r)),o._ellipsoid=t.Ellipsoid.clone(o._ellipsoid),ie.createGeometry(o)}})); |
| | | define(["./defaultValue-865ac579","./Matrix3-aeb3c326","./ArcType-68098157","./BoundingRectangle-272c38cc","./Transforms-221c7c82","./Matrix2-2fdcdec7","./ComponentDatatype-985dcc38","./EllipsoidGeodesic-ec5fd429","./EllipsoidTangentPlane-a9681249","./GeometryAttribute-642addba","./GeometryInstance-8d112c0c","./GeometryOffsetAttribute-06264989","./GeometryPipeline-a349886f","./IndexDatatype-16f6b4a1","./Math-76ce6367","./PolygonGeometryLibrary-9908e46b","./PolygonPipeline-8efb7487","./VertexFormat-20b5279f","./combine-5e110d09","./RuntimeError-9e0724f9","./WebGLConstants-258cf3a0","./AxisAlignedBoundingBox-73c388a7","./IntersectionTests-7b064f18","./Plane-fbab0ca2","./AttributeCompression-10297289","./EncodedCartesian3-e8922703","./arrayRemoveDuplicates-398390b2","./EllipsoidRhumbLine-2cf9c5ef","./GeometryAttributes-75794475"],(function(t,e,o,r,i,n,a,s,l,c,u,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,u=s.attributes.position.values,y=t.defined(s.attributes.st)?s.attributes.st.values:void 0;let d=u.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(u,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(u,i+3,R);if(J){const o=e.Cartesian3.fromArray(u,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 c.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:w}),s.attributes.height=new c.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:1,values:T})),r.normal&&(s.attributes.normal=new c.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:A})),r.tangent&&(s.attributes.tangent=new c.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:v})),r.bitangent&&(s.attributes.bitangent=new c.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:E})),l&&(s.attributes.extrudeDirection=new c.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:G}))}if(o.extrude&&t.defined(o.offsetAttribute)){const t=u.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 c.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 c=1/m.CesiumMath.chordLength(a,r.maximumRadius),u=e.length;let p,y=r.cartesianToCartographic(e[0],Z),d=K;for(let t=1;t<u;t++)p=d,d=y,y=r.cartesianToCartographic(e[t],p),X.setEndPoints(d,y),et(X,c,l,J);return p=d,d=y,y=r.cartesianToCartographic(e[0],p),X.setEndPoints(d,y),et(X,c,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,c,p,y){const m={walls:[]};let f;if(s||c){const n=g.PolygonGeometryLibrary.createGeometryFromPositions(e,o,r,i,a,p,y),l=n.attributes.position.values,h=n.indices;let b,_;if(s&&c){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(c){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 u.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 u.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 u.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),c=t.defaultValue(r.stRotation,0),u=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=c,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=u,this.packedLength=g.PolygonGeometryLibrary.computeHierarchyPackedLength(i,e.Cartesian3)+e.Ellipsoid.packedLength+f.VertexFormat.packedLength+(u?g.PolygonGeometryLibrary.computeHierarchyPackedLength(u,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 c=o[r++],u=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=c,i._extrudedHeight=u,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 u.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 c.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 c.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 c.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)}})); |