2 lines
5.6 KiB
JavaScript
2 lines
5.6 KiB
JavaScript
|
/* 2020-9-22 15:23:26 | 版权所有 军懋国兴 */
|
||
|
define(["./when-cbf8cd21","./Check-35e1a91d","./Math-69007a69","./Cartesian2-43e3a3be","./Transforms-2d1ac5ec","./RuntimeError-f4c64df1","./WebGLConstants-95ceb4e9","./ComponentDatatype-607c9a0c","./GeometryAttribute-2303bbfb","./GeometryAttributes-90846c5f","./IndexDatatype-79bb407c","./IntersectionTests-459f6f08","./Plane-46b5436f","./ArcType-2b58731c","./EllipsoidRhumbLine-357c11e7","./EllipsoidGeodesic-007422da","./PolylinePipeline-be169602","./Color-3c471f55"],function(S,f,I,R,O,e,o,M,U,q,N,r,t,F,a,i,H,W){"use strict";function c(e){var o=(e=S.defaultValue(e,S.defaultValue.EMPTY_OBJECT)).positions,r=e.colors,t=S.defaultValue(e.colorsPerVertex,!1);if(!S.defined(o)||o.length<2)throw new f.DeveloperError("At least two positions are required.");if(S.defined(r)&&(t&&r.length<o.length||!t&&r.length<o.length-1))throw new f.DeveloperError("colors has an invalid length.");this._positions=o,this._colors=r,this._colorsPerVertex=t,this._arcType=S.defaultValue(e.arcType,F.ArcType.GEODESIC),this._granularity=S.defaultValue(e.granularity,I.CesiumMath.RADIANS_PER_DEGREE),this._ellipsoid=S.defaultValue(e.ellipsoid,R.Ellipsoid.WGS84),this._workerName="createSimplePolylineGeometry";var a=1+o.length*R.Cartesian3.packedLength;a+=S.defined(r)?1+r.length*W.Color.packedLength:1,this.packedLength=a+R.Ellipsoid.packedLength+3}c.pack=function(e,o,r){if(!S.defined(e))throw new f.DeveloperError("value is required");if(!S.defined(o))throw new f.DeveloperError("array is required");var t;r=S.defaultValue(r,0);var a=e._positions,i=a.length;for(o[r++]=i,t=0;t<i;++t,r+=R.Cartesian3.packedLength)R.Cartesian3.pack(a[t],o,r);var l=e._colors,i=S.defined(l)?l.length:0;for(o[r++]=i,t=0;t<i;++t,r+=W.Color.packedLength)W.Color.pack(l[t],o,r);return R.Ellipsoid.pack(e._ellipsoid,o,r),r+=R.Ellipsoid.packedLength,o[r++]=e._colorsPerVertex?1:0,o[r++]=e._arcType,o[r]=e._granularity,o},c.unpack=function(e,o,r){if(!S.defined(e))throw new f.DeveloperError("array is required");o=S.defaultValue(o,0);for(var t=e[o++],a=new Array(t),i=0;i<t;++i,o+=R.Cartesian3.packedLength)a[i]=R.Cartesian3.unpack(e,o);var l=0<(t=e[o++])?new Array(t):void 0;for(i=0;i<t;++i,o+=W.Color.packedLength)l[i]=W.Color.unpack(e,o);var n=R.Ellipsoid.unpack(e,o);o+=R.Ellipsoid.packedLength;var s=1===e[o++],p=e[o++],d=e[o];return S.defined(r)?(r._positions=a,r._colors=l,r._ellipsoid=n,r._colorsPerVertex=s,r._arcType=p,r._granularity=d,r):new c({positions:a,colors:l,ellipsoid:n,colorsPerVertex:s,arcType:p,granularity:d})};var Y=new Array(2),z=new Array(2),J={positions:Y,height:z,ellipsoid:void 0,minDistance:void 0,granularity:void 0};return c.createGeometry=function(e){var o,r,t,a=e._positions,i=e._colors,l=e._colorsPerVertex,n=e._arcType,s=e._granularity,p=e._ellipsoid,d=I.CesiumMath.chordLength(s,p.maximumRadius),f=S.defined(i)&&!l,c=a.length,y=0;if(n===F.ArcType.GEODESIC||n===F.ArcType.RHUMB){var u,h,C=n===F.ArcType.GEODESIC?(u=I.CesiumMath.chordLength(s,p.maximumRadius),h=H.PolylinePipeline.numberOfPoints,H.PolylinePipeline.generateArc):(u=s,h=H.PolylinePipeline.numberOfPointsRhumbLine,H.PolylinePipeline.generateRhumbArc),g=H.PolylinePipeline.extractHeights(a,p),T=J;if(n===F.ArcType.GEODESIC?T.minDistance=d:T.granularity=s,T.ellipsoid=p,f){for(var m=0,v=0;v<c-1;v++)m+=h(a[v],a[v+1],u)+1;o=new Float64Array(3*m),t=new Uint8Array(4*m),T.positions=Y,T.height=z;var b=0;for(v=0;v<c-1;++v){Y[0]=a[v],Y[1]=a[v+1],z[0]=g[v],z[1]=g[v+1];var E=C(T);if(S.defined(i))for(var P=E.length/3,_=i[v],A=0;A<P;++A)t[b++]=W.Color.floatToByte(_.red),t[b++]=W.Color.floatToByte(_.green),t[b++]=W.Color.floatToByte(_.blue),t[b++]=W.Color.floatToByte(_.alpha);o.set(E,y),y+=E.length}}else if(T.positions=a,T.height=g,o=new Float64Array(C(T)),S.defined(i)){for(t=new Uint8Array(o.length/3*4),v=0;v<c-1;++v)y=function(e,o,r,t,a,i,l){var n=H.PolylinePipeline.numberOfPoints(e,o,a),s=r.red,p=r.green,d=r.blue,f=r.alpha,c=t.red,y=t.green,u=t.blue,h=t.alpha;if(W.Color.equals(r,t)){for(b=0;b<n;b++)i[l++]=W.Color.floatToByte(s),i[l++]=W.Color.floatToByte(p),i[l++]=W.Color.floatToByte(d),i[l++]=W.Color.floatToByte(f);return l}for(var C=(c-s
|