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

2 lines
4.1 KiB
JavaScript
Raw Permalink Normal View History

2024-01-02 14:12:39 +08:00
define(["./defaultValue-81eec7ed","./Cartesian2-bd414876","./BoundingSphere-9a3b5656","./Cartesian3-e0307675","./ComponentDatatype-aaeec80f","./Check-741c5f3c","./GeometryAttribute-2b42a913","./GeometryAttributes-32b29525","./IndexDatatype-3f3c99e8","./Math-e73894ab","./WallGeometryLibrary-2f7aa617","./GeographicProjection-c931c7fb","./Matrix4-4c545f70","./RuntimeError-26acdd3b","./Rectangle-cf3e0e3e","./WebGLConstants-508b9636","./Matrix2-dc0c61cc","./Transforms-5b829630","./when-422ea0ae","./Resource-8ae1a924","./combine-3c023bda","./arrayRemoveDuplicates-cea3b206","./PolylinePipeline-0e56eeb9","./EllipsoidGeodesic-e7a5ca44","./EllipsoidRhumbLine-592e8885","./IntersectionTests-80510c7b","./Plane-bc8b6777"],(function(e,i,t,n,a,o,s,r,l,m,c,d,u,p,f,h,g,y,_,b,E,C,H,A,k,w,x){"use strict";const G=new n.Cartesian3,L=new n.Cartesian3;function P(t){const a=(t=e.defaultValue(t,e.defaultValue.EMPTY_OBJECT)).positions,o=t.maximumHeights,s=t.minimumHeights,r=e.defaultValue(t.granularity,m.CesiumMath.RADIANS_PER_DEGREE),l=e.defaultValue(t.ellipsoid,i.Ellipsoid.WGS84);this._positions=a,this._minimumHeights=s,this._maximumHeights=o,this._granularity=r,this._ellipsoid=i.Ellipsoid.clone(l),this._workerName="createWallOutlineGeometry";let c=1+a.length*n.Cartesian3.packedLength+2;e.defined(s)&&(c+=s.length),e.defined(o)&&(c+=o.length),this.packedLength=c+i.Ellipsoid.packedLength+1}P.pack=function(t,a,o){let s;o=e.defaultValue(o,0);const r=t._positions;let l=r.length;for(a[o++]=l,s=0;s<l;++s,o+=n.Cartesian3.packedLength)n.Cartesian3.pack(r[s],a,o);const m=t._minimumHeights;if(l=e.defined(m)?m.length:0,a[o++]=l,e.defined(m))for(s=0;s<l;++s)a[o++]=m[s];const c=t._maximumHeights;if(l=e.defined(c)?c.length:0,a[o++]=l,e.defined(c))for(s=0;s<l;++s)a[o++]=c[s];return i.Ellipsoid.pack(t._ellipsoid,a,o),a[o+=i.Ellipsoid.packedLength]=t._granularity,a};const v=i.Ellipsoid.clone(i.Ellipsoid.UNIT_SPHERE),T={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:v,granularity:void 0};return P.unpack=function(t,a,o){let s;a=e.defaultValue(a,0);let r=t[a++];const l=new Array(r);for(s=0;s<r;++s,a+=n.Cartesian3.packedLength)l[s]=n.Cartesian3.unpack(t,a);let m,c;if(r=t[a++],r>0)for(m=new Array(r),s=0;s<r;++s)m[s]=t[a++];if(r=t[a++],r>0)for(c=new Array(r),s=0;s<r;++s)c[s]=t[a++];const d=i.Ellipsoid.unpack(t,a,v),u=t[a+=i.Ellipsoid.packedLength];return e.defined(o)?(o._positions=l,o._minimumHeights=m,o._maximumHeights=c,o._ellipsoid=i.Ellipsoid.clone(d,o._ellipsoid),o._granularity=u,o):(T.positions=l,T.minimumHeights=m,T.maximumHeights=c,T.granularity=u,new P(T))},P.fromConstantHeights=function(i){const t=(i=e.defaultValue(i,e.defaultValue.EMPTY_OBJECT)).positions;let n,a;const o=i.minimumHeight,s=i.maximumHeight,r=e.defined(o),l=e.defined(s);if(r||l){const e=t.length;n=r?new Array(e):void 0,a=l?new Array(e):void 0;for(let i=0;i<e;++i)r&&(n[i]=o),l&&(a[i]=s)}return new P({positions:t,maximumHeights:a,minimumHeights:n,ellipsoid:i.ellipsoid})},P.createGeometry=function(i){const o=i._positions,d=i._minimumHeights,u=i._maximumHeights,p=i._granularity,f=i._ellipsoid,h=c.WallGeometryLibrary.computePositions(f,o,u,d,p,!1);if(!e.defined(h))return;const g=h.bottomPositions,y=h.topPositions;let _=y.length,b=2*_;const E=new Float64Array(b);let C,H=0;for(_/=3,C=0;C<_;++C){const e=3*C,i=n.Cartesian3.fromArray(y,e,G),t=n.Cartesian3.fromArray(g,e,L);E[H++]=t.x,E[H++]=t.y,E[H++]=t.z,E[H++]=i.x,E[H++]=i.y,E[H++]=i.z}const A=new r.GeometryAttributes({position:new s.GeometryAttribute({componentDatatype:a.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:E})}),k=b/3;b=2*k-4+k;const w=l.IndexDatatype.createTypedArray(k,b);let x=0;for(C=0;C<k-2;C+=2){const e=C,i=C+2,t=n.Cartesian3.fromArray(E,3*e,G),a=n.Cartesian3.fromArray(E,3*i,L);if(n.Cartesian3.equalsEpsilon(t,a,m.CesiumMath.EPSILON10))continue;const o=C+1,s=C+3;w[x++]=o,w[x++]=e,w[x++]=o,w[x++]=s,w[x++]=e,w[x++]=i}return w[x++]=k-2,w[x++]=k-1,new s.Geometry({attributes:A,indices:w,primitiveType:s.PrimitiveType.LINES,boundingSphere:new t.BoundingSphere.fromVertices(E)})},function(t,n){return e.defined(n