Permalink
Browse files

Multiple maps with different zoom levels, closes #911

1 parent 3d025ea commit 648872c0c039c5ac7e4e29e372ca4a18d1bb81c6 @devemux86 devemux86 committed Dec 18, 2016
View
@@ -2,22 +2,23 @@
## New since 0.6.1
-- Group layer implementation [#860](https://github.com/mapsforge/mapsforge/issues/860)
-- Render theme resources without location prefixes [#847](https://github.com/mapsforge/mapsforge/issues/847)
- Multithreaded rendering improvements [#591](https://github.com/mapsforge/mapsforge/issues/591) [#806](https://github.com/mapsforge/mapsforge/issues/806)
- Fix map disappearance at large zoom levels [#572](https://github.com/mapsforge/mapsforge/issues/572)
- Map writer: polygon label position enhancements [#886](https://github.com/mapsforge/mapsforge/issues/886)
- Map writer: house numbers (nodes) include at zoom 17 [#895](https://github.com/mapsforge/mapsforge/issues/895)
- Map writer: simplification max zoom option [#892](https://github.com/mapsforge/mapsforge/issues/892)
- POI writer: allow empty categories option [#883](https://github.com/mapsforge/mapsforge/issues/883)
+- Multiple maps with different zoom levels [#911](https://github.com/mapsforge/mapsforge/issues/911)
- Map rotation (external) in library [#637](https://github.com/mapsforge/mapsforge/issues/637)
-- Group marker example [#905](https://github.com/mapsforge/mapsforge/issues/905)
+- Group layer implementation [#860](https://github.com/mapsforge/mapsforge/issues/860)
- SVG symbols customization [#858](https://github.com/mapsforge/mapsforge/issues/858)
- Map scale bar size scaling [#861](https://github.com/mapsforge/mapsforge/issues/861)
+- Group marker example [#905](https://github.com/mapsforge/mapsforge/issues/905)
- Deprecate water tiles rendering [#640](https://github.com/mapsforge/mapsforge/issues/640)
- mapsforge-themes module [#848](https://github.com/mapsforge/mapsforge/issues/848)
- New default internal render theme [#903](https://github.com/mapsforge/mapsforge/issues/903)
- Internal render themes new SVG resources [#904](https://github.com/mapsforge/mapsforge/issues/904)
+- Render theme resources without location prefixes [#847](https://github.com/mapsforge/mapsforge/issues/847)
- SpatiaLite natives published artifacts [#849](https://github.com/mapsforge/mapsforge/issues/849)
- SNAPSHOT builds publish to Sonatype OSSRH [#873](https://github.com/mapsforge/mapsforge/issues/873)
- Deprecate Maven build [#852](https://github.com/mapsforge/mapsforge/issues/852)
@@ -185,6 +185,9 @@
private final MapFileHeader mapFileHeader;
private final long timestamp;
+ private byte zoomLevelMin = 0;
+ private byte zoomLevelMax = Byte.MAX_VALUE;
+
private MapFile() {
// only to create a dummy empty file.
databaseIndexCache = null;
@@ -928,8 +931,8 @@ public MapReadResult readPoiData(Tile upperLeft, Tile lowerRight) {
* @param maxZoom maximum zoom level supported
*/
public void restrictToZoomRange(byte minZoom, byte maxZoom) {
- this.getMapFileInfo().zoomLevelMax = maxZoom;
- this.getMapFileInfo().zoomLevelMin = minZoom;
+ this.zoomLevelMax = maxZoom;
+ this.zoomLevelMin = minZoom;
}
@Override
@@ -950,7 +953,8 @@ public Byte startZoomLevel() {
@Override
public boolean supportsTile(Tile tile) {
- return tile.getBoundingBox().intersects(getMapFileInfo().boundingBox);
+ return tile.getBoundingBox().intersects(getMapFileInfo().boundingBox)
+ && (tile.zoomLevel >= this.zoomLevelMin && tile.zoomLevel <= this.zoomLevelMax);
}
/**
@@ -1,6 +1,7 @@
/*
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
* Copyright 2014 Ludwig M Brinckmann
+ * Copyright 2016 devemux86
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
@@ -100,8 +101,8 @@
*/
public final Tag[] wayTags;
- public byte zoomLevelMin;
- public byte zoomLevelMax;
+ public final byte zoomLevelMin;
+ public final byte zoomLevelMax;
MapFileInfo(MapFileInfoBuilder mapFileInfoBuilder) {
this.comment = mapFileInfoBuilder.optionalFields.comment;
@@ -122,8 +123,4 @@
this.zoomLevelMax = mapFileInfoBuilder.zoomLevelMax;
this.zoomLevelMin = mapFileInfoBuilder.zoomLevelMin;
}
-
- public boolean supportsZoomLevel(byte zoomLevel) {
- return zoomLevel >= this.zoomLevelMin && zoomLevel <= this.zoomLevelMax;
- }
}
@@ -1,6 +1,6 @@
/*
* Copyright 2014 Ludwig M Brinckmann
- * Copyright 2015 devemux86
+ * Copyright 2015-2016 devemux86
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
@@ -75,11 +75,13 @@ protected void onCreate(Bundle savedInstanceState) {
@Override
public boolean supportsTile(Tile tile) {
// Example low res world map has sufficient detail up to zoom level 7
- return tile.zoomLevel <= 7 && super.supportsTile(tile);
+ return tile.zoomLevel <= 10 && super.supportsTile(tile);
}
};
multiMapDataStore = new MultiMapDataStore(MultiMapDataStore.DataPolicy.RETURN_ALL);
- multiMapDataStore.addMapDataStore(getMapFile1(), true, true);
+ MapFile mapFile1 = (MapFile) getMapFile1();
+ mapFile1.restrictToZoomRange((byte) 8, Byte.MAX_VALUE);
+ multiMapDataStore.addMapDataStore(mapFile1, true, true);
multiMapDataStore.addMapDataStore(getMapFile2(), false, false);
super.onCreate(savedInstanceState);

0 comments on commit 648872c

Please sign in to comment.