You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
18 KiB
2 lines
18 KiB
2 years ago
|
define(["./Transforms-a73b3b3b","./Cartesian2-8417ca3d","./Check-d18af7c4","./when-208fe5b0","./Math-4e53b694","./ArcType-dc1c5aee","./arrayRemoveDuplicates-0f62a181","./ComponentDatatype-9204e9f6","./EllipsoidGeodesic-8015072b","./EllipsoidRhumbLine-28521929","./EncodedCartesian3-874933de","./GeometryAttribute-04a19cfe","./IntersectionTests-7d224a2f","./Plane-4aa8974d","./WebMercatorProjection-ffb6b9f8","./RuntimeError-7f634f5d","./WebGLConstants-76bb35d1"],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,d=[new be.Cartographic,new be.Cartographic,new be.Cartographic,new be.Cartographic],h=new be.Cartesian2,Se={};function g(e){be.Cartographic.fromRadians(e.east,e.north,0,d[0]),be.Cartographic.fromRadians(e.west,e.north,0,d[1]),be.Cartographic.fromRadians(e.east,e.south,0,d[2]),be.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)if(p.positionToTileXY(d[l],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=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
|