Add getParams/updateParams to TiledWMS
This commit is contained in:
committed by
Éric Lemoine
parent
8663a5027b
commit
e16de02cb2
@@ -1 +1,3 @@
|
|||||||
@exportClass ol.source.TileWMS ol.source.TileWMSOptions
|
@exportClass ol.source.TileWMS ol.source.TileWMSOptions
|
||||||
|
@exportProperty ol.source.TileWMS.prototype.getParams
|
||||||
|
@exportProperty ol.source.TileWMS.prototype.updateParams
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ goog.provide('ol.source.TileWMS');
|
|||||||
goog.require('goog.array');
|
goog.require('goog.array');
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('goog.math');
|
goog.require('goog.math');
|
||||||
|
goog.require('goog.object');
|
||||||
goog.require('ol.TileCoord');
|
goog.require('ol.TileCoord');
|
||||||
goog.require('ol.TileUrlFunction');
|
goog.require('ol.TileUrlFunction');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
@@ -33,12 +34,18 @@ ol.source.TileWMS = function(options) {
|
|||||||
urls = ol.TileUrlFunction.expandUrl(options.url);
|
urls = ol.TileUrlFunction.expandUrl(options.url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
this.params_ = options.params;
|
||||||
|
|
||||||
if (goog.isDef(urls)) {
|
if (goog.isDef(urls)) {
|
||||||
var tileUrlFunctions = goog.array.map(
|
var tileUrlFunctions = goog.array.map(
|
||||||
urls, function(url) {
|
urls, function(url) {
|
||||||
return ol.TileUrlFunction.createFromParamsFunction(
|
return ol.TileUrlFunction.createFromParamsFunction(
|
||||||
url, options.params, ol.source.wms.getUrl);
|
url, this.params_, ol.source.wms.getUrl);
|
||||||
});
|
}, this);
|
||||||
tileUrlFunction = ol.TileUrlFunction.createFromTileUrlFunctions(
|
tileUrlFunction = ol.TileUrlFunction.createFromTileUrlFunctions(
|
||||||
tileUrlFunctions);
|
tileUrlFunctions);
|
||||||
}
|
}
|
||||||
@@ -97,6 +104,25 @@ ol.source.TileWMS = function(options) {
|
|||||||
goog.inherits(ol.source.TileWMS, ol.source.TileImage);
|
goog.inherits(ol.source.TileWMS, ol.source.TileImage);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
ol.source.TileWMS.prototype.getKeyZXY = function(z, x, y) {
|
||||||
|
return goog.object.getValues(this.params_).join('/') +
|
||||||
|
goog.base(this, 'getKeyZXY', z, x, y);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
ol.source.TileWMS.prototype.getParams = function() {
|
||||||
|
return this.params_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
@@ -118,3 +144,13 @@ ol.source.TileWMS.prototype.getFeatureInfoForPixel =
|
|||||||
[pixel[0] - offset[0], pixel[1] - offset[1]], this.getFeatureInfoOptions_,
|
[pixel[0] - offset[0], pixel[1] - offset[1]], this.getFeatureInfoOptions_,
|
||||||
success, opt_error);
|
success, opt_error);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the user-provided params.
|
||||||
|
* @param {Object} params Params.
|
||||||
|
*/
|
||||||
|
ol.source.TileWMS.prototype.updateParams = function(params) {
|
||||||
|
goog.object.extend(this.params_, params);
|
||||||
|
this.dispatchChangeEvent();
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user