Add function to iterate over tile coordinates in extent and z
This commit is contained in:
@@ -150,6 +150,24 @@ ol.tilegrid.TileGrid = function(options) {
|
||||
ol.tilegrid.TileGrid.tmpTileCoord_ = [0, 0, 0];
|
||||
|
||||
|
||||
/**
|
||||
* Call a function with each tile coordinate for a given extent and zoom level.
|
||||
*
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @param {number} zoom Zoom level.
|
||||
* @param {function(ol.TileCoord)} callback Function called with each tile coordinate.
|
||||
* @api
|
||||
*/
|
||||
ol.tilegrid.TileGrid.prototype.forEachTileCoordInExtentAndZ = function(extent, zoom, callback) {
|
||||
var tileRange = this.getTileRangeForExtentAndZ(extent, zoom);
|
||||
for (var i = tileRange.minX, ii = tileRange.maxX; i <= ii; ++i) {
|
||||
for (var j = tileRange.minY, jj = tileRange.maxY; j <= jj; ++j) {
|
||||
callback([zoom, i, j]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
||||
* @param {function(this: T, number, ol.TileRange): boolean} callback Callback.
|
||||
|
||||
Reference in New Issue
Block a user