Respect the tileSize option for XYZ grids
This commit is contained in:
@@ -5094,7 +5094,8 @@ olx.tilegrid.WMTSOptions.prototype.tileSizes;
|
||||
/**
|
||||
* @typedef {{extent: (ol.Extent|undefined),
|
||||
* maxZoom: (number|undefined),
|
||||
* minZoom: (number|undefined)}}
|
||||
* minZoom: (number|undefined),
|
||||
* tileSize: (number|undefined)}}
|
||||
* @api
|
||||
*/
|
||||
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
|
||||
* 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
|
||||
* provided, the extent of the EPSG:3857 projection is used.
|
||||
* resolution at which one tile fits in the provided extent. If not provided,
|
||||
* the extent of the EPSG:3857 projection is used.
|
||||
* @type {ol.Extent|undefined}
|
||||
*/
|
||||
olx.tilegrid.XYZOptions.prototype.extent;
|
||||
@@ -5124,6 +5125,13 @@ olx.tilegrid.XYZOptions.prototype.maxZoom;
|
||||
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>}}
|
||||
* @api
|
||||
|
||||
@@ -24,18 +24,16 @@ goog.require('ol.tilegrid.TileGrid');
|
||||
* @api
|
||||
*/
|
||||
ol.tilegrid.XYZ = function(options) {
|
||||
// TODO: accept a tileSize option
|
||||
var tileSize = ol.DEFAULT_TILE_SIZE;
|
||||
var extent = goog.isDef(options.extent) ?
|
||||
options.extent : ol.proj.EPSG3857.EXTENT;
|
||||
var resolutions = ol.tilegrid.resolutionsFromExtent(
|
||||
extent, options.maxZoom, tileSize);
|
||||
extent, options.maxZoom, options.tileSize);
|
||||
|
||||
goog.base(this, {
|
||||
minZoom: options.minZoom,
|
||||
origin: ol.extent.getCorner(extent, ol.extent.Corner.TOP_LEFT),
|
||||
resolutions: resolutions,
|
||||
tileSize: tileSize
|
||||
tileSize: options.tileSize
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user