Add a settable key for all tile sources

The source's key is used as the key for all tiles in the source.  For URL tile sources, the URL is the key.
This commit is contained in:
Tim Schaub
2016-05-18 18:27:19 -06:00
parent 9f501aeb0e
commit f86e7e5a71
2 changed files with 30 additions and 9 deletions
+20 -1
View File
@@ -67,6 +67,12 @@ ol.source.Tile = function(options) {
*/
this.tmpSize = [0, 0];
/**
* @private
* @type {string}
*/
this.key_ = '';
};
goog.inherits(ol.source.Tile, ol.source.Source);
@@ -144,7 +150,20 @@ ol.source.Tile.prototype.getGutter = function(projection) {
* @protected
*/
ol.source.Tile.prototype.getKeyParams = function() {
return '';
return this.key_;
};
/**
* Set the value to be used as the key for all tiles in the source.
* @param {string} key The key for tiles.
* @protected
*/
ol.source.Tile.prototype.setKey = function(key) {
if (this.key_ !== key) {
this.key_ = key;
this.changed();
}
};