ts/public/GV/thirdParty/CesiumManager/Workers/createGroundPolylineGeometry.js

2 lines
18 KiB
JavaScript
Raw Normal View History

2024-12-09 06:44:52 +00:00
define(["./when-54c2dc71","./Check-6c0211bc","./Math-fc8cecf5","./Cartesian2-bddc1162","./Transforms-d07bb42c","./RuntimeError-2109023a","./WebGLConstants-76bb35d1","./ComponentDatatype-6d99a1ee","./GeometryAttribute-be1a3386","./EncodedCartesian3-4df2eabb","./IntersectionTests-8abf6dba","./Plane-c8971487","./WebMercatorProjection-df58d479","./arrayRemoveDuplicates-ebc732b0","./ArcType-dc1c5aee","./EllipsoidRhumbLine-c704bf4c","./EllipsoidGeodesic-30fae80b"],function(B,e,be,Oe,Pe,a,t,ke,Ae,Le,j,r,n,G,V,Y,M){"use strict";function i(e){e=B.defaultValue(e,B.defaultValue.EMPTY_OBJECT),this._ellipsoid=B.defaultValue(e.ellipsoid,Oe.Ellipsoid.WGS84),this._rectangle=B.defaultValue(e.rectangle,Oe.Rectangle.MAX_VALUE),this._projection=new Pe.GeographicProjection(this._ellipsoid),this._numberOfLevelZeroTilesX=B.defaultValue(e.numberOfLevelZeroTilesX,2),this._numberOfLevelZeroTilesY=B.defaultValue(e.numberOfLevelZeroTilesY,1)}Object.defineProperties(i.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}}),i.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e},i.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e},i.prototype.rectangleToNativeRectangle=function(e,a){var t=be.CesiumMath.toDegrees(e.west),n=be.CesiumMath.toDegrees(e.south),i=be.CesiumMath.toDegrees(e.east),e=be.CesiumMath.toDegrees(e.north);return B.defined(a)?(a.west=t,a.south=n,a.east=i,a.north=e,a):new Oe.Rectangle(t,n,i,e)},i.prototype.tileXYToNativeRectangle=function(e,a,t,n){n=this.tileXYToRectangle(e,a,t,n);return n.west=be.CesiumMath.toDegrees(n.west),n.south=be.CesiumMath.toDegrees(n.south),n.east=be.CesiumMath.toDegrees(n.east),n.north=be.CesiumMath.toDegrees(n.north),n},i.prototype.tileXYToRectangle=function(e,a,t,n){var i=this._rectangle,r=this.getNumberOfXTilesAtLevel(t),s=this.getNumberOfYTilesAtLevel(t),t=i.width/r,r=e*t+i.west,e=(e+1)*t+i.west,t=i.height/s,s=i.north-a*t,t=i.north-(a+1)*t;return B.defined(n)||(n=new Oe.Rectangle(r,t,e,s)),n.west=r,n.south=t,n.east=e,n.north=s,n},i.prototype.positionToTileXY=function(e,a,t){var n=this._rectangle;if(Oe.Rectangle.contains(n,e)){var i=this.getNumberOfXTilesAtLevel(a),r=this.getNumberOfYTilesAtLevel(a),s=n.width/i,o=n.height/r,a=e.longitude;n.east<n.west&&(a+=be.CesiumMath.TWO_PI);s=(a-n.west)/s|0;i<=s&&(s=i-1);o=(n.north-e.latitude)/o|0;return(r<=o&&(o=r-1),B.defined(t))?(t.x=s,t.y=o,t):new Oe.Cartesian2(s,o)}};var s=new Oe.Cartesian3,o=new Oe.Cartesian3,l=new Oe.Cartographic,u=new Oe.Cartesian3,c=new Oe.Cartesian3,C=new Pe.BoundingSphere,p=new i,d=[new Oe.Cartographic,new Oe.Cartographic,new Oe.Cartographic,new Oe.Cartographic],h=new Oe.Cartesian2,Se={};function g(e){Oe.Cartographic.fromRadians(e.east,e.north,0,d[0]),Oe.Cartographic.fromRadians(e.west,e.north,0,d[1]),Oe.Cartographic.fromRadians(e.east,e.south,0,d[2]),Oe.Cartographic.fromRadians(e.west,e.south,0,d[3]);for(var a=0,t=0,n=0,i=0,r=Se._terrainHeightsMaxLevel,s=0;s<=r;++s){for(var o=!1,l=0;l<4;++l){var u=d[l];if(p.positionToTileXY(u,s,h),0===l)n=h.x,i=h.y;else if(n!==h.x||i!==h.y){o=!0;break}}if(o)break;a=n,t=i}if(0!==s)return{x:a,y:t,level:r<s?r:s-1}}Se.initialize=function(){var e=Se._initPromise;return B.defined(e)?e:(e=Pe.Resource.fetchJson(Pe.buildModuleUrl("Assets/approximateTerrainHeights.json")).then(function(e){Se._terrainHeights=e}),Se._initPromise=e)},Se.getMinimumMaximumHeights=function(e,a){a=B.defaultValue(a,Oe.Ellipsoid.WGS84);var t=g(e),n=Se._defaultMinTerrainHeight,i=Se._defaultMaxTerrainHeight;return B.defined(t)&&(t=t.level+"-"+t.x+"-"+t.y,t=Se._terrainHeights[t],B.defined(t)&&(n=t[0],i=t[1]),a.cartographicToCartesian(Oe.Rectangle.northeast(e,l),s),a.cartographicToCartesian(Oe.Rectangle.southwest(e,l),o),Oe.Cartesian3.midpoint(o,s,u),a=a.scaleToGeodeticSurface(u,c),n=B.defined(a)?(a=Oe.Cartesian3.distance(u,a),Math.min(n,-a)):Se._defaultMinTerrainHeight),{minimumTerrainHeight:n=Math.max(Se._defaultMinTerrainHeight,n),maximumTerrainHeight:i}},Se.getB