From 8c4937170b6cb112a66ebae17a636eaf4716291d Mon Sep 17 00:00:00 2001 From: Tobias Kohr Date: Tue, 24 Sep 2019 18:13:57 +0200 Subject: [PATCH] rename external methods to API names --- examples/igc.js | 2 +- examples/region-growing.js | 2 +- examples/synthetic-points.js | 2 +- examples/utfgrid.js | 2 +- src/ol/PluggableMap.js | 12 ++++++------ src/ol/interaction/Extent.js | 2 +- test/spec/ol/interaction/extent.test.js | 10 +++++----- test/spec/ol/map.test.js | 4 ++-- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/examples/igc.js b/examples/igc.js index be2d2f984d..261108f59a 100644 --- a/examples/igc.js +++ b/examples/igc.js @@ -135,7 +135,7 @@ map.on('pointermove', function(evt) { if (evt.dragging) { return; } - const coordinate = map.getEventCoordinateExternal(evt.originalEvent); + const coordinate = map.getEventCoordinate(evt.originalEvent); displaySnap(coordinate); }); diff --git a/examples/region-growing.js b/examples/region-growing.js index c09678144a..0503ff7127 100644 --- a/examples/region-growing.js +++ b/examples/region-growing.js @@ -117,7 +117,7 @@ raster.on('beforeoperations', function(event) { const data = event.data; data.delta = thresholdControl.value; if (coordinate) { - data.pixel = map.getPixelFromCoordinateExternal(coordinate); + data.pixel = map.getPixelFromCoordinate(coordinate); } }); diff --git a/examples/synthetic-points.js b/examples/synthetic-points.js index 8ccfbc685c..1eceb86fdf 100644 --- a/examples/synthetic-points.js +++ b/examples/synthetic-points.js @@ -85,7 +85,7 @@ map.on('pointermove', function(evt) { if (evt.dragging) { return; } - const coordinate = map.getEventCoordinateExternal(evt.originalEvent); + const coordinate = map.getEventCoordinate(evt.originalEvent); displaySnap(coordinate); }); diff --git a/examples/utfgrid.js b/examples/utfgrid.js index b2007e921d..92b117c100 100644 --- a/examples/utfgrid.js +++ b/examples/utfgrid.js @@ -63,7 +63,7 @@ map.on('pointermove', function(evt) { if (evt.dragging) { return; } - const coordinate = map.getEventCoordinateExternal(evt.originalEvent); + const coordinate = map.getEventCoordinate(evt.originalEvent); displayCountryInfo(coordinate); }); diff --git a/src/ol/PluggableMap.js b/src/ol/PluggableMap.js index c1e5afba06..b239dd20d6 100644 --- a/src/ol/PluggableMap.js +++ b/src/ol/PluggableMap.js @@ -546,7 +546,7 @@ class PluggableMap extends BaseObject { if (!this.frameState_) { return; } - const coordinate = this.getCoordinateFromPixelExternal(pixel); + const coordinate = this.getCoordinateFromPixel(pixel); opt_options = opt_options !== undefined ? opt_options : /** @type {AtPixelOptions} */ ({}); const hitTolerance = opt_options.hitTolerance !== undefined ? @@ -618,7 +618,7 @@ class PluggableMap extends BaseObject { if (!this.frameState_) { return false; } - const coordinate = this.getCoordinateFromPixelExternal(pixel); + const coordinate = this.getCoordinateFromPixel(pixel); opt_options = opt_options !== undefined ? opt_options : /** @type {AtPixelOptions} */ ({}); const layerFilter = opt_options.layerFilter !== undefined ? opt_options.layerFilter : TRUE; @@ -634,8 +634,8 @@ class PluggableMap extends BaseObject { * @return {import("./coordinate.js").Coordinate} Coordinate. * @api */ - getEventCoordinateExternal(event) { - return this.getCoordinateFromPixelExternal(this.getEventPixel(event)); + getEventCoordinate(event) { + return this.getCoordinateFromPixel(this.getEventPixel(event)); } /** @@ -701,7 +701,7 @@ class PluggableMap extends BaseObject { * @return {import("./coordinate.js").Coordinate} The coordinate for the pixel position. * @api */ - getCoordinateFromPixelExternal(pixel) { + getCoordinateFromPixel(pixel) { return toUserCoordinate(this.getCoordinateFromPixelInternal(pixel), this.getView().getProjection()); } @@ -809,7 +809,7 @@ class PluggableMap extends BaseObject { * @return {import("./pixel.js").Pixel} A pixel position in the map viewport. * @api */ - getPixelFromCoordinateExternal(coordinate) { + getPixelFromCoordinate(coordinate) { const viewCoordinate = fromUserCoordinate(coordinate, this.getView().getProjection()); return this.getPixelFromCoordinateInternal(viewCoordinate); } diff --git a/src/ol/interaction/Extent.js b/src/ol/interaction/Extent.js index 863a08fa67..5ca737e2bb 100644 --- a/src/ol/interaction/Extent.js +++ b/src/ol/interaction/Extent.js @@ -386,7 +386,7 @@ class Extent extends PointerInteraction { * @return {import("../extent.js").Extent} Drawn extent in the view projection. * @api */ - getExtentExternal() { + getExtent() { return toUserExtent(this.getExtentInternal(), this.getMap().getView().getProjection()); } diff --git a/test/spec/ol/interaction/extent.test.js b/test/spec/ol/interaction/extent.test.js index c36e8a8350..56fd15765e 100644 --- a/test/spec/ol/interaction/extent.test.js +++ b/test/spec/ol/interaction/extent.test.js @@ -99,7 +99,7 @@ describe('ol.interaction.Extent', function() { simulateEvent('pointerdrag', 50, 50, false, 0); simulateEvent('pointerup', 50, 50, false, 0); - expect(interaction.getExtentExternal()).to.eql([-50, -50, 50, 50]); + expect(interaction.getExtent()).to.eql([-50, -50, 50, 50]); }); it('clicking off extent nulls extent', function() { @@ -108,7 +108,7 @@ describe('ol.interaction.Extent', function() { simulateEvent('pointerdown', -10, -10, false, 0); simulateEvent('pointerup', -10, -10, false, 0); - expect(interaction.getExtentExternal()).to.equal(null); + expect(interaction.getExtent()).to.equal(null); }); it('clicking on extent does not null extent', function() { @@ -117,7 +117,7 @@ describe('ol.interaction.Extent', function() { simulateEvent('pointerdown', 50, 50, false, 0); simulateEvent('pointerup', 50, 50, false, 0); - expect(interaction.getExtentExternal()).to.eql([-50, -50, 50, 50]); + expect(interaction.getExtent()).to.eql([-50, -50, 50, 50]); }); it('snap and drag vertex works', function() { @@ -127,7 +127,7 @@ describe('ol.interaction.Extent', function() { simulateEvent('pointerdrag', -70, -40, false, 0); simulateEvent('pointerup', -70, -40, false, 0); - expect(interaction.getExtentExternal()).to.eql([-70, -50, -50, -40]); + expect(interaction.getExtent()).to.eql([-70, -50, -50, -40]); }); it('snap and drag edge works', function() { @@ -137,7 +137,7 @@ describe('ol.interaction.Extent', function() { simulateEvent('pointerdrag', 20, -30, false, 0); simulateEvent('pointerup', 20, -30, false, 0); - expect(interaction.getExtentExternal()).to.eql([-50, -50, 20, 50]); + expect(interaction.getExtent()).to.eql([-50, -50, 20, 50]); }); }); }); diff --git a/test/spec/ol/map.test.js b/test/spec/ol/map.test.js index 80a9dbaba6..f72a7ccc28 100644 --- a/test/spec/ol/map.test.js +++ b/test/spec/ol/map.test.js @@ -779,7 +779,7 @@ describe('ol.Map', function() { it('gets coordinates in user projection', function(done) { map.renderSync(); - const coordinateGeographic = map.getCoordinateFromPixelExternal(screenCenter); + const coordinateGeographic = map.getCoordinateFromPixel(screenCenter); expect(coordinateGeographic[0]).to.roughlyEqual(centerGeographic[0], 1e-5); expect(coordinateGeographic[1]).to.roughlyEqual(centerGeographic[1], 1e-5); done(); @@ -795,7 +795,7 @@ describe('ol.Map', function() { it('gets pixel from coordinates in user projection', function(done) { map.renderSync(); - const pixel = map.getPixelFromCoordinateExternal(centerGeographic); + const pixel = map.getPixelFromCoordinate(centerGeographic); expect(pixel).to.eql(screenCenter); done(); });