From 085c60af49f17751476ee42b51ca72d0ace6efa3 Mon Sep 17 00:00:00 2001 From: Lutz Helm Date: Thu, 21 Mar 2019 14:47:09 +0100 Subject: [PATCH] Remove tile source zDirection getter The renderer now accesses the zDirection member directly if it exists. This also has the advantage of not advertising any object methods that hav no use for most tile sources. --- src/ol/renderer/canvas/TileLayer.js | 2 +- src/ol/source/Tile.js | 12 ------------ src/ol/source/Zoomify.js | 8 -------- 3 files changed, 1 insertion(+), 21 deletions(-) diff --git a/src/ol/renderer/canvas/TileLayer.js b/src/ol/renderer/canvas/TileLayer.js index 9c8c0b8692..1fda4b016f 100644 --- a/src/ol/renderer/canvas/TileLayer.js +++ b/src/ol/renderer/canvas/TileLayer.js @@ -143,7 +143,7 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer { const tileSource = tileLayer.getSource(); const sourceRevision = tileSource.getRevision(); const tileGrid = tileSource.getTileGridForProjection(projection); - const zDirection = tileSource.getZDirection() === undefined ? this.zDirection : tileSource.getZDirection(); + const zDirection = tileSource.zDirection === undefined ? this.zDirection : tileSource.zDirection; const z = tileGrid.getZForResolution(viewResolution, zDirection); const tileResolution = tileGrid.getResolution(z); let extent = frameState.extent; diff --git a/src/ol/source/Tile.js b/src/ol/source/Tile.js index 0d2438ed06..024a94ac46 100644 --- a/src/ol/source/Tile.js +++ b/src/ol/source/Tile.js @@ -326,18 +326,6 @@ class TileSource extends Source { */ useTile(z, x, y, projection) {} - /** - * Indicate which resolution should be used by a renderer if the views resolution - * does not match any resolution of the tile source. - * If 0, the nearest resolution will be used. If 1, the nearest lower resolution - * will be used. If -1, the nearest higher resolution will be used. If undefined, - * the decision is left to the renderer. - * @return {number|undefined} Prefered zDirection for source resolution selection. - */ - getZDirection() { - return undefined; - } - } diff --git a/src/ol/source/Zoomify.js b/src/ol/source/Zoomify.js index 8d7c400729..a3a997062e 100644 --- a/src/ol/source/Zoomify.js +++ b/src/ol/source/Zoomify.js @@ -258,20 +258,12 @@ class Zoomify extends TileImage { }); /** - * @protected * @type {number|undefined} */ this.zDirection = options.zDirection; } - /** - * @inheritDoc - */ - getZDirection() { - return this.zDirection; - } - } export default Zoomify;