rename external methods to API names

This commit is contained in:
Tobias Kohr
2019-09-24 18:13:57 +02:00
parent 182ed012e2
commit 8c4937170b
8 changed files with 18 additions and 18 deletions

View File

@@ -135,7 +135,7 @@ map.on('pointermove', function(evt) {
if (evt.dragging) { if (evt.dragging) {
return; return;
} }
const coordinate = map.getEventCoordinateExternal(evt.originalEvent); const coordinate = map.getEventCoordinate(evt.originalEvent);
displaySnap(coordinate); displaySnap(coordinate);
}); });

View File

@@ -117,7 +117,7 @@ raster.on('beforeoperations', function(event) {
const data = event.data; const data = event.data;
data.delta = thresholdControl.value; data.delta = thresholdControl.value;
if (coordinate) { if (coordinate) {
data.pixel = map.getPixelFromCoordinateExternal(coordinate); data.pixel = map.getPixelFromCoordinate(coordinate);
} }
}); });

View File

@@ -85,7 +85,7 @@ map.on('pointermove', function(evt) {
if (evt.dragging) { if (evt.dragging) {
return; return;
} }
const coordinate = map.getEventCoordinateExternal(evt.originalEvent); const coordinate = map.getEventCoordinate(evt.originalEvent);
displaySnap(coordinate); displaySnap(coordinate);
}); });

View File

@@ -63,7 +63,7 @@ map.on('pointermove', function(evt) {
if (evt.dragging) { if (evt.dragging) {
return; return;
} }
const coordinate = map.getEventCoordinateExternal(evt.originalEvent); const coordinate = map.getEventCoordinate(evt.originalEvent);
displayCountryInfo(coordinate); displayCountryInfo(coordinate);
}); });

View File

@@ -546,7 +546,7 @@ class PluggableMap extends BaseObject {
if (!this.frameState_) { if (!this.frameState_) {
return; return;
} }
const coordinate = this.getCoordinateFromPixelExternal(pixel); const coordinate = this.getCoordinateFromPixel(pixel);
opt_options = opt_options !== undefined ? opt_options : opt_options = opt_options !== undefined ? opt_options :
/** @type {AtPixelOptions} */ ({}); /** @type {AtPixelOptions} */ ({});
const hitTolerance = opt_options.hitTolerance !== undefined ? const hitTolerance = opt_options.hitTolerance !== undefined ?
@@ -618,7 +618,7 @@ class PluggableMap extends BaseObject {
if (!this.frameState_) { if (!this.frameState_) {
return false; return false;
} }
const coordinate = this.getCoordinateFromPixelExternal(pixel); const coordinate = this.getCoordinateFromPixel(pixel);
opt_options = opt_options !== undefined ? opt_options : opt_options = opt_options !== undefined ? opt_options :
/** @type {AtPixelOptions} */ ({}); /** @type {AtPixelOptions} */ ({});
const layerFilter = opt_options.layerFilter !== undefined ? opt_options.layerFilter : TRUE; const layerFilter = opt_options.layerFilter !== undefined ? opt_options.layerFilter : TRUE;
@@ -634,8 +634,8 @@ class PluggableMap extends BaseObject {
* @return {import("./coordinate.js").Coordinate} Coordinate. * @return {import("./coordinate.js").Coordinate} Coordinate.
* @api * @api
*/ */
getEventCoordinateExternal(event) { getEventCoordinate(event) {
return this.getCoordinateFromPixelExternal(this.getEventPixel(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. * @return {import("./coordinate.js").Coordinate} The coordinate for the pixel position.
* @api * @api
*/ */
getCoordinateFromPixelExternal(pixel) { getCoordinateFromPixel(pixel) {
return toUserCoordinate(this.getCoordinateFromPixelInternal(pixel), this.getView().getProjection()); 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. * @return {import("./pixel.js").Pixel} A pixel position in the map viewport.
* @api * @api
*/ */
getPixelFromCoordinateExternal(coordinate) { getPixelFromCoordinate(coordinate) {
const viewCoordinate = fromUserCoordinate(coordinate, this.getView().getProjection()); const viewCoordinate = fromUserCoordinate(coordinate, this.getView().getProjection());
return this.getPixelFromCoordinateInternal(viewCoordinate); return this.getPixelFromCoordinateInternal(viewCoordinate);
} }

View File

@@ -386,7 +386,7 @@ class Extent extends PointerInteraction {
* @return {import("../extent.js").Extent} Drawn extent in the view projection. * @return {import("../extent.js").Extent} Drawn extent in the view projection.
* @api * @api
*/ */
getExtentExternal() { getExtent() {
return toUserExtent(this.getExtentInternal(), this.getMap().getView().getProjection()); return toUserExtent(this.getExtentInternal(), this.getMap().getView().getProjection());
} }

View File

@@ -99,7 +99,7 @@ describe('ol.interaction.Extent', function() {
simulateEvent('pointerdrag', 50, 50, false, 0); simulateEvent('pointerdrag', 50, 50, false, 0);
simulateEvent('pointerup', 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() { it('clicking off extent nulls extent', function() {
@@ -108,7 +108,7 @@ describe('ol.interaction.Extent', function() {
simulateEvent('pointerdown', -10, -10, false, 0); simulateEvent('pointerdown', -10, -10, false, 0);
simulateEvent('pointerup', -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() { 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('pointerdown', 50, 50, false, 0);
simulateEvent('pointerup', 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() { it('snap and drag vertex works', function() {
@@ -127,7 +127,7 @@ describe('ol.interaction.Extent', function() {
simulateEvent('pointerdrag', -70, -40, false, 0); simulateEvent('pointerdrag', -70, -40, false, 0);
simulateEvent('pointerup', -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() { it('snap and drag edge works', function() {
@@ -137,7 +137,7 @@ describe('ol.interaction.Extent', function() {
simulateEvent('pointerdrag', 20, -30, false, 0); simulateEvent('pointerdrag', 20, -30, false, 0);
simulateEvent('pointerup', 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]);
}); });
}); });
}); });

View File

@@ -779,7 +779,7 @@ describe('ol.Map', function() {
it('gets coordinates in user projection', function(done) { it('gets coordinates in user projection', function(done) {
map.renderSync(); map.renderSync();
const coordinateGeographic = map.getCoordinateFromPixelExternal(screenCenter); const coordinateGeographic = map.getCoordinateFromPixel(screenCenter);
expect(coordinateGeographic[0]).to.roughlyEqual(centerGeographic[0], 1e-5); expect(coordinateGeographic[0]).to.roughlyEqual(centerGeographic[0], 1e-5);
expect(coordinateGeographic[1]).to.roughlyEqual(centerGeographic[1], 1e-5); expect(coordinateGeographic[1]).to.roughlyEqual(centerGeographic[1], 1e-5);
done(); done();
@@ -795,7 +795,7 @@ describe('ol.Map', function() {
it('gets pixel from coordinates in user projection', function(done) { it('gets pixel from coordinates in user projection', function(done) {
map.renderSync(); map.renderSync();
const pixel = map.getPixelFromCoordinateExternal(centerGeographic); const pixel = map.getPixelFromCoordinate(centerGeographic);
expect(pixel).to.eql(screenCenter); expect(pixel).to.eql(screenCenter);
done(); done();
}); });