/* 2020-9-22 15:23:24 | 版权所有 军懋国兴  */
define(["./when-cbf8cd21","./Check-35e1a91d","./Math-69007a69","./Cartesian2-43e3a3be","./Transforms-2d1ac5ec","./RuntimeError-f4c64df1","./WebGLConstants-95ceb4e9","./ComponentDatatype-607c9a0c","./GeometryAttribute-2303bbfb","./GeometryAttributes-90846c5f","./IndexDatatype-79bb407c","./IntersectionTests-459f6f08","./Plane-46b5436f","./arrayRemoveDuplicates-d96adeb6","./BoundingRectangle-943d30f6","./EllipsoidTangentPlane-b5927ee3","./EllipsoidRhumbLine-357c11e7","./PolygonPipeline-2ee85025","./PolylineVolumeGeometryLibrary-7daaef99","./EllipsoidGeodesic-007422da","./PolylinePipeline-be169602"],function(d,u,t,c,y,e,i,f,h,g,v,r,n,o,a,l,s,p,m,E,P){"use strict";function _(e){var i=(e=d.defaultValue(e,d.defaultValue.EMPTY_OBJECT)).polylinePositions,r=e.shapePositions;if(!d.defined(i))throw new u.DeveloperError("options.polylinePositions is required.");if(!d.defined(r))throw new u.DeveloperError("options.shapePositions is required.");this._positions=i,this._shape=r,this._ellipsoid=c.Ellipsoid.clone(d.defaultValue(e.ellipsoid,c.Ellipsoid.WGS84)),this._cornerType=d.defaultValue(e.cornerType,m.CornerType.ROUNDED),this._granularity=d.defaultValue(e.granularity,t.CesiumMath.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeOutlineGeometry";var n=1+i.length*c.Cartesian3.packedLength;n+=1+r.length*c.Cartesian2.packedLength,this.packedLength=n+c.Ellipsoid.packedLength+2}_.pack=function(e,i,r){if(!d.defined(e))throw new u.DeveloperError("value is required");if(!d.defined(i))throw new u.DeveloperError("array is required");var n;r=d.defaultValue(r,0);var t=e._positions,o=t.length;for(i[r++]=o,n=0;n<o;++n,r+=c.Cartesian3.packedLength)c.Cartesian3.pack(t[n],i,r);var a=e._shape,o=a.length;for(i[r++]=o,n=0;n<o;++n,r+=c.Cartesian2.packedLength)c.Cartesian2.pack(a[n],i,r);return c.Ellipsoid.pack(e._ellipsoid,i,r),r+=c.Ellipsoid.packedLength,i[r++]=e._cornerType,i[r]=e._granularity,i};var b=c.Ellipsoid.clone(c.Ellipsoid.UNIT_SPHERE),k={polylinePositions:void 0,shapePositions:void 0,ellipsoid:b,height:void 0,cornerType:void 0,granularity:void 0};_.unpack=function(e,i,r){if(!d.defined(e))throw new u.DeveloperError("array is required");i=d.defaultValue(i,0);for(var n=e[i++],t=new Array(n),o=0;o<n;++o,i+=c.Cartesian3.packedLength)t[o]=c.Cartesian3.unpack(e,i);n=e[i++];var a=new Array(n);for(o=0;o<n;++o,i+=c.Cartesian2.packedLength)a[o]=c.Cartesian2.unpack(e,i);var l=c.Ellipsoid.unpack(e,i,b);i+=c.Ellipsoid.packedLength;var s=e[i++],p=e[i];return d.defined(r)?(r._positions=t,r._shape=a,r._ellipsoid=c.Ellipsoid.clone(l,r._ellipsoid),r._cornerType=s,r._granularity=p,r):(k.polylinePositions=t,k.shapePositions=a,k.cornerType=s,k.granularity=p,new _(k))};var C=new a.BoundingRectangle;return _.createGeometry=function(e){var i=e._positions,r=o.arrayRemoveDuplicates(i,c.Cartesian3.equalsEpsilon),n=e._shape,n=m.PolylineVolumeGeometryLibrary.removeDuplicatesFromShape(n);if(!(r.length<2||n.length<3)){p.PolygonPipeline.computeWindingOrder2D(n)===p.WindingOrder.CLOCKWISE&&n.reverse();var t=a.BoundingRectangle.fromPoints(n,C);return function(e,i){var r=new g.GeometryAttributes;r.position=new h.GeometryAttribute({componentDatatype:f.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:e});var n=i.length,t=r.position.values.length/3,o=e.length/3/n,a=v.IndexDatatype.createTypedArray(t,2*n*(1+o)),l=0,s=0,p=s*n;for(c=0;c<n-1;c++)a[l++]=c+p,a[l++]=c+p+1;for(a[l++]=n-1+p,a[l++]=p,p=(s=o-1)*n,c=0;c<n-1;c++)a[l++]=c+p,a[l++]=c+p+1;for(a[l++]=n-1+p,a[l++]=p,s=0;s<o-1;s++)for(var d=n*s,u=d+n,c=0;c<n;c++)a[l++]=c+d,a[l++]=c+u;return new h.Geometry({attributes:r,indices:v.IndexDatatype.createTypedArray(t,a),boundingSphere:y.BoundingSphere.fromVertices(e),primitiveType:h.PrimitiveType.LINES})}(m.PolylineVolumeGeometryLibrary.computePositions(r,n,t,e,!1),n)}},function(e,i){return d.defined(i)&&(e=_.unpack(e,i)),e._ellipsoid=c.Ellipsoid.clone(e._ellipsoid),_.createGeometry(e)}});