Get rid of unnecessary coord key prefix
This commit is contained in:
@@ -81,13 +81,6 @@ ol.source.TileWMS = function(opt_options) {
|
||||
*/
|
||||
this.hidpi_ = options.hidpi !== undefined ? options.hidpi : true;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {string}
|
||||
*/
|
||||
this.coordKeyPrefix_ = '';
|
||||
this.resetCoordKeyPrefix_();
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.Extent}
|
||||
@@ -171,14 +164,6 @@ ol.source.TileWMS.prototype.getGutterInternal = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.source.TileWMS.prototype.getKeyZXY = function(z, x, y) {
|
||||
return this.coordKeyPrefix_ + ol.source.TileImage.prototype.getKeyZXY.call(this, 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.
|
||||
@@ -273,24 +258,6 @@ ol.source.TileWMS.prototype.getTilePixelRatio = function(pixelRatio) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
ol.source.TileWMS.prototype.resetCoordKeyPrefix_ = function() {
|
||||
var i = 0;
|
||||
var res = [];
|
||||
|
||||
if (this.urls) {
|
||||
var j, jj;
|
||||
for (j = 0, jj = this.urls.length; j < jj; ++j) {
|
||||
res[i++] = this.urls[j];
|
||||
}
|
||||
}
|
||||
|
||||
this.coordKeyPrefix_ = res.join('#');
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @return {string} The key for the current params.
|
||||
@@ -352,15 +319,6 @@ ol.source.TileWMS.prototype.fixedTileUrlFunction = function(tileCoord, pixelRati
|
||||
pixelRatio, projection, baseParams);
|
||||
};
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.source.TileWMS.prototype.setUrls = function(urls) {
|
||||
ol.source.TileImage.prototype.setUrls.call(this, urls);
|
||||
this.resetCoordKeyPrefix_();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Update the user-provided params.
|
||||
* @param {Object} params Params.
|
||||
@@ -368,7 +326,6 @@ ol.source.TileWMS.prototype.setUrls = function(urls) {
|
||||
*/
|
||||
ol.source.TileWMS.prototype.updateParams = function(params) {
|
||||
ol.obj.assign(this.params_, params);
|
||||
this.resetCoordKeyPrefix_();
|
||||
this.updateV13_();
|
||||
this.setKey(this.getKeyForParams_());
|
||||
};
|
||||
|
||||
@@ -275,15 +275,13 @@ describe('ol.source.TileWMS', function() {
|
||||
});
|
||||
|
||||
describe('#setUrls()', function() {
|
||||
it ('resets coordKeyPrefix_', function() {
|
||||
var urls = ['u1', 'u2'];
|
||||
var source1 = new ol.source.TileWMS({
|
||||
urls: urls
|
||||
it ('updates the source key', function() {
|
||||
var source = new ol.source.TileWMS({
|
||||
urls: ['u1', 'u2']
|
||||
});
|
||||
var source2 = new ol.source.TileWMS({});
|
||||
expect(source2.coordKeyPrefix_).to.be.empty();
|
||||
source2.setUrls(urls);
|
||||
expect(source2.coordKeyPrefix_).to.equal(source1.coordKeyPrefix_);
|
||||
var originalKey = source.getKey();
|
||||
source.setUrls(['u3', 'u4']);
|
||||
expect(source.getKey() !== originalKey).to.be(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user