2 lines
6.8 KiB
JavaScript
2 lines
6.8 KiB
JavaScript
|
/* 2020-9-22 15:23:25 | 版权所有 军懋国兴 */
|
||
|
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","./VertexFormat-fe64931e","./arrayRemoveDuplicates-d96adeb6","./ArcType-2b58731c","./EllipsoidRhumbLine-357c11e7","./EllipsoidGeodesic-007422da","./PolylinePipeline-be169602","./Color-3c471f55"],function(J,y,j,K,Q,e,t,X,Z,$,ee,r,o,h,te,re,a,n,oe,ae){"use strict";var ne=[];function f(e){var t=(e=J.defaultValue(e,J.defaultValue.EMPTY_OBJECT)).positions,r=e.colors,o=J.defaultValue(e.width,1),a=J.defaultValue(e.colorsPerVertex,!1);if(!J.defined(t)||t.length<2)throw new y.DeveloperError("At least two positions are required.");if("number"!=typeof o)throw new y.DeveloperError("width must be a number");if(J.defined(r)&&(a&&r.length<t.length||!a&&r.length<t.length-1))throw new y.DeveloperError("colors has an invalid length.");this._positions=t,this._colors=r,this._width=o,this._colorsPerVertex=a,this._vertexFormat=h.VertexFormat.clone(J.defaultValue(e.vertexFormat,h.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*ae.Color.packedLength:1,this.packedLength=n+K.Ellipsoid.packedLength+h.VertexFormat.packedLength+4}f.pack=function(e,t,r){if(!J.defined(e))throw new y.DeveloperError("value is required");if(!J.defined(t))throw new y.DeveloperError("array is required");var o;r=J.defaultValue(r,0);var a=e._positions,n=a.length;for(t[r++]=n,o=0;o<n;++o,r+=K.Cartesian3.packedLength)K.Cartesian3.pack(a[o],t,r);var i=e._colors,n=J.defined(i)?i.length:0;for(t[r++]=n,o=0;o<n;++o,r+=ae.Color.packedLength)ae.Color.pack(i[o],t,r);return K.Ellipsoid.pack(e._ellipsoid,t,r),r+=K.Ellipsoid.packedLength,h.VertexFormat.pack(e._vertexFormat,t,r),r+=h.VertexFormat.packedLength,t[r++]=e._width,t[r++]=e._colorsPerVertex?1:0,t[r++]=e._arcType,t[r]=e._granularity,t};var m=K.Ellipsoid.clone(K.Ellipsoid.UNIT_SPHERE),v=new h.VertexFormat,C={positions:void 0,colors:void 0,ellipsoid:m,vertexFormat:v,width:void 0,colorsPerVertex:void 0,arcType:void 0,granularity:void 0};f.unpack=function(e,t,r){if(!J.defined(e))throw new y.DeveloperError("array is required");t=J.defaultValue(t,0);for(var o=e[t++],a=new Array(o),n=0;n<o;++n,t+=K.Cartesian3.packedLength)a[n]=K.Cartesian3.unpack(e,t);var i=0<(o=e[t++])?new Array(o):void 0;for(n=0;n<o;++n,t+=ae.Color.packedLength)i[n]=ae.Color.unpack(e,t);var l=K.Ellipsoid.unpack(e,t,m);t+=K.Ellipsoid.packedLength;var s=h.VertexFormat.unpack(e,t,v);t+=h.VertexFormat.packedLength;var p=e[t++],d=1===e[t++],c=e[t++],u=e[t];return J.defined(r)?(r._positions=a,r._colors=i,r._ellipsoid=K.Ellipsoid.clone(l,r._ellipsoid),r._vertexFormat=h.VertexFormat.clone(s,r._vertexFormat),r._width=p,r._colorsPerVertex=d,r._arcType=c,r._granularity=u,r):(C.positions=a,C.colors=i,C.width=p,C.colorsPerVertex=d,C.arcType=c,C.granularity=u,new f(C))};var ie=new K.Cartesian3,le=new K.Cartesian3,se=new K.Cartesian3,pe=new K.Cartesian3;return f.createGeometry=function(e){var t=e._width,r=e._vertexFormat,o=e._colors,a=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 d,c=n===re.ArcType.GEODESIC?(d=j.CesiumMath.chordLength(i,l.maximumRadius),oe.PolylinePipeline.numberOfPoints):(d=i,oe.PolylinePipeline.numberOfPointsRhumbLine),u=oe.PolylinePipeline.extractHeights(s,l);if(J.defined(o)){for(var y=1,h=0;h<p-1;++h)y+=c(s[h],s[h+1],d);var f=new Array(y),m=0;for(h=0;h<p-1;++h){var v=s[h],C=s[h+1],g=o[h],w=c(v,C,d);if(a&&h<y)for(var E=function(e,t,r){var o=ne;o.length=r;var a=e.red
|