define(["./when-54335d57","./Rectangle-82621db8","./ArcType-2b58731c","./arrayRemoveDuplicates-6dfd408b","./Transforms-b51fdb37","./Color-3a9dd5fe","./ComponentDatatype-1a100acd","./Check-24483042","./GeometryAttribute-02fdce7a","./GeometryAttributes-caa08d6c","./IndexDatatype-edb2f4d6","./Math-7a8129d6","./PolylinePipeline-c53252ef","./VertexFormat-81ec7207","./PixelFormat-d198afce","./WebGLConstants-95ceb4e9","./RuntimeError-88a32665","./EllipsoidGeodesic-2a3101f9","./EllipsoidRhumbLine-2550c0e1","./IntersectionTests-afc06c64","./Plane-fd9e13db"],function(J,j,K,Q,X,Z,$,e,ee,te,re,ae,oe,y,t,r,a,o,n,i,l){"use strict";var ne=[];function ie(e,t,r,a,o){var n,i=ne;i.length=o;var l=r.red,s=r.green,p=r.blue,c=r.alpha,d=a.red,u=a.green,y=a.blue,m=a.alpha;if(Z.Color.equals(r,a)){for(n=0;n<o;n++)i[n]=Z.Color.clone(r);return i}var f=(d-l)/o,h=(u-s)/o,v=(y-p)/o,C=(m-c)/o;for(n=0;n<o;n++)i[n]=new Z.Color(l+n*f,s+n*h,p+n*v,c+n*C);return i}function m(e){var t=(e=J.defaultValue(e,J.defaultValue.EMPTY_OBJECT)).positions,r=e.colors,a=J.defaultValue(e.width,1),o=J.defaultValue(e.colorsPerVertex,!1);this._positions=t,this._colors=r,this._width=a,this._colorsPerVertex=o,this._vertexFormat=y.VertexFormat.clone(J.defaultValue(e.vertexFormat,y.VertexFormat.DEFAULT)),this._arcType=J.defaultValue(e.arcType,K.ArcType.GEODESIC),this._granularity=J.defaultValue(e.granularity,ae.CesiumMath.RADIANS_PER_DEGREE),this._ellipsoid=j.Ellipsoid.clone(J.defaultValue(e.ellipsoid,j.Ellipsoid.WGS84)),this._workerName="createPolylineGeometry";var n=1+t.length*j.Cartesian3.packedLength;n+=J.defined(r)?1+r.length*Z.Color.packedLength:1,this.packedLength=n+j.Ellipsoid.packedLength+y.VertexFormat.packedLength+4}m.pack=function(e,t,r){var a;r=J.defaultValue(r,0);var o=e._positions,n=o.length;for(t[r++]=n,a=0;a<n;++a,r+=j.Cartesian3.packedLength)j.Cartesian3.pack(o[a],t,r);var i=e._colors;for(n=J.defined(i)?i.length:0,t[r++]=n,a=0;a<n;++a,r+=Z.Color.packedLength)Z.Color.pack(i[a],t,r);return j.Ellipsoid.pack(e._ellipsoid,t,r),r+=j.Ellipsoid.packedLength,y.VertexFormat.pack(e._vertexFormat,t,r),r+=y.VertexFormat.packedLength,t[r++]=e._width,t[r++]=e._colorsPerVertex?1:0,t[r++]=e._arcType,t[r]=e._granularity,t};var f=j.Ellipsoid.clone(j.Ellipsoid.UNIT_SPHERE),h=new y.VertexFormat,v={positions:void 0,colors:void 0,ellipsoid:f,vertexFormat:h,width:void 0,colorsPerVertex:void 0,arcType:void 0,granularity:void 0};m.unpack=function(e,t,r){var a;t=J.defaultValue(t,0);var o=e[t++],n=new Array(o);for(a=0;a<o;++a,t+=j.Cartesian3.packedLength)n[a]=j.Cartesian3.unpack(e,t);var i=0<(o=e[t++])?new Array(o):void 0;for(a=0;a<o;++a,t+=Z.Color.packedLength)i[a]=Z.Color.unpack(e,t);var l=j.Ellipsoid.unpack(e,t,f);t+=j.Ellipsoid.packedLength;var s=y.VertexFormat.unpack(e,t,h);t+=y.VertexFormat.packedLength;var p=e[t++],c=1===e[t++],d=e[t++],u=e[t];return J.defined(r)?(r._positions=n,r._colors=i,r._ellipsoid=j.Ellipsoid.clone(l,r._ellipsoid),r._vertexFormat=y.VertexFormat.clone(s,r._vertexFormat),r._width=p,r._colorsPerVertex=c,r._arcType=d,r._granularity=u,r):(v.positions=n,v.colors=i,v.width=p,v.colorsPerVertex=c,v.arcType=d,v.granularity=u,new m(v))};var le=new j.Cartesian3,se=new j.Cartesian3,pe=new j.Cartesian3,ce=new j.Cartesian3;return m.createGeometry=function(e){var t,r,a,o=e._width,n=e._vertexFormat,i=e._colors,l=e._colorsPerVertex,s=e._arcType,p=e._granularity,c=e._ellipsoid,d=Q.arrayRemoveDuplicates(e._positions,j.Cartesian3.equalsEpsilon),u=d.length;if(!(u<2||o<=0)){if(s===K.ArcType.GEODESIC||s===K.ArcType.RHUMB){var y,m;m=s===K.ArcType.GEODESIC?(y=ae.CesiumMath.chordLength(p,c.maximumRadius),oe.PolylinePipeline.numberOfPoints):(y=p,oe.PolylinePipeline.numberOfPointsRhumbLine);var f=oe.PolylinePipeline.extractHeights(d,c);if(J.defined(i)){var h=1;for(t=0;t<u-1;++t)h+=m(d[t],d[t+1],y);var v=new Array(h),C=0;for(t=0;t<u-1;++t){var g=d[t],_=d[t+1],A=i[t],E=m(g,_,y);if(l&&t<h){var P=ie(0,0,A,i[t+1],E),b=P.length;for(r=0;r<b;++r)v[C++]=P[r]}else for(r=0;r<E;++r)v[C++]=Z.Color.clone(A)}v[C]=Z.Color.clone(i[i.length-1]),i=v,ne.length=0}d=s===K.ArcType.GEODESIC?oe.PolylinePipeline.generateCartesianArc({positions:d,minDistance:y,ellipsoid:c,height:f}):oe.PolylinePipeline.generateCartesianRhumbArc({positions:d,granularity:y,ellipsoid:c,height:f})}var w,x=4*(u=d.length)-4,T=new Float64Array(3*x),k=new Float64Array(3*x),D=new Float64Array(3*x),V=new Float32Array(2*x),F=n.st?new Float32Array(2*x):void 0,L=J.defined(i)?new Uint8Array(4*x):void 0,G=0,R=0,O=0,I=0;for(r=0;r<u;++r){var S,B;0===r?(w=le,j.Cartesian3.subtract(d[0],d[1],w),j.Cartesian3.add(d[0],w,w)):w=d[r-1],j.Cartesian3.clone(w,pe),j.Cartesian3.clone(d[r],se),r===u-1?(w=le,j.Cartesian3.subtract(d[u-1],d[u-2],w),j.Cartesian3.add(d[u-1],w,w)):w=d[r+1],j.Cartesian3.clone(w,ce),J.defined(L)&&(S=0===r||l?i[r]:i[r-1],r!==u-1&&(B=i[r]));var U=r===u-1?2:4;for(a=0===r?2:0;a<U;++a){j.Cartesian3.pack(se,T,G),j.Cartesian3.pack(pe,k,G),j.Cartesian3.pack(ce,D,G),G+=3;var N=a-2<0?-1:1;if(V[R++]=a%2*2-1,V[R++]=N*o,n.st&&(F[O++]=r/(u-1),F[O++]=Math.max(V[R-2],0)),J.defined(L)){var M=a<2?S:B;L[I++]=Z.Color.floatToByte(M.red),L[I++]=Z.Color.floatToByte(M.green),L[I++]=Z.Color.floatToByte(M.blue),L[I++]=Z.Color.floatToByte(M.alpha)}}}var H=new te.GeometryAttributes;H.position=new ee.GeometryAttribute({componentDatatype:$.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:T}),H.prevPosition=new ee.GeometryAttribute({componentDatatype:$.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:k}),H.nextPosition=new ee.GeometryAttribute({componentDatatype:$.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:D}),H.expandAndWidth=new ee.GeometryAttribute({componentDatatype:$.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:V}),n.st&&(H.st=new ee.GeometryAttribute({componentDatatype:$.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:F})),J.defined(L)&&(H.color=new ee.GeometryAttribute({componentDatatype:$.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:4,values:L,normalize:!0}));var W=re.IndexDatatype.createTypedArray(x,6*u-6),Y=0,q=0,z=u-1;for(r=0;r<z;++r)W[q++]=Y,W[q++]=Y+2,W[q++]=Y+1,W[q++]=Y+1,W[q++]=Y+2,W[q++]=Y+3,Y+=4;return new ee.Geometry({attributes:H,indices:W,primitiveType:ee.PrimitiveType.TRIANGLES,boundingSphere:X.BoundingSphere.fromPoints(d),geometryType:ee.GeometryType.POLYLINES})}},function(e,t){return J.defined(t)&&(e=m.unpack(e,t)),e._ellipsoid=j.Ellipsoid.clone(e._ellipsoid),m.createGeometry(e)}});
|