From 310b9256eb27bb3b8333990c0a57fceaaabe3e43 Mon Sep 17 00:00:00 2001 From: Michael Kuenzli Date: Tue, 17 Apr 2018 14:46:51 +0200 Subject: [PATCH] Move olx.tilegrid.XYZOptions to ol/tilegrid --- externs/olx.js | 46 ---------------------------------------------- src/ol/tilegrid.js | 16 ++++++++++++++-- 2 files changed, 14 insertions(+), 48 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index 7de64fb3e1..06bcb88675 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -647,49 +647,3 @@ olx.style.StyleOptions.prototype.text; * @api */ olx.style.StyleOptions.prototype.zIndex; - - -/** - * @typedef {{extent: (ol.Extent|undefined), - * maxZoom: (number|undefined), - * minZoom: (number|undefined), - * tileSize: (number|ol.Size|undefined)}} - */ -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 tile fits in the provided extent. If not provided, - * the extent of the EPSG:3857 projection is used. - * @type {ol.Extent|undefined} - * @api - */ -olx.tilegrid.XYZOptions.prototype.extent; - - -/** - * 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. - * @type {number|undefined} - * @api - */ -olx.tilegrid.XYZOptions.prototype.maxZoom; - - -/** - * Minimum zoom. Default is 0. - * @type {number|undefined} - * @api - */ -olx.tilegrid.XYZOptions.prototype.minZoom; - - -/** - * Tile size in pixels. Default is `[256, 256]`. - * @type {number|ol.Size|undefined} - * @api - */ -olx.tilegrid.XYZOptions.prototype.tileSize; diff --git a/src/ol/tilegrid.js b/src/ol/tilegrid.js index 6e9a0643c4..b7d068ed2a 100644 --- a/src/ol/tilegrid.js +++ b/src/ol/tilegrid.js @@ -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(); }