Move olx.tilegrid.XYZOptions to ol/tilegrid

This commit is contained in:
Michael Kuenzli
2018-04-17 14:46:51 +02:00
parent 2178393e18
commit 310b9256eb
2 changed files with 14 additions and 48 deletions

View File

@@ -70,16 +70,28 @@ export function createForExtent(extent, opt_maxZoom, opt_tileSize, opt_corner) {
}
/**
* @typedef {Object} XYZOptions
* @property {module:ol/extent~Extent} [extent] 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 tile fits in the
* provided extent. If not provided, the extent of the EPSG:3857 projection is used.
* @property {number} [maxZoom] Maximum zoom. The default is `ol.DEFAULT_MAX_ZOOM`. This determines the number of levels
* in the grid set. For example, a `maxZoom` of 21 means there are 22 levels in the grid set.
* @property {number} [minZoom=0] Minimum zoom.
* @property {number|module:ol/size~Size} [tileSize=[256, 256]] Tile size in pixels.
*/
/**
* Creates a tile grid with a standard XYZ tiling scheme.
* @param {olx.tilegrid.XYZOptions=} opt_options Tile grid options.
* @param {module:ol/tilegrid~XYZOptions=} opt_options Tile grid options.
* @return {!module:ol/tilegrid/TileGrid~TileGrid} Tile grid instance.
* @api
*/
export function createXYZ(opt_options) {
const options = /** @type {module:ol/tilegrid/TileGrid~Options} */ ({});
assign(options, opt_options !== undefined ?
opt_options : /** @type {olx.tilegrid.XYZOptions} */ ({}));
opt_options : /** @type {module:ol/tilegrid~XYZOptions} */ ({}));
if (options.extent === undefined) {
options.extent = getProjection('EPSG:3857').getExtent();
}