add an ol.TileCache and use it in ol.TileLayer

This commit is contained in:
Éric Lemoine
2012-06-21 18:56:43 +02:00
parent a06de64f37
commit 1c7e0f8481
7 changed files with 92 additions and 1 deletions

29
src/ol/TileCache.js Normal file
View File

@@ -0,0 +1,29 @@
goog.provide('ol.TileCache');
goog.require('goog.structs.LinkedMap');
/**
* A cache of ol.Tile objects.
* @constructor
* @extends {goog.structs.LinkedMap}
* @param {number=} opt_size
*/
ol.TileCache = function(opt_size) {
/**
* @constant
* @type {number}
*/
this.size_ = opt_size || 100;
goog.base(this, 1, true /* cache mode */);
};
goog.inherits(ol.TileCache, goog.structs.LinkedMap);
/**
* @inheritDoc
*/
ol.TileCache.prototype.removeNode = function(node) {
goog.base(this, 'removeNode', node);
node.value.destroy();
};