2 lines
2.2 KiB
JavaScript
2 lines
2.2 KiB
JavaScript
define(["exports","./Cartesian2-bd414876","./Check-741c5f3c","./defaultValue-81eec7ed","./GeographicProjection-c931c7fb","./Math-e73894ab","./Rectangle-cf3e0e3e"],(function(e,t,i,n,o,s,r){"use strict";function l(e){e=n.defaultValue(e,n.defaultValue.EMPTY_OBJECT),this._ellipsoid=n.defaultValue(e.ellipsoid,t.Ellipsoid.WGS84),this._rectangle=n.defaultValue(e.rectangle,r.Rectangle.MAX_VALUE),this._projection=new o.GeographicProjection(this._ellipsoid),this._numberOfLevelZeroTilesX=n.defaultValue(e.numberOfLevelZeroTilesX,2),this._numberOfLevelZeroTilesY=n.defaultValue(e.numberOfLevelZeroTilesY,1)}Object.defineProperties(l.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}}),l.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e},l.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e},l.prototype.rectangleToNativeRectangle=function(e,t){const i=s.CesiumMath.toDegrees(e.west),o=s.CesiumMath.toDegrees(e.south),l=s.CesiumMath.toDegrees(e.east),u=s.CesiumMath.toDegrees(e.north);return n.defined(t)?(t.west=i,t.south=o,t.east=l,t.north=u,t):new r.Rectangle(i,o,l,u)},l.prototype.tileXYToNativeRectangle=function(e,t,i,n){const o=this.tileXYToRectangle(e,t,i,n);return o.west=s.CesiumMath.toDegrees(o.west),o.south=s.CesiumMath.toDegrees(o.south),o.east=s.CesiumMath.toDegrees(o.east),o.north=s.CesiumMath.toDegrees(o.north),o},l.prototype.tileXYToRectangle=function(e,t,i,o){const s=this._rectangle,l=this.getNumberOfXTilesAtLevel(i),u=this.getNumberOfYTilesAtLevel(i),a=s.width/l,h=e*a+s.west,c=(e+1)*a+s.west,g=s.height/u,f=s.north-t*g,p=s.north-(t+1)*g;return n.defined(o)||(o=new r.Rectangle(h,p,c,f)),o.west=h,o.south=p,o.east=c,o.north=f,o},l.prototype.positionToTileXY=function(e,i,o){const l=this._rectangle;if(!r.Rectangle.contains(l,e))return;const u=this.getNumberOfXTilesAtLevel(i),a=this.getNumberOfYTilesAtLevel(i),h=l.width/u,c=l.height/a;let g=e.longitude;l.east<l.west&&(g+=s.CesiumMath.TWO_PI);let f=(g-l.west)/h|0;f>=u&&(f=u-1);let p=(l.north-e.latitude)/c|0;return p>=a&&(p=a-1),n.defined(o)?(o.x=f,o.y=p,o):new t.Cartesian2(f,p)},e.GeographicTilingScheme=l}));
|