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

2 lines
2.9 KiB
JavaScript
Raw Normal View History

2023-09-11 21:56:39 +08:00
define(["./arrayFill-4513d7ad","./BoundingSphere-561b54d0","./Cartesian2-47311507","./Cartographic-3309dd0d","./Check-7b2a090c","./ComponentDatatype-c140a87d","./CylinderGeometryLibrary-aa453214","./when-b60132fc","./GeometryAttribute-3a42bbdc","./GeometryAttributes-252e9929","./GeometryOffsetAttribute-fbeb6f1a","./IndexDatatype-8a5eead4","./PrimitiveType-39acab88","./Math-119be1a3","./Cartesian4-3ca25aab","./RuntimeError-4a5c8994","./WebGLConstants-4ae0db90","./Transforms-cb0006b0","./buildModuleUrl-3addfe33","./FeatureDetection-c3b71206"],(function(e,t,i,a,r,n,o,u,s,d,f,b,l,c,m,p,y,_,h,v){"use strict";var A=new i.Cartesian2;function R(e){var t=(e=u.defaultValue(e,u.defaultValue.EMPTY_OBJECT)).length,i=e.topRadius,a=e.bottomRadius,r=u.defaultValue(e.slices,128),n=Math.max(u.defaultValue(e.numberOfVerticalLines,16),0);this._length=t,this._topRadius=i,this._bottomRadius=a,this._slices=r,this._numberOfVerticalLines=n,this._offsetAttribute=e.offsetAttribute,this._workerName="createCylinderOutlineGeometry"}R.packedLength=6,R.pack=function(e,t,i){return i=u.defaultValue(i,0),t[i++]=e._length,t[i++]=e._topRadius,t[i++]=e._bottomRadius,t[i++]=e._slices,t[i++]=e._numberOfVerticalLines,t[i]=u.defaultValue(e._offsetAttribute,-1),t};var C={length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};return R.unpack=function(e,t,i){t=u.defaultValue(t,0);var a=e[t++],r=e[t++],n=e[t++],o=e[t++],s=e[t++],d=e[t];return u.defined(i)?(i._length=a,i._topRadius=r,i._bottomRadius=n,i._slices=o,i._numberOfVerticalLines=s,i._offsetAttribute=-1===d?void 0:d,i):(C.length=a,C.topRadius=r,C.bottomRadius=n,C.slices=o,C.numberOfVerticalLines=s,C.offsetAttribute=-1===d?void 0:d,new R(C))},R.createGeometry=function(r){var c=r._length,m=r._topRadius,p=r._bottomRadius,y=r._slices,_=r._numberOfVerticalLines;if(!(c<=0||m<0||p<0||0===m&&0===p)){var h,v=2*y,R=o.CylinderGeometryLibrary.computePositions(c,m,p,y,!1),C=2*y;if(_>0){var G=Math.min(_,y);h=Math.round(y/G),C+=G}var O,g=b.IndexDatatype.createTypedArray(v,2*C),V=0;for(O=0;O<y-1;O++)g[V++]=O,g[V++]=O+1,g[V++]=O+y,g[V++]=O+1+y;if(g[V++]=y-1,g[V++]=0,g[V++]=y+y-1,g[V++]=y,_>0)for(O=0;O<y;O+=h)g[V++]=O,g[V++]=O+y;var L=new d.GeometryAttributes;L.position=new s.GeometryAttribute({componentDatatype:n.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:R}),A.x=.5*c,A.y=Math.max(p,m);var w=new t.BoundingSphere(a.Cartesian3.ZERO,i.Cartesian2.magnitude(A));if(u.defined(r._offsetAttribute)){c=R.length;var D=new Uint8Array(c/3),E=r._offsetAttribute===f.GeometryOffsetAttribute.NONE?0:1;e.arrayFill(D,E),L.applyOffset=new s.GeometryAttribute({componentDatatype:n.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:D})}return new s.Geometry({attributes:L,indices:g,primitiveType:l.PrimitiveType.LINES,boundingSphere:w,offsetAttribute:r._offsetAttribute})}},function(e,t){return u.defined(t)&&(e=R.unpack(e,t)),R.createGeometry(e)}}));