Handle interim tiles correctly when reprojecting
This commit is contained in:
@@ -241,16 +241,21 @@ ol.source.TileImage.prototype.getTile = function(z, x, y, pixelRatio, projection
|
|||||||
} else {
|
} else {
|
||||||
var cache = this.getTileCacheForProjection(projection);
|
var cache = this.getTileCacheForProjection(projection);
|
||||||
var tileCoord = [z, x, y];
|
var tileCoord = [z, x, y];
|
||||||
|
var tile;
|
||||||
var tileCoordKey = this.getKeyZXY.apply(this, tileCoord);
|
var tileCoordKey = this.getKeyZXY.apply(this, tileCoord);
|
||||||
if (cache.containsKey(tileCoordKey)) {
|
if (cache.containsKey(tileCoordKey)) {
|
||||||
return /** @type {!ol.Tile} */ (cache.get(tileCoordKey));
|
tile = /** @type {!ol.Tile} */ (cache.get(tileCoordKey));
|
||||||
|
}
|
||||||
|
var key = this.getKey();
|
||||||
|
if (tile && tile.key == key) {
|
||||||
|
return tile;
|
||||||
} else {
|
} else {
|
||||||
var sourceProjection = this.getProjection();
|
var sourceProjection = this.getProjection();
|
||||||
var sourceTileGrid = this.getTileGridForProjection(sourceProjection);
|
var sourceTileGrid = this.getTileGridForProjection(sourceProjection);
|
||||||
var targetTileGrid = this.getTileGridForProjection(projection);
|
var targetTileGrid = this.getTileGridForProjection(projection);
|
||||||
var wrappedTileCoord =
|
var wrappedTileCoord =
|
||||||
this.getTileCoordForTileUrlFunction(tileCoord, projection);
|
this.getTileCoordForTileUrlFunction(tileCoord, projection);
|
||||||
var tile = new ol.reproj.Tile(
|
var newTile = new ol.reproj.Tile(
|
||||||
sourceProjection, sourceTileGrid,
|
sourceProjection, sourceTileGrid,
|
||||||
projection, targetTileGrid,
|
projection, targetTileGrid,
|
||||||
tileCoord, wrappedTileCoord, this.getTilePixelRatio(pixelRatio),
|
tileCoord, wrappedTileCoord, this.getTilePixelRatio(pixelRatio),
|
||||||
@@ -259,9 +264,15 @@ ol.source.TileImage.prototype.getTile = function(z, x, y, pixelRatio, projection
|
|||||||
return this.getTileInternal(z, x, y, pixelRatio, sourceProjection);
|
return this.getTileInternal(z, x, y, pixelRatio, sourceProjection);
|
||||||
}.bind(this), this.reprojectionErrorThreshold_,
|
}.bind(this), this.reprojectionErrorThreshold_,
|
||||||
this.renderReprojectionEdges_);
|
this.renderReprojectionEdges_);
|
||||||
|
newTile.key = key;
|
||||||
|
|
||||||
cache.set(tileCoordKey, tile);
|
if (tile) {
|
||||||
return tile;
|
newTile.interimTile = tile;
|
||||||
|
cache.replace(tileCoordKey, newTile);
|
||||||
|
} else {
|
||||||
|
cache.set(tileCoordKey, newTile);
|
||||||
|
}
|
||||||
|
return newTile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user