define(["./GeometryOffsetAttribute-718fa138","./arrayRemoveDuplicates-6dfd408b","./Transforms-b51fdb37","./Rectangle-82621db8","./Check-24483042","./ComponentDatatype-1a100acd","./PolylineVolumeGeometryLibrary-41961142","./CorridorGeometryLibrary-7c88b7a9","./when-54335d57","./GeometryAttribute-02fdce7a","./GeometryAttributes-caa08d6c","./IndexDatatype-edb2f4d6","./Math-7a8129d6","./PolygonPipeline-be37706f","./RuntimeError-88a32665","./PixelFormat-d198afce","./WebGLConstants-95ceb4e9","./EllipsoidTangentPlane-3e9e5847","./IntersectionTests-afc06c64","./Plane-fd9e13db","./PolylinePipeline-c53252ef","./EllipsoidGeodesic-2a3101f9","./EllipsoidRhumbLine-2550c0e1"],function(E,c,g,M,e,B,F,U,Y,q,W,J,b,C,t,i,r,o,a,n,s,l,d){"use strict";var j=new M.Cartesian3,z=new M.Cartesian3,K=new M.Cartesian3;function G(e,t){var i,r,o,a=[],n=e.positions,s=e.corners,l=e.endPositions,d=new W.GeometryAttributes,u=0,p=0,f=0;for(r=0;r<n.length;r+=2)u+=o=n[r].length-3,f+=o/3*4,p+=n[r+1].length-3;for(u+=3,p+=3,r=0;r<s.length;r++){i=s[r];var h=s[r].leftPositions;Y.defined(h)?u+=o=h.length:p+=o=s[r].rightPositions.length,f+=o/3*2}var y,c=Y.defined(l);c&&(u+=y=l[0].length-3,p+=y,f+=4*(y/=3));var g,b,m,v,A,_,E=u+p,C=new Float64Array(E),G=0,P=E-1,T=y/2,w=J.IndexDatatype.createTypedArray(E/3,f+4),L=0;if(w[L++]=G/3,w[L++]=(P-2)/3,c){a.push(G/3),_=j,A=z;var D=l[0];for(r=0;r<T;r++)_=M.Cartesian3.fromArray(D,3*(T-1-r),_),A=M.Cartesian3.fromArray(D,3*(T+r),A),U.CorridorGeometryLibrary.addAttribute(C,A,G),U.CorridorGeometryLibrary.addAttribute(C,_,void 0,P),v=(b=G/3)+1,m=(g=(P-2)/3)-1,w[L++]=g,w[L++]=m,w[L++]=b,w[L++]=v,G+=3,P-=3}var k=0,x=n[k++],N=n[k++];for(C.set(x,G),C.set(N,P-N.length+1),o=N.length-3,a.push(G/3,(P-2)/3),r=0;r<o;r+=3)v=(b=G/3)+1,m=(g=(P-2)/3)-1,w[L++]=g,w[L++]=m,w[L++]=b,w[L++]=v,G+=3,P-=3;for(r=0;r<s.length;r++){var O,V,H=(i=s[r]).leftPositions,I=i.rightPositions,R=K;if(Y.defined(H)){for(P-=3,V=m,a.push(v),O=0;O<H.length/3;O++)R=M.Cartesian3.fromArray(H,3*O,R),w[L++]=V-O-1,w[L++]=V-O,U.CorridorGeometryLibrary.addAttribute(C,R,void 0,P),P-=3;a.push(V-Math.floor(H.length/6)),t===F.CornerType.BEVELED&&a.push((P-2)/3+1),G+=3}else{for(G+=3,V=v,a.push(m),O=0;O<I.length/3;O++)R=M.Cartesian3.fromArray(I,3*O,R),w[L++]=V+O,w[L++]=V+O+1,U.CorridorGeometryLibrary.addAttribute(C,R,G),G+=3;a.push(V+Math.floor(I.length/6)),t===F.CornerType.BEVELED&&a.push(G/3-1),P-=3}for(x=n[k++],N=n[k++],x.splice(0,3),N.splice(N.length-3,3),C.set(x,G),C.set(N,P-N.length+1),o=N.length-3,O=0;O<N.length;O+=3)b=(v=G/3)-1,g=(m=(P-2)/3)+1,w[L++]=g,w[L++]=m,w[L++]=b,w[L++]=v,G+=3,P-=3;G-=3,P+=3,a.push(G/3,(P-2)/3)}if(c){G+=3,P-=3,_=j,A=z;var S=l[1];for(r=0;r<T;r++)_=M.Cartesian3.fromArray(S,3*(y-r-1),_),A=M.Cartesian3.fromArray(S,3*r,A),U.CorridorGeometryLibrary.addAttribute(C,_,void 0,P),U.CorridorGeometryLibrary.addAttribute(C,A,G),b=(v=G/3)-1,g=(m=(P-2)/3)+1,w[L++]=g,w[L++]=m,w[L++]=b,w[L++]=v,G+=3,P-=3;a.push(G/3)}else a.push(G/3,(P-2)/3);return w[L++]=G/3,w[L++]=(P-2)/3,d.position=new q.GeometryAttribute({componentDatatype:B.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:C}),{attributes:d,indices:w,wallIndices:a}}function h(e){var t=(e=Y.defaultValue(e,Y.defaultValue.EMPTY_OBJECT)).positions,i=e.width,r=Y.defaultValue(e.height,0),o=Y.defaultValue(e.extrudedHeight,r);this._positions=t,this._ellipsoid=M.Ellipsoid.clone(Y.defaultValue(e.ellipsoid,M.Ellipsoid.WGS84)),this._width=i,this._height=Math.max(r,o),this._extrudedHeight=Math.min(r,o),this._cornerType=Y.defaultValue(e.cornerType,F.CornerType.ROUNDED),this._granularity=Y.defaultValue(e.granularity,b.CesiumMath.RADIANS_PER_DEGREE),this._offsetAttribute=e.offsetAttribute,this._workerName="createCorridorOutlineGeometry",this.packedLength=1+t.length*M.Cartesian3.packedLength+M.Ellipsoid.packedLength+6}h.pack=function(e,t,i){i=Y.defaultValue(i,0);var r=e._positions,o=r.length;t[i++]=o;for(var a=0;a<o;++a,i+=M.Cartesian3.packedLength)M.Cartesian3.pack(r[a],t,i);return M.Ellipsoid.pack(e._ellipsoid,t,i),i+=M.Ellipsoid.packedLength,t[i++]=e._width,t[i++]=e._height,t[i++]=e._extrudedHeight,t[i++]=e._cornerType,t[i++]=e._granularity,t[i]=Y.defaultValue(e._offsetAttribute,-1),t};var y=M.Ellipsoid.clone(M.Ellipsoid.UNIT_SPHERE),m={positions:void 0,ellipsoid:y,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,offsetAttribute:void 0};return h.unpack=function(e,t,i){t=Y.defaultValue(t,0);for(var r=e[t++],o=new Array(r),a=0;a<r;++a,t+=M.Cartesian3.packedLength)o[a]=M.Cartesian3.unpack(e,t);var n=M.Ellipsoid.unpack(e,t,y);t+=M.Ellipsoid.packedLength;var s=e[t++],l=e[t++],d=e[t++],u=e[t++],p=e[t++],f=e[t];return Y.defined(i)?(i._positions=o,i._ellipsoid=M.Ellipsoid.clone(n,i._ellipsoid),i._width=s,i._height=l,i._extrudedHeight=d,i._cornerType=u,i._granularity=p,i._offsetAttribute=-1===f?void 0:f,i):(m.positions=o,m.width=s,m.height=l,m.extrudedHeight=d,m.cornerType=u,m.granularity=p,m.offsetAttribute=-1===f?void 0:f,new h(m))},h.createGeometry=function(e){var t=e._positions,i=e._width,r=e._ellipsoid;t=function(e,t){for(var i=0;i<e.length;i++)e[i]=t.scaleToGeodeticSurface(e[i],e[i]);return e}(t,r);var o=c.arrayRemoveDuplicates(t,M.Cartesian3.equalsEpsilon);if(!(o.length<2||i<=0)){var a,n=e._height,s=e._extrudedHeight,l=!b.CesiumMath.equalsEpsilon(n,s,0,b.CesiumMath.EPSILON2),d={ellipsoid:r,positions:o,width:i,cornerType:e._cornerType,granularity:e._granularity,saveAttributes:!1};if(l)d.height=n,d.extrudedHeight=s,d.offsetAttribute=e._offsetAttribute,a=function(e){var t=e.ellipsoid,i=G(U.CorridorGeometryLibrary.computePositions(e),e.cornerType),r=i.wallIndices,o=e.height,a=e.extrudedHeight,n=i.attributes,s=i.indices,l=n.position.values,d=l.length,u=new Float64Array(d);u.set(l);var p,f=new Float64Array(2*d);if(l=C.PolygonPipeline.scaleToGeodeticHeight(l,o,t),u=C.PolygonPipeline.scaleToGeodeticHeight(u,a,t),f.set(l),f.set(u,d),n.position.values=f,d/=3,Y.defined(e.offsetAttribute)){var h=new Uint8Array(2*d);if(e.offsetAttribute===E.GeometryOffsetAttribute.TOP)h=E.arrayFill(h,1,0,d);else{var y=e.offsetAttribute===E.GeometryOffsetAttribute.NONE?0:1;h=E.arrayFill(h,y)}n.applyOffset=new q.GeometryAttribute({componentDatatype:B.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:h})}var c=s.length,g=J.IndexDatatype.createTypedArray(f.length/3,2*(c+r.length));g.set(s);var b,m,v=c;for(p=0;p<c;p+=2){var A=s[p],_=s[p+1];g[v++]=A+d,g[v++]=_+d}for(p=0;p<r.length;p++)m=(b=r[p])+d,g[v++]=b,g[v++]=m;return{attributes:n,indices:g}}(d);else if((a=G(U.CorridorGeometryLibrary.computePositions(d),d.cornerType)).attributes.position.values=C.PolygonPipeline.scaleToGeodeticHeight(a.attributes.position.values,n,r),Y.defined(e._offsetAttribute)){var u=a.attributes.position.values.length,p=new Uint8Array(u/3),f=e._offsetAttribute===E.GeometryOffsetAttribute.NONE?0:1;E.arrayFill(p,f),a.attributes.applyOffset=new q.GeometryAttribute({componentDatatype:B.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:p})}var h=a.attributes,y=g.BoundingSphere.fromVertices(h.position.values,void 0,3);return new q.Geometry({attributes:h,indices:a.indices,primitiveType:q.PrimitiveType.LINES,boundingSphere:y,offsetAttribute:e._offsetAttribute})}},function(e,t){return Y.defined(t)&&(e=h.unpack(e,t)),e._ellipsoid=M.Ellipsoid.clone(e._ellipsoid),h.createGeometry(e)}});
|