Agriculture-front-end/dist/Cesium/Workers/createWallOutlineGeometry.js

2 lines
4.0 KiB
JavaScript
Raw Normal View History

2023-09-11 21:56:39 +08:00
define(["./when-b60132fc","./Cartesian2-47311507","./BoundingSphere-561b54d0","./Cartographic-3309dd0d","./ComponentDatatype-c140a87d","./Check-7b2a090c","./GeometryAttribute-3a42bbdc","./GeometryAttributes-252e9929","./IndexDatatype-8a5eead4","./Math-119be1a3","./PrimitiveType-39acab88","./WallGeometryLibrary-fad9e8d3","./Cartesian4-3ca25aab","./RuntimeError-4a5c8994","./WebGLConstants-4ae0db90","./Transforms-cb0006b0","./buildModuleUrl-3addfe33","./FeatureDetection-c3b71206","./arrayRemoveDuplicates-d2f048c5","./PolylinePipeline-971d8853","./EllipsoidGeodesic-0f19ac62","./EllipsoidRhumbLine-ed1a6bf4","./IntersectionTests-0c6d0a14","./Plane-097b3a8f"],(function(e,i,t,a,n,r,o,s,l,d,m,u,p,f,c,h,g,y,v,_,E,b,C,H){"use strict";var A=new a.Cartesian3,k=new a.Cartesian3;function w(t){var n=(t=e.defaultValue(t,e.defaultValue.EMPTY_OBJECT)).positions,r=t.maximumHeights,o=t.minimumHeights,s=e.defaultValue(t.granularity,d.CesiumMath.RADIANS_PER_DEGREE),l=e.defaultValue(t.ellipsoid,i.Ellipsoid.WGS84);this._positions=n,this._minimumHeights=o,this._maximumHeights=r,this._granularity=s,this._ellipsoid=i.Ellipsoid.clone(l),this._workerName="createWallOutlineGeometry";var m=1+n.length*a.Cartesian3.packedLength+2;e.defined(o)&&(m+=o.length),e.defined(r)&&(m+=r.length),this.packedLength=m+i.Ellipsoid.packedLength+1}w.pack=function(t,n,r){var o;r=e.defaultValue(r,0);var s=t._positions,l=s.length;for(n[r++]=l,o=0;o<l;++o,r+=a.Cartesian3.packedLength)a.Cartesian3.pack(s[o],n,r);var d=t._minimumHeights;if(l=e.defined(d)?d.length:0,n[r++]=l,e.defined(d))for(o=0;o<l;++o)n[r++]=d[o];var m=t._maximumHeights;if(l=e.defined(m)?m.length:0,n[r++]=l,e.defined(m))for(o=0;o<l;++o)n[r++]=m[o];return i.Ellipsoid.pack(t._ellipsoid,n,r),n[r+=i.Ellipsoid.packedLength]=t._granularity,n};var G=i.Ellipsoid.clone(i.Ellipsoid.UNIT_SPHERE),L={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:G,granularity:void 0};return w.unpack=function(t,n,r){var o;n=e.defaultValue(n,0);var s,l,d=t[n++],m=new Array(d);for(o=0;o<d;++o,n+=a.Cartesian3.packedLength)m[o]=a.Cartesian3.unpack(t,n);if((d=t[n++])>0)for(s=new Array(d),o=0;o<d;++o)s[o]=t[n++];if((d=t[n++])>0)for(l=new Array(d),o=0;o<d;++o)l[o]=t[n++];var u=i.Ellipsoid.unpack(t,n,G),p=t[n+=i.Ellipsoid.packedLength];return e.defined(r)?(r._positions=m,r._minimumHeights=s,r._maximumHeights=l,r._ellipsoid=i.Ellipsoid.clone(u,r._ellipsoid),r._granularity=p,r):(L.positions=m,L.minimumHeights=s,L.maximumHeights=l,L.granularity=p,new w(L))},w.fromConstantHeights=function(i){var t,a,n=(i=e.defaultValue(i,e.defaultValue.EMPTY_OBJECT)).positions,r=i.minimumHeight,o=i.maximumHeight,s=e.defined(r),l=e.defined(o);if(s||l){var d=n.length;t=s?new Array(d):void 0,a=l?new Array(d):void 0;for(var m=0;m<d;++m)s&&(t[m]=r),l&&(a[m]=o)}return new w({positions:n,maximumHeights:a,minimumHeights:t,ellipsoid:i.ellipsoid})},w.createGeometry=function(i){var r=i._positions,p=i._minimumHeights,f=i._maximumHeights,c=i._granularity,h=i._ellipsoid,g=u.WallGeometryLibrary.computePositions(h,r,f,p,c,!1);if(e.defined(g)){var y,v=g.pos.bottomPositions,_=g.pos.topPositions,E=_.length,b=2*E,C=new Float64Array(b),H=0;for(E/=3,y=0;y<E;++y){var w=3*y,G=a.Cartesian3.fromArray(_,w,A),L=a.Cartesian3.fromArray(v,w,k);C[H++]=L.x,C[H++]=L.y,C[H++]=L.z,C[H++]=G.x,C[H++]=G.y,C[H++]=G.z}var P=new s.GeometryAttributes({position:new o.GeometryAttribute({componentDatatype:n.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:C})}),x=b/3;b=2*x-4+x;var T=l.IndexDatatype.createTypedArray(x,b),D=0;for(y=0;y<x-2;y+=2){var V=y,S=y+2,I=a.Cartesian3.fromArray(C,3*V,A),R=a.Cartesian3.fromArray(C,3*S,k);if(!a.Cartesian3.equalsEpsilon(I,R,d.CesiumMath.EPSILON10)){var M=y+1,B=y+3;T[D++]=M,T[D++]=V,T[D++]=M,T[D++]=B,T[D++]=V,T[D++]=S}}return T[D++]=x-2,T[D++]=x-1,new o.Geometry({attributes:P,indices:T,primitiveType:m.PrimitiveType.LINES,boundingSphere:new t.BoundingSphere.fromVertices(C)})}},function(t,a){return e.defined(a)&&(t=w.unpack(t,a)),t._ellipsoid=i.Ellipsoid.clone(t._ellipsoid),w.createGeometry(t)}}));