fix issue 199

git-svn-id: https://osmand.googlecode.com/svn/trunk@688 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-11-22 19:49:26 +00:00
parent 1bf926ad69
commit 9d8d7b56d1

View file

@ -30,6 +30,8 @@ public class SQLiteTileSource implements ITileSource {
private String name;
private SQLiteDatabase db;
private final File file;
private int minZoom = 1;
private int maxZoom = 17;
public SQLiteTileSource(File f){
this.file = f;
@ -56,12 +58,14 @@ public class SQLiteTileSource implements ITileSource {
@Override
public int getMaximumZoomSupported() {
return base != null ? base.getMaximumZoomSupported() : 17;
getDatabase();
return base != null ? base.getMaximumZoomSupported() : maxZoom;
}
@Override
public int getMinimumZoomSupported() {
return base != null ? base.getMinimumZoomSupported() : 1;
getDatabase();
return base != null ? base.getMinimumZoomSupported() : minZoom;
}
@Override
@ -129,6 +133,16 @@ public class SQLiteTileSource implements ITileSource {
}
} catch (RuntimeException e) {
}
try {
long z;
z = db.compileStatement("SELECT minzoom FROM info").simpleQueryForLong(); //$NON-NLS-1$
if (z < 17 && z >= 0)
maxZoom = 17 - (int)z;
z = db.compileStatement("SELECT maxzoom FROM info").simpleQueryForLong(); //$NON-NLS-1$
if (z < 17 && z >= 0)
minZoom = 17 - (int)z;
} catch (RuntimeException e) {
}
}
return db;
}