Mapsforge: reduce points on-the-fly while reading from map files (improvements) #757

This commit is contained in:
Emux
2019-12-13 19:14:33 +02:00
parent 412cacd1c2
commit 766b0d9914
3 changed files with 10 additions and 8 deletions

View File

@@ -6,7 +6,7 @@
- Location texture renderer: rewrite and optimize [#750](https://github.com/mapsforge/vtm/pull/750) - Location texture renderer: rewrite and optimize [#750](https://github.com/mapsforge/vtm/pull/750)
- Mapsforge: fix ways precision loss [#752](https://github.com/mapsforge/vtm/pull/752) - Mapsforge: fix ways precision loss [#752](https://github.com/mapsforge/vtm/pull/752)
- Mapsforge: additional simplification [#757](https://github.com/mapsforge/vtm/pull/757) - Mapsforge: additional simplification [#757](https://github.com/mapsforge/vtm/pull/757)
- `Parameters.SIMPLIFICATION` - `Parameters.SIMPLIFICATION_TOLERANCE`
- Android: OpenGL ES 2.0 default for performance / stability [#749](https://github.com/mapsforge/vtm/pull/749) - Android: OpenGL ES 2.0 default for performance / stability [#749](https://github.com/mapsforge/vtm/pull/749)
- `MapView.OPENGL_VERSION` - `MapView.OPENGL_VERSION`
- Android: threaded system initialization - Android: threaded system initialization

View File

@@ -263,15 +263,13 @@ public class MapDatabase implements ITileDataSource {
mTileProjection.setTile(tile); mTileProjection.setTile(tile);
//mTile = tile; //mTile = tile;
if (tile.zoomLevel < SIMPLIFICATION_MIN_ZOOM || tile.zoomLevel > SIMPLIFICATION_MAX_ZOOM) { if (Parameters.SIMPLIFICATION_TOLERANCE > 0
minDeltaLat = 0; && tile.zoomLevel >= SIMPLIFICATION_MIN_ZOOM && tile.zoomLevel <= SIMPLIFICATION_MAX_ZOOM) {
minDeltaLon = 0;
} else {
/* size of tile in map coordinates; */ /* size of tile in map coordinates; */
double size = 1.0 / (1 << tile.zoomLevel); double size = 1.0 / (1 << tile.zoomLevel);
/* simplification tolerance */ /* simplification tolerance */
int pixel = 2; int pixel = Parameters.SIMPLIFICATION_TOLERANCE;
int simplify = Tile.SIZE / pixel; int simplify = Tile.SIZE / pixel;
@@ -281,6 +279,9 @@ public class MapDatabase implements ITileDataSource {
- MercatorProjection.toLatitude(tile.y)) * 1e6) / simplify; - MercatorProjection.toLatitude(tile.y)) * 1e6) / simplify;
minDeltaLon = (int) (Math.abs(MercatorProjection.toLongitude(tile.x + size) minDeltaLon = (int) (Math.abs(MercatorProjection.toLongitude(tile.x + size)
- MercatorProjection.toLongitude(tile.x)) * 1e6) / simplify; - MercatorProjection.toLongitude(tile.x)) * 1e6) / simplify;
} else {
minDeltaLat = 0;
minDeltaLon = 0;
} }
QueryParameters queryParameters = new QueryParameters(); QueryParameters queryParameters = new QueryParameters();
@@ -815,7 +816,7 @@ public class MapDatabase implements ITileDataSource {
} else if (lat == pLat && lon == pLon) { } else if (lat == pLat && lon == pLon) {
/* drop small distance intermediate nodes */ /* drop small distance intermediate nodes */
//log.debug("drop zero delta "); //log.debug("drop zero delta ");
} else if (!Parameters.SIMPLIFICATION } else if (Parameters.SIMPLIFICATION_TOLERANCE == 0
|| (e.tags.contains(TAG_ISSEA) || (e.tags.contains(TAG_ISSEA)
|| e.tags.contains(TAG_SEA) || e.tags.contains(TAG_SEA)
|| e.tags.contains(TAG_NOSEA) || e.tags.contains(TAG_NOSEA)

View File

@@ -64,8 +64,9 @@ public final class Parameters {
/** /**
* Reduce points on-the-fly while reading from map files. * Reduce points on-the-fly while reading from map files.
* e.g. 0 (no simplification), 2, 4, ...
*/ */
public static boolean SIMPLIFICATION = false; public static int SIMPLIFICATION_TOLERANCE = 0;
/** /**
* Texture atlas in themes. * Texture atlas in themes.