Respect the tileSize option for XYZ grids
This commit is contained in:
+11
-3
@@ -5094,7 +5094,8 @@ olx.tilegrid.WMTSOptions.prototype.tileSizes;
|
|||||||
/**
|
/**
|
||||||
* @typedef {{extent: (ol.Extent|undefined),
|
* @typedef {{extent: (ol.Extent|undefined),
|
||||||
* maxZoom: (number|undefined),
|
* maxZoom: (number|undefined),
|
||||||
* minZoom: (number|undefined)}}
|
* minZoom: (number|undefined),
|
||||||
|
* tileSize: (number|undefined)}}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
olx.tilegrid.XYZOptions;
|
olx.tilegrid.XYZOptions;
|
||||||
@@ -5103,8 +5104,8 @@ olx.tilegrid.XYZOptions;
|
|||||||
/**
|
/**
|
||||||
* Extent for the tile grid. The origin for an XYZ tile grid is the top-left
|
* Extent for the tile grid. The origin for an XYZ tile grid is the top-left
|
||||||
* corner of the extent. The zero level of the grid is defined by the
|
* corner of the extent. The zero level of the grid is defined by the
|
||||||
* resolution at which one 256 x 256 tile fits in the provided extent. If not
|
* resolution at which one tile fits in the provided extent. If not provided,
|
||||||
* provided, the extent of the EPSG:3857 projection is used.
|
* the extent of the EPSG:3857 projection is used.
|
||||||
* @type {ol.Extent|undefined}
|
* @type {ol.Extent|undefined}
|
||||||
*/
|
*/
|
||||||
olx.tilegrid.XYZOptions.prototype.extent;
|
olx.tilegrid.XYZOptions.prototype.extent;
|
||||||
@@ -5124,6 +5125,13 @@ olx.tilegrid.XYZOptions.prototype.maxZoom;
|
|||||||
olx.tilegrid.XYZOptions.prototype.minZoom;
|
olx.tilegrid.XYZOptions.prototype.minZoom;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tile size in pixels. Default is 256. (Only square tiles are supported.)
|
||||||
|
* @type {number|undefined}
|
||||||
|
*/
|
||||||
|
olx.tilegrid.XYZOptions.prototype.tileSize;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{resolutions: !Array.<number>}}
|
* @typedef {{resolutions: !Array.<number>}}
|
||||||
* @api
|
* @api
|
||||||
|
|||||||
@@ -24,18 +24,16 @@ goog.require('ol.tilegrid.TileGrid');
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.tilegrid.XYZ = function(options) {
|
ol.tilegrid.XYZ = function(options) {
|
||||||
// TODO: accept a tileSize option
|
|
||||||
var tileSize = ol.DEFAULT_TILE_SIZE;
|
|
||||||
var extent = goog.isDef(options.extent) ?
|
var extent = goog.isDef(options.extent) ?
|
||||||
options.extent : ol.proj.EPSG3857.EXTENT;
|
options.extent : ol.proj.EPSG3857.EXTENT;
|
||||||
var resolutions = ol.tilegrid.resolutionsFromExtent(
|
var resolutions = ol.tilegrid.resolutionsFromExtent(
|
||||||
extent, options.maxZoom, tileSize);
|
extent, options.maxZoom, options.tileSize);
|
||||||
|
|
||||||
goog.base(this, {
|
goog.base(this, {
|
||||||
minZoom: options.minZoom,
|
minZoom: options.minZoom,
|
||||||
origin: ol.extent.getCorner(extent, ol.extent.Corner.TOP_LEFT),
|
origin: ol.extent.getCorner(extent, ol.extent.Corner.TOP_LEFT),
|
||||||
resolutions: resolutions,
|
resolutions: resolutions,
|
||||||
tileSize: tileSize
|
tileSize: options.tileSize
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user