Update mapguidesource.js
Add a method updateParams to ol.source.MapGuide.
This commit is contained in:
@@ -55,6 +55,12 @@ ol.source.MapGuide = function(options) {
|
|||||||
*/
|
*/
|
||||||
this.imageUrlFunction_ = imageUrlFunction;
|
this.imageUrlFunction_ = imageUrlFunction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
this.params_ = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
@@ -87,10 +93,27 @@ ol.source.MapGuide = function(options) {
|
|||||||
*/
|
*/
|
||||||
this.image_ = null;
|
this.image_ = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
this.renderedRevision_ = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
goog.inherits(ol.source.MapGuide, ol.source.Image);
|
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
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
@@ -101,6 +124,7 @@ ol.source.MapGuide.prototype.getImage =
|
|||||||
|
|
||||||
var image = this.image_;
|
var image = this.image_;
|
||||||
if (!goog.isNull(image) &&
|
if (!goog.isNull(image) &&
|
||||||
|
this.renderedRevision_ == this.getRevision() &&
|
||||||
image.getResolution() == resolution &&
|
image.getResolution() == resolution &&
|
||||||
image.getPixelRatio() == pixelRatio &&
|
image.getPixelRatio() == pixelRatio &&
|
||||||
ol.extent.containsExtent(image.getExtent(), extent)) {
|
ol.extent.containsExtent(image.getExtent(), extent)) {
|
||||||
@@ -123,6 +147,7 @@ ol.source.MapGuide.prototype.getImage =
|
|||||||
image = null;
|
image = null;
|
||||||
}
|
}
|
||||||
this.image_ = image;
|
this.image_ = image;
|
||||||
|
this.renderedRevision_ = this.getRevision();
|
||||||
|
|
||||||
return image;
|
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 {string} baseUrl The mapagent url.
|
||||||
* @param {Object.<string, string|number>} params Request parameters.
|
* @param {Object.<string, string|number>} params Request parameters.
|
||||||
|
|||||||
Reference in New Issue
Block a user