/* 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","./GeometryOffsetAttribute-9c676324"],function(c,o,e,y,d,t,n,p,b,C,l){"use strict";var h=new y.Cartesian3;function u(e){var t=(e=c.defaultValue(e,c.defaultValue.EMPTY_OBJECT)).minimum,n=e.maximum;if(o.Check.typeOf.object("min",t),o.Check.typeOf.object("max",n),c.defined(e.offsetAttribute)&&e.offsetAttribute===l.GeometryOffsetAttribute.TOP)throw new o.DeveloperError("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._min=y.Cartesian3.clone(t),this._max=y.Cartesian3.clone(n),this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxOutlineGeometry"}u.fromDimensions=function(e){var t=(e=c.defaultValue(e,c.defaultValue.EMPTY_OBJECT)).dimensions;o.Check.typeOf.object("dimensions",t),o.Check.typeOf.number.greaterThanOrEquals("dimensions.x",t.x,0),o.Check.typeOf.number.greaterThanOrEquals("dimensions.y",t.y,0),o.Check.typeOf.number.greaterThanOrEquals("dimensions.z",t.z,0);var n=y.Cartesian3.multiplyByScalar(t,.5,new y.Cartesian3);return new u({minimum:y.Cartesian3.negate(n,new y.Cartesian3),maximum:n,offsetAttribute:e.offsetAttribute})},u.fromAxisAlignedBoundingBox=function(e){return o.Check.typeOf.object("boundindBox",e),new u({minimum:e.minimum,maximum:e.maximum})},u.packedLength=2*y.Cartesian3.packedLength+1,u.pack=function(e,t,n){return o.Check.typeOf.object("value",e),o.Check.defined("array",t),n=c.defaultValue(n,0),y.Cartesian3.pack(e._min,t,n),y.Cartesian3.pack(e._max,t,n+y.Cartesian3.packedLength),t[n+2*y.Cartesian3.packedLength]=c.defaultValue(e._offsetAttribute,-1),t};var s=new y.Cartesian3,f=new y.Cartesian3,m={minimum:s,maximum:f,offsetAttribute:void 0};return u.unpack=function(e,t,n){o.Check.defined("array",e),t=c.defaultValue(t,0);var a=y.Cartesian3.unpack(e,t,s),r=y.Cartesian3.unpack(e,t+y.Cartesian3.packedLength,f),i=e[t+2*y.Cartesian3.packedLength];return c.defined(n)?(n._min=y.Cartesian3.clone(a,n._min),n._max=y.Cartesian3.clone(r,n._max),n._offsetAttribute=-1===i?void 0:i,n):(m.offsetAttribute=-1===i?void 0:i,new u(m))},u.createGeometry=function(e){var t=e._min,n=e._max;if(!y.Cartesian3.equals(t,n)){var a=new C.GeometryAttributes,r=new Uint16Array(24),i=new Float64Array(24);i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=n.x,i[4]=t.y,i[5]=t.z,i[6]=n.x,i[7]=n.y,i[8]=t.z,i[9]=t.x,i[10]=n.y,i[11]=t.z,i[12]=t.x,i[13]=t.y,i[14]=n.z,i[15]=n.x,i[16]=t.y,i[17]=n.z,i[18]=n.x,i[19]=n.y,i[20]=n.z,i[21]=t.x,i[22]=n.y,i[23]=n.z,a.position=new b.GeometryAttribute({componentDatatype:p.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:i}),r[0]=4,r[1]=5,r[2]=5,r[3]=6,r[4]=6,r[5]=7,r[6]=7,r[7]=4,r[8]=0,r[9]=1,r[10]=1,r[11]=2,r[12]=2,r[13]=3,r[14]=3,r[15]=0,r[16]=0,r[17]=4,r[18]=1,r[19]=5,r[20]=2,r[21]=6,r[22]=3,r[23]=7;var o,u,s,f=y.Cartesian3.subtract(n,t,h),m=.5*y.Cartesian3.magnitude(f);return c.defined(e._offsetAttribute)&&(o=i.length,u=new Uint8Array(o/3),s=e._offsetAttribute===l.GeometryOffsetAttribute.NONE?0:1,l.arrayFill(u,s),a.applyOffset=new b.GeometryAttribute({componentDatatype:p.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:u})),new b.Geometry({attributes:a,indices:r,primitiveType:b.PrimitiveType.LINES,boundingSphere:new d.BoundingSphere(y.Cartesian3.ZERO,m),offsetAttribute:e._offsetAttribute})}},function(e,t){return c.defined(t)&&(e=u.unpack(e,t)),u.createGeometry(e)}});