qa-prevention-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/createPolylineGeometry.js

2 lines
6.7 KiB
JavaScript
Raw Normal View History

2023-12-17 15:30:40 +08:00
define(["./defaultValue-81eec7ed","./Cartesian2-bd414876","./ArcType-fc72c06c","./arrayRemoveDuplicates-cea3b206","./BoundingSphere-9a3b5656","./Cartesian3-e0307675","./Color-82ef4a75","./ComponentDatatype-aaeec80f","./Check-741c5f3c","./GeometryAttribute-2b42a913","./GeometryAttributes-32b29525","./IndexDatatype-3f3c99e8","./Math-e73894ab","./PolylinePipeline-0e56eeb9","./VertexFormat-d50a69ba","./GeographicProjection-c931c7fb","./Matrix4-4c545f70","./RuntimeError-26acdd3b","./Rectangle-cf3e0e3e","./Transforms-5b829630","./when-422ea0ae","./Resource-8ae1a924","./combine-3c023bda","./WebGLConstants-508b9636","./Matrix2-dc0c61cc","./EllipsoidGeodesic-e7a5ca44","./EllipsoidRhumbLine-592e8885","./IntersectionTests-80510c7b","./Plane-bc8b6777"],(function(e,t,o,n,r,a,i,l,s,c,p,d,u,y,m,f,h,C,g,b,_,A,E,P,w,x,T,k,D){"use strict";const V=[];function v(e,t,o,n,r){const a=V;let l;a.length=r;const s=o.red,c=o.green,p=o.blue,d=o.alpha,u=n.red,y=n.green,m=n.blue,f=n.alpha;if(i.Color.equals(o,n)){for(l=0;l<r;l++)a[l]=i.Color.clone(o);return a}const h=(u-s)/r,C=(y-c)/r,g=(m-p)/r,b=(f-d)/r;for(l=0;l<r;l++)a[l]=new i.Color(s+l*h,c+l*C,p+l*g,d+l*b);return a}function L(n){const r=(n=e.defaultValue(n,e.defaultValue.EMPTY_OBJECT)).positions,l=n.colors,s=e.defaultValue(n.width,1),c=e.defaultValue(n.colorsPerVertex,!1);this._positions=r,this._colors=l,this._width=s,this._colorsPerVertex=c,this._vertexFormat=m.VertexFormat.clone(e.defaultValue(n.vertexFormat,m.VertexFormat.DEFAULT)),this._arcType=e.defaultValue(n.arcType,o.ArcType.GEODESIC),this._granularity=e.defaultValue(n.granularity,u.CesiumMath.RADIANS_PER_DEGREE),this._ellipsoid=t.Ellipsoid.clone(e.defaultValue(n.ellipsoid,t.Ellipsoid.WGS84)),this._workerName="createPolylineGeometry";let p=1+r.length*a.Cartesian3.packedLength;p+=e.defined(l)?1+l.length*i.Color.packedLength:1,this.packedLength=p+t.Ellipsoid.packedLength+m.VertexFormat.packedLength+4}L.pack=function(o,n,r){let l;r=e.defaultValue(r,0);const s=o._positions;let c=s.length;for(n[r++]=c,l=0;l<c;++l,r+=a.Cartesian3.packedLength)a.Cartesian3.pack(s[l],n,r);const p=o._colors;for(c=e.defined(p)?p.length:0,n[r++]=c,l=0;l<c;++l,r+=i.Color.packedLength)i.Color.pack(p[l],n,r);return t.Ellipsoid.pack(o._ellipsoid,n,r),r+=t.Ellipsoid.packedLength,m.VertexFormat.pack(o._vertexFormat,n,r),r+=m.VertexFormat.packedLength,n[r++]=o._width,n[r++]=o._colorsPerVertex?1:0,n[r++]=o._arcType,n[r]=o._granularity,n};const F=t.Ellipsoid.clone(t.Ellipsoid.UNIT_SPHERE),G=new m.VertexFormat,R={positions:void 0,colors:void 0,ellipsoid:F,vertexFormat:G,width:void 0,colorsPerVertex:void 0,arcType:void 0,granularity:void 0};L.unpack=function(o,n,r){let l;n=e.defaultValue(n,0);let s=o[n++];const c=new Array(s);for(l=0;l<s;++l,n+=a.Cartesian3.packedLength)c[l]=a.Cartesian3.unpack(o,n);s=o[n++];const p=s>0?new Array(s):void 0;for(l=0;l<s;++l,n+=i.Color.packedLength)p[l]=i.Color.unpack(o,n);const d=t.Ellipsoid.unpack(o,n,F);n+=t.Ellipsoid.packedLength;const u=m.VertexFormat.unpack(o,n,G);n+=m.VertexFormat.packedLength;const y=o[n++],f=1===o[n++],h=o[n++],C=o[n];return e.defined(r)?(r._positions=c,r._colors=p,r._ellipsoid=t.Ellipsoid.clone(d,r._ellipsoid),r._vertexFormat=m.VertexFormat.clone(u,r._vertexFormat),r._width=y,r._colorsPerVertex=f,r._arcType=h,r._granularity=C,r):(R.positions=c,R.colors=p,R.width=y,R.colorsPerVertex=f,R.arcType=h,R.granularity=C,new L(R))};const O=new a.Cartesian3,S=new a.Cartesian3,B=new a.Cartesian3,I=new a.Cartesian3;return L.createGeometry=function(t){const s=t._width,m=t._vertexFormat;let f=t._colors;const h=t._colorsPerVertex,C=t._arcType,g=t._granularity,b=t._ellipsoid;let _,A,E;const P=[];let w=n.arrayRemoveDuplicates(t._positions,a.Cartesian3.equalsEpsilon,!1,P);if(e.defined(f)&&P.length>0){let e=0,t=P[0];f=f.filter((function(o,n){let r=!1;return r=h?n===t||0===n&&1===t:n+1===t,!r||(e++,t=P[e],!1)}))}let x=w.length;if(x<2||s<=0)return;if(C===o.ArcType.GEODESIC||C===o.ArcType.RHUMB){let t,n;C===o.ArcType.GEODESIC?(t=u.CesiumMath.chordLength(g,b.maximumRadius),n=y.PolylinePipeline.numberOfPoints):(t=g,n=y.PolylinePipeline.numberOf