From 5a1effb4839f77b3ae220897c559424b44e6e6a7 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sat, 7 Oct 2017 12:31:29 -0600 Subject: [PATCH] Get rid of unnecessary coord key prefix --- src/ol/source/tilewms.js | 43 ----------------------------- test/spec/ol/source/tilewms.test.js | 14 ++++------ 2 files changed, 6 insertions(+), 51 deletions(-) diff --git a/src/ol/source/tilewms.js b/src/ol/source/tilewms.js index 979981988d..b3e1ddcb62 100644 --- a/src/ol/source/tilewms.js +++ b/src/ol/source/tilewms.js @@ -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_()); }; diff --git a/test/spec/ol/source/tilewms.test.js b/test/spec/ol/source/tilewms.test.js index 478a0bf27a..8045d184c5 100644 --- a/test/spec/ol/source/tilewms.test.js +++ b/test/spec/ol/source/tilewms.test.js @@ -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); }); }); });