From 9e3b46762b048f7d3856ac2e820c77876e7ff319 Mon Sep 17 00:00:00 2001 From: bnare Date: Tue, 15 Jul 2014 17:04:19 +0200 Subject: [PATCH] Update mapguidesource.js Add a method updateParams to ol.source.MapGuide. --- src/ol/source/mapguidesource.js | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/ol/source/mapguidesource.js b/src/ol/source/mapguidesource.js index a7c92d0e08..fdd1ce664f 100644 --- a/src/ol/source/mapguidesource.js +++ b/src/ol/source/mapguidesource.js @@ -55,6 +55,12 @@ ol.source.MapGuide = function(options) { */ this.imageUrlFunction_ = imageUrlFunction; + /** + * @private + * @type {Object} + */ + this.params_ = null; + /** * @private * @type {boolean} @@ -87,10 +93,27 @@ ol.source.MapGuide = function(options) { */ this.image_ = null; + /** + * @private + * @type {number} + */ + this.renderedRevision_ = 0; + }; goog.inherits(ol.source.MapGuide, ol.source.Image); +/** + * Get the user-provided params, i.e. those passed to the constructor through + * the "params" option, and possibly updated using the updateParams method. + * @return {Object} Params. + * @api + */ +ol.source.MapGuide.prototype.getParams = function() { + return this.params_; +}; + + /** * @inheritDoc */ @@ -101,6 +124,7 @@ ol.source.MapGuide.prototype.getImage = var image = this.image_; if (!goog.isNull(image) && + this.renderedRevision_ == this.getRevision() && image.getResolution() == resolution && image.getPixelRatio() == pixelRatio && ol.extent.containsExtent(image.getExtent(), extent)) { @@ -123,6 +147,7 @@ ol.source.MapGuide.prototype.getImage = image = null; } this.image_ = image; + this.renderedRevision_ = this.getRevision(); return image; }; @@ -149,6 +174,17 @@ ol.source.MapGuide.getScale = function(extent, size, metersPerUnit, dpi) { }; +/** + * Update the user-provided params. + * @param {Object} params Params. + * @api + */ +ol.source.MapGuide.prototype.updateParams = function(params) { + goog.object.extend(this.params_, params); + this.dispatchChangeEvent(); +}; + + /** * @param {string} baseUrl The mapagent url. * @param {Object.} params Request parameters.