/* 2020-9-22 15:23:25 | 版权所有 军懋国兴  */
define(["./when-cbf8cd21","./Check-35e1a91d","./Math-69007a69","./Cartesian2-43e3a3be","./Transforms-2d1ac5ec","./RuntimeError-f4c64df1","./WebGLConstants-95ceb4e9","./ComponentDatatype-607c9a0c","./GeometryAttribute-2303bbfb","./GeometryAttributes-90846c5f","./IndexDatatype-79bb407c","./GeometryOffsetAttribute-9c676324","./CylinderGeometryLibrary-ea3f4c29"],function(_,f,e,A,O,t,i,v,C,R,G,g,V){"use strict";var k=new A.Cartesian2;function d(e){var t=(e=_.defaultValue(e,_.defaultValue.EMPTY_OBJECT)).length,i=e.topRadius,r=e.bottomRadius,o=_.defaultValue(e.slices,128),a=Math.max(_.defaultValue(e.numberOfVerticalLines,16),0);if(f.Check.typeOf.number("options.positions",t),f.Check.typeOf.number("options.topRadius",i),f.Check.typeOf.number("options.bottomRadius",r),f.Check.typeOf.number.greaterThanOrEquals("options.slices",o,3),_.defined(e.offsetAttribute)&&e.offsetAttribute===g.GeometryOffsetAttribute.TOP)throw new f.DeveloperError("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._length=t,this._topRadius=i,this._bottomRadius=r,this._slices=o,this._numberOfVerticalLines=a,this._offsetAttribute=e.offsetAttribute,this._workerName="createCylinderOutlineGeometry"}d.packedLength=6,d.pack=function(e,t,i){return f.Check.typeOf.object("value",e),f.Check.defined("array",t),i=_.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]=_.defaultValue(e._offsetAttribute,-1),t};var b={length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};return d.unpack=function(e,t,i){f.Check.defined("array",e),t=_.defaultValue(t,0);var r=e[t++],o=e[t++],a=e[t++],n=e[t++],s=e[t++],u=e[t];return _.defined(i)?(i._length=r,i._topRadius=o,i._bottomRadius=a,i._slices=n,i._numberOfVerticalLines=s,i._offsetAttribute=-1===u?void 0:u,i):(b.length=r,b.topRadius=o,b.bottomRadius=a,b.slices=n,b.numberOfVerticalLines=s,b.offsetAttribute=-1===u?void 0:u,new d(b))},d.createGeometry=function(e){var t=e._length,i=e._topRadius,r=e._bottomRadius,o=e._slices,a=e._numberOfVerticalLines;if(!(t<=0||i<0||r<0||0===i&&0===r)){var n,s,u=2*o,f=V.CylinderGeometryLibrary.computePositions(t,i,r,o,!1),d=2*o;0<a&&(n=Math.min(a,o),s=Math.round(o/n),d+=n);for(var b=G.IndexDatatype.createTypedArray(u,2*d),c=0,m=0;m<o-1;m++)b[c++]=m,b[c++]=m+1,b[c++]=m+o,b[c++]=m+1+o;if(b[c++]=o-1,b[c++]=0,b[c++]=o+o-1,b[c++]=o,0<a)for(m=0;m<o;m+=s)b[c++]=m,b[c++]=m+o;var p=new R.GeometryAttributes;p.position=new C.GeometryAttribute({componentDatatype:v.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:f}),k.x=.5*t,k.y=Math.max(r,i);var l,y,h=new O.BoundingSphere(A.Cartesian3.ZERO,A.Cartesian2.magnitude(k));return _.defined(e._offsetAttribute)&&(t=f.length,l=new Uint8Array(t/3),y=e._offsetAttribute===g.GeometryOffsetAttribute.NONE?0:1,g.arrayFill(l,y),p.applyOffset=new C.GeometryAttribute({componentDatatype:v.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:l})),new C.Geometry({attributes:p,indices:b,primitiveType:C.PrimitiveType.LINES,boundingSphere:h,offsetAttribute:e._offsetAttribute})}},function(e,t){return _.defined(t)&&(e=d.unpack(e,t)),d.createGeometry(e)}});