Merge pull request #4596 from ahocevar/tile-key

Use consistent tile coordinate keys
This commit is contained in:
Andreas Hocevar
2016-01-04 19:27:47 +01:00
8 changed files with 10 additions and 26 deletions

View File

@@ -59,7 +59,6 @@ goog.require('ol.renderer.dom.Map');
goog.require('ol.renderer.webgl.Map');
goog.require('ol.size');
goog.require('ol.structs.PriorityQueue');
goog.require('ol.tilecoord');
goog.require('ol.vec.Mat4');
@@ -937,7 +936,7 @@ ol.Map.prototype.getTilePriority =
if (!frameState || !(tileSourceKey in frameState.wantedTiles)) {
return ol.structs.PriorityQueue.DROP;
}
var coordKey = ol.tilecoord.toString(tile.tileCoord);
var coordKey = tile.tileCoord.toString();
if (!frameState.wantedTiles[tileSourceKey][coordKey]) {
return ol.structs.PriorityQueue.DROP;
}

View File

@@ -14,7 +14,6 @@ goog.require('ol.extent');
goog.require('ol.layer.Tile');
goog.require('ol.renderer.canvas.Layer');
goog.require('ol.size');
goog.require('ol.tilecoord');
goog.require('ol.vec.Mat4');
@@ -336,7 +335,7 @@ ol.renderer.canvas.TileLayer.prototype.prepareFrame =
}
goog.asserts.assert(tile);
if (drawableTile(tile)) {
tilesToDrawByZ[z][ol.tilecoord.toString(tile.tileCoord)] = tile;
tilesToDrawByZ[z][tile.tileCoord.toString()] = tile;
continue;
}
fullyLoaded = tileGrid.forEachTileCoordParentTileRange(

View File

@@ -20,7 +20,6 @@ goog.require('ol.renderer.canvas.Layer');
goog.require('ol.renderer.vector');
goog.require('ol.size');
goog.require('ol.source.VectorTile');
goog.require('ol.tilecoord');
goog.require('ol.vec.Mat4');
@@ -439,7 +438,7 @@ ol.renderer.canvas.VectorTileLayer.prototype.prepareFrame =
if (tileState == ol.TileState.LOADED ||
tileState == ol.TileState.EMPTY ||
(tileState == ol.TileState.ERROR && !useInterimTilesOnError)) {
tilesToDrawByZ[z][ol.tilecoord.toString(tile.tileCoord)] = tile;
tilesToDrawByZ[z][tile.tileCoord.toString()] = tile;
continue;
}

View File

@@ -19,7 +19,6 @@ goog.require('ol.extent');
goog.require('ol.layer.Tile');
goog.require('ol.renderer.dom.Layer');
goog.require('ol.size');
goog.require('ol.tilecoord');
goog.require('ol.tilegrid.TileGrid');
goog.require('ol.vec.Mat4');
@@ -142,7 +141,7 @@ ol.renderer.dom.TileLayer.prototype.prepareFrame =
goog.asserts.assert(tile);
tileState = tile.getState();
if (tileState == ol.TileState.LOADED) {
tilesToDrawByZ[z][ol.tilecoord.toString(tile.tileCoord)] = tile;
tilesToDrawByZ[z][tile.tileCoord.toString()] = tile;
continue;
} else if (tileState == ol.TileState.EMPTY ||
(tileState == ol.TileState.ERROR &&
@@ -345,7 +344,7 @@ ol.renderer.dom.TileLayerZ_.prototype.addTile = function(tile, tileGutter) {
var tileCoordY = tileCoord[2];
goog.asserts.assert(tileCoordZ == this.tileCoordOrigin_[0],
'tileCoordZ matches z of tileCoordOrigin');
var tileCoordKey = ol.tilecoord.toString(tileCoord);
var tileCoordKey = tileCoord.toString();
if (tileCoordKey in this.tiles_) {
return;
}
@@ -437,7 +436,7 @@ ol.renderer.dom.TileLayerZ_.prototype.removeTilesOutsideExtent =
var i, ii;
for (i = 0, ii = tilesToRemove.length; i < ii; ++i) {
tile = tilesToRemove[i];
tileCoordKey = ol.tilecoord.toString(tile.tileCoord);
tileCoordKey = tile.tileCoord.toString();
goog.dom.removeNode(tile.getImage(this));
delete this.tiles_[tileCoordKey];
}

View File

@@ -13,7 +13,6 @@ goog.require('ol.layer.Layer');
goog.require('ol.source.Source');
goog.require('ol.source.State');
goog.require('ol.source.Tile');
goog.require('ol.tilecoord');
goog.require('ol.vec.Mat4');
@@ -319,7 +318,7 @@ ol.renderer.Layer.prototype.manageTilePyramid = function(
if (currentZ - z <= preload) {
tile = tileSource.getTile(z, x, y, pixelRatio, projection);
if (tile.getState() == ol.TileState.IDLE) {
wantedTiles[ol.tilecoord.toString(tile.tileCoord)] = true;
wantedTiles[tile.tileCoord.toString()] = true;
if (!tileQueue.isKeyQueued(tile.getKey())) {
tileQueue.enqueue([tile, tileSourceKey,
tileGrid.getTileCoordCenter(tile.tileCoord), tileResolution]);

View File

@@ -18,7 +18,6 @@ goog.require('ol.renderer.webgl.tilelayer.shader.Fragment');
goog.require('ol.renderer.webgl.tilelayer.shader.Locations');
goog.require('ol.renderer.webgl.tilelayer.shader.Vertex');
goog.require('ol.size');
goog.require('ol.tilecoord');
goog.require('ol.vec.Mat4');
goog.require('ol.webgl.Buffer');
@@ -271,7 +270,7 @@ ol.renderer.webgl.TileLayer.prototype.prepareFrame =
tileState = tile.getState();
if (tileState == ol.TileState.LOADED) {
if (mapRenderer.isTileTextureLoaded(tile)) {
tilesToDrawByZ[z][ol.tilecoord.toString(tile.tileCoord)] = tile;
tilesToDrawByZ[z][tile.tileCoord.toString()] = tile;
continue;
}
} else if (tileState == ol.TileState.EMPTY ||

View File

@@ -6,7 +6,6 @@ goog.require('ol.TileState');
goog.require('ol.dom');
goog.require('ol.size');
goog.require('ol.source.Tile');
goog.require('ol.tilecoord');
@@ -113,8 +112,8 @@ ol.source.TileDebug.prototype.getTile = function(z, x, y) {
var tileSize = ol.size.toSize(this.tileGrid.getTileSize(z));
var tileCoord = [z, x, y];
var textTileCoord = this.getTileCoordForTileUrlFunction(tileCoord);
var text = !textTileCoord ? '' : ol.tilecoord.toString(
this.getTileCoordForTileUrlFunction(textTileCoord));
var text = !textTileCoord ? '' :
this.getTileCoordForTileUrlFunction(textTileCoord).toString();
var tile = new ol.DebugTile_(tileCoord, tileSize, text);
this.tileCache.set(tileCoordKey, tile);
return tile;

View File

@@ -103,15 +103,6 @@ ol.tilecoord.quadKey = function(tileCoord) {
};
/**
* @param {ol.TileCoord} tileCoord Tile coord.
* @return {string} String.
*/
ol.tilecoord.toString = function(tileCoord) {
return ol.tilecoord.getKeyZXY(tileCoord[0], tileCoord[1], tileCoord[2]);
};
/**
* @param {ol.TileCoord} tileCoord Tile coordinate.
* @param {ol.tilegrid.TileGrid} tileGrid Tile grid.