From 54cc60e9bb033dd6f932840e0e1905c736bf67ee Mon Sep 17 00:00:00 2001 From: Emux Date: Sat, 1 Mar 2025 13:20:20 +0200 Subject: [PATCH] Rename MapDatabase.readLabels to readNamedItems and MapDatabase.Selector.LABELS to NAMED (#1181) --- docs/Changelog.md | 2 ++ .../android/test/ReverseGeocodeActivity.java | 10 ++------ .../tiling/source/mapfile/MapDatabase.java | 25 +++++++++++++------ .../source/mapfile/MultiMapDatabase.java | 8 +++--- 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/docs/Changelog.md b/docs/Changelog.md index 49545ef8a..e0711ac57 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -6,6 +6,8 @@ - Multi-map `MapFileTileSource.setPriority` [#1176](https://github.com/mapsforge/vtm/pull/1176) - Color filter theme resources [#1175](https://github.com/mapsforge/vtm/pull/1175) - `ThemeCallback.getBitmap` +- Rename `MapDatabase.readLabels` to `readNamedItems` [#1181](https://github.com/mapsforge/vtm/pull/1181) + - Rename `MapDatabase.Selector.LABELS` to `NAMED` - Update JTS, OkHttp dependencies [#1172](https://github.com/mapsforge/vtm/pull/1172) [#1173](https://github.com/mapsforge/vtm/pull/1173) - Remove SLF4J dependency [#1167](https://github.com/mapsforge/vtm/pull/1167) [#1170](https://github.com/mapsforge/vtm/pull/1170) - Libtess2 v1.0.1 [#1178](https://github.com/mapsforge/vtm/pull/1178) diff --git a/vtm-android-example/src/org/oscim/android/test/ReverseGeocodeActivity.java b/vtm-android-example/src/org/oscim/android/test/ReverseGeocodeActivity.java index f2c395904..e267874c4 100644 --- a/vtm-android-example/src/org/oscim/android/test/ReverseGeocodeActivity.java +++ b/vtm-android-example/src/org/oscim/android/test/ReverseGeocodeActivity.java @@ -18,14 +18,8 @@ import android.content.Intent; import android.os.Bundle; import android.view.Menu; - import org.oscim.backend.CanvasAdapter; -import org.oscim.core.GeoPoint; -import org.oscim.core.GeometryBuffer; -import org.oscim.core.MercatorProjection; -import org.oscim.core.Point; -import org.oscim.core.Tag; -import org.oscim.core.Tile; +import org.oscim.core.*; import org.oscim.event.Gesture; import org.oscim.event.GestureListener; import org.oscim.event.MotionEvent; @@ -97,7 +91,7 @@ public boolean onGesture(Gesture g, MotionEvent e) { int tileYMax = MercatorProjection.pixelYToTileY(pixelY + touchRadius, (byte) mMap.getMapPosition().getZoomLevel()); Tile upperLeft = new Tile(tileXMin, tileYMin, (byte) mMap.getMapPosition().getZoomLevel()); Tile lowerRight = new Tile(tileXMax, tileYMax, (byte) mMap.getMapPosition().getZoomLevel()); - MapReadResult mapReadResult = ((MapDatabase) ((OverzoomTileDataSource) mTileLayer.getTileSource().getDataSource()).getDataSource()).readLabels(upperLeft, lowerRight); + MapReadResult mapReadResult = ((MapDatabase) ((OverzoomTileDataSource) mTileLayer.getTileSource().getDataSource()).getDataSource()).readNamedItems(upperLeft, lowerRight); StringBuilder sb = new StringBuilder(); diff --git a/vtm/src/org/oscim/tiling/source/mapfile/MapDatabase.java b/vtm/src/org/oscim/tiling/source/mapfile/MapDatabase.java index e0e75c934..8f14ccbc5 100644 --- a/vtm/src/org/oscim/tiling/source/mapfile/MapDatabase.java +++ b/vtm/src/org/oscim/tiling/source/mapfile/MapDatabase.java @@ -1117,13 +1117,13 @@ private boolean processWays(QueryParameters queryParameters, ITileDataSink mapDa } /** - * Reads only labels for tile. + * Reads only named items for a tile. * * @param tile tile for which data is requested. * @return label data for the tile. */ - public MapReadResult readLabels(Tile tile) { - return readMapData(tile, tile, Selector.LABELS); + public MapReadResult readNamedItems(Tile tile) { + return readMapData(tile, tile, Selector.NAMED); } /** @@ -1135,8 +1135,8 @@ public MapReadResult readLabels(Tile tile) { * @param lowerRight tile that defines the lower right corner of the requested area. * @return map data for the tile. */ - public MapReadResult readLabels(Tile upperLeft, Tile lowerRight) { - return readMapData(upperLeft, lowerRight, Selector.LABELS); + public MapReadResult readNamedItems(Tile upperLeft, Tile lowerRight) { + return readMapData(upperLeft, lowerRight, Selector.NAMED); } /** @@ -1332,10 +1332,21 @@ public boolean wayAsLabelTagFilter(List tags) { * The Selector enum is used to specify which data subset is to be retrieved from a MapFile: * ALL: all data (as in version 0.6.0) * POIS: only poi data, no ways (new after 0.6.0) - * LABELS: poi data and ways that have a name (new after 0.6.0) + * NAMED: poi data and ways that have a name (new after 0.6.0) */ private enum Selector { - ALL, POIS, LABELS + /** + * All data. + */ + ALL, + /** + * Only POI data. + */ + POIS, + /** + * POI data and ways that have a name. + */ + NAMED } static class TileProjection { diff --git a/vtm/src/org/oscim/tiling/source/mapfile/MultiMapDatabase.java b/vtm/src/org/oscim/tiling/source/mapfile/MultiMapDatabase.java index 377e55688..285089e26 100644 --- a/vtm/src/org/oscim/tiling/source/mapfile/MultiMapDatabase.java +++ b/vtm/src/org/oscim/tiling/source/mapfile/MultiMapDatabase.java @@ -112,7 +112,7 @@ public void cancel() { } } - public MapReadResult readLabels(Tile tile, boolean deduplicate) { + public MapReadResult readNamedItems(Tile tile, boolean deduplicate) { MapReadResult mapReadResult = new MapReadResult(); boolean isTileFilled = false; for (MapDatabase mdb : mapDatabases) { @@ -120,7 +120,7 @@ public MapReadResult readLabels(Tile tile, boolean deduplicate) { break; } if (mdb.supportsTile(tile)) { - MapReadResult result = mdb.readLabels(tile); + MapReadResult result = mdb.readNamedItems(tile); if (result == null) { continue; } @@ -135,7 +135,7 @@ public MapReadResult readLabels(Tile tile, boolean deduplicate) { return mapReadResult; } - public MapReadResult readLabels(Tile upperLeft, Tile lowerRight, boolean deduplicate) { + public MapReadResult readNamedItems(Tile upperLeft, Tile lowerRight, boolean deduplicate) { MapReadResult mapReadResult = new MapReadResult(); boolean isTileFilled = false; for (MapDatabase mdb : mapDatabases) { @@ -144,7 +144,7 @@ public MapReadResult readLabels(Tile upperLeft, Tile lowerRight, boolean dedupli } if (mdb.supportsArea(upperLeft.getBoundingBox().extendBoundingBox(lowerRight.getBoundingBox()), upperLeft.zoomLevel)) { - MapReadResult result = mdb.readLabels(upperLeft, lowerRight); + MapReadResult result = mdb.readNamedItems(upperLeft, lowerRight); if (result == null) { continue; }