createWallOutlineGeometry.js 4.5 KB

1
  1. define(["./when-92c6cf3c","./Rectangle-bab7abf0","./buildModuleUrl-3d15f25c","./Cartographic-67e73ef9","./ComponentDatatype-81047f82","./Check-52a7d806","./GeometryAttribute-ef657318","./GeometryAttributes-7f66ea53","./IndexDatatype-4c0e98b8","./Math-92c3b5f7","./PrimitiveType-cdfe443e","./WallGeometryLibrary-74484942","./Intersect-b97e930a","./Event-3390cd7d","./RuntimeError-c6a62a80","./WebGLConstants-71f10989","./Cartesian2-6033fa5d","./FeatureDetection-067cb23c","./Cartesian4-ad128b5d","./arrayRemoveDuplicates-f7eaafa2","./PolylinePipeline-c0932bf7","./EllipsoidGeodesic-04ac0e77","./EllipsoidRhumbLine-8847d1a1","./IntersectionTests-a42760d9","./Plane-f8d22530"],(function(e,t,i,n,r,o,a,s,m,u,l,p,h,d,c,f,g,y,v,_,w,b,A,H,E){"use strict";var x=new n.t,k=new n.t;function L(i){var r=(i=e.u(i,e.u.EMPTY_OBJECT)).positions,a=i.maximumHeights,s=i.minimumHeights;if(!e.e(r))throw new o.t("options.positions is required.");if(e.e(a)&&a.length!==r.length)throw new o.t("options.positions and options.maximumHeights must have the same length.");if(e.e(s)&&s.length!==r.length)throw new o.t("options.positions and options.minimumHeights must have the same length.");var m=e.u(i.granularity,u.e.RADIANS_PER_DEGREE),l=e.u(i.ellipsoid,t.t.WGS84);this._positions=r,this._minimumHeights=s,this._maximumHeights=a,this._granularity=m,this._ellipsoid=t.t.clone(l),this._workerName="createWallOutlineGeometry",this._outlineWidth=e.u(i.outlineWidth,1);var p=1+r.length*n.t.packedLength+2;e.e(s)&&(p+=s.length),e.e(a)&&(p+=a.length),this.packedLength=p+t.t.packedLength+2}L.pack=function(i,r,a){if(!e.e(i))throw new o.t("value is required");if(!e.e(r))throw new o.t("array is required");a=e.u(a,0);var s,m=i._positions,u=m.length;for(r[a++]=u,s=0;s<u;++s,a+=n.t.packedLength)n.t.pack(m[s],r,a);var l=i._minimumHeights;if(u=e.e(l)?l.length:0,r[a++]=u,e.e(l))for(s=0;s<u;++s)r[a++]=l[s];var p=i._maximumHeights;if(u=e.e(p)?p.length:0,r[a++]=u,e.e(p))for(s=0;s<u;++s)r[a++]=p[s];return t.t.pack(i._ellipsoid,r,a),a+=t.t.packedLength,r[a++]=i._granularity,r[a]=i._outlineWidth,r};var P=t.t.clone(t.t.UNIT_SPHERE),D={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:P,granularity:void 0,outlineWidth:void 0};return L.unpack=function(i,r,a){if(!e.e(i))throw new o.t("array is required");r=e.u(r,0);var s,m,u,l=i[r++],p=new Array(l);for(s=0;s<l;++s,r+=n.t.packedLength)p[s]=n.t.unpack(i,r);if((l=i[r++])>0)for(m=new Array(l),s=0;s<l;++s)m[s]=i[r++];if((l=i[r++])>0)for(u=new Array(l),s=0;s<l;++s)u[s]=i[r++];var h=t.t.unpack(i,r,P);r+=t.t.packedLength;var d=i[r++],c=i[r];return e.e(a)?(a._positions=p,a._minimumHeights=m,a._maximumHeights=u,a._ellipsoid=t.t.clone(h,a._ellipsoid),a._granularity=d,a._outlineWidth=c,a):(D.positions=p,D.minimumHeights=m,D.maximumHeights=u,D.granularity=d,D.outlineWidth=c,new L(D))},L.fromConstantHeights=function(t){var i=(t=e.u(t,e.u.EMPTY_OBJECT)).positions;if(!e.e(i))throw new o.t("options.positions is required.");var n,r,a=t.minimumHeight,s=t.maximumHeight,m=e.e(a),u=e.e(s);if(m||u){var l=i.length;n=m?new Array(l):void 0,r=u?new Array(l):void 0;for(var p=0;p<l;++p)m&&(n[p]=a),u&&(r[p]=s)}return new L({positions:i,maximumHeights:r,minimumHeights:n,ellipsoid:t.ellipsoid})},L.createGeometry=function(t){var o=t._positions,h=t._minimumHeights,d=t._maximumHeights,c=t._granularity,f=t._ellipsoid,g=p.D.computePositions(f,o,d,h,c,!1);if(!e.e(g))return;var y=g.pos.bottomPositions,v=g.pos.topPositions,_=v.length;let w=_/3;var b=3*(2*(2*w-2)+1),A=new Float64Array(b),H=0;let E,L,P;for(_=w,E=0;E<_;++E){var D=3*E;L=n.t.fromArray(v,D,x),P=n.t.fromArray(y,D,k),0!==E&&(A[H++]=L.x,A[H++]=L.y,A[H++]=L.z),A[H++]=P.x,A[H++]=P.y,A[H++]=P.z,A[H++]=L.x,A[H++]=L.y,A[H++]=L.z}for(H-=3,E=_-2;E>=0;--E){D=3*E;P=n.t.fromArray(y,D,k),A[H++]=P.x,A[H++]=P.y,A[H++]=P.z}let C=new s.a({position:new a.o({componentDatatype:r.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:A})});C.sideness=new a.o({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:new Float32Array([0,0,0,1,1,1,1,0])}),C.sideness.isInstanceAttribute=!0;var G=b/3;b=2*G-4+G;var T=m.IndexDatatype.createTypedArray(G,b),I=0;for(E=0;E<G-2;E+=2){var W=E,R=E+2,q=n.t.fromArray(A,3*W,x),O=n.t.fromArray(A,3*R,k);if(!n.t.equalsEpsilon(q,O,u.e.EPSILON10)){var S=E+1,N=E+3;T[I++]=S,T[I++]=W,T[I++]=S,T[I++]=N,T[I++]=W,T[I++]=R}}return T[I++]=G-2,T[I++]=G-1,new a.I({attributes:C,indices:T,primitiveType:l._0x29ba75.TRIANGLES,boundingSphere:new i.i.fromVertices(A)})},function(i,n){return e.e(n)&&(i=L.unpack(i,n)),i._ellipsoid=t.t.clone(i._ellipsoid),L.createGeometry(i)}}));