qa-prevention-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/PolygonOutlineGeometry-29f6...

2 lines
7.0 KiB
JavaScript

define(["exports","./ArcType-fc72c06c","./GeometryOffsetAttribute-ed56ff58","./BoundingSphere-9a3b5656","./Check-741c5f3c","./ComponentDatatype-aaeec80f","./defaultValue-81eec7ed","./Cartesian2-bd414876","./EllipsoidTangentPlane-4d138901","./GeometryAttribute-2b42a913","./GeometryAttributes-32b29525","./GeometryInstance-1b39c9e8","./GeometryPipeline-e7083fea","./IndexDatatype-3f3c99e8","./Math-e73894ab","./PolygonGeometryLibrary-231711c2","./PolygonPipeline-04baeb41"],(function(e,t,i,o,r,n,a,l,s,y,u,p,c,d,g,f,h){"use strict";const m=[],b=[];function P(e,i,o,r,a){const l=s.EllipsoidTangentPlane.fromPoints(i,e).projectPointsOntoPlane(i,m);let c,g;h.PolygonPipeline.computeWindingOrder2D(l)===h.WindingOrder.CLOCKWISE&&(l.reverse(),i=i.slice().reverse());let P=i.length,A=0;if(r)for(c=new Float64Array(2*P*3),g=0;g<P;g++){const e=i[g],t=i[(g+1)%P];c[A++]=e.x,c[A++]=e.y,c[A++]=e.z,c[A++]=t.x,c[A++]=t.y,c[A++]=t.z}else{let r=0;if(a===t.ArcType.GEODESIC)for(g=0;g<P;g++)r+=f.PolygonGeometryLibrary.subdivideLineCount(i[g],i[(g+1)%P],o);else if(a===t.ArcType.RHUMB)for(g=0;g<P;g++)r+=f.PolygonGeometryLibrary.subdivideRhumbLineCount(e,i[g],i[(g+1)%P],o);for(c=new Float64Array(3*r),g=0;g<P;g++){let r;a===t.ArcType.GEODESIC?r=f.PolygonGeometryLibrary.subdivideLine(i[g],i[(g+1)%P],o,b):a===t.ArcType.RHUMB&&(r=f.PolygonGeometryLibrary.subdivideRhumbLine(e,i[g],i[(g+1)%P],o,b));const n=r.length;for(let e=0;e<n;++e)c[A++]=r[e]}}P=c.length/3;const E=2*P,_=d.IndexDatatype.createTypedArray(P,E);for(A=0,g=0;g<P-1;g++)_[A++]=g,_[A++]=g+1;return _[A++]=P-1,_[A++]=0,new p.GeometryInstance({geometry:new y.Geometry({attributes:new u.GeometryAttributes({position:new y.GeometryAttribute({componentDatatype:n.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:c})}),indices:_,primitiveType:y.PrimitiveType.LINES})})}function A(e,i,o,r,a){const l=s.EllipsoidTangentPlane.fromPoints(i,e).projectPointsOntoPlane(i,m);let c,g;h.PolygonPipeline.computeWindingOrder2D(l)===h.WindingOrder.CLOCKWISE&&(l.reverse(),i=i.slice().reverse());let P=i.length;const A=new Array(P);let E=0;if(r)for(c=new Float64Array(2*P*3*2),g=0;g<P;++g){A[g]=E/3;const e=i[g],t=i[(g+1)%P];c[E++]=e.x,c[E++]=e.y,c[E++]=e.z,c[E++]=t.x,c[E++]=t.y,c[E++]=t.z}else{let r=0;if(a===t.ArcType.GEODESIC)for(g=0;g<P;g++)r+=f.PolygonGeometryLibrary.subdivideLineCount(i[g],i[(g+1)%P],o);else if(a===t.ArcType.RHUMB)for(g=0;g<P;g++)r+=f.PolygonGeometryLibrary.subdivideRhumbLineCount(e,i[g],i[(g+1)%P],o);for(c=new Float64Array(3*r*2),g=0;g<P;++g){let r;A[g]=E/3,a===t.ArcType.GEODESIC?r=f.PolygonGeometryLibrary.subdivideLine(i[g],i[(g+1)%P],o,b):a===t.ArcType.RHUMB&&(r=f.PolygonGeometryLibrary.subdivideRhumbLine(e,i[g],i[(g+1)%P],o,b));const n=r.length;for(let e=0;e<n;++e)c[E++]=r[e]}}P=c.length/6;const _=A.length,G=2*(2*P+_),H=d.IndexDatatype.createTypedArray(P+_,G);for(E=0,g=0;g<P;++g)H[E++]=g,H[E++]=(g+1)%P,H[E++]=g+P,H[E++]=(g+1)%P+P;for(g=0;g<_;g++){const e=A[g];H[E++]=e,H[E++]=e+P}return new p.GeometryInstance({geometry:new y.Geometry({attributes:new u.GeometryAttributes({position:new y.GeometryAttribute({componentDatatype:n.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:c})}),indices:H,primitiveType:y.PrimitiveType.LINES})})}function E(e){const i=e.polygonHierarchy,o=a.defaultValue(e.ellipsoid,l.Ellipsoid.WGS84),r=a.defaultValue(e.granularity,g.CesiumMath.RADIANS_PER_DEGREE),n=a.defaultValue(e.perPositionHeight,!1),s=n&&a.defined(e.extrudedHeight),y=a.defaultValue(e.arcType,t.ArcType.GEODESIC);let u=a.defaultValue(e.height,0),p=a.defaultValue(e.extrudedHeight,u);if(!s){const e=Math.max(u,p);p=Math.min(u,p),u=e}this._ellipsoid=l.Ellipsoid.clone(o),this._granularity=r,this._height=u,this._extrudedHeight=p,this._arcType=y,this._polygonHierarchy=i,this._perPositionHeight=n,this._perPositionHeightExtrude=s,this._offsetAttribute=e.offsetAttribute,this._workerName="createPolygonOutlineGeometry",this.packedLength=f.PolygonGeometryLibrary.computeHierarchyPackedLength(i)+l.Ellipsoid.packedLength+8}E.pack=function(e,t,i){return i=a.defaultValue(i,0),i=f.PolygonGeometryLibrary.packPolygonHierarchy(e._polygonHierarchy,t,i),l.Ellipsoid.pack(e._ellipsoid,t,i),i+=l.Ellipsoid.packedLength,t[i++]=e._height,t[i++]=e._extrudedHeight,t[i++]=e._granularity,t[i++]=e._perPositionHeightExtrude?1:0,t[i++]=e._perPositionHeight?1:0,t[i++]=e._arcType,t[i++]=a.defaultValue(e._offsetAttribute,-1),t[i]=e.packedLength,t};const _=l.Ellipsoid.clone(l.Ellipsoid.UNIT_SPHERE),G={polygonHierarchy:{}};E.unpack=function(e,t,i){t=a.defaultValue(t,0);const o=f.PolygonGeometryLibrary.unpackPolygonHierarchy(e,t);t=o.startingIndex,delete o.startingIndex;const r=l.Ellipsoid.unpack(e,t,_);t+=l.Ellipsoid.packedLength;const n=e[t++],s=e[t++],y=e[t++],u=1===e[t++],p=1===e[t++],c=e[t++],d=e[t++],g=e[t];return a.defined(i)||(i=new E(G)),i._polygonHierarchy=o,i._ellipsoid=l.Ellipsoid.clone(r,i._ellipsoid),i._height=n,i._extrudedHeight=s,i._granularity=y,i._perPositionHeight=p,i._perPositionHeightExtrude=u,i._arcType=c,i._offsetAttribute=-1===d?void 0:d,i.packedLength=g,i},E.fromPositions=function(e){return new E({polygonHierarchy:{positions:(e=a.defaultValue(e,a.defaultValue.EMPTY_OBJECT)).positions},height:e.height,extrudedHeight:e.extrudedHeight,ellipsoid:e.ellipsoid,granularity:e.granularity,perPositionHeight:e.perPositionHeight,arcType:e.arcType,offsetAttribute:e.offsetAttribute})},E.createGeometry=function(e){const t=e._ellipsoid,r=e._granularity,l=e._polygonHierarchy,s=e._perPositionHeight,u=e._arcType,p=f.PolygonGeometryLibrary.polygonOutlinesFromHierarchy(l,!s,t);if(0===p.length)return;let d;const m=[],b=g.CesiumMath.chordLength(r,t.maximumRadius),E=e._height,_=e._extrudedHeight;let G,H;if(e._perPositionHeightExtrude||!g.CesiumMath.equalsEpsilon(E,_,0,g.CesiumMath.EPSILON2))for(H=0;H<p.length;H++){if(d=A(t,p[H],b,s,u),d.geometry=f.PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(d.geometry,E,_,t,s),a.defined(e._offsetAttribute)){const t=d.geometry.attributes.position.values.length/3;let o=new Uint8Array(t);e._offsetAttribute===i.GeometryOffsetAttribute.TOP?o=i.arrayFill(o,1,0,t/2):(G=e._offsetAttribute===i.GeometryOffsetAttribute.NONE?0:1,o=i.arrayFill(o,G)),d.geometry.attributes.applyOffset=new y.GeometryAttribute({componentDatatype:n.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:o})}m.push(d)}else for(H=0;H<p.length;H++){if(d=P(t,p[H],b,s,u),d.geometry.attributes.position.values=h.PolygonPipeline.scaleToGeodeticHeight(d.geometry.attributes.position.values,E,t,!s),a.defined(e._offsetAttribute)){const t=d.geometry.attributes.position.values.length,o=new Uint8Array(t/3);G=e._offsetAttribute===i.GeometryOffsetAttribute.NONE?0:1,i.arrayFill(o,G),d.geometry.attributes.applyOffset=new y.GeometryAttribute({componentDatatype:n.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:o})}m.push(d)}const L=c.GeometryPipeline.combineInstances(m)[0],T=o.BoundingSphere.fromVertices(L.attributes.position.values);return new y.Geometry({attributes:L.attributes,indices:L.indices,primitiveType:L.primitiveType,boundingSphere:T,offsetAttribute:e._offsetAttribute})},e.PolygonOutlineGeometry=E}));