2 lines
3.8 KiB
JavaScript
2 lines
3.8 KiB
JavaScript
|
define(["./defaultValue-81eec7ed","./Cartesian2-bd414876","./arrayRemoveDuplicates-cea3b206","./BoundingRectangle-0e36efc3","./BoundingSphere-9a3b5656","./Cartesian3-e0307675","./ComponentDatatype-aaeec80f","./PolylineVolumeGeometryLibrary-c618b783","./Check-741c5f3c","./GeometryAttribute-2b42a913","./GeometryAttributes-32b29525","./IndexDatatype-3f3c99e8","./Math-e73894ab","./PolygonPipeline-04baeb41","./GeographicProjection-c931c7fb","./Rectangle-cf3e0e3e","./Matrix4-4c545f70","./RuntimeError-26acdd3b","./WebGLConstants-508b9636","./EllipsoidTangentPlane-4d138901","./AxisAlignedBoundingBox-8774439c","./IntersectionTests-80510c7b","./Plane-bc8b6777","./Transforms-5b829630","./when-422ea0ae","./Resource-8ae1a924","./combine-3c023bda","./PolylinePipeline-0e56eeb9","./EllipsoidGeodesic-e7a5ca44","./EllipsoidRhumbLine-592e8885","./Matrix2-dc0c61cc"],(function(e,t,n,i,o,a,r,l,s,c,p,d,u,y,h,g,f,m,b,E,P,_,C,k,L,T,G,D,R,v,A){"use strict";function V(n){const i=(n=e.defaultValue(n,e.defaultValue.EMPTY_OBJECT)).polylinePositions,o=n.shapePositions;this._positions=i,this._shape=o,this._ellipsoid=t.Ellipsoid.clone(e.defaultValue(n.ellipsoid,t.Ellipsoid.WGS84)),this._cornerType=e.defaultValue(n.cornerType,l.CornerType.ROUNDED),this._granularity=e.defaultValue(n.granularity,u.CesiumMath.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeOutlineGeometry";let r=1+i.length*a.Cartesian3.packedLength;r+=1+o.length*t.Cartesian2.packedLength,this.packedLength=r+t.Ellipsoid.packedLength+2}V.pack=function(n,i,o){let r;o=e.defaultValue(o,0);const l=n._positions;let s=l.length;for(i[o++]=s,r=0;r<s;++r,o+=a.Cartesian3.packedLength)a.Cartesian3.pack(l[r],i,o);const c=n._shape;for(s=c.length,i[o++]=s,r=0;r<s;++r,o+=t.Cartesian2.packedLength)t.Cartesian2.pack(c[r],i,o);return t.Ellipsoid.pack(n._ellipsoid,i,o),o+=t.Ellipsoid.packedLength,i[o++]=n._cornerType,i[o]=n._granularity,i};const w=t.Ellipsoid.clone(t.Ellipsoid.UNIT_SPHERE),B={polylinePositions:void 0,shapePositions:void 0,ellipsoid:w,height:void 0,cornerType:void 0,granularity:void 0};V.unpack=function(n,i,o){let r;i=e.defaultValue(i,0);let l=n[i++];const s=new Array(l);for(r=0;r<l;++r,i+=a.Cartesian3.packedLength)s[r]=a.Cartesian3.unpack(n,i);l=n[i++];const c=new Array(l);for(r=0;r<l;++r,i+=t.Cartesian2.packedLength)c[r]=t.Cartesian2.unpack(n,i);const p=t.Ellipsoid.unpack(n,i,w);i+=t.Ellipsoid.packedLength;const d=n[i++],u=n[i];return e.defined(o)?(o._positions=s,o._shape=c,o._ellipsoid=t.Ellipsoid.clone(p,o._ellipsoid),o._cornerType=d,o._granularity=u,o):(B.polylinePositions=s,B.shapePositions=c,B.cornerType=d,B.granularity=u,new V(B))};const S=new i.BoundingRectangle;return V.createGeometry=function(e){const t=e._positions,s=n.arrayRemoveDuplicates(t,a.Cartesian3.equalsEpsilon);let u=e._shape;if(u=l.PolylineVolumeGeometryLibrary.removeDuplicatesFromShape(u),s.length<2||u.length<3)return;y.PolygonPipeline.computeWindingOrder2D(u)===y.WindingOrder.CLOCKWISE&&u.reverse();const h=i.BoundingRectangle.fromPoints(u,S);return function(e,t){const n=new p.GeometryAttributes;n.position=new c.GeometryAttribute({componentDatatype:r.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:e});const i=t.length,a=n.position.values.length/3,l=e.length/3/i,s=d.IndexDatatype.createTypedArray(a,2*i*(l+1));let u,y,h=0;u=0;let g=u*i;for(y=0;y<i-1;y++)s[h++]=y+g,s[h++]=y+g+1;for(s[h++]=i-1+g,s[h++]=g,u=l-1,g=u*i,y=0;y<i-1;y++)s[h++]=y+g,s[h++]=y+g+1;for(s[h++]=i-1+g,s[h++]=g,u=0;u<l-1;u++){const e=i*u,t=e+i;for(y=0;y<i;y++)s[h++]=y+e,s[h++]=y+t}return new c.Geometry({attributes:n,indices:d.IndexDatatype.createTypedArray(a,s),boundingSphere:o.BoundingSphere.fromVertices(e),primitiveType:c.PrimitiveType.LINES})}(l.PolylineVolumeGeometryLibrary.computePositions(s,u,h,e,!1),u)},function(n,i){return e.defined(i)&&(n=V.unpack(n,i)),n._ellipsoid=t.Ellipsoid.clone(n._ellipsoid),V.createGeometry(n)}}));
|