define(["./when-54335d57","./Rectangle-82621db8","./ArcType-2b58731c","./GeometryOffsetAttribute-718fa138","./Transforms-b51fdb37","./Check-24483042","./ComponentDatatype-1a100acd","./EllipsoidTangentPlane-3e9e5847","./GeometryAttribute-02fdce7a","./GeometryAttributes-caa08d6c","./GeometryInstance-4247a2b3","./GeometryPipeline-6bfd5efb","./IndexDatatype-edb2f4d6","./Math-7a8129d6","./PolygonGeometryLibrary-340be930","./PolygonPipeline-be37706f","./PixelFormat-d198afce","./WebGLConstants-95ceb4e9","./RuntimeError-88a32665","./IntersectionTests-afc06c64","./Plane-fd9e13db","./AttributeCompression-3961575e","./EncodedCartesian3-c7ed7a62","./arrayRemoveDuplicates-6dfd408b","./EllipsoidRhumbLine-2550c0e1"],function(v,c,E,A,_,e,G,L,T,H,O,C,D,x,I,w,t,i,r,o,n,a,l,s,y){"use strict";var R=[],S=[];function k(e,t,i,r,o){var n,a,l=L.EllipsoidTangentPlane.fromPoints(t,e).projectPointsOntoPlane(t,R);w.PolygonPipeline.computeWindingOrder2D(l)===w.WindingOrder.CLOCKWISE&&(l.reverse(),t=t.slice().reverse());var s=t.length,y=0;if(r)for(n=new Float64Array(2*s*3),a=0;a<s;a++){var u=t[a],p=t[(a+1)%s];n[y++]=u.x,n[y++]=u.y,n[y++]=u.z,n[y++]=p.x,n[y++]=p.y,n[y++]=p.z}else{var d=0;if(o===E.ArcType.GEODESIC)for(a=0;a<s;a++)d+=I.PolygonGeometryLibrary.subdivideLineCount(t[a],t[(a+1)%s],i);else if(o===E.ArcType.RHUMB)for(a=0;a<s;a++)d+=I.PolygonGeometryLibrary.subdivideRhumbLineCount(e,t[a],t[(a+1)%s],i);for(n=new Float64Array(3*d),a=0;a<s;a++){var c;o===E.ArcType.GEODESIC?c=I.PolygonGeometryLibrary.subdivideLine(t[a],t[(a+1)%s],i,S):o===E.ArcType.RHUMB&&(c=I.PolygonGeometryLibrary.subdivideRhumbLine(e,t[a],t[(a+1)%s],i,S));for(var f=c.length,g=0;g<f;++g)n[y++]=c[g]}}var h=2*(s=n.length/3),m=D.IndexDatatype.createTypedArray(s,h);for(a=y=0;a<s-1;a++)m[y++]=a,m[y++]=a+1;return m[y++]=s-1,m[y++]=0,new O.GeometryInstance({geometry:new T.Geometry({attributes:new H.GeometryAttributes({position:new T.GeometryAttribute({componentDatatype:G.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:n})}),indices:m,primitiveType:T.PrimitiveType.LINES})})}function N(e,t,i,r,o){var n,a,l=L.EllipsoidTangentPlane.fromPoints(t,e).projectPointsOntoPlane(t,R);w.PolygonPipeline.computeWindingOrder2D(l)===w.WindingOrder.CLOCKWISE&&(l.reverse(),t=t.slice().reverse());var s=t.length,y=new Array(s),u=0;if(r)for(n=new Float64Array(2*s*3*2),a=0;a<s;++a){y[a]=u/3;var p=t[a],d=t[(a+1)%s];n[u++]=p.x,n[u++]=p.y,n[u++]=p.z,n[u++]=d.x,n[u++]=d.y,n[u++]=d.z}else{var c=0;if(o===E.ArcType.GEODESIC)for(a=0;a<s;a++)c+=I.PolygonGeometryLibrary.subdivideLineCount(t[a],t[(a+1)%s],i);else if(o===E.ArcType.RHUMB)for(a=0;a<s;a++)c+=I.PolygonGeometryLibrary.subdivideRhumbLineCount(e,t[a],t[(a+1)%s],i);for(n=new Float64Array(3*c*2),a=0;a<s;++a){var f;y[a]=u/3,o===E.ArcType.GEODESIC?f=I.PolygonGeometryLibrary.subdivideLine(t[a],t[(a+1)%s],i,S):o===E.ArcType.RHUMB&&(f=I.PolygonGeometryLibrary.subdivideRhumbLine(e,t[a],t[(a+1)%s],i,S));for(var g=f.length,h=0;h<g;++h)n[u++]=f[h]}}s=n.length/6;var m=y.length,b=2*(2*s+m),P=D.IndexDatatype.createTypedArray(s+m,b);for(a=u=0;a<s;++a)P[u++]=a,P[u++]=(a+1)%s,P[u++]=a+s,P[u++]=(a+1)%s+s;for(a=0;a<m;a++){var v=y[a];P[u++]=v,P[u++]=v+s}return new O.GeometryInstance({geometry:new T.Geometry({attributes:new H.GeometryAttributes({position:new T.GeometryAttribute({componentDatatype:G.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:n})}),indices:P,primitiveType:T.PrimitiveType.LINES})})}function f(e){var t=e.polygonHierarchy,i=v.defaultValue(e.ellipsoid,c.Ellipsoid.WGS84),r=v.defaultValue(e.granularity,x.CesiumMath.RADIANS_PER_DEGREE),o=v.defaultValue(e.perPositionHeight,!1),n=o&&v.defined(e.extrudedHeight),a=v.defaultValue(e.arcType,E.ArcType.GEODESIC),l=v.defaultValue(e.height,0),s=v.defaultValue(e.extrudedHeight,l);if(!n){var y=Math.max(l,s);s=Math.min(l,s),l=y}this._ellipsoid=c.Ellipsoid.clone(i),this._granularity=r,this._height=l,this._extrudedHeight=s,this._arcType=a,this._polygonHierarchy=t,this._perPositionHeight=o,this._perPositionHeightExtrude=n,this._offsetAttribute=e.offsetAttribute,this._workerName="createPolygonOutlineGeometry",this.packedLength=I.PolygonGeometryLibrary.computeHierarchyPackedLength(t)+c.Ellipsoid.packedLength+8}f.pack=function(e,t,i){return i=v.defaultValue(i,0),i=I.PolygonGeometryLibrary.packPolygonHierarchy(e._polygonHierarchy,t,i),c.Ellipsoid.pack(e._ellipsoid,t,i),i+=c.Ellipsoid.packedLength,t[i++]=e._height,t[i++]=e._extrudedHeight,t[i++]=e._granularity,t[i++]=e._perPositionHeightExtrude?1:0,t[i++]=e._perPositionHeight?1:0,t[i++]=e._arcType,t[i++]=v.defaultValue(e._offsetAttribute,-1),t[i]=e.packedLength,t};var g=c.Ellipsoid.clone(c.Ellipsoid.UNIT_SPHERE),h={polygonHierarchy:{}};return f.unpack=function(e,t,i){t=v.defaultValue(t,0);var r=I.PolygonGeometryLibrary.unpackPolygonHierarchy(e,t);t=r.startingIndex,delete r.startingIndex;var o=c.Ellipsoid.unpack(e,t,g);t+=c.Ellipsoid.packedLength;var n=e[t++],a=e[t++],l=e[t++],s=1===e[t++],y=1===e[t++],u=e[t++],p=e[t++],d=e[t];return v.defined(i)||(i=new f(h)),i._polygonHierarchy=r,i._ellipsoid=c.Ellipsoid.clone(o,i._ellipsoid),i._height=n,i._extrudedHeight=a,i._granularity=l,i._perPositionHeight=y,i._perPositionHeightExtrude=s,i._arcType=u,i._offsetAttribute=-1===p?void 0:p,i.packedLength=d,i},f.fromPositions=function(e){return new f({polygonHierarchy:{positions:(e=v.defaultValue(e,v.defaultValue.EMPTY_OBJECT)).positions},height:e.height,extrudedHeight:e.extrudedHeight,ellipsoid:e.ellipsoid,granularity:e.granularity,perPositionHeight:e.perPositionHeight,arcType:e.arcType,offsetAttribute:e.offsetAttribute})},f.createGeometry=function(e){var t=e._ellipsoid,i=e._granularity,r=e._polygonHierarchy,o=e._perPositionHeight,n=e._arcType,a=I.PolygonGeometryLibrary.polygonOutlinesFromHierarchy(r,!o,t);if(0!==a.length){var l,s,y,u=[],p=x.CesiumMath.chordLength(i,t.maximumRadius),d=e._height,c=e._extrudedHeight;if(e._perPositionHeightExtrude||!x.CesiumMath.equalsEpsilon(d,c,0,x.CesiumMath.EPSILON2))for(y=0;y<a.length;y++){if((l=N(t,a[y],p,o,n)).geometry=I.PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(l.geometry,d,c,t,o),v.defined(e._offsetAttribute)){var f=l.geometry.attributes.position.values.length/3,g=new Uint8Array(f);g=e._offsetAttribute===A.GeometryOffsetAttribute.TOP?A.arrayFill(g,1,0,f/2):(s=e._offsetAttribute===A.GeometryOffsetAttribute.NONE?0:1,A.arrayFill(g,s)),l.geometry.attributes.applyOffset=new T.GeometryAttribute({componentDatatype:G.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:g})}u.push(l)}else for(y=0;y<a.length;y++){if((l=k(t,a[y],p,o,n)).geometry.attributes.position.values=w.PolygonPipeline.scaleToGeodeticHeight(l.geometry.attributes.position.values,d,t,!o),v.defined(e._offsetAttribute)){var h=l.geometry.attributes.position.values.length,m=new Uint8Array(h/3);s=e._offsetAttribute===A.GeometryOffsetAttribute.NONE?0:1,A.arrayFill(m,s),l.geometry.attributes.applyOffset=new T.GeometryAttribute({componentDatatype:G.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:m})}u.push(l)}var b=C.GeometryPipeline.combineInstances(u)[0],P=_.BoundingSphere.fromVertices(b.attributes.position.values);return new T.Geometry({attributes:b.attributes,indices:b.indices,primitiveType:b.primitiveType,boundingSphere:P,offsetAttribute:e._offsetAttribute})}},function(e,t){return v.defined(t)&&(e=f.unpack(e,t)),e._ellipsoid=c.Ellipsoid.clone(e._ellipsoid),f.createGeometry(e)}});
|