Create tile cache for all tile sources

This commit is contained in:
Tim Schaub
2015-02-16 12:22:15 -07:00
parent eb1a46cf7d
commit 2cf1fe5552
4 changed files with 21 additions and 79 deletions

View File

@@ -1,7 +1,6 @@
goog.provide('ol.source.TileDebug');
goog.require('ol.Tile');
goog.require('ol.TileCache');
goog.require('ol.TileCoord');
goog.require('ol.TileState');
goog.require('ol.dom');
@@ -89,42 +88,20 @@ ol.source.TileDebug = function(options) {
tileGrid: options.tileGrid
});
/**
* @private
* @type {ol.TileCache}
*/
this.tileCache_ = new ol.TileCache();
};
goog.inherits(ol.source.TileDebug, ol.source.Tile);
/**
* @inheritDoc
*/
ol.source.TileDebug.prototype.canExpireCache = function() {
return this.tileCache_.canExpireCache();
};
/**
* @inheritDoc
*/
ol.source.TileDebug.prototype.expireCache = function(usedTiles) {
this.tileCache_.expireCache(usedTiles);
};
/**
* @inheritDoc
*/
ol.source.TileDebug.prototype.getTile = function(z, x, y) {
var tileCoordKey = this.getKeyZXY(z, x, y);
if (this.tileCache_.containsKey(tileCoordKey)) {
return /** @type {!ol.DebugTile_} */ (this.tileCache_.get(tileCoordKey));
if (this.tileCache.containsKey(tileCoordKey)) {
return /** @type {!ol.DebugTile_} */ (this.tileCache.get(tileCoordKey));
} else {
var tile = new ol.DebugTile_([z, x, y], this.tileGrid);
this.tileCache_.set(tileCoordKey, tile);
this.tileCache.set(tileCoordKey, tile);
return tile;
}
};