| 1 |
- define(["./when-b60132fc","./Cartesian2-47311507","./ArcType-29cf2197","./arrayRemoveDuplicates-d2f048c5","./buildModuleUrl-57a32107","./Cartographic-3309dd0d","./Color-5008547b","./ComponentDatatype-c140a87d","./Check-7b2a090c","./GeometryAttribute-c42d25b7","./GeometryAttributes-252e9929","./IndexDatatype-8a5eead4","./Math-119be1a3","./PolylinePipeline-4ec7a59e","./VertexFormat-6446fca0","./Matrix4-cde86d0e","./Cartesian4-3ca25aab","./RuntimeError-4a5c8994","./WebGLConstants-4ae0db90","./FeatureDetection-c3b71206","./EllipsoidGeodesic-0f19ac62","./EllipsoidRhumbLine-ed1a6bf4","./IntersectionTests-5e35c2ab","./Plane-ca0357f4"],(function(e,t,r,a,o,i,n,l,s,p,d,c,u,y,m,f,h,v,C,_,A,g,w,E){"use strict";var b=[];function P(e,t,r,a,o){var i,l=b;l.length=o;var s=r.red,p=r.green,d=r.blue,c=r.alpha,u=a.red,y=a.green,m=a.blue,f=a.alpha;if(n.Color.equals(r,a)){for(i=0;i<o;i++)l[i]=n.Color.clone(r);return l}var h=(u-s)/o,v=(y-p)/o,C=(m-d)/o,_=(f-c)/o;for(i=0;i<o;i++)l[i]=new n.Color(s+i*h,p+i*v,d+i*C,c+i*_);return l}function x(a){var l,s,p=(a=e.defaultValue(a,e.defaultValue.EMPTY_OBJECT)).positions,d=a.colors,c=e.defaultValue(a.width,1),y=e.defaultValue(a.hMax,-1),f=e.defaultValue(a.colorsPerVertex,!1);this._positions=p,this._colors=d,this._width=c,this._hMax=y,this._colorsPerVertex=f,this._dist=a.dist,this._period=a.period,this._vertexFormat=m.VertexFormat.clone(e.defaultValue(a.vertexFormat,m.VertexFormat.DEFAULT)),this._followSurface=e.defaultValue(a.followSurface,!0),e.defined(a.followSurface)&&(l="PolylineGeometry.followSurface",s="PolylineGeometry.followSurface is deprecated and will be removed in Cesium 1.55. Use PolylineGeometry.arcType instead.",o.oneTimeWarning(l,s),a.arcType=a.followSurface?r.ArcType.GEODESIC:r.ArcType.NONE),this._arcType=e.defaultValue(a.arcType,r.ArcType.GEODESIC),this._followSurface=this._arcType!==r.ArcType.NONE,this._granularity=e.defaultValue(a.granularity,u.CesiumMath.RADIANS_PER_DEGREE),this._ellipsoid=t.Ellipsoid.clone(e.defaultValue(a.ellipsoid,t.Ellipsoid.WGS84)),this._workerName="createPolylineGeometry";var h=1+p.length*i.Cartesian3.packedLength;h+=e.defined(d)?1+d.length*n.Color.packedLength:1,this.packedLength=h+t.Ellipsoid.packedLength+m.VertexFormat.packedLength+4+2}x.pack=function(r,a,o){var l;o=e.defaultValue(o,0);var s=r._positions,p=s.length;for(a[o++]=p,l=0;l<p;++l,o+=i.Cartesian3.packedLength)i.Cartesian3.pack(s[l],a,o);var d=r._colors;for(p=e.defined(d)?d.length:0,a[o++]=p,l=0;l<p;++l,o+=n.Color.packedLength)n.Color.pack(d[l],a,o);return t.Ellipsoid.pack(r._ellipsoid,a,o),o+=t.Ellipsoid.packedLength,m.VertexFormat.pack(r._vertexFormat,a,o),o+=m.VertexFormat.packedLength,a[o++]=r._width,a[o++]=r._colorsPerVertex?1:0,a[o++]=r._arcType,a[o++]=r._granularity,a[o++]=r._hMax,a[o++]=r._dist,a[o]=r._period,a};var T=t.Ellipsoid.clone(t.Ellipsoid.UNIT_SPHERE),D=new m.VertexFormat,k={positions:void 0,colors:void 0,ellipsoid:T,vertexFormat:D,width:void 0,colorsPerVertex:void 0,arcType:void 0,granularity:void 0};x.unpack=function(r,a,o){var l;a=e.defaultValue(a,0);var s=r[a++],p=new Array(s);for(l=0;l<s;++l,a+=i.Cartesian3.packedLength)p[l]=i.Cartesian3.unpack(r,a);var d=(s=r[a++])>0?new Array(s):void 0;for(l=0;l<s;++l,a+=n.Color.packedLength)d[l]=n.Color.unpack(r,a);var c=t.Ellipsoid.unpack(r,a,T);a+=t.Ellipsoid.packedLength;var u=m.VertexFormat.unpack(r,a,D);a+=m.VertexFormat.packedLength;var y=r[a++],f=1===r[a++],h=r[a++],v=r[a++],C=r[a++],_=1==r[a++],A=r[a];return e.defined(o)?(o._positions=p,o._colors=d,o._ellipsoid=t.Ellipsoid.clone(c,o._ellipsoid),o._vertexFormat=m.VertexFormat.clone(u,o._vertexFormat),o._width=y,o._colorsPerVertex=f,o._arcType=h,o._granularity=v,o._hMax=C,o._dist=_,o._period=A,o):(k.positions=p,k.colors=d,k.width=y,k.colorsPerVertex=f,k.arcType=h,k.granularity=v,k.hMax=C,k.dist=_,k.period=A,new x(k))};var G=new i.Cartesian3,V=new i.Cartesian3,F=new i.Cartesian3,L=new i.Cartesian3;return x.createGeometry=function(t){var s,m,f,h=t._width,v=t._hMax,C=t._vertexFormat,_=t._colors,A=t._colorsPerVertex,g=t._arcType,w=t._granularity,E=t._ellipsoid,x=t._dist,T=t._period,D=a.arrayRemoveDuplicates(t._positions,i.Cartesian3.equalsEpsilon),k=D.length;if(!(k<2||h<=0)){if(g===r.ArcType.GEODESIC||g===r.ArcType.RHUMB){var S,O;g===r.ArcType.GEODESIC?(S=u.CesiumMath.chordLength(w,E.maximumRadius),O=y.PolylinePipeline.numberOfPoints):(S=w,O=y.PolylinePipeline.numberOfPointsRhumbLine);var M=y.PolylinePipeline.extractHeights(D,E);if(e.defined(_)){var I=1;for(s=0;s<k-1;++s)I+=O(D[s],D[s+1],S);var R=new Array(I),B=0;for(s=0;s<k-1;++s){var N=D[s],U=D[s+1],W=_[s],H=O(N,U,S);if(A&&s<I){var Y=P(0,0,W,_[s+1],H),q=Y.length;for(m=0;m<q;++m)R[B++]=Y[m]}else for(m=0;m<H;++m)R[B++]=n.Color.clone(W)}R[B]=n.Color.clone(_[_.length-1]),_=R,b.length=0}D=g===r.ArcType.GEODESIC?y.PolylinePipeline.generateCartesianArc({positions:D,minDistance:S,ellipsoid:E,height:M,hMax:v}):y.PolylinePipeline.generateCartesianRhumbArc({positions:D,granularity:S,ellipsoid:E,height:M})}var z,J=4*(k=D.length)-4,j=new Float64Array(3*J),K=new Float64Array(3*J),Q=new Float64Array(3*J),X=new Float32Array(2*J),Z=C.st?new Float32Array(2*J):void 0,$=e.defined(_)?new Uint8Array(4*J):void 0,ee=x?new Float32Array(3*J):void 0,te=0,re=0,ae=0,oe=0,ie=0,ne=0;for(m=0;m<k;++m){var le,se;0===m?(z=G,i.Cartesian3.subtract(D[0],D[1],z),i.Cartesian3.add(D[0],z,z)):z=D[m-1],i.Cartesian3.clone(z,F),i.Cartesian3.clone(D[m],V),m===k-1?(z=G,i.Cartesian3.subtract(D[k-1],D[k-2],z),i.Cartesian3.add(D[k-1],z,z)):z=D[m+1],i.Cartesian3.clone(z,L),e.defined($)&&(le=0===m||A?_[m]:_[m-1],m!==k-1&&(se=_[m]));var pe=m===k-1?2:4;for(f=0===m?2:0;f<pe;++f){i.Cartesian3.pack(V,j,te),i.Cartesian3.pack(F,K,te),i.Cartesian3.pack(L,Q,te),te+=3;var de=f-2<0?-1:1,ce=f%2*2-1,ue=ce*m/k;if(X[re++]=v>0?ue:ce,X[re++]=de*h,C.st&&(Z[ae++]=m/(k-1),Z[ae++]=Math.max(X[re-2],0)),e.defined($)){var ye=f<2?le:se;$[oe++]=n.Color.floatToByte(ye.red),$[oe++]=n.Color.floatToByte(ye.green),$[oe++]=n.Color.floatToByte(ye.blue),$[oe++]=n.Color.floatToByte(ye.alpha)}x&&(ee[3*ie]=ne,ie++)}ne+=i.Cartesian3.distance(z,D[m])}if(x){var me=ne,fe=Math.random()*(T>0?T:me);for(m=0;m<J;m++)ee[3*m+1]=me,ee[3*m+2]=fe}var he=new d.GeometryAttributes;he.position=new p.GeometryAttribute({componentDatatype:l.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:j}),he.prevPosition=new p.GeometryAttribute({componentDatatype:l.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:K}),he.nextPosition=new p.GeometryAttribute({componentDatatype:l.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:Q}),he.expandAndWidth=new p.GeometryAttribute({componentDatatype:l.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:X}),C.st&&(he.st=new p.GeometryAttribute({componentDatatype:l.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:Z})),e.defined($)&&(he.color=new p.GeometryAttribute({componentDatatype:l.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:4,values:$,normalize:!0})),x&&(he.dist=new p.GeometryAttribute({componentDatatype:l.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:ee}));var ve=c.IndexDatatype.createTypedArray(J,6*k-6),Ce=0,_e=0,Ae=k-1;for(m=0;m<Ae;++m)ve[_e++]=Ce,ve[_e++]=Ce+2,ve[_e++]=Ce+1,ve[_e++]=Ce+1,ve[_e++]=Ce+2,ve[_e++]=Ce+3,Ce+=4;return new p.Geometry({attributes:he,indices:ve,primitiveType:o.PrimitiveType.TRIANGLES,boundingSphere:o.BoundingSphere.fromPoints(D),geometryType:p.GeometryType.POLYLINES})}},function(r,a){return e.defined(a)&&(r=x.unpack(r,a)),r._ellipsoid=t.Ellipsoid.clone(r._ellipsoid),x.createGeometry(r)}}));
|