learning_cesium/XbsjCesium/Workers/createGroundPolylineGeometr...

2 lines
18 KiB
JavaScript
Raw Permalink Normal View History

2024-03-19 18:06:25 +08:00
define(["./Transforms-251ff661","./Cartesian2-697a9954","./Check-f3fec9b0","./when-54335d57","./Math-737a2579","./ArcType-2b58731c","./arrayRemoveDuplicates-db90b85c","./ComponentDatatype-417761a2","./EllipsoidGeodesic-efd225af","./EllipsoidRhumbLine-e5c51fa7","./EncodedCartesian3-0ae9fe5e","./GeometryAttribute-7ca1c9e4","./IntersectionTests-3e34a0aa","./Plane-d4cb7bb3","./WebMercatorProjection-6a6458e9","./RuntimeError-88a32665","./WebGLConstants-4739ce15"],function(Oe,be,e,B,Pe,j,G,ke,M,V,Ae,Le,Y,r,a,t,n){"use strict";function i(e){e=B.defaultValue(e,B.defaultValue.EMPTY_OBJECT),this._ellipsoid=B.defaultValue(e.ellipsoid,be.Ellipsoid.WGS84),this._rectangle=B.defaultValue(e.rectangle,be.Rectangle.MAX_VALUE),this._projection=new Oe.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=Pe.CesiumMath.toDegrees(e.west),n=Pe.CesiumMath.toDegrees(e.south),i=Pe.CesiumMath.toDegrees(e.east),e=Pe.CesiumMath.toDegrees(e.north);return B.defined(a)?(a.west=t,a.south=n,a.east=i,a.north=e,a):new be.Rectangle(t,n,i,e)},i.prototype.tileXYToNativeRectangle=function(e,a,t,n){n=this.tileXYToRectangle(e,a,t,n);return n.west=Pe.CesiumMath.toDegrees(n.west),n.south=Pe.CesiumMath.toDegrees(n.south),n.east=Pe.CesiumMath.toDegrees(n.east),n.north=Pe.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(n=!B.defined(n)?new be.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(be.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+=Pe.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 be.Cartesian2(s,o)}};var s=new be.Cartesian3,o=new be.Cartesian3,l=new be.Cartographic,u=new be.Cartesian3,c=new be.Cartesian3,C=new Oe.BoundingSphere,p=new i,h=[new be.Cartographic,new be.Cartographic,new be.Cartographic,new be.Cartographic],d=new be.Cartesian2,Se={};function g(e){be.Cartographic.fromRadians(e.east,e.north,0,h[0]),be.Cartographic.fromRadians(e.west,e.north,0,h[1]),be.Cartographic.fromRadians(e.east,e.south,0,h[2]),be.Cartographic.fromRadians(e.west,e.south,0,h[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)if(p.positionToTileXY(h[l],s,d),0===l)n=d.x,i=d.y;else if(n!==d.x||i!==d.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=Oe.Resource.fetchJson(Oe.buildModuleUrl("Assets/approximateTerrainHeights.json")).then(function(e){Se._terrainHeights=e}),Se._initPromise=e)},Se.getMinimumMaximumHeights=function(e,a){a=B.defaultValue(a,be.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(be.Rectangle.northeast(e,l),s),a.cartographicToCartesian(be.Rectangle.southwest(e,l),o),be.Cartesian3.midpoint(o,s,u),a=a.scaleToGeodeticSurface(u,c),n=B.defined(a)?(a=be.Cartesian3.distance(u,a),Math.min(n,-a)):Se._defaultMinTerrainHeight),{minimumTerrainHeight:n=Math.max(Se._defaultMinTerrainHeight,n),maximumTerrainHeight:i}},Se.getBoundingSphe