diff --git a/src/org/oscim/layers/tile/TileManager.java b/src/org/oscim/layers/tile/TileManager.java index 035f5350..8eacf30e 100644 --- a/src/org/oscim/layers/tile/TileManager.java +++ b/src/org/oscim/layers/tile/TileManager.java @@ -141,6 +141,13 @@ public class TileManager { // ... free static pools } + private int[] mZoomTable; + + public void setZoomTable(int[] zoomLevel) { + mZoomTable = zoomLevel; + + } + public void init(int width, int height) { // sync with GLRender thread @@ -201,6 +208,18 @@ public class TileManager { int tileZoom = FastMath.clamp(pos.zoomLevel, MIN_ZOOMLEVEL, mMaxZoom); + if (mZoomTable != null){ + int match = 0; + for (int z : mZoomTable){ + if (z <= tileZoom && z > match) + match = z; + } + if (match == 0) + return; + + tileZoom = match; + } + mMapViewPosition.getMapViewProjection(mMapPlane); // scan visible tiles. callback function calls 'addTile' @@ -350,7 +369,7 @@ public class TileManager { mJobs.add(tile); } - if (zoomLevel > 2) { + if ((zoomLevel > 2) && (mZoomTable == null)) { boolean add = false; // prefetch parent diff --git a/src/org/oscim/layers/tile/vector/MapTileLayer.java b/src/org/oscim/layers/tile/vector/MapTileLayer.java index 2457695a..c0ad5bc6 100644 --- a/src/org/oscim/layers/tile/vector/MapTileLayer.java +++ b/src/org/oscim/layers/tile/vector/MapTileLayer.java @@ -104,6 +104,8 @@ public class MapTileLayer extends TileLayer { else MapView.enableClosePolygons = false; + mTileManager.setZoomTable(mMapDatabase.getMapInfo().zoomLevel); + mMapView.clearMap(); resumeLoaders();