add getTile() function to Grid.js. with tests
git-svn-id: http://svn.openlayers.org/trunk/openlayers@981 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -101,6 +101,30 @@ OpenLayers.Layer.Grid.prototype =
|
||||
this.tileSize = size.clone();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {String} tileID
|
||||
*
|
||||
* @returns The OpenLayers.Tile with the corresponding ID from the grid.
|
||||
* if no tile is found, returns null
|
||||
* @type OpenLayers.Tile
|
||||
*/
|
||||
getTile: function(tileID) {
|
||||
var foundTile = null;
|
||||
if (this.grid) {
|
||||
|
||||
for(var iRow = 0; iRow < this.grid.length; iRow++) {
|
||||
var row = this.grid[iRow];
|
||||
for(var iCol = 0; iCol < row.length; iCol++) {
|
||||
var tile = row[iCol];
|
||||
if (tile.id == tileID) {
|
||||
foundTile = tile;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return foundTile;
|
||||
},
|
||||
|
||||
/** This function is called whenever the map is moved. All the moving
|
||||
* of actual 'tiles' is done by the map, but moveTo's role is to accept
|
||||
|
||||
Reference in New Issue
Block a user