learning_cesium/js/XbsjCesium/Workers/createPolylineVolumeOutline...

2 lines
3.5 KiB
JavaScript

define(["./when-54335d57","./Cartesian2-697a9954","./arrayRemoveDuplicates-db90b85c","./BoundingRectangle-f46bca91","./Transforms-251ff661","./ComponentDatatype-417761a2","./PolylineVolumeGeometryLibrary-82babed3","./Check-f3fec9b0","./GeometryAttribute-7ca1c9e4","./GeometryAttributes-caa08d6c","./IndexDatatype-c134ea39","./Math-737a2579","./PolygonPipeline-1048742e","./RuntimeError-88a32665","./WebGLConstants-4739ce15","./EllipsoidTangentPlane-ae33ec6a","./AxisAlignedBoundingBox-dcfdb7a9","./IntersectionTests-3e34a0aa","./Plane-d4cb7bb3","./PolylinePipeline-d9c22c71","./EllipsoidGeodesic-efd225af","./EllipsoidRhumbLine-e5c51fa7"],function(d,c,t,o,u,y,r,e,h,g,f,a,l,i,n,s,p,m,E,v,P,_){"use strict";function b(e){var i=(e=d.defaultValue(e,d.defaultValue.EMPTY_OBJECT)).polylinePositions,n=e.shapePositions;this._positions=i,this._shape=n,this._ellipsoid=c.Ellipsoid.clone(d.defaultValue(e.ellipsoid,c.Ellipsoid.WGS84)),this._cornerType=d.defaultValue(e.cornerType,r.CornerType.ROUNDED),this._granularity=d.defaultValue(e.granularity,a.CesiumMath.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeOutlineGeometry";i=1+i.length*c.Cartesian3.packedLength;i+=1+n.length*c.Cartesian2.packedLength,this.packedLength=i+c.Ellipsoid.packedLength+2}b.pack=function(e,i,n){var a;n=d.defaultValue(n,0);var t=e._positions,o=t.length;for(i[n++]=o,a=0;a<o;++a,n+=c.Cartesian3.packedLength)c.Cartesian3.pack(t[a],i,n);var r=e._shape,o=r.length;for(i[n++]=o,a=0;a<o;++a,n+=c.Cartesian2.packedLength)c.Cartesian2.pack(r[a],i,n);return c.Ellipsoid.pack(e._ellipsoid,i,n),n+=c.Ellipsoid.packedLength,i[n++]=e._cornerType,i[n]=e._granularity,i};var k=c.Ellipsoid.clone(c.Ellipsoid.UNIT_SPHERE),C={polylinePositions:void 0,shapePositions:void 0,ellipsoid:k,height:void 0,cornerType:void 0,granularity:void 0};b.unpack=function(e,i,n){i=d.defaultValue(i,0);for(var a=e[i++],t=new Array(a),o=0;o<a;++o,i+=c.Cartesian3.packedLength)t[o]=c.Cartesian3.unpack(e,i);var a=e[i++],r=new Array(a);for(o=0;o<a;++o,i+=c.Cartesian2.packedLength)r[o]=c.Cartesian2.unpack(e,i);var l=c.Ellipsoid.unpack(e,i,k);i+=c.Ellipsoid.packedLength;var s=e[i++],p=e[i];return d.defined(n)?(n._positions=t,n._shape=r,n._ellipsoid=c.Ellipsoid.clone(l,n._ellipsoid),n._cornerType=s,n._granularity=p,n):(C.polylinePositions=t,C.shapePositions=r,C.cornerType=s,C.granularity=p,new b(C))};var L=new o.BoundingRectangle;return b.createGeometry=function(e){var i=e._positions,n=t.arrayRemoveDuplicates(i,c.Cartesian3.equalsEpsilon),a=e._shape,a=r.PolylineVolumeGeometryLibrary.removeDuplicatesFromShape(a);if(!(n.length<2||a.length<3)){l.PolygonPipeline.computeWindingOrder2D(a)===l.WindingOrder.CLOCKWISE&&a.reverse();i=o.BoundingRectangle.fromPoints(a,L);return function(e,i){var n=new g.GeometryAttributes;n.position=new h.GeometryAttribute({componentDatatype:y.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:e});var a=i.length,i=n.position.values.length/3,t=e.length/3/a,o=f.IndexDatatype.createTypedArray(i,2*a*(1+t)),r=0,l=0,s=l*a;for(c=0;c<a-1;c++)o[r++]=c+s,o[r++]=c+s+1;for(o[r++]=a-1+s,o[r++]=s,s=(l=t-1)*a,c=0;c<a-1;c++)o[r++]=c+s,o[r++]=c+s+1;for(o[r++]=a-1+s,o[r++]=s,l=0;l<t-1;l++)for(var p=a*l,d=p+a,c=0;c<a;c++)o[r++]=c+p,o[r++]=c+d;return new h.Geometry({attributes:n,indices:f.IndexDatatype.createTypedArray(i,o),boundingSphere:u.BoundingSphere.fromVertices(e),primitiveType:h.PrimitiveType.LINES})}(r.PolylineVolumeGeometryLibrary.computePositions(n,a,i,e,!1),a)}},function(e,i){return(e=d.defined(i)?b.unpack(e,i):e)._ellipsoid=c.Ellipsoid.clone(e._ellipsoid),b.createGeometry(e)}});