qa-prevention-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/createBoxOutlineGeometry.js

2 lines
3.1 KiB
JavaScript
Raw Permalink Normal View History

2023-12-17 15:30:40 +08:00
define(["./GeometryOffsetAttribute-ed56ff58","./BoundingSphere-9a3b5656","./Cartesian3-e0307675","./Check-741c5f3c","./ComponentDatatype-aaeec80f","./defaultValue-81eec7ed","./GeometryAttribute-2b42a913","./GeometryAttributes-32b29525","./Cartesian2-bd414876","./Math-e73894ab","./GeographicProjection-c931c7fb","./Matrix4-4c545f70","./RuntimeError-26acdd3b","./Rectangle-cf3e0e3e","./WebGLConstants-508b9636","./Matrix2-dc0c61cc","./Transforms-5b829630","./when-422ea0ae","./Resource-8ae1a924","./combine-3c023bda"],(function(e,t,n,a,i,r,o,u,s,m,c,f,d,b,p,l,y,C,A,x){"use strict";const _=new n.Cartesian3;function h(e){const t=(e=r.defaultValue(e,r.defaultValue.EMPTY_OBJECT)).minimum,a=e.maximum;this._min=n.Cartesian3.clone(t),this._max=n.Cartesian3.clone(a),this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxOutlineGeometry"}h.fromDimensions=function(e){const t=(e=r.defaultValue(e,r.defaultValue.EMPTY_OBJECT)).dimensions,a=n.Cartesian3.multiplyByScalar(t,.5,new n.Cartesian3);return new h({minimum:n.Cartesian3.negate(a,new n.Cartesian3),maximum:a,offsetAttribute:e.offsetAttribute})},h.fromAxisAlignedBoundingBox=function(e){return new h({minimum:e.minimum,maximum:e.maximum})},h.packedLength=2*n.Cartesian3.packedLength+1,h.pack=function(e,t,a){return a=r.defaultValue(a,0),n.Cartesian3.pack(e._min,t,a),n.Cartesian3.pack(e._max,t,a+n.Cartesian3.packedLength),t[a+2*n.Cartesian3.packedLength]=r.defaultValue(e._offsetAttribute,-1),t};const w=new n.Cartesian3,g=new n.Cartesian3,k={minimum:w,maximum:g,offsetAttribute:void 0};return h.unpack=function(e,t,a){t=r.defaultValue(t,0);const i=n.Cartesian3.unpack(e,t,w),o=n.Cartesian3.unpack(e,t+n.Cartesian3.packedLength,g),u=e[t+2*n.Cartesian3.packedLength];return r.defined(a)?(a._min=n.Cartesian3.clone(i,a._min),a._max=n.Cartesian3.clone(o,a._max),a._offsetAttribute=-1===u?void 0:u,a):(k.offsetAttribute=-1===u?void 0:u,new h(k))},h.createGeometry=function(a){const s=a._min,m=a._max;if(n.Cartesian3.equals(s,m))return;const c=new u.GeometryAttributes,f=new Uint16Array(24),d=new Float64Array(24);d[0]=s.x,d[1]=s.y,d[2]=s.z,d[3]=m.x,d[4]=s.y,d[5]=s.z,d[6]=m.x,d[7]=m.y,d[8]=s.z,d[9]=s.x,d[10]=m.y,d[11]=s.z,d[12]=s.x,d[13]=s.y,d[14]=m.z,d[15]=m.x,d[16]=s.y,d[17]=m.z,d[18]=m.x,d[19]=m.y,d[20]=m.z,d[21]=s.x,d[22]=m.y,d[23]=m.z,c.position=new o.GeometryAttribute({componentDatatype:i.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:d}),f[0]=4,f[1]=5,f[2]=5,f[3]=6,f[4]=6,f[5]=7,f[6]=7,f[7]=4,f[8]=0,f[9]=1,f[10]=1,f[11]=2,f[12]=2,f[13]=3,f[14]=3,f[15]=0,f[16]=0,f[17]=4,f[18]=1,f[19]=5,f[20]=2,f[21]=6,f[22]=3,f[23]=7;const b=n.Cartesian3.subtract(m,s,_),p=.5*n.Cartesian3.magnitude(b);if(r.defined(a._offsetAttribute)){const t=d.length,n=new Uint8Array(t/3),r=a._offsetAttribute===e.GeometryOffsetAttribute.NONE?0:1;e.arrayFill(n,r),c.applyOffset=new o.GeometryAttribute({componentDatatype:i.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}return new o.Geometry({attributes:c,indices:f,primitiveType:o.PrimitiveType.LINES,boundingSphere:new t.BoundingSphere(n.Cartesian3.ZERO,p),offsetAttribute:a._offsetAttribute})},function(e,t){return r.defined(t)&&(e=h.unpack(e,t)),h.createGeometry(e)}}));