2 lines
7.3 KiB
JavaScript
2 lines
7.3 KiB
JavaScript
define(["./arrayFill-4513d7ad","./arrayRemoveDuplicates-d2f048c5","./BoundingSphere-561b54d0","./Cartographic-3309dd0d","./Check-7b2a090c","./ComponentDatatype-c140a87d","./PolylineVolumeGeometryLibrary-3333255c","./CorridorGeometryLibrary-63feb55c","./when-b60132fc","./Cartesian2-47311507","./GeometryAttribute-3a42bbdc","./GeometryAttributes-252e9929","./GeometryOffsetAttribute-fbeb6f1a","./IndexDatatype-8a5eead4","./Math-119be1a3","./PolygonPipeline-f49953b9","./PrimitiveType-39acab88","./Cartesian4-3ca25aab","./RuntimeError-4a5c8994","./WebGLConstants-4ae0db90","./EllipsoidTangentPlane-b2b18d75","./IntersectionTests-0c6d0a14","./Plane-097b3a8f","./Transforms-cb0006b0","./buildModuleUrl-3addfe33","./FeatureDetection-c3b71206","./PolylinePipeline-971d8853","./EllipsoidGeodesic-0f19ac62","./EllipsoidRhumbLine-ed1a6bf4","./earcut-2.2.1-20c8012f"],(function(e,t,i,r,o,a,n,s,l,d,u,p,f,h,y,c,b,g,m,v,A,_,C,E,G,T,P,w,L,D){"use strict";var k=new r.Cartesian3,N=new r.Cartesian3,O=new r.Cartesian3;function V(e,t){var i,o,d,f=[],y=e.positions,c=e.corners,b=e.endPositions,g=new p.GeometryAttributes,m=0,v=0,A=0;for(o=0;o<y.length;o+=2)m+=d=y[o].length-3,A+=d/3*4,v+=y[o+1].length-3;for(m+=3,v+=3,o=0;o<c.length;o++){i=c[o];var _=c[o].leftPositions;l.defined(_)?(m+=d=_.length,A+=d/3*2):(v+=d=c[o].rightPositions.length,A+=d/3*2)}var C,E=l.defined(b);E&&(m+=C=b[0].length-3,v+=C,A+=4*(C/=3));var G,T,P,w,L,D,V=m+v,x=new Float64Array(V),H=0,I=V-1,S=C/2,M=h.IndexDatatype.createTypedArray(V/3,A+4),R=0;if(M[R++]=H/3,M[R++]=(I-2)/3,E){f.push(H/3),D=k,L=N;var B=b[0];for(o=0;o<S;o++)D=r.Cartesian3.fromArray(B,3*(S-1-o),D),L=r.Cartesian3.fromArray(B,3*(S+o),L),s.CorridorGeometryLibrary.addAttribute(x,L,H),s.CorridorGeometryLibrary.addAttribute(x,D,void 0,I),w=(T=H/3)+1,P=(G=(I-2)/3)-1,M[R++]=G,M[R++]=P,M[R++]=T,M[R++]=w,H+=3,I-=3}var F=0,U=y[F++],Y=y[F++];for(x.set(U,H),x.set(Y,I-Y.length+1),d=Y.length-3,f.push(H/3,(I-2)/3),o=0;o<d;o+=3)w=(T=H/3)+1,P=(G=(I-2)/3)-1,M[R++]=G,M[R++]=P,M[R++]=T,M[R++]=w,H+=3,I-=3;for(o=0;o<c.length;o++){var q,W,J=(i=c[o]).leftPositions,j=i.rightPositions,z=O;if(l.defined(J)){for(I-=3,W=P,f.push(w),q=0;q<J.length/3;q++)z=r.Cartesian3.fromArray(J,3*q,z),M[R++]=W-q-1,M[R++]=W-q,s.CorridorGeometryLibrary.addAttribute(x,z,void 0,I),I-=3;f.push(W-Math.floor(J.length/6)),t===n.CornerType.BEVELED&&f.push((I-2)/3+1),H+=3}else{for(H+=3,W=w,f.push(P),q=0;q<j.length/3;q++)z=r.Cartesian3.fromArray(j,3*q,z),M[R++]=W+q,M[R++]=W+q+1,s.CorridorGeometryLibrary.addAttribute(x,z,H),H+=3;f.push(W+Math.floor(j.length/6)),t===n.CornerType.BEVELED&&f.push(H/3-1),I-=3}for(U=y[F++],Y=y[F++],U.splice(0,3),Y.splice(Y.length-3,3),x.set(U,H),x.set(Y,I-Y.length+1),d=Y.length-3,q=0;q<Y.length;q+=3)T=(w=H/3)-1,G=(P=(I-2)/3)+1,M[R++]=G,M[R++]=P,M[R++]=T,M[R++]=w,H+=3,I-=3;H-=3,I+=3,f.push(H/3,(I-2)/3)}if(E){H+=3,I-=3,D=k,L=N;var K=b[1];for(o=0;o<S;o++)D=r.Cartesian3.fromArray(K,3*(C-o-1),D),L=r.Cartesian3.fromArray(K,3*o,L),s.CorridorGeometryLibrary.addAttribute(x,D,void 0,I),s.CorridorGeometryLibrary.addAttribute(x,L,H),T=(w=H/3)-1,G=(P=(I-2)/3)+1,M[R++]=G,M[R++]=P,M[R++]=T,M[R++]=w,H+=3,I-=3;f.push(H/3)}else f.push(H/3,(I-2)/3);return M[R++]=H/3,M[R++]=(I-2)/3,g.position=new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:x}),{attributes:g,indices:M,wallIndices:f}}function x(e){var t=(e=l.defaultValue(e,l.defaultValue.EMPTY_OBJECT)).positions,i=e.width,o=l.defaultValue(e.height,0),a=l.defaultValue(e.extrudedHeight,o);this._positions=t,this._ellipsoid=d.Ellipsoid.clone(l.defaultValue(e.ellipsoid,d.Ellipsoid.WGS84)),this._width=i,this._height=Math.max(o,a),this._extrudedHeight=Math.min(o,a),this._cornerType=l.defaultValue(e.cornerType,n.CornerType.ROUNDED),this._granularity=l.defaultValue(e.granularity,y.CesiumMath.RADIANS_PER_DEGREE),this._offsetAttribute=e.offsetAttribute,this._workerName="createCorridorOutlineGeometry",this.packedLength=1+t.length*r.Cartesian3.packedLength+d.Ellipsoid.packedLength+6}x.pack=function(e,t,i){i=l.defaultValue(i,0);var o=e._positions,a=o.length;t[i++]=a;for(var n=0;n<a;++n,i+=r.Cartesian3.packedLength)r.Cartesian3.pack(o[n],t,i);return d.Ellipsoid.pack(e._ellipsoid,t,i),i+=d.Ellipsoid.packedLength,t[i++]=e._width,t[i++]=e._height,t[i++]=e._extrudedHeight,t[i++]=e._cornerType,t[i++]=e._granularity,t[i]=l.defaultValue(e._offsetAttribute,-1),t};var H=d.Ellipsoid.clone(d.Ellipsoid.UNIT_SPHERE),I={positions:void 0,ellipsoid:H,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,offsetAttribute:void 0};return x.unpack=function(e,t,i){t=l.defaultValue(t,0);for(var o=e[t++],a=new Array(o),n=0;n<o;++n,t+=r.Cartesian3.packedLength)a[n]=r.Cartesian3.unpack(e,t);var s=d.Ellipsoid.unpack(e,t,H);t+=d.Ellipsoid.packedLength;var u=e[t++],p=e[t++],f=e[t++],h=e[t++],y=e[t++],c=e[t];return l.defined(i)?(i._positions=a,i._ellipsoid=d.Ellipsoid.clone(s,i._ellipsoid),i._width=u,i._height=p,i._extrudedHeight=f,i._cornerType=h,i._granularity=y,i._offsetAttribute=-1===c?void 0:c,i):(I.positions=a,I.width=u,I.height=p,I.extrudedHeight=f,I.cornerType=h,I.granularity=y,I.offsetAttribute=-1===c?void 0:c,new x(I))},x.createGeometry=function(o){var n=o._positions,d=o._width,p=o._ellipsoid;n=function(e,t){for(var i=0;i<e.length;i++)e[i]=t.scaleToGeodeticSurface(e[i],e[i]);return e}(n,p);var g=t.arrayRemoveDuplicates(n,r.Cartesian3.equalsEpsilon);if(!(g.length<2||d<=0)){var m,v=o._height,A=o._extrudedHeight,_=!y.CesiumMath.equalsEpsilon(v,A,0,y.CesiumMath.EPSILON2),C={ellipsoid:p,positions:g,width:d,cornerType:o._cornerType,granularity:o._granularity,saveAttributes:!1};if(_)C.height=v,C.extrudedHeight=A,C.offsetAttribute=o._offsetAttribute,m=function(t){var i=t.ellipsoid,r=V(s.CorridorGeometryLibrary.computePositions(t),t.cornerType),o=r.wallIndices,n=t.height,d=t.extrudedHeight,p=r.attributes,y=r.indices,b=p.position.values,g=b.length,m=new Float64Array(g);m.set(b);var v,A=new Float64Array(2*g);if(b=c.PolygonPipeline.scaleToGeodeticHeight(b,n,i),m=c.PolygonPipeline.scaleToGeodeticHeight(m,d,i),A.set(b),A.set(m,g),p.position.values=A,g/=3,l.defined(t.offsetAttribute)){var _=new Uint8Array(2*g);if(t.offsetAttribute===f.GeometryOffsetAttribute.TOP)_=e.arrayFill(_,1,0,g);else{var C=t.offsetAttribute===f.GeometryOffsetAttribute.NONE?0:1;_=e.arrayFill(_,C)}p.applyOffset=new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:_})}var E=y.length,G=h.IndexDatatype.createTypedArray(A.length/3,2*(E+o.length));G.set(y);var T,P,w=E;for(v=0;v<E;v+=2){var L=y[v],D=y[v+1];G[w++]=L+g,G[w++]=D+g}for(v=0;v<o.length;v++)P=(T=o[v])+g,G[w++]=T,G[w++]=P;return{attributes:p,indices:G}}(C);else if((m=V(s.CorridorGeometryLibrary.computePositions(C),C.cornerType)).attributes.position.values=c.PolygonPipeline.scaleToGeodeticHeight(m.attributes.position.values,v,p),l.defined(o._offsetAttribute)){var E=m.attributes.position.values.length,G=new Uint8Array(E/3),T=o._offsetAttribute===f.GeometryOffsetAttribute.NONE?0:1;e.arrayFill(G,T),m.attributes.applyOffset=new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:G})}var P=m.attributes,w=i.BoundingSphere.fromVertices(P.position.values,void 0,3);return new u.Geometry({attributes:P,indices:m.indices,primitiveType:b.PrimitiveType.LINES,boundingSphere:w,offsetAttribute:o._offsetAttribute})}},function(e,t){return l.defined(t)&&(e=x.unpack(e,t)),e._ellipsoid=d.Ellipsoid.clone(e._ellipsoid),x.createGeometry(e)}}));
|