2 lines
6.2 KiB
JavaScript
2 lines
6.2 KiB
JavaScript
|
define(["./when-54c2dc71","./Check-6c0211bc","./Math-fc8cecf5","./Cartesian2-d1adddcb","./Transforms-ea828842","./RuntimeError-2109023a","./WebGLConstants-76bb35d1","./ComponentDatatype-6d99a1ee","./GeometryAttribute-618451c9","./GeometryAttributes-4fcfcf40","./IndexDatatype-53503fee","./IntersectionTests-43aa431f","./Plane-0cab2b36","./VertexFormat-7572c785","./arrayRemoveDuplicates-ebc732b0","./ArcType-dc1c5aee","./EllipsoidRhumbLine-8b165373","./EllipsoidGeodesic-a4f6440a","./PolylinePipeline-7574302f","./Color-caa7085a"],function(J,e,j,K,Q,t,r,X,Z,$,ee,a,o,y,te,re,n,i,ae,oe){"use strict";var ne=[];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,re.ArcType.GEODESIC),this._granularity=J.defaultValue(e.granularity,j.CesiumMath.RADIANS_PER_DEGREE),this._ellipsoid=K.Ellipsoid.clone(J.defaultValue(e.ellipsoid,K.Ellipsoid.WGS84)),this._workerName="createPolylineGeometry";var n=1+t.length*K.Cartesian3.packedLength;n+=J.defined(r)?1+r.length*oe.Color.packedLength:1,this.packedLength=n+K.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+=K.Cartesian3.packedLength)K.Cartesian3.pack(o[a],t,r);var i=e._colors,n=J.defined(i)?i.length:0;for(t[r++]=n,a=0;a<n;++a,r+=oe.Color.packedLength)oe.Color.pack(i[a],t,r);return K.Ellipsoid.pack(e._ellipsoid,t,r),r+=K.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=K.Ellipsoid.clone(K.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){t=J.defaultValue(t,0);for(var a=e[t++],o=new Array(a),n=0;n<a;++n,t+=K.Cartesian3.packedLength)o[n]=K.Cartesian3.unpack(e,t);var i=0<(a=e[t++])?new Array(a):void 0;for(n=0;n<a;++n,t+=oe.Color.packedLength)i[n]=oe.Color.unpack(e,t);var l=K.Ellipsoid.unpack(e,t,f);t+=K.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=o,r._colors=i,r._ellipsoid=K.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=o,v.colors=i,v.width=p,v.colorsPerVertex=c,v.arcType=d,v.granularity=u,new m(v))};var ie=new K.Cartesian3,le=new K.Cartesian3,se=new K.Cartesian3,pe=new K.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=te.arrayRemoveDuplicates(e._positions,K.Cartesian3.equalsEpsilon),p=s.length;if(!(p<2||t<=0)){if(n===re.ArcType.GEODESIC||n===re.ArcType.RHUMB){var c,d=n===re.ArcType.GEODESIC?(c=j.CesiumMath.chordLength(i,l.maximumRadius),ae.PolylinePipeline.numberOfPoints):(c=i,ae.PolylinePipeline.numberOfPointsRhumbLine),u=ae.PolylinePipeline.extractHeights(s,l);if(J.defined(a)){for(var y=1,m=0;m<p-1;++m)y+=d(s[m],s[m+1],c);var f=new Array(y),h=0;for(m=0;m<p-1;++m){var v=s[m],C=s[m+1],g=a[m],_=d(v,C,c);if(o&&m<y)for(var A=function(e,t,r){var a=ne;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(oe.Color.equals(e,t)){for(h=0;h<r;h++)a[h]=oe.Color.clone(e);return a}for(var u=(s-o)/r,y=(p-n)/r,m=(c-i)/r,f=(d-l)/r,h=0;h<r;h++)a[h]=new oe.Color(o+h*u,n+h*y,i+h*m,l+h*f);return a}(g,a[m+1],_),E=A.length,b=0;b<E;++b)f[h++]=A[b];else for(b=0;b<_;++b)f[h++]=oe.Color.clone(g)}f[h]=oe.Color.clone(a[a.length-1]),a=f,ne.length=0}s=n===re.ArcType.GEODESIC?ae.PolylinePipeline.generateCartesianArc({positions:s,minDistance:c,
|