Skip to content

Commit

Permalink
Rename MapDatabase.readLabels to readNamedItems and MapDatabase.Selec…
Browse files Browse the repository at this point in the history
…tor.LABELS to NAMED (#1181)
  • Loading branch information
devemux86 authored Mar 1, 2025
1 parent f2ebb17 commit 54cc60e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 19 deletions.
2 changes: 2 additions & 0 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();

Expand Down
25 changes: 18 additions & 7 deletions vtm/src/org/oscim/tiling/source/mapfile/MapDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand Down Expand Up @@ -1332,10 +1332,21 @@ public boolean wayAsLabelTagFilter(List<Tag> 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 {
Expand Down
8 changes: 4 additions & 4 deletions vtm/src/org/oscim/tiling/source/mapfile/MultiMapDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ 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) {
if (isTileFilled && mdb.getPriority() < 0) {
break;
}
if (mdb.supportsTile(tile)) {
MapReadResult result = mdb.readLabels(tile);
MapReadResult result = mdb.readNamedItems(tile);
if (result == null) {
continue;
}
Expand All @@ -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) {
Expand All @@ -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;
}
Expand Down

0 comments on commit 54cc60e

Please sign in to comment.