Fix return from findLoadedTiles

Previously, the findInterimTiles method was returning undefined if the min x/y coord for a tile range was already in the lookup.  The return says it indicates whether all tiles for the given z are loaded.  This change corrects the return.

This change also reveals a misunderstanding of the tile range returned by `getTileRangeForExtentAndZ`.  The previous findInterimTiles method was treating max values as inclusive.  This is intuitive.  It looks like the method returns a range where max values are exclusive.
This commit is contained in:
Tim Schaub
2013-02-18 14:51:39 -07:00
parent ddf993f0c9
commit 6aa4e99fe5
2 changed files with 100 additions and 10 deletions

View File

@@ -75,12 +75,13 @@ ol.source.TileSource.prototype.findLoadedTiles = function(loadedTilesByZ, z,
// FIXME this could be more efficient about filling partial holes
var fullyCovered = true;
var tile, tileCoord, tileCoordKey, x, y;
// TODO: tile range is misunderstood (inclusive or not?)
for (x = tileRange.minX; x <= tileRange.maxX; ++x) {
for (y = tileRange.minY; y <= tileRange.maxY; ++y) {
tileCoord = new ol.TileCoord(z, x, y);
tileCoordKey = tileCoord.toString();
if (loadedTilesByZ[z] && loadedTilesByZ[z][tileCoordKey]) {
return false; // TODO: fix this
continue;
}
tile = this.getTile(tileCoord);
if (!goog.isNull(tile) && tile.getState() == ol.TileState.LOADED) {