surprise
2024-04-17 f560ccccd3878497339daeee3241a81c263898f7
1
define(["./when-229515d6","./Matrix2-2fec35ad","./arrayRemoveDuplicates-bb548aa3","./BoundingRectangle-a8819644","./Transforms-75891ac8","./ComponentDatatype-17b06483","./PolylineVolumeGeometryLibrary-2222b7a1","./RuntimeError-ffe03243","./GeometryAttribute-c0946387","./GeometryAttributes-b253752a","./IndexDatatype-b10faa0b","./PolygonPipeline-1d19b57a","./PixelFormat-daf99ebc","./WebGLConstants-4e26b85a","./combine-8ce3f24b","./EllipsoidTangentPlane-52a8d8f6","./AxisAlignedBoundingBox-9cc0d3fd","./IntersectionTests-c2481e4c","./Plane-c66ae040","./PolylinePipeline-f3398bb8","./EllipsoidGeodesic-cadbe242","./EllipsoidRhumbLine-0b875bcf"],(function(e,i,n,a,t,r,o,l,s,p,d,c,u,y,g,h,f,m,v,b,E,P){"use strict";function _(n){var a=(n=e.defaultValue(n,e.defaultValue.EMPTY_OBJECT)).polylinePositions,t=n.shapePositions;this._positions=a,this._shape=t,this._ellipsoid=i.Ellipsoid.clone(e.defaultValue(n.ellipsoid,i.Ellipsoid.WGS84)),this._cornerType=e.defaultValue(n.cornerType,o.CornerType.ROUNDED),this._granularity=e.defaultValue(n.granularity,r.CesiumMath.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeOutlineGeometry";var l=1+a.length*i.Cartesian3.packedLength;l+=1+t.length*i.Cartesian2.packedLength,this.packedLength=l+i.Ellipsoid.packedLength+2}_.pack=function(n,a,t){var r;t=e.defaultValue(t,0);var o=n._positions,l=o.length;for(a[t++]=l,r=0;r<l;++r,t+=i.Cartesian3.packedLength)i.Cartesian3.pack(o[r],a,t);var s=n._shape;for(l=s.length,a[t++]=l,r=0;r<l;++r,t+=i.Cartesian2.packedLength)i.Cartesian2.pack(s[r],a,t);return i.Ellipsoid.pack(n._ellipsoid,a,t),t+=i.Ellipsoid.packedLength,a[t++]=n._cornerType,a[t]=n._granularity,a};var k=i.Ellipsoid.clone(i.Ellipsoid.UNIT_SPHERE),C={polylinePositions:void 0,shapePositions:void 0,ellipsoid:k,height:void 0,cornerType:void 0,granularity:void 0};_.unpack=function(n,a,t){var r;a=e.defaultValue(a,0);var o=n[a++],l=new Array(o);for(r=0;r<o;++r,a+=i.Cartesian3.packedLength)l[r]=i.Cartesian3.unpack(n,a);o=n[a++];var s=new Array(o);for(r=0;r<o;++r,a+=i.Cartesian2.packedLength)s[r]=i.Cartesian2.unpack(n,a);var p=i.Ellipsoid.unpack(n,a,k);a+=i.Ellipsoid.packedLength;var d=n[a++],c=n[a];return e.defined(t)?(t._positions=l,t._shape=s,t._ellipsoid=i.Ellipsoid.clone(p,t._ellipsoid),t._cornerType=d,t._granularity=c,t):(C.polylinePositions=l,C.shapePositions=s,C.cornerType=d,C.granularity=c,new _(C))};var L=new a.BoundingRectangle;return _.createGeometry=function(e){var l=e._positions,u=n.arrayRemoveDuplicates(l,i.Cartesian3.equalsEpsilon),y=e._shape;if(y=o.PolylineVolumeGeometryLibrary.removeDuplicatesFromShape(y),!(u.length<2||y.length<3)){c.PolygonPipeline.computeWindingOrder2D(y)===c.WindingOrder.CLOCKWISE&&y.reverse();var g=a.BoundingRectangle.fromPoints(y,L);return function(e,i){var n=new p.GeometryAttributes;n.position=new s.GeometryAttribute({componentDatatype:r.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:e});var a,o,l=i.length,c=n.position.values.length/3,u=e.length/3/l,y=d.IndexDatatype.createTypedArray(c,2*l*(u+1)),g=0,h=(a=0)*l;for(o=0;o<l-1;o++)y[g++]=o+h,y[g++]=o+h+1;for(y[g++]=l-1+h,y[g++]=h,h=(a=u-1)*l,o=0;o<l-1;o++)y[g++]=o+h,y[g++]=o+h+1;for(y[g++]=l-1+h,y[g++]=h,a=0;a<u-1;a++){var f=l*a,m=f+l;for(o=0;o<l;o++)y[g++]=o+f,y[g++]=o+m}return new s.Geometry({attributes:n,indices:d.IndexDatatype.createTypedArray(c,y),boundingSphere:t.BoundingSphere.fromVertices(e),primitiveType:s.PrimitiveType.LINES})}(o.PolylineVolumeGeometryLibrary.computePositions(u,y,g,e,!1),y)}},function(n,a){return e.defined(a)&&(n=_.unpack(n,a)),n._ellipsoid=i.Ellipsoid.clone(n._ellipsoid),_.createGeometry(n)}}));