createCorridorOutlineGeometry.js 6.7 KB

1
  1. define(["./arrayFill-0358accf","./arrayRemoveDuplicates-f7eaafa2","./buildModuleUrl-3d15f25c","./Cartographic-67e73ef9","./Check-52a7d806","./ComponentDatatype-81047f82","./PolylineVolumeGeometryLibrary-9a645937","./CorridorGeometryLibrary-db429299","./when-92c6cf3c","./Rectangle-bab7abf0","./GeometryAttribute-ef657318","./GeometryAttributes-7f66ea53","./GeometryOffsetAttribute-b4d599f5","./IndexDatatype-4c0e98b8","./Math-92c3b5f7","./PolygonPipeline-b86e8785","./PrimitiveType-cdfe443e","./Intersect-b97e930a","./Event-3390cd7d","./RuntimeError-c6a62a80","./WebGLConstants-71f10989","./Cartesian2-6033fa5d","./Cartesian4-ad128b5d","./EllipsoidTangentPlane-53184efd","./IntersectionTests-a42760d9","./Plane-f8d22530","./PolylinePipeline-c0932bf7","./EllipsoidGeodesic-04ac0e77","./EllipsoidRhumbLine-8847d1a1","./FeatureDetection-067cb23c","./WindingOrder-1b9c8a87"],(function(t,e,i,r,o,n,a,s,l,u,d,p,h,f,c,g,b,y,v,A,_,m,E,w,T,P,D,G,O,k,L){"use strict";var x=new r.t,I=new r.t,N=new r.t;function H(t,e){var i,o,u,h=[],c=t.positions,g=t.corners,b=t.endPositions,y=new p.a,v=0,A=0,_=0;for(o=0;o<c.length;o+=2)v+=u=c[o].length-3,_+=u/3*4,A+=c[o+1].length-3;for(v+=3,A+=3,o=0;o<g.length;o++){i=g[o];var m=g[o].leftPositions;l.e(m)?(v+=u=m.length,_+=u/3*2):(A+=u=g[o].rightPositions.length,_+=u/3*2)}var E,w=l.e(b);w&&(v+=E=b[0].length-3,A+=E,_+=4*(E/=3));var T,P,D,G,O,k,L=v+A,H=new Float64Array(L),C=0,S=L-1,R=E/2,U=f.IndexDatatype.createTypedArray(L/3,_+4),M=0;if(U[M++]=C/3,U[M++]=(S-2)/3,w){h.push(C/3),k=x,O=I;var B=b[0];for(o=0;o<R;o++)k=r.t.fromArray(B,3*(R-1-o),k),O=r.t.fromArray(B,3*(R+o),O),s.b.addAttribute(H,O,C),s.b.addAttribute(H,k,void 0,S),G=(P=C/3)+1,D=(T=(S-2)/3)-1,U[M++]=T,U[M++]=D,U[M++]=P,U[M++]=G,C+=3,S-=3}var F=0,j=c[F++],V=c[F++];for(H.set(j,C),H.set(V,S-V.length+1),u=V.length-3,h.push(C/3,(S-2)/3),o=0;o<u;o+=3)G=(P=C/3)+1,D=(T=(S-2)/3)-1,U[M++]=T,U[M++]=D,U[M++]=P,U[M++]=G,C+=3,S-=3;for(o=0;o<g.length;o++){var z,W,Y=(i=g[o]).leftPositions,q=i.rightPositions,J=N;if(l.e(Y)){for(S-=3,W=D,h.push(G),z=0;z<Y.length/3;z++)J=r.t.fromArray(Y,3*z,J),U[M++]=W-z-1,U[M++]=W-z,s.b.addAttribute(H,J,void 0,S),S-=3;h.push(W-Math.floor(Y.length/6)),e===a.S.BEVELED&&h.push((S-2)/3+1),C+=3}else{for(C+=3,W=G,h.push(D),z=0;z<q.length/3;z++)J=r.t.fromArray(q,3*z,J),U[M++]=W+z,U[M++]=W+z+1,s.b.addAttribute(H,J,C),C+=3;h.push(W+Math.floor(q.length/6)),e===a.S.BEVELED&&h.push(C/3-1),S-=3}for(j=c[F++],V=c[F++],j.splice(0,3),V.splice(V.length-3,3),H.set(j,C),H.set(V,S-V.length+1),u=V.length-3,z=0;z<V.length;z+=3)P=(G=C/3)-1,T=(D=(S-2)/3)+1,U[M++]=T,U[M++]=D,U[M++]=P,U[M++]=G,C+=3,S-=3;C-=3,S+=3,h.push(C/3,(S-2)/3)}if(w){C+=3,S-=3,k=x,O=I;var K=b[1];for(o=0;o<R;o++)k=r.t.fromArray(K,3*(E-o-1),k),O=r.t.fromArray(K,3*o,O),s.b.addAttribute(H,k,void 0,S),s.b.addAttribute(H,O,C),P=(G=C/3)-1,T=(D=(S-2)/3)+1,U[M++]=T,U[M++]=D,U[M++]=P,U[M++]=G,C+=3,S-=3;h.push(C/3)}else h.push(C/3,(S-2)/3);return U[M++]=C/3,U[M++]=(S-2)/3,y.position=new d.o({componentDatatype:n.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:H}),{attributes:y,indices:U,wallIndices:h}}function C(t){var e=(t=l.u(t,l.u.EMPTY_OBJECT)).positions,i=t.width;o.o.typeOf.object("options.positions",e),o.o.typeOf.number("options.width",i);var n=l.u(t.height,0),s=l.u(t.extrudedHeight,n);this._positions=e,this._ellipsoid=u.t.clone(l.u(t.ellipsoid,u.t.WGS84)),this._width=i,this._height=Math.max(n,s),this._extrudedHeight=Math.min(n,s),this._cornerType=l.u(t.cornerType,a.S.ROUNDED),this._granularity=l.u(t.granularity,c.e.RADIANS_PER_DEGREE),this._offsetAttribute=t.offsetAttribute,this._workerName="createCorridorOutlineGeometry",this.packedLength=1+e.length*r.t.packedLength+u.t.packedLength+6}C.pack=function(t,e,i){o.o.typeOf.object("value",t),o.o.typeOf.object("array",e),i=l.u(i,0);var n=t._positions,a=n.length;e[i++]=a;for(var s=0;s<a;++s,i+=r.t.packedLength)r.t.pack(n[s],e,i);return u.t.pack(t._ellipsoid,e,i),i+=u.t.packedLength,e[i++]=t._width,e[i++]=t._height,e[i++]=t._extrudedHeight,e[i++]=t._cornerType,e[i++]=t._granularity,e[i]=l.u(t._offsetAttribute,-1),e};var S=u.t.clone(u.t.UNIT_SPHERE),R={positions:void 0,ellipsoid:S,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,offsetAttribute:void 0};return C.unpack=function(t,e,i){o.o.typeOf.object("array",t),e=l.u(e,0);for(var n=t[e++],a=new Array(n),s=0;s<n;++s,e+=r.t.packedLength)a[s]=r.t.unpack(t,e);var d=u.t.unpack(t,e,S);e+=u.t.packedLength;var p=t[e++],h=t[e++],f=t[e++],c=t[e++],g=t[e++],b=t[e];return l.e(i)?(i._positions=a,i._ellipsoid=u.t.clone(d,i._ellipsoid),i._width=p,i._height=h,i._extrudedHeight=f,i._cornerType=c,i._granularity=g,i._offsetAttribute=-1===b?void 0:b,i):(R.positions=a,R.width=p,R.height=h,R.extrudedHeight=f,R.cornerType=c,R.granularity=g,R.offsetAttribute=-1===b?void 0:b,new C(R))},C.createGeometry=function(o){var a=o._positions,u=o._width,p=o._ellipsoid;a=function(t,e){for(var i=0;i<t.length;i++)t[i]=e.scaleToGeodeticSurface(t[i],t[i]);return t}(a,p);var y=e.D(a,r.t.equalsEpsilon);if(!(y.length<2||u<=0)){var v,A=o._height,_=o._extrudedHeight,m=!c.e.equalsEpsilon(A,_,0,c.e.EPSILON2),E={ellipsoid:p,positions:y,width:u,cornerType:o._cornerType,granularity:o._granularity,saveAttributes:!1};if(m)E.height=A,E.extrudedHeight=_,E.offsetAttribute=o._offsetAttribute,v=function(e){var i=e.ellipsoid,r=H(s.b.computePositions(e),e.cornerType),o=r.wallIndices,a=e.height,u=e.extrudedHeight,p=r.attributes,c=r.indices,b=p.position.values,y=b.length,v=new Float64Array(y);v.set(b);var A=new Float64Array(2*y);if(b=g.A.scaleToGeodeticHeight(b,a,i),v=g.A.scaleToGeodeticHeight(v,u,i),A.set(b),A.set(v,y),p.position.values=A,y/=3,l.e(e.offsetAttribute)){var _=new Uint8Array(2*y);if(e.offsetAttribute===h.z.TOP)_=t.d(_,1,0,y);else{var m=e.offsetAttribute===h.z.NONE?0:1;_=t.d(_,m)}p.applyOffset=new d.o({componentDatatype:n.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:_})}var E,w=c.length,T=f.IndexDatatype.createTypedArray(A.length/3,2*(w+o.length));T.set(c);var P,D,G=w;for(E=0;E<w;E+=2){var O=c[E],k=c[E+1];T[G++]=O+y,T[G++]=k+y}for(E=0;E<o.length;E++)D=(P=o[E])+y,T[G++]=P,T[G++]=D;return{attributes:p,indices:T}}(E);else if((v=H(s.b.computePositions(E),E.cornerType)).attributes.position.values=g.A.scaleToGeodeticHeight(v.attributes.position.values,A,p),l.e(o._offsetAttribute)){var w=v.attributes.position.values.length,T=new Uint8Array(w/3),P=o._offsetAttribute===h.z.NONE?0:1;t.d(T,P),v.attributes.applyOffset=new d.o({componentDatatype:n.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:T})}var D=v.attributes,G=i.i.fromVertices(D.position.values,void 0,3);return new d.I({attributes:D,indices:v.indices,primitiveType:b._0x29ba75.LINES,boundingSphere:G,offsetAttribute:o._offsetAttribute})}},function(t,e){return l.e(e)&&(t=C.unpack(t,e)),t._ellipsoid=u.t.clone(t._ellipsoid),C.createGeometry(t)}}));