1 |
- define(["./defaultValue-81eec7ed","./Matrix2-e3fb4559","./ArcType-fc72c06c","./Transforms-98ffa11d","./Cartesian3-7e9cc2ff","./Color-3aa7f38b","./ComponentDatatype-aaeec80f","./Check-741c5f3c","./GeometryAttribute-b025f9a8","./GeometryAttributes-32b29525","./IndexDatatype-f1e3f799","./Math-5f585871","./PolylinePipeline-de59c85a","./Matrix4-d34187af","./RuntimeError-26acdd3b","./_commonjsHelpers-3aae1032-26891ab7","./combine-3c023bda","./WebGLConstants-508b9636","./EllipsoidGeodesic-6de45192","./EllipsoidRhumbLine-9c6b32ea","./IntersectionTests-73b87d72","./Plane-4f75b3df"],(function(e,o,t,l,r,n,a,i,s,c,p,d,f,y,u,h,C,m,T,g,b,_){"use strict";function P(e,o,t,l,r,a,i){const s=f.PolylinePipeline.numberOfPoints(e,o,r);let c;const p=t.red,d=t.green,y=t.blue,u=t.alpha,h=l.red,C=l.green,m=l.blue,T=l.alpha;if(n.Color.equals(t,l)){for(c=0;c<s;c++)a[i++]=n.Color.floatToByte(p),a[i++]=n.Color.floatToByte(d),a[i++]=n.Color.floatToByte(y),a[i++]=n.Color.floatToByte(u);return i}const g=(h-p)/s,b=(C-d)/s,_=(m-y)/s,P=(T-u)/s;let B=i;for(c=0;c<s;c++)a[B++]=n.Color.floatToByte(p+c*g),a[B++]=n.Color.floatToByte(d+c*b),a[B++]=n.Color.floatToByte(y+c*_),a[B++]=n.Color.floatToByte(u+c*P);return B}function B(l){const a=(l=e.defaultValue(l,e.defaultValue.EMPTY_OBJECT)).positions,i=l.colors,s=e.defaultValue(l.colorsPerVertex,!1);this._positions=a,this._colors=i,this._colorsPerVertex=s,this._arcType=e.defaultValue(l.arcType,t.ArcType.GEODESIC),this._granularity=e.defaultValue(l.granularity,d.CesiumMath.RADIANS_PER_DEGREE),this._ellipsoid=e.defaultValue(l.ellipsoid,o.Ellipsoid.WGS84),this._workerName="createSimplePolylineGeometry";let c=1+a.length*r.Cartesian3.packedLength;c+=e.defined(i)?1+i.length*n.Color.packedLength:1,this.packedLength=c+o.Ellipsoid.packedLength+3}B.pack=function(t,l,a){let i;a=e.defaultValue(a,0);const s=t._positions;let c=s.length;for(l[a++]=c,i=0;i<c;++i,a+=r.Cartesian3.packedLength)r.Cartesian3.pack(s[i],l,a);const p=t._colors;for(c=e.defined(p)?p.length:0,l[a++]=c,i=0;i<c;++i,a+=n.Color.packedLength)n.Color.pack(p[i],l,a);return o.Ellipsoid.pack(t._ellipsoid,l,a),a+=o.Ellipsoid.packedLength,l[a++]=t._colorsPerVertex?1:0,l[a++]=t._arcType,l[a]=t._granularity,l},B.unpack=function(t,l,a){let i;l=e.defaultValue(l,0);let s=t[l++];const c=new Array(s);for(i=0;i<s;++i,l+=r.Cartesian3.packedLength)c[i]=r.Cartesian3.unpack(t,l);s=t[l++];const p=s>0?new Array(s):void 0;for(i=0;i<s;++i,l+=n.Color.packedLength)p[i]=n.Color.unpack(t,l);const d=o.Ellipsoid.unpack(t,l);l+=o.Ellipsoid.packedLength;const f=1===t[l++],y=t[l++],u=t[l];return e.defined(a)?(a._positions=c,a._colors=p,a._ellipsoid=d,a._colorsPerVertex=f,a._arcType=y,a._granularity=u,a):new B({positions:c,colors:p,ellipsoid:d,colorsPerVertex:f,arcType:y,granularity:u})};const A=new Array(2),E=new Array(2),k={positions:A,height:E,ellipsoid:void 0,minDistance:void 0,granularity:void 0};return B.createGeometry=function(o){const i=o._positions,y=o._colors,u=o._colorsPerVertex,h=o._arcType,C=o._granularity,m=o._ellipsoid,T=d.CesiumMath.chordLength(C,m.maximumRadius),g=e.defined(y)&&!u;let b;const _=i.length;let B,G,D,L,w=0;if(h===t.ArcType.GEODESIC||h===t.ArcType.RHUMB){let o,l,r;h===t.ArcType.GEODESIC?(o=d.CesiumMath.chordLength(C,m.maximumRadius),l=f.PolylinePipeline.numberOfPoints,r=f.PolylinePipeline.generateArc):(o=C,l=f.PolylinePipeline.numberOfPointsRhumbLine,r=f.PolylinePipeline.generateRhumbArc);const a=f.PolylinePipeline.extractHeights(i,m),s=k;if(h===t.ArcType.GEODESIC?s.minDistance=T:s.granularity=C,s.ellipsoid=m,g){let t=0;for(b=0;b<_-1;b++)t+=l(i[b],i[b+1],o)+1;B=new Float64Array(3*t),D=new Uint8Array(4*t),s.positions=A,s.height=E;let c=0;for(b=0;b<_-1;++b){A[0]=i[b],A[1]=i[b+1],E[0]=a[b],E[1]=a[b+1];const o=r(s);if(e.defined(y)){const e=o.length/3;L=y[b];for(let o=0;o<e;++o)D[c++]=n.Color.floatToByte(L.red),D[c++]=n.Color.floatToByte(L.green),D[c++]=n.Color.floatToByte(L.blue),D[c++]=n.Color.floatToByte(L.alpha)}B.set(o,w),w+=o.length}}else if(s.positions=i,s.height=a,B=new Float64Array(r(s)),e.defined(y)){for(D=new Uint8Array(B.length/3*4),b=0;b<_-1;++b){w=P(i[b],i[b+1],y[b],y[b+1],T,D,w)}const e=y[_-1];D[w++]=n.Color.floatToByte(e.red),D[w++]=n.Color.floatToByte(e.green),D[w++]=n.Color.floatToByte(e.blue),D[w++]=n.Color.floatToByte(e.alpha)}}else{G=g?2*_-2:_,B=new Float64Array(3*G),D=e.defined(y)?new Uint8Array(4*G):void 0;let o=0,t=0;for(b=0;b<_;++b){const l=i[b];if(g&&b>0&&(r.Cartesian3.pack(l,B,o),o+=3,L=y[b-1],D[t++]=n.Color.floatToByte(L.red),D[t++]=n.Color.floatToByte(L.green),D[t++]=n.Color.floatToByte(L.blue),D[t++]=n.Color.floatToByte(L.alpha)),g&&b===_-1)break;r.Cartesian3.pack(l,B,o),o+=3,e.defined(y)&&(L=y[b],D[t++]=n.Color.floatToByte(L.red),D[t++]=n.Color.floatToByte(L.green),D[t++]=n.Color.floatToByte(L.blue),D[t++]=n.Color.floatToByte(L.alpha))}}const V=new c.GeometryAttributes;V.position=new s.GeometryAttribute({componentDatatype:a.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:B}),e.defined(y)&&(V.color=new s.GeometryAttribute({componentDatatype:a.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:4,values:D,normalize:!0})),G=B.length/3;const x=2*(G-1),S=p.IndexDatatype.createTypedArray(G,x);let I=0;for(b=0;b<G-1;++b)S[I++]=b,S[I++]=b+1;return new s.Geometry({attributes:V,indices:S,primitiveType:s.PrimitiveType.LINES,boundingSphere:l.BoundingSphere.fromPoints(i)})},function(t,l){return e.defined(l)&&(t=B.unpack(t,l)),t._ellipsoid=o.Ellipsoid.clone(t._ellipsoid),B.createGeometry(t)}}));
|