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

2 lines
3.1 KiB
JavaScript
Raw Normal View History

2023-09-11 21:56:39 +08:00
define(["./arrayFill-4513d7ad","./BoundingSphere-561b54d0","./Cartographic-3309dd0d","./Check-7b2a090c","./ComponentDatatype-c140a87d","./when-b60132fc","./GeometryAttribute-3a42bbdc","./GeometryAttributes-252e9929","./GeometryOffsetAttribute-fbeb6f1a","./PrimitiveType-39acab88","./Cartesian2-47311507","./Math-119be1a3","./Cartesian4-3ca25aab","./RuntimeError-4a5c8994","./WebGLConstants-4ae0db90","./Transforms-cb0006b0","./buildModuleUrl-3addfe33","./FeatureDetection-c3b71206"],(function(e,t,a,n,i,r,u,o,m,s,f,c,d,b,p,l,y,C){"use strict";var A=new a.Cartesian3;function x(e){var t=(e=r.defaultValue(e,r.defaultValue.EMPTY_OBJECT)).minimum,n=e.maximum;this._min=a.Cartesian3.clone(t),this._max=a.Cartesian3.clone(n),this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxOutlineGeometry"}x.fromDimensions=function(e){var t=(e=r.defaultValue(e,r.defaultValue.EMPTY_OBJECT)).dimensions,n=a.Cartesian3.multiplyByScalar(t,.5,new a.Cartesian3);return new x({minimum:a.Cartesian3.negate(n,new a.Cartesian3),maximum:n,offsetAttribute:e.offsetAttribute})},x.fromAxisAlignedBoundingBox=function(e){return new x({minimum:e.minimum,maximum:e.maximum})},x.packedLength=2*a.Cartesian3.packedLength+1,x.pack=function(e,t,n){return n=r.defaultValue(n,0),a.Cartesian3.pack(e._min,t,n),a.Cartesian3.pack(e._max,t,n+a.Cartesian3.packedLength),t[n+2*a.Cartesian3.packedLength]=r.defaultValue(e._offsetAttribute,-1),t};var _=new a.Cartesian3,h=new a.Cartesian3,w={minimum:_,maximum:h,offsetAttribute:void 0};return x.unpack=function(e,t,n){t=r.defaultValue(t,0);var i=a.Cartesian3.unpack(e,t,_),u=a.Cartesian3.unpack(e,t+a.Cartesian3.packedLength,h),o=e[t+2*a.Cartesian3.packedLength];return r.defined(n)?(n._min=a.Cartesian3.clone(i,n._min),n._max=a.Cartesian3.clone(u,n._max),n._offsetAttribute=-1===o?void 0:o,n):(w.offsetAttribute=-1===o?void 0:o,new x(w))},x.createGeometry=function(n){var f=n._min,c=n._max;if(!a.Cartesian3.equals(f,c)){var d=new o.GeometryAttributes,b=new Uint16Array(24),p=new Float64Array(24);p[0]=f.x,p[1]=f.y,p[2]=f.z,p[3]=c.x,p[4]=f.y,p[5]=f.z,p[6]=c.x,p[7]=c.y,p[8]=f.z,p[9]=f.x,p[10]=c.y,p[11]=f.z,p[12]=f.x,p[13]=f.y,p[14]=c.z,p[15]=c.x,p[16]=f.y,p[17]=c.z,p[18]=c.x,p[19]=c.y,p[20]=c.z,p[21]=f.x,p[22]=c.y,p[23]=c.z,d.position=new u.GeometryAttribute({componentDatatype:i.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:p}),b[0]=4,b[1]=5,b[2]=5,b[3]=6,b[4]=6,b[5]=7,b[6]=7,b[7]=4,b[8]=0,b[9]=1,b[10]=1,b[11]=2,b[12]=2,b[13]=3,b[14]=3,b[15]=0,b[16]=0,b[17]=4,b[18]=1,b[19]=5,b[20]=2,b[21]=6,b[22]=3,b[23]=7;var l=a.Cartesian3.subtract(c,f,A),y=.5*a.Cartesian3.magnitude(l);if(r.defined(n._offsetAttribute)){var C=p.length,x=new Uint8Array(C/3),_=n._offsetAttribute===m.GeometryOffsetAttribute.NONE?0:1;e.arrayFill(x,_),d.applyOffset=new u.GeometryAttribute({componentDatatype:i.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:x})}return new u.Geometry({attributes:d,indices:b,primitiveType:s.PrimitiveType.LINES,boundingSphere:new t.BoundingSphere(a.Cartesian3.ZERO,y),offsetAttribute:n._offsetAttribute})}},function(e,t){return r.defined(t)&&(e=x.unpack(e,t)),x.createGeometry(e)}}));