use zoomTable for zoom-levels provided by db

This commit is contained in:
Hannes Janetzek 2013-05-15 02:59:08 +02:00
parent 3b0c3c8ce9
commit 355f41aee3
2 changed files with 22 additions and 1 deletions
src/org/oscim/layers/tile

@ -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

@ -104,6 +104,8 @@ public class MapTileLayer extends TileLayer<MapTileLoader> {
else
MapView.enableClosePolygons = false;
mTileManager.setZoomTable(mMapDatabase.getMapInfo().zoomLevel);
mMapView.clearMap();
resumeLoaders();