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
+6 -19
View File
@@ -54,13 +54,6 @@ ol.source.WMTS = function(options) {
*/ */
this.dimensions_ = options.dimensions !== undefined ? options.dimensions : {}; this.dimensions_ = options.dimensions !== undefined ? options.dimensions : {};
/**
* @private
* @type {string}
*/
this.dimensionsKey_ = '';
this.resetDimensionsKey_();
/** /**
* @private * @private
* @type {string} * @type {string}
@@ -187,6 +180,8 @@ ol.source.WMTS = function(options) {
wrapX: options.wrapX !== undefined ? options.wrapX : false wrapX: options.wrapX !== undefined ? options.wrapX : false
}); });
this.setKey(this.getKeyForDimensions_());
}; };
goog.inherits(ol.source.WMTS, ol.source.TileImage); 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 the layer of the WMTS source.
* @return {string} Layer. * @return {string} Layer.
@@ -273,14 +260,15 @@ ol.source.WMTS.prototype.getVersion = function() {
/** /**
* @private * @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 i = 0;
var res = []; var res = [];
for (var key in this.dimensions_) { for (var key in this.dimensions_) {
res[i++] = key + '-' + this.dimensions_[key]; 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.source.WMTS.prototype.updateDimensions = function(dimensions) {
ol.object.assign(this.dimensions_, dimensions); ol.object.assign(this.dimensions_, dimensions);
this.resetDimensionsKey_(); this.setKey(this.getKeyForDimensions_());
this.changed();
}; };