/* 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","./AttributeCompression-ea810287","./GeometryPipeline-1ea64cde","./EncodedCartesian3-29a09d7b","./IndexDatatype-79bb407c","./IntersectionTests-459f6f08","./Plane-46b5436f","./GeometryInstance-6264cc0f","./arrayRemoveDuplicates-d96adeb6","./EllipsoidTangentPlane-b5927ee3","./OrientedBoundingBox-5e0b7a7c","./CoplanarPolygonGeometryLibrary-77345aa0","./ArcType-2b58731c","./EllipsoidRhumbLine-357c11e7","./PolygonPipeline-2ee85025","./PolygonGeometryLibrary-bcb33f68"],function(i,a,e,l,p,t,r,s,u,d,n,m,o,f,y,c,b,g,h,P,v,G,C,k,L){"use strict";function T(e){var t=(e=i.defaultValue(e,i.defaultValue.EMPTY_OBJECT)).polygonHierarchy;a.Check.defined("options.polygonHierarchy",t),this._polygonHierarchy=t,this._workerName="createCoplanarPolygonOutlineGeometry",this.packedLength=L.PolygonGeometryLibrary.computeHierarchyPackedLength(t)+1}T.fromPositions=function(e){return e=i.defaultValue(e,i.defaultValue.EMPTY_OBJECT),a.Check.defined("options.positions",e.positions),new T({polygonHierarchy:{positions:e.positions}})},T.pack=function(e,t,r){return a.Check.typeOf.object("value",e),a.Check.defined("array",t),r=i.defaultValue(r,0),t[r=L.PolygonGeometryLibrary.packPolygonHierarchy(e._polygonHierarchy,t,r)]=e.packedLength,t};var E={polygonHierarchy:{}};return T.unpack=function(e,t,r){a.Check.defined("array",e),t=i.defaultValue(t,0);var n=L.PolygonGeometryLibrary.unpackPolygonHierarchy(e,t);t=n.startingIndex,delete n.startingIndex;var o=e[t];return i.defined(r)||(r=new T(E)),r._polygonHierarchy=n,r.packedLength=o,r},T.createGeometry=function(e){var t=e._polygonHierarchy,r=t.positions;if(!((r=g.arrayRemoveDuplicates(r,l.Cartesian3.equalsEpsilon,!0)).length<3)&&v.CoplanarPolygonGeometryLibrary.validOutline(r)){var n=L.PolygonGeometryLibrary.polygonOutlinesFromHierarchy(t,!1);if(0!==n.length){for(var o=[],i=0;i<n.length;i++){var a=new b.GeometryInstance({geometry:function(e){for(var t=e.length,r=new Float64Array(3*t),n=f.IndexDatatype.createTypedArray(t,2*t),o=0,i=0,a=0;a<t;a++){var y=e[a];r[o++]=y.x,r[o++]=y.y,r[o++]=y.z,n[i++]=a,n[i++]=(a+1)%t}var c=new d.GeometryAttributes({position:new u.GeometryAttribute({componentDatatype:s.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:r})});return new u.Geometry({attributes:c,indices:n,primitiveType:u.PrimitiveType.LINES})}(n[i])});o.push(a)}var y=m.GeometryPipeline.combineInstances(o)[0],c=p.BoundingSphere.fromPoints(t.positions);return new u.Geometry({attributes:y.attributes,indices:y.indices,primitiveType:y.primitiveType,boundingSphere:c})}}},function(e,t){return i.defined(t)&&(e=T.unpack(e,t)),e._ellipsoid=l.Ellipsoid.clone(e._ellipsoid),T.createGeometry(e)}});