s/forEachTileCoordParent/forEachTileCoordParentTileBounds/

This commit is contained in:
Tom Payne
2012-08-05 00:32:02 +02:00
parent c2b1a94298
commit a3b73d5fd4
2 changed files with 8 additions and 4 deletions

View File

@@ -77,13 +77,17 @@ ol.TileGrid = function(resolutions, extent, origin, opt_tileSize) {
/** /**
* @param {ol.TileCoord} tileCoord Tile coordinate. * @param {ol.TileCoord} tileCoord Tile coordinate.
* @param {function(number, ol.TileBounds): boolean} callback Callback. * @param {function(this: T, number, ol.TileBounds): boolean} callback Callback.
* @param {T=} opt_obj Object.
* @template T
*/ */
ol.TileGrid.prototype.forEachTileCoordParent = function(tileCoord, callback) { ol.TileGrid.prototype.forEachTileCoordParentTileBounds =
function(tileCoord, callback, opt_obj) {
var tileCoordExtent = this.getTileCoordExtent(tileCoord); var tileCoordExtent = this.getTileCoordExtent(tileCoord);
var z = tileCoord.z - 1; var z = tileCoord.z - 1;
while (z >= 0) { while (z >= 0) {
if (callback(z, this.getTileBoundsForExtentAndZ(tileCoordExtent, z))) { if (callback.call(
opt_obj, z, this.getTileBoundsForExtentAndZ(tileCoordExtent, z))) {
return; return;
} }
--z; --z;

View File

@@ -398,7 +398,7 @@ function testForEachTileCoordParent() {
var tileGrid = new ol.TileGrid(resolutions, extent, origin, tileSize); var tileGrid = new ol.TileGrid(resolutions, extent, origin, tileSize);
var zs = [], tileBoundss = []; var zs = [], tileBoundss = [];
tileGrid.forEachTileCoordParent( tileGrid.forEachTileCoordParentTileBounds(
new ol.TileCoord(3, 7, 3), new ol.TileCoord(3, 7, 3),
function(z, tileBounds) { function(z, tileBounds) {
zs.push(z); zs.push(z);