From 2fe4d63893dbb1fcd05f9f4495d934d433bef490 Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Mon, 24 Oct 2016 10:31:15 +0200 Subject: [PATCH] Make sure updateParams reloads in TileArcGISRest --- src/ol/source/tilearcgisrest.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/ol/source/tilearcgisrest.js b/src/ol/source/tilearcgisrest.js index 06ad9da371..1004d00264 100644 --- a/src/ol/source/tilearcgisrest.js +++ b/src/ol/source/tilearcgisrest.js @@ -55,10 +55,25 @@ ol.source.TileArcGISRest = function(opt_options) { */ this.tmpExtent_ = ol.extent.createEmpty(); + this.setKey(this.getKeyForParams_()); }; 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 * 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.obj.assign(this.params_, params); - this.changed(); + this.setKey(this.getKeyForParams_()); };