define(["./defined-b9ff0e39","./Check-e6691f86","./freezeObject-2d5b18ce","./defaultValue-199f5aa8","./Math-92bd3539","./Cartesian2-8fa798b8","./defineProperties-ae15c9d5","./Transforms-a140c8a7","./RuntimeError-d5522ee3","./WebGLConstants-554ddbe2","./ComponentDatatype-569c1e3e","./GeometryAttribute-928dddaf","./when-c208a7cf","./GeometryAttributes-c3465b51","./IndexDatatype-7119db15","./GeometryOffsetAttribute-0abfa3f6","./EllipsoidRhumbLine-fb5cc30d","./PolygonPipeline-7e1a6f3b","./RectangleGeometryLibrary-9182c07c"],function(h,e,t,d,y,c,i,b,a,r,E,A,n,G,R,m,o,P,w){"use strict";var _=new b.BoundingSphere,v=new b.BoundingSphere,L=new c.Cartesian3,C=new c.Rectangle;function D(e,t){var i=e._ellipsoid,a=t.height,r=t.width,n=t.northCap,o=t.southCap,l=a,u=2,s=0,d=4;n&&(u-=1,l-=1,s+=1,d-=2),o&&(u-=1,l-=1,s+=1,d-=2),s+=u*r+2*l-d;var c,p=new Float64Array(3*s),f=0,g=0,h=L;if(n)w.RectangleGeometryLibrary.computePosition(t,i,!1,g,0,h),p[f++]=h.x,p[f++]=h.y,p[f++]=h.z;else for(c=0;c<r;c++)w.RectangleGeometryLibrary.computePosition(t,i,!1,g,c,h),p[f++]=h.x,p[f++]=h.y,p[f++]=h.z;for(c=r-1,g=1;g<a;g++)w.RectangleGeometryLibrary.computePosition(t,i,!1,g,c,h),p[f++]=h.x,p[f++]=h.y,p[f++]=h.z;if(g=a-1,!o)for(c=r-2;0<=c;c--)w.RectangleGeometryLibrary.computePosition(t,i,!1,g,c,h),p[f++]=h.x,p[f++]=h.y,p[f++]=h.z;for(c=0,g=a-2;0<g;g--)w.RectangleGeometryLibrary.computePosition(t,i,!1,g,c,h),p[f++]=h.x,p[f++]=h.y,p[f++]=h.z;for(var y=p.length/3*2,b=R.IndexDatatype.createTypedArray(p.length/3,y),m=0,_=0;_<p.length/3-1;_++)b[m++]=_,b[m++]=_+1;b[m++]=p.length/3-1,b[m++]=0;var v=new A.Geometry({attributes:new G.GeometryAttributes,primitiveType:A.PrimitiveType.LINES});return v.attributes.position=new A.GeometryAttribute({componentDatatype:E.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:p}),v.indices=b,v}function p(e){var t=(e=d.defaultValue(e,d.defaultValue.EMPTY_OBJECT)).rectangle,i=d.defaultValue(e.granularity,y.CesiumMath.RADIANS_PER_DEGREE),a=d.defaultValue(e.ellipsoid,c.Ellipsoid.WGS84),r=d.defaultValue(e.rotation,0),n=d.defaultValue(e.height,0),o=d.defaultValue(e.extrudedHeight,n);this._rectangle=c.Rectangle.clone(t),this._granularity=i,this._ellipsoid=a,this._surfaceHeight=Math.max(n,o),this._rotation=r,this._extrudedHeight=Math.min(n,o),this._offsetAttribute=e.offsetAttribute,this._workerName="createRectangleOutlineGeometry"}p.packedLength=c.Rectangle.packedLength+c.Ellipsoid.packedLength+5,p.pack=function(e,t,i){return i=d.defaultValue(i,0),c.Rectangle.pack(e._rectangle,t,i),i+=c.Rectangle.packedLength,c.Ellipsoid.pack(e._ellipsoid,t,i),i+=c.Ellipsoid.packedLength,t[i++]=e._granularity,t[i++]=e._surfaceHeight,t[i++]=e._rotation,t[i++]=e._extrudedHeight,t[i]=d.defaultValue(e._offsetAttribute,-1),t};var f=new c.Rectangle,g=c.Ellipsoid.clone(c.Ellipsoid.UNIT_SPHERE),x={rectangle:f,ellipsoid:g,granularity:void 0,height:void 0,rotation:void 0,extrudedHeight:void 0,offsetAttribute:void 0};p.unpack=function(e,t,i){t=d.defaultValue(t,0);var a=c.Rectangle.unpack(e,t,f);t+=c.Rectangle.packedLength;var r=c.Ellipsoid.unpack(e,t,g);t+=c.Ellipsoid.packedLength;var n=e[t++],o=e[t++],l=e[t++],u=e[t++],s=e[t];return h.defined(i)?(i._rectangle=c.Rectangle.clone(a,i._rectangle),i._ellipsoid=c.Ellipsoid.clone(r,i._ellipsoid),i._surfaceHeight=o,i._rotation=l,i._extrudedHeight=u,i._offsetAttribute=-1===s?void 0:s,i):(x.granularity=n,x.height=o,x.rotation=l,x.extrudedHeight=u,x.offsetAttribute=-1===s?void 0:s,new p(x))};var H=new c.Cartographic;return p.createGeometry=function(e){var t,i,a=e._rectangle,r=e._ellipsoid,n=w.RectangleGeometryLibrary.computeOptions(a,e._granularity,e._rotation,0,C,H);if(!y.CesiumMath.equalsEpsilon(a.north,a.south,y.CesiumMath.EPSILON10)&&!y.CesiumMath.equalsEpsilon(a.east,a.west,y.CesiumMath.EPSILON10)){var o,l=e._surfaceHeight,u=e._extrudedHeight;if(!y.CesiumMath.equalsEpsilon(l,u,0,y.CesiumMath.EPSILON2)){if(t=function(e,t){var i=e._surfaceHeight,a=e._extrudedHeight,r=e._ellipsoid,n=a,o=i,l=D(e,t),u=t.height,s=t.width,d=P.PolygonPipeline.scaleToGeodeticHeight(l.attributes.position.values,o,r,!1),c=d.length,p=new Float64Array(2*c);p.set(d);var f=P.PolygonPipeline.scaleToGeodeticHeight(l.attributes.position.values,n,r);p.set(f,c),l.attributes.position.values=p;var g=t.northCap,h=t.southCap,y=4;g&&(y-=1),h&&(y-=1);var b=2*(p.length/3+y),m=R.IndexDatatype.createTypedArray(p.length/3,b);c=p.length/6;for(var _,v=0,E=0;E<c-1;E++)m[v++]=E,m[v++]=E+1,m[v++]=E+c,m[v++]=E+c+1;if(m[v++]=c-1,m[v++]=0,m[v++]=c+c-1,m[v++]=c,m[v++]=0,m[v++]=c,g)_=u-1;else{var A=s-1;m[v++]=A,m[v++]=A+c,_=s+u-2}if(m[v++]=_,m[v++]=_+c,!h){var G=s+_-1;m[v++]=G,m[v]=G+c}return l.indices=m,l}(e,n),h.defined(e._offsetAttribute)){var s=t.attributes.position.values.length/3,d=new Uint8Array(s);d=e._offsetAttribute===m.GeometryOffsetAttribute.TOP?m.arrayFill(d,1,0,s/2):(o=e._offsetAttribute===m.GeometryOffsetAttribute.NONE?0:1,m.arrayFill(d,o)),t.attributes.applyOffset=new A.GeometryAttribute({componentDatatype:E.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:d})}var c=b.BoundingSphere.fromRectangle3D(a,r,l,v),p=b.BoundingSphere.fromRectangle3D(a,r,u,_);i=b.BoundingSphere.union(c,p)}else{if((t=D(e,n)).attributes.position.values=P.PolygonPipeline.scaleToGeodeticHeight(t.attributes.position.values,l,r,!1),h.defined(e._offsetAttribute)){var f=t.attributes.position.values.length,g=new Uint8Array(f/3);o=e._offsetAttribute===m.GeometryOffsetAttribute.NONE?0:1,m.arrayFill(g,o),t.attributes.applyOffset=new A.GeometryAttribute({componentDatatype:E.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:g})}i=b.BoundingSphere.fromRectangle3D(a,r,l)}return new A.Geometry({attributes:t.attributes,indices:t.indices,primitiveType:A.PrimitiveType.LINES,boundingSphere:i,offsetAttribute:e._offsetAttribute})}},function(e,t){return h.defined(t)&&(e=p.unpack(e,t)),e._ellipsoid=c.Ellipsoid.clone(e._ellipsoid),e._rectangle=c.Rectangle.clone(e._rectangle),p.createGeometry(e)}});
|