1
lxl
2022-09-16 2d9ddf8269640309f22053d3c92a38fd77e84358
1
define(["./GeometryOffsetAttribute-718fa138","./Transforms-b51fdb37","./Rectangle-82621db8","./Check-24483042","./ComponentDatatype-1a100acd","./CylinderGeometryLibrary-8d99e1fd","./when-54335d57","./GeometryAttribute-02fdce7a","./GeometryAttributes-caa08d6c","./IndexDatatype-edb2f4d6","./Math-7a8129d6","./RuntimeError-88a32665","./PixelFormat-d198afce","./WebGLConstants-95ceb4e9"],function(h,v,A,t,R,G,O,V,g,L,e,i,a,r){"use strict";var C=new A.Cartesian2;function f(t){var e=(t=O.defaultValue(t,O.defaultValue.EMPTY_OBJECT)).length,i=t.topRadius,a=t.bottomRadius,r=O.defaultValue(t.slices,128),n=Math.max(O.defaultValue(t.numberOfVerticalLines,16),0);this._length=e,this._topRadius=i,this._bottomRadius=a,this._slices=r,this._numberOfVerticalLines=n,this._offsetAttribute=t.offsetAttribute,this._workerName="createCylinderOutlineGeometry"}f.packedLength=6,f.pack=function(t,e,i){return i=O.defaultValue(i,0),e[i++]=t._length,e[i++]=t._topRadius,e[i++]=t._bottomRadius,e[i++]=t._slices,e[i++]=t._numberOfVerticalLines,e[i]=O.defaultValue(t._offsetAttribute,-1),e};var d={length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};return f.unpack=function(t,e,i){e=O.defaultValue(e,0);var a=t[e++],r=t[e++],n=t[e++],o=t[e++],u=t[e++],s=t[e];return O.defined(i)?(i._length=a,i._topRadius=r,i._bottomRadius=n,i._slices=o,i._numberOfVerticalLines=u,i._offsetAttribute=-1===s?void 0:s,i):(d.length=a,d.topRadius=r,d.bottomRadius=n,d.slices=o,d.numberOfVerticalLines=u,d.offsetAttribute=-1===s?void 0:s,new f(d))},f.createGeometry=function(t){var e=t._length,i=t._topRadius,a=t._bottomRadius,r=t._slices,n=t._numberOfVerticalLines;if(!(e<=0||i<0||a<0||0===i&&0===a)){var o,u=2*r,s=G.CylinderGeometryLibrary.computePositions(e,i,a,r,!1),f=2*r;if(0<n){var d=Math.min(n,r);o=Math.round(r/d),f+=d}var l,m=L.IndexDatatype.createTypedArray(u,2*f),b=0;for(l=0;l<r-1;l++)m[b++]=l,m[b++]=l+1,m[b++]=l+r,m[b++]=l+1+r;if(m[b++]=r-1,m[b++]=0,m[b++]=r+r-1,m[b++]=r,0<n)for(l=0;l<r;l+=o)m[b++]=l,m[b++]=l+r;var c=new g.GeometryAttributes;c.position=new V.GeometryAttribute({componentDatatype:R.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:s}),C.x=.5*e,C.y=Math.max(a,i);var p=new v.BoundingSphere(A.Cartesian3.ZERO,A.Cartesian2.magnitude(C));if(O.defined(t._offsetAttribute)){e=s.length;var y=new Uint8Array(e/3),_=t._offsetAttribute===h.GeometryOffsetAttribute.NONE?0:1;h.arrayFill(y,_),c.applyOffset=new V.GeometryAttribute({componentDatatype:R.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:y})}return new V.Geometry({attributes:c,indices:m,primitiveType:V.PrimitiveType.LINES,boundingSphere:p,offsetAttribute:t._offsetAttribute})}},function(t,e){return O.defined(e)&&(t=f.unpack(t,e)),f.createGeometry(t)}});