Agriculture-front-end/public/Cesium/Workers/createCoplanarPolygonOutlineGeometry.js

2 lines
2.9 KiB
JavaScript
Raw Normal View History

2023-09-11 21:56:39 +08:00
define(["./arrayRemoveDuplicates-d2f048c5","./BoundingSphere-561b54d0","./Cartographic-3309dd0d","./Check-7b2a090c","./ComponentDatatype-c140a87d","./CoplanarPolygonGeometryLibrary-de8c7233","./when-b60132fc","./GeometryAttribute-3a42bbdc","./GeometryAttributes-252e9929","./GeometryInstance-41780fb6","./GeometryPipeline-e1b82a4e","./IndexDatatype-8a5eead4","./PolygonGeometryLibrary-ae9ad77c","./PrimitiveType-39acab88","./Cartesian2-47311507","./Math-119be1a3","./Cartesian4-3ca25aab","./RuntimeError-4a5c8994","./WebGLConstants-4ae0db90","./OrientedBoundingBox-f1d7843f","./EllipsoidTangentPlane-b2b18d75","./IntersectionTests-0c6d0a14","./Plane-097b3a8f","./Transforms-cb0006b0","./buildModuleUrl-3addfe33","./FeatureDetection-c3b71206","./AttributeCompression-90851096","./EncodedCartesian3-f1396b05","./ArcType-29cf2197","./EllipsoidRhumbLine-ed1a6bf4","./PolygonPipeline-f49953b9","./earcut-2.2.1-20c8012f"],(function(e,t,r,n,a,o,i,y,c,l,p,u,s,d,m,b,f,g,h,P,v,G,C,L,T,E,k,H,w,A,D,I){"use strict";function _(e){for(var t=e.length,r=new Float64Array(3*t),n=u.IndexDatatype.createTypedArray(t,2*t),o=0,i=0,l=0;l<t;l++){var p=e[l];r[o++]=p.x,r[o++]=p.y,r[o++]=p.z,n[i++]=l,n[i++]=(l+1)%t}var s=new c.GeometryAttributes({position:new y.GeometryAttribute({componentDatatype:a.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:r})});return new y.Geometry({attributes:s,indices:n,primitiveType:d.PrimitiveType.LINES})}function B(e){var t=(e=i.defaultValue(e,i.defaultValue.EMPTY_OBJECT)).polygonHierarchy;this._polygonHierarchy=t,this._workerName="createCoplanarPolygonOutlineGeometry",this.packedLength=s.PolygonGeometryLibrary.computeHierarchyPackedLength(t)+1}B.fromPositions=function(e){return new B({polygonHierarchy:{positions:(e=i.defaultValue(e,i.defaultValue.EMPTY_OBJECT)).positions}})},B.pack=function(e,t,r){return r=i.defaultValue(r,0),t[r=s.PolygonGeometryLibrary.packPolygonHierarchy(e._polygonHierarchy,t,r)]=e.packedLength,t};var O={polygonHierarchy:{}};return B.unpack=function(e,t,r){t=i.defaultValue(t,0);var n=s.PolygonGeometryLibrary.unpackPolygonHierarchy(e,t);t=n.startingIndex,delete n.startingIndex;var a=e[t];return i.defined(r)||(r=new B(O)),r._polygonHierarchy=n,r.packedLength=a,r},B.createGeometry=function(n){var a=n._polygonHierarchy,i=a.positions;if(!((i=e.arrayRemoveDuplicates(i,r.Cartesian3.equalsEpsilon,!0)).length<3)&&o.CoplanarPolygonGeometryLibrary.validOutline(i)){var c=s.PolygonGeometryLibrary.polygonOutlinesFromHierarchy(a,!1);if(0!==c.length){for(var u=[],d=0;d<c.length;d++){var m=new l.GeometryInstance({geometry:_(c[d])});u.push(m)}var b=p.GeometryPipeline.combineInstances(u)[0],f=t.BoundingSphere.fromPoints(a.positions);return new y.Geometry({attributes:b.attributes,indices:b.indices,primitiveType:b.primitiveType,boundingSphere:f})}}},function(e,t){return i.defined(t)&&(e=B.unpack(e,t)),e._ellipsoid=m.Ellipsoid.clone(e._ellipsoid),B.createGeometry(e)}}));