Agriculture-front-end/public/Cesium/Workers/createSimplePolylineGeometry.js

2 lines
5.3 KiB
JavaScript
Raw Normal View History

2023-04-16 22:33:44 +08:00
define(["./when-b60132fc","./Cartesian2-47311507","./ArcType-29cf2197","./buildModuleUrl-4e1b81e7","./Cartographic-3309dd0d","./Color-5008547b","./ComponentDatatype-c140a87d","./Check-7b2a090c","./GeometryAttribute-3a88ba31","./GeometryAttributes-252e9929","./IndexDatatype-8a5eead4","./Math-119be1a3","./PolylinePipeline-2fe9092e","./PrimitiveType-a54dc62f","./Event-16a2dfbf","./RuntimeError-4a5c8994","./FeatureDetection-c3b71206","./WebGLConstants-4ae0db90","./Cartesian4-3ca25aab","./EllipsoidGeodesic-0f19ac62","./EllipsoidRhumbLine-ed1a6bf4","./IntersectionTests-7386ffbf","./Plane-7ae8294c"],(function(e,o,r,t,a,l,i,n,s,p,d,c,f,y,u,h,C,g,T,m,v,b,P){"use strict";function _(e,o,r,t,a,i,n){var s,p=f.PolylinePipeline.numberOfPoints(e,o,a),d=r.red,c=r.green,y=r.blue,u=r.alpha,h=t.red,C=t.green,g=t.blue,T=t.alpha;if(l.Color.equals(r,t)){for(s=0;s<p;s++)i[n++]=l.Color.floatToByte(d),i[n++]=l.Color.floatToByte(c),i[n++]=l.Color.floatToByte(y),i[n++]=l.Color.floatToByte(u);return n}var m=(h-d)/p,v=(C-c)/p,b=(g-y)/p,P=(T-u)/p,_=n;for(s=0;s<p;s++)i[_++]=l.Color.floatToByte(d+s*m),i[_++]=l.Color.floatToByte(c+s*v),i[_++]=l.Color.floatToByte(y+s*b),i[_++]=l.Color.floatToByte(u+s*P);return _}function B(t){var i=(t=e.defaultValue(t,e.defaultValue.EMPTY_OBJECT)).positions,n=t.colors,s=e.defaultValue(t.colorsPerVertex,!1);this._positions=i,this._colors=n,this._colorsPerVertex=s,this._arcType=e.defaultValue(t.arcType,r.ArcType.GEODESIC),this._granularity=e.defaultValue(t.granularity,c.CesiumMath.RADIANS_PER_DEGREE),this._ellipsoid=e.defaultValue(t.ellipsoid,o.Ellipsoid.WGS84),this._workerName="createSimplePolylineGeometry";var p=1+i.length*a.Cartesian3.packedLength;p+=e.defined(n)?1+n.length*l.Color.packedLength:1,this.packedLength=p+o.Ellipsoid.packedLength+3}B.pack=function(r,t,i){var n;i=e.defaultValue(i,0);var s=r._positions,p=s.length;for(t[i++]=p,n=0;n<p;++n,i+=a.Cartesian3.packedLength)a.Cartesian3.pack(s[n],t,i);var d=r._colors;for(p=e.defined(d)?d.length:0,t[i++]=p,n=0;n<p;++n,i+=l.Color.packedLength)l.Color.pack(d[n],t,i);return o.Ellipsoid.pack(r._ellipsoid,t,i),i+=o.Ellipsoid.packedLength,t[i++]=r._colorsPerVertex?1:0,t[i++]=r._arcType,t[i]=r._granularity,t},B.unpack=function(r,t,i){var n;t=e.defaultValue(t,0);var s=r[t++],p=new Array(s);for(n=0;n<s;++n,t+=a.Cartesian3.packedLength)p[n]=a.Cartesian3.unpack(r,t);var d=(s=r[t++])>0?new Array(s):void 0;for(n=0;n<s;++n,t+=l.Color.packedLength)d[n]=l.Color.unpack(r,t);var c=o.Ellipsoid.unpack(r,t);t+=o.Ellipsoid.packedLength;var f=1===r[t++],y=r[t++],u=r[t];return e.defined(i)?(i._positions=p,i._colors=d,i._ellipsoid=c,i._colorsPerVertex=f,i._arcType=y,i._granularity=u,i):new B({positions:p,colors:d,ellipsoid:c,colorsPerVertex:f,arcType:y,granularity:u})};var E=new Array(2),A=new Array(2),k={positions:E,height:A,ellipsoid:void 0,minDistance:void 0,granularity:void 0};return B.createGeometry=function(o){var n,u,h,C,g,T=o._positions,m=o._colors,v=o._colorsPerVertex,b=o._arcType,P=o._granularity,B=o._ellipsoid,D=c.CesiumMath.chordLength(P,B.maximumRadius),G=e.defined(m)&&!v,w=T.length,L=0;if(b===r.ArcType.GEODESIC||b===r.ArcType.RHUMB){var V,x,S;b===r.ArcType.GEODESIC?(V=c.CesiumMath.chordLength(P,B.maximumRadius),x=f.PolylinePipeline.numberOfPoints,S=f.PolylinePipeline.generateArc):(V=P,x=f.PolylinePipeline.numberOfPointsRhumbLine,S=f.PolylinePipeline.generateRhumbArc);var I=f.PolylinePipeline.extractHeights(T,B),R=k;if(b===r.ArcType.GEODESIC?R.minDistance=D:R.granularity=P,R.ellipsoid=B,G){var O=0;for(n=0;n<w-1;n++)O+=x(T[n],T[n+1],V)+1;u=new Float64Array(3*O),C=new Uint8Array(4*O),R.positions=E,R.height=A;var M=0;for(n=0;n<w-1;++n){E[0]=T[n],E[1]=T[n+1],A[0]=I[n],A[1]=I[n+1];var U=S(R);if(e.defined(m)){var N=U.length/3;g=m[n];for(var F=0;F<N;++F)C[M++]=l.Color.floatToByte(g.red),C[M++]=l.Color.floatToByte(g.green),C[M++]=l.Color.floatToByte(g.blue),C[M++]=l.Color.floatToByte(g.alpha)}u.set(U,L),L+=U.length}}else if(R.positions=T,R.height=I,u=new Float64Array(S(R)),e.defined(m)){for(C=new Uint8Array(u.length/3*4),n=0;n<w-1;++n){L=_(T[n],T[n+1],m[n],m[n+1],D,C,L)}var H=m[w-1];C[L++]