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

2 lines
7.4 KiB
JavaScript
Raw Normal View History

2023-04-23 09:41:12 +08:00
define(["./defaultValue-f6d5e6da","./Matrix3-81054f0f","./ArcType-26a3f38d","./Transforms-20461479","./ComponentDatatype-ab629b88","./EllipsoidTangentPlane-d430e7d5","./GeometryAttribute-b8117bde","./GeometryAttributes-1e4ddcd2","./GeometryInstance-0318e0cd","./GeometryOffsetAttribute-2579b8d2","./GeometryPipeline-fcaf4d4d","./IndexDatatype-d3db4e7d","./Math-2ce22ee9","./PolygonGeometryLibrary-d7e504f0","./PolygonPipeline-621b1cb0","./Matrix2-413c4048","./RuntimeError-9b4ce3fb","./combine-0c102d93","./WebGLConstants-7f557f93","./AxisAlignedBoundingBox-2c0751ca","./IntersectionTests-a57eed59","./Plane-6add0ae1","./AttributeCompression-48e336db","./EncodedCartesian3-5e2017ab","./arrayRemoveDuplicates-9b636830","./EllipsoidRhumbLine-77eff028"],(function(e,t,i,o,r,n,a,s,l,y,u,p,d,c,g,f,h,m,b,P,A,E,_,G,L,T){"use strict";const H=[],v=[];function x(e,t,o,y,u){const d=n.EllipsoidTangentPlane.fromPoints(t,e).projectPointsOntoPlane(t,H);let f,h;g.PolygonPipeline.computeWindingOrder2D(d)===g.WindingOrder.CLOCKWISE&&(d.reverse(),t=t.slice().reverse());let m=t.length,b=0;if(y)for(f=new Float64Array(2*m*3),h=0;h<m;h++){const e=t[h],i=t[(h+1)%m];f[b++]=e.x,f[b++]=e.y,f[b++]=e.z,f[b++]=i.x,f[b++]=i.y,f[b++]=i.z}else{let r=0;if(u===i.ArcType.GEODESIC)for(h=0;h<m;h++)r+=c.PolygonGeometryLibrary.subdivideLineCount(t[h],t[(h+1)%m],o);else if(u===i.ArcType.RHUMB)for(h=0;h<m;h++)r+=c.PolygonGeometryLibrary.subdivideRhumbLineCount(e,t[h],t[(h+1)%m],o);for(f=new Float64Array(3*r),h=0;h<m;h++){let r;u===i.ArcType.GEODESIC?r=c.PolygonGeometryLibrary.subdivideLine(t[h],t[(h+1)%m],o,v):u===i.ArcType.RHUMB&&(r=c.PolygonGeometryLibrary.subdivideRhumbLine(e,t[h],t[(h+1)%m],o,v));const n=r.length;for(let e=0;e<n;++e)f[b++]=r[e]}}m=f.length/3;const P=2*m,A=p.IndexDatatype.createTypedArray(m,P);for(b=0,h=0;h<m-1;h++)A[b++]=h,A[b++]=h+1;return A[b++]=m-1,A[b++]=0,new l.GeometryInstance({geometry:new a.Geometry({attributes:new s.GeometryAttributes({position:new a.GeometryAttribute({componentDatatype:r.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:f})}),indices:A,primitiveType:a.PrimitiveType.LINES})})}function C(e,t,o,y,u){const d=n.EllipsoidTangentPlane.fromPoints(t,e).projectPointsOntoPlane(t,H);let f,h;g.PolygonPipeline.computeWindingOrder2D(d)===g.WindingOrder.CLOCKWISE&&(d.reverse(),t=t.slice().reverse());let m=t.length;const b=new Array(m);let P=0;if(y)for(f=new Float64Array(2*m*3*2),h=0;h<m;++h){b[h]=P/3;const e=t[h],i=t[(h+1)%m];f[P++]=e.x,f[P++]=e.y,f[P++]=e.z,f[P++]=i.x,f[P++]=i.y,f[P++]=i.z}else{let r=0;if(u===i.ArcType.GEODESIC)for(h=0;h<m;h++)r+=c.PolygonGeometryLibrary.subdivideLineCount(t[h],t[(h+1)%m],o);else if(u===i.ArcType.RHUMB)for(h=0;h<m;h++)r+=c.PolygonGeometryLibrary.subdivideRhumbLineCount(e,t[h],t[(h+1)%m],o);for(f=new Float64Array(3*r*2),h=0;h<m;++h){let r;b[h]=P/3,u===i.ArcType.GEODESIC?r=c.PolygonGeometryLibrary.subdivideLine(t[h],t[(h+1)%m],o,v):u===i.ArcType.RHUMB&&(r=c.PolygonGeometryLibrary.subdivideRhumbLine(e,t[h],t[(h+1)%m],o,v));const n=r.length;for(let e=0;e<n;++e)f[P++]=r[e]}}m=f.length/6;const A=b.length,E=2*(2*m+A),_=p.IndexDatatype.createTypedArray(m+A,E);for(P=0,h=0;h<m;++h)_[P++]=h,_[P++]=(h+1)%m,_[P++]=h+m,_[P++]=(h+1)%m+m;for(h=0;h<A;h++){const e=b[h];_[P++]=e,_[P++]=e+m}return new l.GeometryInstance({geometry:new a.Geometry({attributes:new s.GeometryAttributes({position:new a.GeometryAttribute({componentDatatype:r.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:f})}),indices:_,primitiveType:a.PrimitiveType.LINES})})}function O(o){const r=o.polygonHierarchy,n=e.defaultValue(o.ellipsoid,t.Ellipsoid.WGS84),a=e.defaultValue(o.granularity,d.CesiumMath.RADIANS_PER_DEGREE),s=e.defaultValue(o.perPositionHeight,!1),l=s&&e.defined(o.extrudedHeight),y=e.defaultValue(o.arcType,i.ArcType.GEODESIC);let u=e.defaultValue(o.height,0),p=e.defaultValue(o.extrudedHeight,u);if(!l){const e=Math.max(u,p);p=Math.min(u,p),u=e}this._ellipsoid=t.Ellipsoid.clone(n),this._granularity=a,this._height=u,this._extrudedHeight=p,this._arcType=y,this._polygonHierarchy=r,this._perPositionHeight=s,this._perPositionHeightExtrud