Less special handling for WMTS tiles

This commit is contained in:
Tim Schaub
2016-05-18 18:52:42 -06:00
parent 025c063251
commit 5542f045d5

View File

@@ -54,13 +54,6 @@ ol.source.WMTS = function(options) {
*/
this.dimensions_ = options.dimensions !== undefined ? options.dimensions : {};
/**
* @private
* @type {string}
*/
this.dimensionsKey_ = '';
this.resetDimensionsKey_();
/**
* @private
* @type {string}
@@ -187,6 +180,8 @@ ol.source.WMTS = function(options) {
wrapX: options.wrapX !== undefined ? options.wrapX : false
});
this.setKey(this.getKeyForDimensions_());
};
goog.inherits(ol.source.WMTS, ol.source.TileImage);
@@ -213,14 +208,6 @@ ol.source.WMTS.prototype.getFormat = function() {
};
/**
* @inheritDoc
*/
ol.source.WMTS.prototype.getKey = function() {
return this.dimensionsKey_;
};
/**
* Return the layer of the WMTS source.
* @return {string} Layer.
@@ -273,14 +260,15 @@ ol.source.WMTS.prototype.getVersion = function() {
/**
* @private
* @return {string} The key for the current dimensions.
*/
ol.source.WMTS.prototype.resetDimensionsKey_ = function() {
ol.source.WMTS.prototype.getKeyForDimensions_ = function() {
var i = 0;
var res = [];
for (var key in this.dimensions_) {
res[i++] = key + '-' + this.dimensions_[key];
}
this.dimensionsKey_ = res.join('/');
return res.join('/');
};
@@ -291,8 +279,7 @@ ol.source.WMTS.prototype.resetDimensionsKey_ = function() {
*/
ol.source.WMTS.prototype.updateDimensions = function(dimensions) {
ol.object.assign(this.dimensions_, dimensions);
this.resetDimensionsKey_();
this.changed();
this.setKey(this.getKeyForDimensions_());
};