qd-changjing/public/static/Build/Cesium/Workers/createCoplanarPolygonOutlin...

2 lines
2.7 KiB
JavaScript

define(["./arrayRemoveDuplicates-80a91d16","./Transforms-f15de320","./Matrix2-c6c16658","./RuntimeError-5b082e8f","./ComponentDatatype-3d0a0aac","./CoplanarPolygonGeometryLibrary-0078be3d","./when-4bbc8319","./GeometryAttribute-8350368e","./GeometryAttributes-7827a6c2","./GeometryInstance-0b07c761","./GeometryPipeline-0fb7cb2c","./IndexDatatype-ddbc25a7","./PolygonGeometryLibrary-a02d6b0b","./combine-e9466e32","./WebGLConstants-508b9636","./OrientedBoundingBox-f3d80bd4","./EllipsoidTangentPlane-41514392","./AxisAlignedBoundingBox-a572809f","./IntersectionTests-a4e54d9a","./Plane-26e67b94","./AttributeCompression-f7a901f9","./EncodedCartesian3-b1495e46","./ArcType-fc72c06c","./EllipsoidRhumbLine-c6741351","./PolygonPipeline-ff4d4077"],(function(e,t,n,o,r,i,a,c,y,l,s,p,u,d,m,g,b,f,h,P,G,L,T,E,A){"use strict";function C(e){const t=e.length,n=new Float64Array(3*t),o=p.IndexDatatype.createTypedArray(t,2*t);let i=0,a=0;for(let r=0;r<t;r++){const c=e[r];n[i++]=c.x,n[i++]=c.y,n[i++]=c.z,o[a++]=r,o[a++]=(r+1)%t}const l=new y.GeometryAttributes({position:new c.GeometryAttribute({componentDatatype:r.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:n})});return new c.Geometry({attributes:l,indices:o,primitiveType:c.PrimitiveType.LINES})}function H(e){const t=(e=a.defaultValue(e,a.defaultValue.EMPTY_OBJECT)).polygonHierarchy;this._polygonHierarchy=t,this._workerName="createCoplanarPolygonOutlineGeometry",this.packedLength=u.PolygonGeometryLibrary.computeHierarchyPackedLength(t)+1}H.fromPositions=function(e){return new H({polygonHierarchy:{positions:(e=a.defaultValue(e,a.defaultValue.EMPTY_OBJECT)).positions}})},H.pack=function(e,t,n){return n=a.defaultValue(n,0),t[n=u.PolygonGeometryLibrary.packPolygonHierarchy(e._polygonHierarchy,t,n)]=e.packedLength,t};const k={polygonHierarchy:{}};return H.unpack=function(e,t,n){t=a.defaultValue(t,0);const o=u.PolygonGeometryLibrary.unpackPolygonHierarchy(e,t);t=o.startingIndex,delete o.startingIndex;const r=e[t];return a.defined(n)||(n=new H(k)),n._polygonHierarchy=o,n.packedLength=r,n},H.createGeometry=function(o){const r=o._polygonHierarchy;let a=r.positions;if(a=e.arrayRemoveDuplicates(a,n.Cartesian3.equalsEpsilon,!0),a.length<3)return;if(!i.CoplanarPolygonGeometryLibrary.validOutline(a))return;const y=u.PolygonGeometryLibrary.polygonOutlinesFromHierarchy(r,!1);if(0===y.length)return;const p=[];for(let e=0;e<y.length;e++){const t=new l.GeometryInstance({geometry:C(y[e])});p.push(t)}const d=s.GeometryPipeline.combineInstances(p)[0],m=t.BoundingSphere.fromPoints(r.positions);return new c.Geometry({attributes:d.attributes,indices:d.indices,primitiveType:d.primitiveType,boundingSphere:m})},function(e,t){return a.defined(t)&&(e=H.unpack(e,t)),e._ellipsoid=n.Ellipsoid.clone(e._ellipsoid),H.createGeometry(e)}}));