1
Surpriseplus
2022-09-16 8d1a91c23df335b090e38b2edd15203aa3b03da9
1
define(["./when-cbf8cd21","./Check-35e1a91d","./Math-e66fad2a","./Rectangle-53325d53","./WebGLConstants-95ceb4e9","./PixelFormat-d198afce","./Transforms-00c25a19","./RuntimeError-f4c64df1","./ComponentDatatype-7ee14e67","./GeometryAttribute-0b3418e6","./GeometryAttributes-90846c5f","./AttributeCompression-fd688b33","./GeometryPipeline-eeba9dc9","./EncodedCartesian3-35776b5f","./IndexDatatype-66caba23","./IntersectionTests-fdc68d04","./Plane-353c5ea0","./VertexFormat-cc24f342","./arrayRemoveDuplicates-b817241d","./BoundingRectangle-1ba4d0fb","./EllipsoidTangentPlane-c89e3523","./EllipsoidRhumbLine-59f604d0","./PolygonPipeline-ae1ebf63","./PolylineVolumeGeometryLibrary-6022a47f","./EllipsoidGeodesic-f0048131","./PolylinePipeline-2c8508bb"],function(c,e,i,u,t,n,G,r,R,A,D,a,I,o,O,l,s,g,p,d,y,m,S,h,f,v){"use strict";var b={};function B(e,t){c.defined(b[e])||(b[e]=!0,console.warn(c.defaultValue(t,e)))}function E(e){var t=(e=c.defaultValue(e,c.defaultValue.EMPTY_OBJECT)).polylinePositions,n=e.shapePositions;this._positions=t,this._shape=n,this._ellipsoid=u.Ellipsoid.clone(c.defaultValue(e.ellipsoid,u.Ellipsoid.WGS84)),this._cornerType=c.defaultValue(e.cornerType,h.CornerType.ROUNDED),this._vertexFormat=g.VertexFormat.clone(c.defaultValue(e.vertexFormat,g.VertexFormat.DEFAULT)),this._granularity=c.defaultValue(e.granularity,i.CesiumMath.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeGeometry";var r=1+t.length*u.Cartesian3.packedLength;r+=1+n.length*u.Cartesian2.packedLength,this.packedLength=r+u.Ellipsoid.packedLength+g.VertexFormat.packedLength+2}B.geometryOutlines="Entity geometry outlines are unsupported on terrain. Outlines will be disabled. To enable outlines, disable geometry terrain clamping by explicitly setting height to 0.",B.geometryZIndex="Entity geometry with zIndex are unsupported when height or extrudedHeight are defined.  zIndex will be ignored",B.geometryHeightReference="Entity corridor, ellipse, polygon or rectangle with heightReference must also have a defined height.  heightReference will be ignored",B.geometryExtrudedHeightReference="Entity corridor, ellipse, polygon or rectangle with extrudedHeightReference must also have a defined extrudedHeight.  extrudedHeightReference will be ignored",E.pack=function(e,t,n){var r;n=c.defaultValue(n,0);var i=e._positions,a=i.length;for(t[n++]=a,r=0;r<a;++r,n+=u.Cartesian3.packedLength)u.Cartesian3.pack(i[r],t,n);var o=e._shape,a=o.length;for(t[n++]=a,r=0;r<a;++r,n+=u.Cartesian2.packedLength)u.Cartesian2.pack(o[r],t,n);return u.Ellipsoid.pack(e._ellipsoid,t,n),n+=u.Ellipsoid.packedLength,g.VertexFormat.pack(e._vertexFormat,t,n),n+=g.VertexFormat.packedLength,t[n++]=e._cornerType,t[n]=e._granularity,t};var P=u.Ellipsoid.clone(u.Ellipsoid.UNIT_SPHERE),_=new g.VertexFormat,x={polylinePositions:void 0,shapePositions:void 0,ellipsoid:P,vertexFormat:_,cornerType:void 0,granularity:void 0};E.unpack=function(e,t,n){t=c.defaultValue(t,0);for(var r=e[t++],i=new Array(r),a=0;a<r;++a,t+=u.Cartesian3.packedLength)i[a]=u.Cartesian3.unpack(e,t);r=e[t++];var o=new Array(r);for(a=0;a<r;++a,t+=u.Cartesian2.packedLength)o[a]=u.Cartesian2.unpack(e,t);var l=u.Ellipsoid.unpack(e,t,P);t+=u.Ellipsoid.packedLength;var s=g.VertexFormat.unpack(e,t,_);t+=g.VertexFormat.packedLength;var p=e[t++],d=e[t];return c.defined(n)?(n._positions=i,n._shape=o,n._ellipsoid=u.Ellipsoid.clone(l,n._ellipsoid),n._vertexFormat=g.VertexFormat.clone(s,n._vertexFormat),n._cornerType=p,n._granularity=d,n):(x.polylinePositions=i,x.shapePositions=o,x.cornerType=p,x.granularity=d,new E(x))};var k=new d.BoundingRectangle;return E.createGeometry=function(e){var t=e._positions,n=p.arrayRemoveDuplicates(t,u.Cartesian3.equalsEpsilon),r=e._shape,r=h.PolylineVolumeGeometryLibrary.removeDuplicatesFromShape(r);if(!(n.length<2||r.length<3)){S.PolygonPipeline.computeWindingOrder2D(r)===S.WindingOrder.CLOCKWISE&&r.reverse();var i=d.BoundingRectangle.fromPoints(r,k);return function(e,t,n,r){var i=new D.GeometryAttributes;r.position&&(i.position=new A.GeometryAttribute({componentDatatype:R.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:e}));var a,o,l,s,p,d=t.length,c=e.length/3,u=(c-2*d)/(2*d),g=S.PolygonPipeline.triangulate(t),y=(u-1)*d*6+2*g.length,m=O.IndexDatatype.createTypedArray(c,y),h=2*d,f=0;for(V=0;V<u-1;V++){for(a=0;a<d-1;a++)p=(o=2*a+V*d*2)+h,s=(l=o+1)+h,m[f++]=l,m[f++]=o,m[f++]=s,m[f++]=s,m[f++]=o,m[f++]=p;s=(l=(o=2*d-2+V*d*2)+1)+h,p=o+h,m[f++]=l,m[f++]=o,m[f++]=s,m[f++]=s,m[f++]=o,m[f++]=p}if(r.st||r.tangent||r.bitangent){for(var v,b,E=new Float32Array(2*c),P=1/(u-1),_=1/n.height,x=n.height/2,k=0,V=0;V<u;V++){for(v=V*P,b=_*(t[0].y+x),E[k++]=v,E[k++]=b,a=1;a<d;a++)b=_*(t[a].y+x),E[k++]=v,E[k++]=b,E[k++]=v,E[k++]=b;b=_*(t[0].y+x),E[k++]=v,E[k++]=b}for(a=0;a<d;a++)v=0,b=_*(t[a].y+x),E[k++]=v,E[k++]=b;for(a=0;a<d;a++)v=(u-1)*P,b=_*(t[a].y+x),E[k++]=v,E[k++]=b;i.st=new A.GeometryAttribute({componentDatatype:R.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:new Float32Array(E)})}var C=c-2*d;for(V=0;V<g.length;V+=3){var F=g[V]+C,L=g[V+1]+C,w=g[V+2]+C;m[f++]=F,m[f++]=L,m[f++]=w,m[f++]=w+d,m[f++]=L+d,m[f++]=F+d}var T=new A.Geometry({attributes:i,indices:m,boundingSphere:G.BoundingSphere.fromVertices(e),primitiveType:A.PrimitiveType.TRIANGLES});if(r.normal&&(T=I.GeometryPipeline.computeNormal(T)),r.tangent||r.bitangent){try{T=I.GeometryPipeline.computeTangentAndBitangent(T)}catch(e){B("polyline-volume-tangent-bitangent","Unable to compute tangents and bitangents for polyline volume geometry")}r.tangent||(T.attributes.tangent=void 0),r.bitangent||(T.attributes.bitangent=void 0),r.st||(T.attributes.st=void 0)}return T}(h.PolylineVolumeGeometryLibrary.computePositions(n,r,i,e,!0),r,i,e._vertexFormat)}},function(e,t){return c.defined(t)&&(e=E.unpack(e,t)),e._ellipsoid=u.Ellipsoid.clone(e._ellipsoid),E.createGeometry(e)}});