From 841c8a5747e2ce1fb001eccf46a58f4c1d4446f5 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Wed, 18 May 2016 18:34:50 -0600 Subject: [PATCH] Rename source.getKeyParams() to source.getKey() --- src/ol/source/tileimagesource.js | 2 +- src/ol/source/tilesource.js | 7 +++---- src/ol/source/tilewmssource.js | 2 +- src/ol/source/wmtssource.js | 2 +- test/spec/ol/source/tileimagesource.test.js | 8 ++++---- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/ol/source/tileimagesource.js b/src/ol/source/tileimagesource.js index 5f623d67f4..49ab00d1cd 100644 --- a/src/ol/source/tileimagesource.js +++ b/src/ol/source/tileimagesource.js @@ -279,7 +279,7 @@ ol.source.TileImage.prototype.getTile = function(z, x, y, pixelRatio, projection ol.source.TileImage.prototype.getTileInternal = function(z, x, y, pixelRatio, projection) { var /** @type {ol.Tile} */ tile = null; var tileCoordKey = this.getKeyZXY(z, x, y); - var paramsKey = this.getKeyParams(); + var paramsKey = this.getKey(); if (!this.tileCache.containsKey(tileCoordKey)) { goog.asserts.assert(projection, 'argument projection is truthy'); tile = this.createTile_(z, x, y, pixelRatio, projection, paramsKey); diff --git a/src/ol/source/tilesource.js b/src/ol/source/tilesource.js index 14542a41df..f397a3f4f5 100644 --- a/src/ol/source/tilesource.js +++ b/src/ol/source/tilesource.js @@ -144,12 +144,11 @@ ol.source.Tile.prototype.getGutter = function(projection) { /** - * Return the "parameters" key, a string composed of the source's - * parameters/dimensions. - * @return {string} The parameters key. + * Return the key to be used for all tiles in the source. + * @return {string} The key for all tiles. * @protected */ -ol.source.Tile.prototype.getKeyParams = function() { +ol.source.Tile.prototype.getKey = function() { return this.key_; }; diff --git a/src/ol/source/tilewmssource.js b/src/ol/source/tilewmssource.js index c74505442d..050c66e47c 100644 --- a/src/ol/source/tilewmssource.js +++ b/src/ol/source/tilewmssource.js @@ -185,7 +185,7 @@ ol.source.TileWMS.prototype.getGutterInternal = function() { /** * @inheritDoc */ -ol.source.TileWMS.prototype.getKeyParams = function() { +ol.source.TileWMS.prototype.getKey = function() { return this.paramsKey_; }; diff --git a/src/ol/source/wmtssource.js b/src/ol/source/wmtssource.js index 017e6f1077..644d8b8784 100644 --- a/src/ol/source/wmtssource.js +++ b/src/ol/source/wmtssource.js @@ -216,7 +216,7 @@ ol.source.WMTS.prototype.getFormat = function() { /** * @inheritDoc */ -ol.source.WMTS.prototype.getKeyParams = function() { +ol.source.WMTS.prototype.getKey = function() { return this.dimensionsKey_; }; diff --git a/test/spec/ol/source/tileimagesource.test.js b/test/spec/ol/source/tileimagesource.test.js index 7d5cd3a12a..e79bbd7152 100644 --- a/test/spec/ol/source/tileimagesource.test.js +++ b/test/spec/ol/source/tileimagesource.test.js @@ -27,7 +27,7 @@ describe('ol.source.TileImage', function() { beforeEach(function() { source = createSource(); - expect(source.getKeyParams()).to.be(''); + expect(source.getKey()).to.be(''); source.getTileInternal(0, 0, -1, 1, ol.proj.get('EPSG:3857')); expect(source.tileCache.getCount()).to.be(1); tile = source.tileCache.get(source.getKeyZXY(0, 0, -1)); @@ -43,7 +43,7 @@ describe('ol.source.TileImage', function() { describe('tile is not loaded', function() { it('returns a tile with no interim tile', function() { - source.getKeyParams = function() { + source.getKey = function() { return 'key0'; }; var returnedTile = source.getTileInternal( @@ -56,7 +56,7 @@ describe('ol.source.TileImage', function() { describe('tile is loaded', function() { it('returns a tile with interim tile', function() { - source.getKeyParams = function() { + source.getKey = function() { return 'key0'; }; tile.state = ol.TileState.LOADED; @@ -71,7 +71,7 @@ describe('ol.source.TileImage', function() { describe('tile is not loaded but interim tile is', function() { it('returns a tile with interim tile', function() { var dynamicParamsKey, returnedTile; - source.getKeyParams = function() { + source.getKey = function() { return dynamicParamsKey; }; dynamicParamsKey = 'key0';