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","./IntersectionTests-260c9bf6","./Plane-b9a516bb","./GeometryOffsetAttribute-0abfa3f6","./arrayRemoveDuplicates-1efed288","./EllipsoidTangentPlane-9b89fc6c","./EllipsoidRhumbLine-fb5cc30d","./PolygonPipeline-7e1a6f3b","./PolylineVolumeGeometryLibrary-54b0f9f3","./EllipsoidGeodesic-b8e7c0c6","./PolylinePipeline-cb1c5b79","./CorridorGeometryLibrary-ee1b7b0c"],function(R,e,t,h,c,B,i,b,r,o,U,F,a,Y,q,n,s,E,g,l,d,C,W,u,f,j){"use strict";var z=new B.Cartesian3,J=new B.Cartesian3,K=new B.Cartesian3;function G(e,t){var i,r,o,a=[],n=e.positions,s=e.corners,l=e.endPositions,d=new Y.GeometryAttributes,u=0,f=0,p=0;for(r=0;r<n.length;r+=2)u+=o=n[r].length-3,p+=o/3*4,f+=n[r+1].length-3;for(u+=3,f+=3,r=0;r<s.length;r++){i=s[r];var h=s[r].leftPositions;R.defined(h)?u+=o=h.length:f+=o=s[r].rightPositions.length,p+=o/3*2}var y,c=R.defined(l);c&&(u+=y=l[0].length-3,f+=y,p+=4*(y/=3));var b,g,m,v,A,_,E=u+f,C=new Float64Array(E),G=0,P=E-1,T=y/2,w=q.IndexDatatype.createTypedArray(E/3,p+4),L=0;if(w[L++]=G/3,w[L++]=(P-2)/3,c){a.push(G/3),_=z,A=J;var D=l[0];for(r=0;r<T;r++)_=B.Cartesian3.fromArray(D,3*(T-1-r),_),A=B.Cartesian3.fromArray(D,3*(T+r),A),j.CorridorGeometryLibrary.addAttribute(C,A,G),j.CorridorGeometryLibrary.addAttribute(C,_,void 0,P),v=(g=G/3)+1,m=(b=(P-2)/3)-1,w[L++]=b,w[L++]=m,w[L++]=g,w[L++]=v,G+=3,P-=3}var k=0,O=n[k++],V=n[k++];for(C.set(O,G),C.set(V,P-V.length+1),o=V.length-3,a.push(G/3,(P-2)/3),r=0;r<o;r+=3)v=(g=G/3)+1,m=(b=(P-2)/3)-1,w[L++]=b,w[L++]=m,w[L++]=g,w[L++]=v,G+=3,P-=3;for(r=0;r<s.length;r++){var N,x,H=(i=s[r]).leftPositions,I=i.rightPositions,S=K;if(R.defined(H)){for(P-=3,x=m,a.push(v),N=0;N<H.length/3;N++)S=B.Cartesian3.fromArray(H,3*N,S),w[L++]=x-N-1,w[L++]=x-N,j.CorridorGeometryLibrary.addAttribute(C,S,void 0,P),P-=3;a.push(x-Math.floor(H.length/6)),t===W.CornerType.BEVELED&&a.push((P-2)/3+1),G+=3}else{for(G+=3,x=v,a.push(m),N=0;N<I.length/3;N++)S=B.Cartesian3.fromArray(I,3*N,S),w[L++]=x+N,w[L++]=x+N+1,j.CorridorGeometryLibrary.addAttribute(C,S,G),G+=3;a.push(x+Math.floor(I.length/6)),t===W.CornerType.BEVELED&&a.push(G/3-1),P-=3}for(O=n[k++],V=n[k++],O.splice(0,3),V.splice(V.length-3,3),C.set(O,G),C.set(V,P-V.length+1),o=V.length-3,N=0;N<V.length;N+=3)g=(v=G/3)-1,b=(m=(P-2)/3)+1,w[L++]=b,w[L++]=m,w[L++]=g,w[L++]=v,G+=3,P-=3;G-=3,P+=3,a.push(G/3,(P-2)/3)}if(c){G+=3,P-=3,_=z,A=J;var M=l[1];for(r=0;r<T;r++)_=B.Cartesian3.fromArray(M,3*(y-r-1),_),A=B.Cartesian3.fromArray(M,3*r,A),j.CorridorGeometryLibrary.addAttribute(C,_,void 0,P),j.CorridorGeometryLibrary.addAttribute(C,A,G),g=(v=G/3)-1,b=(m=(P-2)/3)+1,w[L++]=b,w[L++]=m,w[L++]=g,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 F.GeometryAttribute({componentDatatype:U.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:C}),{attributes:d,indices:w,wallIndices:a}}function y(e){var t=(e=h.defaultValue(e,h.defaultValue.EMPTY_OBJECT)).positions,i=e.width,r=h.defaultValue(e.height,0),o=h.defaultValue(e.extrudedHeight,r);this._positions=t,this._ellipsoid=B.Ellipsoid.clone(h.defaultValue(e.ellipsoid,B.Ellipsoid.WGS84)),this._width=i,this._height=Math.max(r,o),this._extrudedHeight=Math.min(r,o),this._cornerType=h.defaultValue(e.cornerType,W.CornerType.ROUNDED),this._granularity=h.defaultValue(e.granularity,c.CesiumMath.RADIANS_PER_DEGREE),this._offsetAttribute=e.offsetAttribute,this._workerName="createCorridorOutlineGeometry",this.packedLength=1+t.length*B.Cartesian3.packedLength+B.Ellipsoid.packedLength+6}y.pack=function(e,t,i){i=h.defaultValue(i,0);var r=e._positions,o=r.length;t[i++]=o;for(var a=0;a<o;++a,i+=B.Cartesian3.packedLength)B.Cartesian3.pack(r[a],t,i);return B.Ellipsoid.pack(e._ellipsoid,t,i),i+=B.Ellipsoid.packedLength,t[i++]=e._width,t[i++]=e._height,t[i++]=e._extrudedHeight,t[i++]=e._cornerType,t[i++]=e._granularity,t[i]=h.defaultValue(e._offsetAttribute,-1),t};var m=B.Ellipsoid.clone(B.Ellipsoid.UNIT_SPHERE),v={positions:void 0,ellipsoid:m,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,offsetAttribute:void 0};return y.unpack=function(e,t,i){t=h.defaultValue(t,0);for(var r=e[t++],o=new Array(r),a=0;a<r;++a,t+=B.Cartesian3.packedLength)o[a]=B.Cartesian3.unpack(e,t);var n=B.Ellipsoid.unpack(e,t,m);t+=B.Ellipsoid.packedLength;var s=e[t++],l=e[t++],d=e[t++],u=e[t++],f=e[t++],p=e[t];return R.defined(i)?(i._positions=o,i._ellipsoid=B.Ellipsoid.clone(n,i._ellipsoid),i._width=s,i._height=l,i._extrudedHeight=d,i._cornerType=u,i._granularity=f,i._offsetAttribute=-1===p?void 0:p,i):(v.positions=o,v.width=s,v.height=l,v.extrudedHeight=d,v.cornerType=u,v.granularity=f,v.offsetAttribute=-1===p?void 0:p,new y(v))},y.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=g.arrayRemoveDuplicates(t,B.Cartesian3.equalsEpsilon);if(!(o.length<2||i<=0)){var a,n=e._height,s=e._extrudedHeight,l=!c.CesiumMath.equalsEpsilon(n,s,0,c.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(j.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 f,p=new Float64Array(2*d);if(l=C.PolygonPipeline.scaleToGeodeticHeight(l,o,t),u=C.PolygonPipeline.scaleToGeodeticHeight(u,a,t),p.set(l),p.set(u,d),n.position.values=p,d/=3,R.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 F.GeometryAttribute({componentDatatype:U.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:h})}var c=s.length,b=q.IndexDatatype.createTypedArray(p.length/3,2*(c+r.length));b.set(s);var g,m,v=c;for(f=0;f<c;f+=2){var A=s[f],_=s[f+1];b[v++]=A+d,b[v++]=_+d}for(f=0;f<r.length;f++)m=(g=r[f])+d,b[v++]=g,b[v++]=m;return{attributes:n,indices:b}}(d);else if((a=G(j.CorridorGeometryLibrary.computePositions(d),d.cornerType)).attributes.position.values=C.PolygonPipeline.scaleToGeodeticHeight(a.attributes.position.values,n,r),R.defined(e._offsetAttribute)){var u=a.attributes.position.values.length,f=new Uint8Array(u/3),p=e._offsetAttribute===E.GeometryOffsetAttribute.NONE?0:1;E.arrayFill(f,p),a.attributes.applyOffset=new F.GeometryAttribute({componentDatatype:U.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:f})}var h=a.attributes,y=b.BoundingSphere.fromVertices(h.position.values,void 0,3);return new F.Geometry({attributes:h,indices:a.indices,primitiveType:F.PrimitiveType.LINES,boundingSphere:y,offsetAttribute:e._offsetAttribute})}},function(e,t){return R.defined(t)&&(e=y.unpack(e,t)),e._ellipsoid=B.Ellipsoid.clone(e._ellipsoid),y.createGeometry(e)}});
|