diff --git a/externs/olx.js b/externs/olx.js index 4f864f5467..8f480b4118 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -4235,7 +4235,8 @@ olx.source.MapQuestOptions.prototype.url; /** * @typedef {{projection: ol.proj.ProjectionLike, - * tileGrid: (ol.tilegrid.TileGrid|undefined)}} + * tileGrid: (ol.tilegrid.TileGrid|undefined), + * wrapX: (boolean|undefined)}} * @api */ olx.source.TileDebugOptions; @@ -4257,6 +4258,14 @@ olx.source.TileDebugOptions.prototype.projection; olx.source.TileDebugOptions.prototype.tileGrid; +/** + * Whether to wrap the world horizontally. Default is `true`. + * @type {boolean|undefined} + * @api + */ +olx.source.TileDebugOptions.prototype.wrapX; + + /** * @typedef {{attributions: (Array.|undefined), * crossOrigin: (null|string|undefined), @@ -6142,7 +6151,7 @@ olx.tilegrid.TileGridOptions; /** * Extent for the tile grid. No tiles outside this extent will be requested by * {@link ol.source.Tile} sources. When no `origin` or `origins` are - * configured, the `origin` will be set to the bottom-left corner of the extent. + * configured, the `origin` will be set to the top-left corner of the extent. * @type {ol.Extent|undefined} * @api */ @@ -6189,17 +6198,6 @@ olx.tilegrid.TileGridOptions.prototype.origins; olx.tilegrid.TileGridOptions.prototype.resolutions; -/** - * Number of tile rows and columns of the grid for each zoom level. This setting - * is only needed for tile coordinate transforms that need to work with origins - * other than the bottom-left corner of the grid. No tiles outside this range - * will be requested by sources. If an `extent` is also configured, it takes - * precedence. - * @type {Array.|undefined} - */ -olx.tilegrid.TileGridOptions.prototype.sizes; - - /** * Tile size. Default is `[256, 256]`. * @type {number|ol.Size|undefined} @@ -6233,9 +6231,8 @@ olx.tilegrid.WMTSOptions; /** * Extent for the tile grid. No tiles outside this extent will be requested by - * {@link ol.source.WMTS} sources. When no `origin` or `origins` are - * configured, the `origin` will be calculated from the extent. - * When no `sizes` are configured, they will be calculated from the extent. + * {@link ol.source.Tile} sources. When no `origin` or `origins` are + * configured, the `origin` will be set to the top-left corner of the extent. * @type {ol.Extent|undefined} * @api */ @@ -6243,19 +6240,23 @@ olx.tilegrid.WMTSOptions.prototype.extent; /** - * Origin, i.e. the top-left corner of the grid. + * The tile grid origin, i.e. where the `x` and `y` axes meet (`[z, 0, 0]`). + * Tile coordinates increase from left to right and from bottom to top. If not + * specified, `extent` or `origins` must be provided. * @type {ol.Coordinate|undefined} - * @api + * @api stable */ olx.tilegrid.WMTSOptions.prototype.origin; /** - * Origins, i.e. the top-left corners of the grid for each zoom level. The - * length of this array needs to match the length of the - * `resolutions` array. + * Tile grid origins, i.e. where the `x` and `y` axes meet (`[z, 0, 0]`), for + * each zoom level. If given, the array length should match the length of the + * `resolutions` array, i.e. each resolution can have a different origin. Tile + * coordinates increase from left to right and from bottom to top. If not + * specified, `extent` or `origin` must be provided. * @type {Array.|undefined} - * @api + * @api stable */ olx.tilegrid.WMTSOptions.prototype.origins; @@ -6284,7 +6285,10 @@ olx.tilegrid.WMTSOptions.prototype.matrixIds; * here are the `TileMatrixWidth` and `TileMatrixHeight` advertised in the * GetCapabilities response of the WMTS, and define the grid's extent together * with the `origin`. An `extent` can be configured in addition, and will - * further limit the extent for which tile requests are made by sources. + * further limit the extent for which tile requests are made by sources. Note + * that when the top-left corner of the `extent` is used as `origin` or + * `origins`, then the `y` value must be negative because OpenLayers tile + * coordinates increase from bottom to top. * @type {Array.|undefined} * @api */ diff --git a/src/ol/source/tiledebugsource.js b/src/ol/source/tiledebugsource.js index 59a1540f00..01d884bb8f 100644 --- a/src/ol/source/tiledebugsource.js +++ b/src/ol/source/tiledebugsource.js @@ -91,7 +91,8 @@ ol.source.TileDebug = function(options) { goog.base(this, { opaque: false, projection: options.projection, - tileGrid: options.tileGrid + tileGrid: options.tileGrid, + wrapX: goog.isDef(options.wrapX) ? options.wrapX : true }); }; @@ -108,8 +109,9 @@ ol.source.TileDebug.prototype.getTile = function(z, x, y) { } else { var tileSize = ol.size.toSize(this.tileGrid.getTileSize(z)); var tileCoord = [z, x, y]; - var text = ol.tilecoord.toString( - this.getTileCoordForTileUrlFunction(tileCoord)); + var textTileCoord = this.getTileCoordForTileUrlFunction(tileCoord); + var text = goog.isNull(textTileCoord) ? '' : ol.tilecoord.toString( + this.getTileCoordForTileUrlFunction(textTileCoord)); var tile = new ol.DebugTile_(tileCoord, tileSize, text); this.tileCache.set(tileCoordKey, tile); return tile;