Make sure updateParams reloads in TileArcGISRest

This commit is contained in:
Bart van den Eijnden
2016-10-24 10:31:15 +02:00
parent 78f283c32b
commit 2fe4d63893

View File

@@ -55,10 +55,25 @@ ol.source.TileArcGISRest = function(opt_options) {
*/ */
this.tmpExtent_ = ol.extent.createEmpty(); this.tmpExtent_ = ol.extent.createEmpty();
this.setKey(this.getKeyForParams_());
}; };
ol.inherits(ol.source.TileArcGISRest, ol.source.TileImage); ol.inherits(ol.source.TileArcGISRest, ol.source.TileImage);
/**
* @private
* @return {string} The key for the current params.
*/
ol.source.TileArcGISRest.prototype.getKeyForParams_ = function() {
var i = 0;
var res = [];
for (var key in this.params_) {
res[i++] = key + '-' + this.params_[key];
}
return res.join('/');
};
/** /**
* Get the user-provided params, i.e. those passed to the constructor through * Get the user-provided params, i.e. those passed to the constructor through
* the "params" option, and possibly updated using the updateParams method. * the "params" option, and possibly updated using the updateParams method.
@@ -168,5 +183,5 @@ ol.source.TileArcGISRest.prototype.fixedTileUrlFunction = function(tileCoord, pi
*/ */
ol.source.TileArcGISRest.prototype.updateParams = function(params) { ol.source.TileArcGISRest.prototype.updateParams = function(params) {
ol.obj.assign(this.params_, params); ol.obj.assign(this.params_, params);
this.changed(); this.setKey(this.getKeyForParams_());
}; };