2 lines
6.2 KiB
JavaScript
2 lines
6.2 KiB
JavaScript
/* 2020-9-22 15:23:25 | 版权所有 军懋国兴 */
|
|
define(["./when-cbf8cd21","./Check-35e1a91d","./Math-69007a69","./Cartesian2-43e3a3be","./Transforms-2d1ac5ec","./RuntimeError-f4c64df1","./WebGLConstants-95ceb4e9","./ComponentDatatype-607c9a0c","./GeometryAttribute-2303bbfb","./GeometryAttributes-90846c5f","./AttributeCompression-ea810287","./GeometryPipeline-1ea64cde","./EncodedCartesian3-29a09d7b","./IndexDatatype-79bb407c","./IntersectionTests-459f6f08","./Plane-46b5436f","./VertexFormat-fe64931e","./arrayRemoveDuplicates-d96adeb6","./BoundingRectangle-943d30f6","./EllipsoidTangentPlane-b5927ee3","./EllipsoidRhumbLine-357c11e7","./PolygonPipeline-2ee85025","./PolylineVolumeGeometryLibrary-7daaef99","./EllipsoidGeodesic-007422da","./PolylinePipeline-be169602"],function(u,c,n,g,T,e,t,G,A,R,r,I,i,O,o,a,y,l,s,d,p,S,h,m,f){"use strict";var v={};function q(e,t){if(!u.defined(e))throw new c.DeveloperError("identifier is required.");u.defined(v[e])||(v[e]=!0,console.warn(u.defaultValue(t,e)))}function b(e){var t=(e=u.defaultValue(e,u.defaultValue.EMPTY_OBJECT)).polylinePositions,r=e.shapePositions;if(!u.defined(t))throw new c.DeveloperError("options.polylinePositions is required.");if(!u.defined(r))throw new c.DeveloperError("options.shapePositions is required.");this._positions=t,this._shape=r,this._ellipsoid=g.Ellipsoid.clone(u.defaultValue(e.ellipsoid,g.Ellipsoid.WGS84)),this._cornerType=u.defaultValue(e.cornerType,h.CornerType.ROUNDED),this._vertexFormat=y.VertexFormat.clone(u.defaultValue(e.vertexFormat,y.VertexFormat.DEFAULT)),this._granularity=u.defaultValue(e.granularity,n.CesiumMath.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeGeometry";var i=1+t.length*g.Cartesian3.packedLength;i+=1+r.length*g.Cartesian2.packedLength,this.packedLength=i+g.Ellipsoid.packedLength+y.VertexFormat.packedLength+2}q.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.",q.geometryZIndex="Entity geometry with zIndex are unsupported when height or extrudedHeight are defined. zIndex will be ignored",q.geometryHeightReference="Entity corridor, ellipse, polygon or rectangle with heightReference must also have a defined height. heightReference will be ignored",q.geometryExtrudedHeightReference="Entity corridor, ellipse, polygon or rectangle with extrudedHeightReference must also have a defined extrudedHeight. extrudedHeightReference will be ignored",b.pack=function(e,t,r){if(!u.defined(e))throw new c.DeveloperError("value is required");if(!u.defined(t))throw new c.DeveloperError("array is required");var i;r=u.defaultValue(r,0);var n=e._positions,o=n.length;for(t[r++]=o,i=0;i<o;++i,r+=g.Cartesian3.packedLength)g.Cartesian3.pack(n[i],t,r);var a=e._shape,o=a.length;for(t[r++]=o,i=0;i<o;++i,r+=g.Cartesian2.packedLength)g.Cartesian2.pack(a[i],t,r);return g.Ellipsoid.pack(e._ellipsoid,t,r),r+=g.Ellipsoid.packedLength,y.VertexFormat.pack(e._vertexFormat,t,r),r+=y.VertexFormat.packedLength,t[r++]=e._cornerType,t[r]=e._granularity,t};var E=g.Ellipsoid.clone(g.Ellipsoid.UNIT_SPHERE),w=new y.VertexFormat,P={polylinePositions:void 0,shapePositions:void 0,ellipsoid:E,vertexFormat:w,cornerType:void 0,granularity:void 0};b.unpack=function(e,t,r){if(!u.defined(e))throw new c.DeveloperError("array is required");t=u.defaultValue(t,0);for(var i=e[t++],n=new Array(i),o=0;o<i;++o,t+=g.Cartesian3.packedLength)n[o]=g.Cartesian3.unpack(e,t);i=e[t++];var a=new Array(i);for(o=0;o<i;++o,t+=g.Cartesian2.packedLength)a[o]=g.Cartesian2.unpack(e,t);var l=g.Ellipsoid.unpack(e,t,E);t+=g.Ellipsoid.packedLength;var s=y.VertexFormat.unpack(e,t,w);t+=y.VertexFormat.packedLength;var d=e[t++],p=e[t];return u.defined(r)?(r._positions=n,r._shape=a,r._ellipsoid=g.Ellipsoid.clone(l,r._ellipsoid),r._vertexFormat=y.VertexFormat.clone(s,r._vertexFormat),r._cornerType=d,r._granularity=p,r):(P.polylinePositions=n,P.shapePositions=a,P.cornerType=d,P.granularity=p,new b(P))};var _=new s.BoundingRectangle;return b.createGeometry=function(e){var t=e._positions,r=l.arrayRemoveDuplicates(t,g.Cartesian3.equalsEpsilon),i=e._shape,i=h.PolylineVolumeGeometryLibrary.removeDuplicatesFromShape(i);if(!(r.length<2||i.length<3)){S.PolygonPipeline.computeWindingOrder2D(i)===S.WindingOrder.CLOCKWISE&&i.reverse();var n=s.BoundingRectangle.fromPoints(i,_);return function(e,t,r,i){var n=new R.GeometryAttributes;i.position&&(n.position=new A.GeometryAttribute({componentDatatype:G.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:e}));var o,a,l,s,d,p=t.length,u=e.length/3,c=(u-2*p)/(2*p),g=S.PolygonPipeline.triangulate(t),y=(c-1)*p*6+2*g.length,h=O.IndexDatatype.createTypedArray(u,y),m=2*p,f=0;for(k=0;k<c-1;k++){for(o=0;o<p-1;o++)d=(a=2*o+k*p*2)+m,s=(l=a+1)+m,h[f++]=l,h[f++]=a,h[f++]=s,h[f++]=s,h[f++]=a,h[f++]=d;s=(l=(a=2*p-2+k*p*2)+1)+m,d=a+m,h[f++]=l,h[f++]=a,h[f++]=s,h[f++]=s,h[f++]=a,h[f++]=d}if(i.st||i.tangent||i.bitangent){for(var v,b,E=new Float32Array(2*u),w=1/(c-1),P=1/r.height,_=r.height/2,x=0,k=0;k<c;k++){for(v=k*w,b=P*(t[0].y+_),E[x++]=v,E[x++]=b,o=1;o<p;o++)b=P*(t[o].y+_),E[x++]=v,E[x++]=b,E[x++]=v,E[x++]=b;b=P*(t[0].y+_),E[x++]=v,E[x++]=b}for(o=0;o<p;o++)v=0,b=P*(t[o].y+_),E[x++]=v,E[x++]=b;for(o=0;o<p;o++)v=(c-1)*w,b=P*(t[o].y+_),E[x++]=v,E[x++]=b;n.st=new A.GeometryAttribute({componentDatatype:G.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:new Float32Array(E)})}var C=u-2*p;for(k=0;k<g.length;k+=3){var V=g[k]+C,D=g[k+1]+C,L=g[k+2]+C;h[f++]=V,h[f++]=D,h[f++]=L,h[f++]=L+p,h[f++]=D+p,h[f++]=V+p}var F=new A.Geometry({attributes:n,indices:h,boundingSphere:T.BoundingSphere.fromVertices(e),primitiveType:A.PrimitiveType.TRIANGLES});if(i.normal&&(F=I.GeometryPipeline.computeNormal(F)),i.tangent||i.bitangent){try{F=I.GeometryPipeline.computeTangentAndBitangent(F)}catch(e){q("polyline-volume-tangent-bitangent","Unable to compute tangents and bitangents for polyline volume geometry")}i.tangent||(F.attributes.tangent=void 0),i.bitangent||(F.attributes.bitangent=void 0),i.st||(F.attributes.st=void 0)}return F}(h.PolylineVolumeGeometryLibrary.computePositions(r,i,n,e,!0),i,n,e._vertexFormat)}},function(e,t){return u.defined(t)&&(e=b.unpack(e,t)),e._ellipsoid=g.Ellipsoid.clone(e._ellipsoid),b.createGeometry(e)}}); |