define(["./when-cbf8cd21","./Check-35e1a91d","./Math-e66fad2a","./Rectangle-53325d53","./WebGLConstants-95ceb4e9","./PixelFormat-d198afce","./Transforms-00c25a19","./RuntimeError-f4c64df1","./ComponentDatatype-7ee14e67","./GeometryAttribute-0b3418e6","./GeometryAttributes-90846c5f","./IndexDatatype-66caba23","./IntersectionTests-fdc68d04","./Plane-353c5ea0","./ArcType-2b58731c","./EllipsoidRhumbLine-59f604d0","./EllipsoidGeodesic-f0048131","./PolylinePipeline-2c8508bb","./Color-cae0b4c9"],function(R,e,S,I,o,t,O,r,M,U,N,F,a,l,H,i,n,W,Y){"use strict";function d(e){var o=(e=R.defaultValue(e,R.defaultValue.EMPTY_OBJECT)).positions,t=e.colors,r=R.defaultValue(e.colorsPerVertex,!1);this._positions=o,this._colors=t,this._colorsPerVertex=r,this._arcType=R.defaultValue(e.arcType,H.ArcType.GEODESIC),this._granularity=R.defaultValue(e.granularity,S.CesiumMath.RADIANS_PER_DEGREE),this._ellipsoid=R.defaultValue(e.ellipsoid,I.Ellipsoid.WGS84),this._workerName="createSimplePolylineGeometry";var a=1+o.length*I.Cartesian3.packedLength;a+=R.defined(t)?1+t.length*Y.Color.packedLength:1,this.packedLength=a+I.Ellipsoid.packedLength+3}d.pack=function(e,o,t){var r;t=R.defaultValue(t,0);var a=e._positions,l=a.length;for(o[t++]=l,r=0;r<l;++r,t+=I.Cartesian3.packedLength)I.Cartesian3.pack(a[r],o,t);var i=e._colors,l=R.defined(i)?i.length:0;for(o[t++]=l,r=0;r<l;++r,t+=Y.Color.packedLength)Y.Color.pack(i[r],o,t);return I.Ellipsoid.pack(e._ellipsoid,o,t),t+=I.Ellipsoid.packedLength,o[t++]=e._colorsPerVertex?1:0,o[t++]=e._arcType,o[t]=e._granularity,o},d.unpack=function(e,o,t){o=R.defaultValue(o,0);for(var r=e[o++],a=new Array(r),l=0;l<r;++l,o+=I.Cartesian3.packedLength)a[l]=I.Cartesian3.unpack(e,o);var i=0<(r=e[o++])?new Array(r):void 0;for(l=0;l<r;++l,o+=Y.Color.packedLength)i[l]=Y.Color.unpack(e,o);var n=I.Ellipsoid.unpack(e,o);o+=I.Ellipsoid.packedLength;var s=1===e[o++],p=e[o++],c=e[o];return R.defined(t)?(t._positions=a,t._colors=i,t._ellipsoid=n,t._colorsPerVertex=s,t._arcType=p,t._granularity=c,t):new d({positions:a,colors:i,ellipsoid:n,colorsPerVertex:s,arcType:p,granularity:c})};var q=new Array(2),z=new Array(2),J={positions:q,height:z,ellipsoid:void 0,minDistance:void 0,granularity:void 0};return d.createGeometry=function(e){var o,t,r,a=e._positions,l=e._colors,i=e._colorsPerVertex,n=e._arcType,s=e._granularity,p=e._ellipsoid,c=S.CesiumMath.chordLength(s,p.maximumRadius),d=R.defined(l)&&!i,f=a.length,y=0;if(n===H.ArcType.GEODESIC||n===H.ArcType.RHUMB){var u,h,C=n===H.ArcType.GEODESIC?(u=S.CesiumMath.chordLength(s,p.maximumRadius),h=W.PolylinePipeline.numberOfPoints,W.PolylinePipeline.generateArc):(u=s,h=W.PolylinePipeline.numberOfPointsRhumbLine,W.PolylinePipeline.generateRhumbArc),g=W.PolylinePipeline.extractHeights(a,p),T=J;if(n===H.ArcType.GEODESIC?T.minDistance=c:T.granularity=s,T.ellipsoid=p,d){for(var m=0,v=0;v<f-1;v++)m+=h(a[v],a[v+1],u)+1;o=new Float64Array(3*m),r=new Uint8Array(4*m),T.positions=q,T.height=z;var P=0;for(v=0;v<f-1;++v){q[0]=a[v],q[1]=a[v+1],z[0]=g[v],z[1]=g[v+1];var b=C(T);if(R.defined(l))for(var _=b.length/3,B=l[v],A=0;A<_;++A)r[P++]=Y.Color.floatToByte(B.red),r[P++]=Y.Color.floatToByte(B.green),r[P++]=Y.Color.floatToByte(B.blue),r[P++]=Y.Color.floatToByte(B.alpha);o.set(b,y),y+=b.length}}else if(T.positions=a,T.height=g,o=new Float64Array(C(T)),R.defined(l)){for(r=new Uint8Array(o.length/3*4),v=0;v<f-1;++v)y=function(e,o,t,r,a,l,i){var n=W.PolylinePipeline.numberOfPoints(e,o,a),s=t.red,p=t.green,c=t.blue,d=t.alpha,f=r.red,y=r.green,u=r.blue,h=r.alpha;if(Y.Color.equals(t,r)){for(P=0;P<n;P++)l[i++]=Y.Color.floatToByte(s),l[i++]=Y.Color.floatToByte(p),l[i++]=Y.Color.floatToByte(c),l[i++]=Y.Color.floatToByte(d);return i}for(var C=(f-s)/n,g=(y-p)/n,T=(u-c)/n,m=(h-d)/n,v=i,P=0;P<n;P++)l[v++]=Y.Color.floatToByte(s+P*C),l[v++]=Y.Color.floatToByte(p+P*g),l[v++]=Y.Color.floatToByte(c+P*T),l[v++]=Y.Color.floatToByte(d+P*m);return v}(a[v],a[v+1],l[v],l[v+1],c,r,y);var E=l[f-1];r[y++]=Y.Color.floatToByte(E.red),r[y++]=Y.Color.floatToByte(E.green),r[y++]=Y.Color.floatToByte(E.blue),r[y++]=Y.Color.floatToByte(E.alpha)}}else{t=d?2*f-2:f,o=new Float64Array(3*t),r=R.defined(l)?new Uint8Array(4*t):void 0;var k=0,G=0;for(v=0;v<f;++v){var w=a[v];if(d&&0<v&&(I.Cartesian3.pack(w,o,k),k+=3,B=l[v-1],r[G++]=Y.Color.floatToByte(B.red),r[G++]=Y.Color.floatToByte(B.green),r[G++]=Y.Color.floatToByte(B.blue),r[G++]=Y.Color.floatToByte(B.alpha)),d&&v===f-1)break;I.Cartesian3.pack(w,o,k),k+=3,R.defined(l)&&(B=l[v],r[G++]=Y.Color.floatToByte(B.red),r[G++]=Y.Color.floatToByte(B.green),r[G++]=Y.Color.floatToByte(B.blue),r[G++]=Y.Color.floatToByte(B.alpha))}}var D=new N.GeometryAttributes;D.position=new U.GeometryAttribute({componentDatatype:M.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:o}),R.defined(l)&&(D.color=new U.GeometryAttribute({componentDatatype:M.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:4,values:r,normalize:!0}));var L=2*((t=o.length/3)-1),V=F.IndexDatatype.createTypedArray(t,L),x=0;for(v=0;v<t-1;++v)V[x++]=v,V[x++]=v+1;return new U.Geometry({attributes:D,indices:V,primitiveType:U.PrimitiveType.LINES,boundingSphere:O.BoundingSphere.fromPoints(a)})},function(e,o){return R.defined(o)&&(e=d.unpack(e,o)),e._ellipsoid=I.Ellipsoid.clone(e._ellipsoid),d.createGeometry(e)}});
|