|
1 |
- define(["./when-54c2dc71","./Cartesian2-49b1de22","./ArcType-dc1c5aee","./arrayRemoveDuplicates-216006b0","./Transforms-e9dbfb40","./Color-91231c89","./ComponentDatatype-6d99a1ee","./Check-6c0211bc","./GeometryAttribute-669569db","./GeometryAttributes-4fcfcf40","./IndexDatatype-46306178","./Math-44e92d6b","./PolylinePipeline-eb80587e","./VertexFormat-7572c785","./RuntimeError-2109023a","./WebGLConstants-76bb35d1","./EllipsoidGeodesic-a2d57ae0","./EllipsoidRhumbLine-9b557f71","./IntersectionTests-6ead8677","./Plane-8f7e53d1"],function(Y,q,z,J,j,K,Q,e,X,Z,$,ee,te,y,t,r,a,o,n,i){"use strict";var re=[];function m(e){var t=(e=Y.defaultValue(e,Y.defaultValue.EMPTY_OBJECT)).positions,r=e.colors,a=Y.defaultValue(e.width,1),o=Y.defaultValue(e.colorsPerVertex,!1);this._positions=t,this._colors=r,this._width=a,this._colorsPerVertex=o,this._vertexFormat=y.VertexFormat.clone(Y.defaultValue(e.vertexFormat,y.VertexFormat.DEFAULT)),this._arcType=Y.defaultValue(e.arcType,z.ArcType.GEODESIC),this._granularity=Y.defaultValue(e.granularity,ee.CesiumMath.RADIANS_PER_DEGREE),this._ellipsoid=q.Ellipsoid.clone(Y.defaultValue(e.ellipsoid,q.Ellipsoid.WGS84)),this._workerName="createPolylineGeometry";t=1+t.length*q.Cartesian3.packedLength;t+=Y.defined(r)?1+r.length*K.Color.packedLength:1,this.packedLength=t+q.Ellipsoid.packedLength+y.VertexFormat.packedLength+4}m.pack=function(e,t,r){var a;r=Y.defaultValue(r,0);var o=e._positions,n=o.length;for(t[r++]=n,a=0;a<n;++a,r+=q.Cartesian3.packedLength)q.Cartesian3.pack(o[a],t,r);var i=e._colors,n=Y.defined(i)?i.length:0;for(t[r++]=n,a=0;a<n;++a,r+=K.Color.packedLength)K.Color.pack(i[a],t,r);return q.Ellipsoid.pack(e._ellipsoid,t,r),r+=q.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 h=q.Ellipsoid.clone(q.Ellipsoid.UNIT_SPHERE),f=new y.VertexFormat,C={positions:void 0,colors:void 0,ellipsoid:h,vertexFormat:f,width:void 0,colorsPerVertex:void 0,arcType:void 0,granularity:void 0};m.unpack=function(e,t,r){t=Y.defaultValue(t,0);for(var a=e[t++],o=new Array(a),n=0;n<a;++n,t+=q.Cartesian3.packedLength)o[n]=q.Cartesian3.unpack(e,t);var i=0<(a=e[t++])?new Array(a):void 0;for(n=0;n<a;++n,t+=K.Color.packedLength)i[n]=K.Color.unpack(e,t);var l=q.Ellipsoid.unpack(e,t,h);t+=q.Ellipsoid.packedLength;var s=y.VertexFormat.unpack(e,t,f);t+=y.VertexFormat.packedLength;var p=e[t++],c=1===e[t++],d=e[t++],u=e[t];return Y.defined(r)?(r._positions=o,r._colors=i,r._ellipsoid=q.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):(C.positions=o,C.colors=i,C.width=p,C.colorsPerVertex=c,C.arcType=d,C.granularity=u,new m(C))};var ae=new q.Cartesian3,oe=new q.Cartesian3,ne=new q.Cartesian3,ie=new q.Cartesian3;return m.createGeometry=function(e){var t=e._width,r=e._vertexFormat,a=e._colors,o=e._colorsPerVertex,n=e._arcType,i=e._granularity,l=e._ellipsoid,s=J.arrayRemoveDuplicates(e._positions,q.Cartesian3.equalsEpsilon),p=s.length;if(!(p<2||t<=0)){if(n===z.ArcType.GEODESIC||n===z.ArcType.RHUMB){var c,d=n===z.ArcType.GEODESIC?(c=ee.CesiumMath.chordLength(i,l.maximumRadius),te.PolylinePipeline.numberOfPoints):(c=i,te.PolylinePipeline.numberOfPointsRhumbLine),u=te.PolylinePipeline.extractHeights(s,l);if(Y.defined(a)){for(var y=1,m=0;m<p-1;++m)y+=d(s[m],s[m+1],c);var h=new Array(y),f=0;for(m=0;m<p-1;++m){var C=s[m],v=s[m+1],g=a[m],_=d(C,v,c);if(o&&m<y)for(var A=function(e,t,r){var a=re;a.length=r;var o=e.red,n=e.green,i=e.blue,l=e.alpha,s=t.red,p=t.green,c=t.blue,d=t.alpha;if(K.Color.equals(e,t)){for(f=0;f<r;f++)a[f]=K.Color.clone(e);return a}for(var u=(s-o)/r,y=(p-n)/r,m=(c-i)/r,h=(d-l)/r,f=0;f<r;f++)a[f]=new K.Color(o+f*u,n+f*y,i+f*m,l+f*h);return a}(g,a[m+1],_),b=A.length,E=0;E<b;++E)h[f++]=A[E];else for(E=0;E<_;++E)h[f++]=K.Color.clone(g)}h[f]=K.Color.clone(a[a.length-1]),a=h,re.length=0}s=n===z.ArcType.GEODESIC?te.PolylinePipeline.generateCartesianArc({positions:s,minDistance:c,ellipsoid:l,height:u}):te.PolylinePipeline.generateCartesianRhumbArc({positions:s,granularity:c,ellipsoid:l,height:u})}var P,w,T,l=4*(p=s.length)-4,x=new Float64Array(3*l),k=new Float64Array(3*l),D=new Float64Array(3*l),V=new Float32Array(2*l),L=r.st?new Float32Array(2*l):void 0,F=Y.defined(a)?new Uint8Array(4*l):void 0,G=0,O=0,R=0,I=0;for(E=0;E<p;++E){0===E?(P=ae,q.Cartesian3.subtract(s[0],s[1],P),q.Cartesian3.add(s[0],P,P)):P=s[E-1],q.Cartesian3.clone(P,ne),q.Cartesian3.clone(s[E],oe),E===p-1?(P=ae,q.Cartesian3.subtract(s[p-1],s[p-2],P),q.Cartesian3.add(s[p-1],P,P)):P=s[E+1],q.Cartesian3.clone(P,ie),Y.defined(F)&&(w=0===E||o?a[E]:a[E-1],E!==p-1&&(T=a[E]));for(var S=E===p-1?2:4,B=0===E?2:0;B<S;++B){q.Cartesian3.pack(oe,x,G),q.Cartesian3.pack(ne,k,G),q.Cartesian3.pack(ie,D,G),G+=3;var U=B-2<0?-1:1;V[O++]=B%2*2-1,V[O++]=U*t,r.st&&(L[R++]=E/(p-1),L[R++]=Math.max(V[O-2],0)),Y.defined(F)&&(U=B<2?w:T,F[I++]=K.Color.floatToByte(U.red),F[I++]=K.Color.floatToByte(U.green),F[I++]=K.Color.floatToByte(U.blue),F[I++]=K.Color.floatToByte(U.alpha))}}u=new Z.GeometryAttributes;u.position=new X.GeometryAttribute({componentDatatype:Q.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:x}),u.prevPosition=new X.GeometryAttribute({componentDatatype:Q.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:k}),u.nextPosition=new X.GeometryAttribute({componentDatatype:Q.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:D}),u.expandAndWidth=new X.GeometryAttribute({componentDatatype:Q.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:V}),r.st&&(u.st=new X.GeometryAttribute({componentDatatype:Q.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:L})),Y.defined(F)&&(u.color=new X.GeometryAttribute({componentDatatype:Q.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:4,values:F,normalize:!0}));var N=$.IndexDatatype.createTypedArray(l,6*p-6),M=0,H=0,W=p-1;for(E=0;E<W;++E)N[H++]=M,N[H++]=M+2,N[H++]=M+1,N[H++]=M+1,N[H++]=M+2,N[H++]=M+3,M+=4;return new X.Geometry({attributes:u,indices:N,primitiveType:X.PrimitiveType.TRIANGLES,boundingSphere:j.BoundingSphere.fromPoints(s),geometryType:X.GeometryType.POLYLINES})}},function(e,t){return(e=Y.defined(t)?m.unpack(e,t):e)._ellipsoid=q.Ellipsoid.clone(e._ellipsoid),m.createGeometry(e)}});
|