bmh_cesium/public/lib/cesiumjs/CesiumUnminified/Workers/createWallGeometry.js

2 lines
6.5 KiB
JavaScript
Raw Normal View History

2025-03-09 23:23:50 +00:00
/* 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","./IndexDatatype-79bb407c","./IntersectionTests-459f6f08","./Plane-46b5436f","./VertexFormat-fe64931e","./arrayRemoveDuplicates-d96adeb6","./EllipsoidRhumbLine-357c11e7","./EllipsoidGeodesic-007422da","./PolylinePipeline-be169602","./WallGeometryLibrary-ebaee328"],function(Y,d,Z,j,K,e,t,Q,X,$,ee,i,r,u,a,n,o,s,te){"use strict";var ie=new j.Cartesian3,re=new j.Cartesian3,ae=new j.Cartesian3,ne=new j.Cartesian3,oe=new j.Cartesian3,se=new j.Cartesian3,me=new j.Cartesian3;function f(e){var t=(e=Y.defaultValue(e,Y.defaultValue.EMPTY_OBJECT)).positions,i=e.maximumHeights,r=e.minimumHeights;if(!Y.defined(t))throw new d.DeveloperError("options.positions is required.");if(Y.defined(i)&&i.length!==t.length)throw new d.DeveloperError("options.positions and options.maximumHeights must have the same length.");if(Y.defined(r)&&r.length!==t.length)throw new d.DeveloperError("options.positions and options.minimumHeights must have the same length.");var a=Y.defaultValue(e.vertexFormat,u.VertexFormat.DEFAULT),n=Y.defaultValue(e.granularity,Z.CesiumMath.RADIANS_PER_DEGREE),o=Y.defaultValue(e.ellipsoid,j.Ellipsoid.WGS84);this._positions=t,this._minimumHeights=r,this._maximumHeights=i,this._vertexFormat=u.VertexFormat.clone(a),this._granularity=n,this._ellipsoid=j.Ellipsoid.clone(o),this._workerName="createWallGeometry";var s=1+t.length*j.Cartesian3.packedLength+2;Y.defined(r)&&(s+=r.length),Y.defined(i)&&(s+=i.length),this.packedLength=s+j.Ellipsoid.packedLength+u.VertexFormat.packedLength+1}f.pack=function(e,t,i){if(!Y.defined(e))throw new d.DeveloperError("value is required");if(!Y.defined(t))throw new d.DeveloperError("array is required");var r;i=Y.defaultValue(i,0);var a=e._positions,n=a.length;for(t[i++]=n,r=0;r<n;++r,i+=j.Cartesian3.packedLength)j.Cartesian3.pack(a[r],t,i);var o=e._minimumHeights,n=Y.defined(o)?o.length:0;if(t[i++]=n,Y.defined(o))for(r=0;r<n;++r)t[i++]=o[r];var s=e._maximumHeights;if(n=Y.defined(s)?s.length:0,t[i++]=n,Y.defined(s))for(r=0;r<n;++r)t[i++]=s[r];return j.Ellipsoid.pack(e._ellipsoid,t,i),i+=j.Ellipsoid.packedLength,u.VertexFormat.pack(e._vertexFormat,t,i),t[i+=u.VertexFormat.packedLength]=e._granularity,t};var c=j.Ellipsoid.clone(j.Ellipsoid.UNIT_SPHERE),h=new u.VertexFormat,g={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:c,vertexFormat:h,granularity:void 0};return f.unpack=function(e,t,i){if(!Y.defined(e))throw new d.DeveloperError("array is required");t=Y.defaultValue(t,0);for(var r,a,n=e[t++],o=new Array(n),s=0;s<n;++s,t+=j.Cartesian3.packedLength)o[s]=j.Cartesian3.unpack(e,t);if(0<(n=e[t++]))for(r=new Array(n),s=0;s<n;++s)r[s]=e[t++];if(0<(n=e[t++]))for(a=new Array(n),s=0;s<n;++s)a[s]=e[t++];var m=j.Ellipsoid.unpack(e,t,c);t+=j.Ellipsoid.packedLength;var l=u.VertexFormat.unpack(e,t,h),p=e[t+=u.VertexFormat.packedLength];return Y.defined(i)?(i._positions=o,i._minimumHeights=r,i._maximumHeights=a,i._ellipsoid=j.Ellipsoid.clone(m,i._ellipsoid),i._vertexFormat=u.VertexFormat.clone(l,i._vertexFormat),i._granularity=p,i):(g.positions=o,g.minimumHeights=r,g.maximumHeights=a,g.granularity=p,new f(g))},f.fromConstantHeights=function(e){var t=(e=Y.defaultValue(e,Y.defaultValue.EMPTY_OBJECT)).positions;if(!Y.defined(t))throw new d.DeveloperError("options.positions is required.");var i=e.minimumHeight,r=e.maximumHeight,a=Y.defined(i),n=Y.defined(r);if(a||n)for(var o=t.length,s=a?new Array(o):void 0,m=n?new Array(o):void 0,l=0;l<o;++l)a&&(s[l]=i),n&&(m[l]=r);return new f({positions:t,maximumHeights:m,minimumHeights:s,ellipsoid:e.ellipsoid,vertexFormat:e.vertexFormat})},f.createGeometry=function(e){var t=e._positions,i=e._minimumHeights,r=e._maximumHeights,a=e._vertexFormat,n=e._granularity,o=e._ellipsoid,s=te.WallGeometryLibrary.computePositions(o,t,r,i,n,!0);if(Y.defined(s)){for(var m=s.bottomPositions,l=s.topPositions,p=s.numCorners,