sqlite map sources with urls
This commit is contained in:
parent
99a64eaa7b
commit
148e6a2b1e
2 changed files with 8 additions and 19 deletions
|
@ -56,14 +56,7 @@ public class SQLiteTileSource implements ITileSource {
|
||||||
private OsmandApplication ctx;
|
private OsmandApplication ctx;
|
||||||
private boolean onlyReadonlyAvailable = false;
|
private boolean onlyReadonlyAvailable = false;
|
||||||
|
|
||||||
private static final String TILES_TABLE_CREATE = "CREATE TABLE IF NOT EXISTS tiles (" +
|
private static final String TILES_TABLE_CREATE = "CREATE TABLE IF NOT EXISTS \"tiles\" (\"x\" INTEGER NOT NULL, \"y\" INTEGER NOT NULL, \"z\" INTEGER NOT NULL, \"s\" INTEGER, \"image\" BLOB, \"time\" INTEGER, PRIMARY KEY (\"x\", \"y\", \"z\"))";
|
||||||
"x, " +
|
|
||||||
"y, " +
|
|
||||||
"z, " +
|
|
||||||
"s, " +
|
|
||||||
"image, " +
|
|
||||||
"time" +
|
|
||||||
")";
|
|
||||||
|
|
||||||
public SQLiteTileSource(OsmandApplication ctx, File f, List<TileSourceTemplate> toFindUrl){
|
public SQLiteTileSource(OsmandApplication ctx, File f, List<TileSourceTemplate> toFindUrl){
|
||||||
this.ctx = ctx;
|
this.ctx = ctx;
|
||||||
|
@ -106,18 +99,14 @@ public class SQLiteTileSource implements ITileSource {
|
||||||
public void createDataBase() {
|
public void createDataBase() {
|
||||||
db = ctx.getSQLiteAPI().getOrCreateDatabase(
|
db = ctx.getSQLiteAPI().getOrCreateDatabase(
|
||||||
ctx.getAppPath(TILES_INDEX_DIR).getAbsolutePath() + "/" + name + SQLITE_EXT, true);
|
ctx.getAppPath(TILES_INDEX_DIR).getAbsolutePath() + "/" + name + SQLITE_EXT, true);
|
||||||
|
|
||||||
db.execSQL("CREATE TABLE IF NOT EXISTS info (" +
|
db.execSQL("CREATE TABLE IF NOT EXISTS info (" +
|
||||||
"url " +
|
"minzoom, " +
|
||||||
|
"maxzoom " +
|
||||||
");");
|
");");
|
||||||
db.execSQL("INSERT INTO info (url) VALUES ('" + urlTemplate + "');");
|
db.execSQL("INSERT INTO info (minzoom,maxzoom) VALUES ('" + minZoom + "','" + maxZoom + "');");
|
||||||
|
|
||||||
// db.execSQL("INSERT INTO info VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
addInfoColumn("url", urlTemplate);
|
||||||
// new Object[]{minZoom, maxZoom, urlTemplate, randoms, isEllipsoid ? 1 : 0,
|
|
||||||
// invertedY ? 1 : 0, referer, timeSupported ? "yes" : "no", timeSupported ? "yes" : "no",
|
|
||||||
// getExpirationTimeMinutes(), inversiveZoom ? "BigPlanet" : ""});
|
|
||||||
|
|
||||||
addInfoColumn("minzoom", String.valueOf(minZoom));
|
|
||||||
addInfoColumn("maxzoom", String.valueOf(maxZoom));
|
|
||||||
addInfoColumn("randoms", randoms);
|
addInfoColumn("randoms", randoms);
|
||||||
addInfoColumn("ellipsoid", isEllipsoid ? "1" : "0");
|
addInfoColumn("ellipsoid", isEllipsoid ? "1" : "0");
|
||||||
addInfoColumn("inverted_y", invertedY ? "1" : "0");
|
addInfoColumn("inverted_y", invertedY ? "1" : "0");
|
||||||
|
|
|
@ -1091,8 +1091,8 @@ public class SettingsHelper {
|
||||||
JSONObject object = items.getJSONObject(i);
|
JSONObject object = items.getJSONObject(i);
|
||||||
boolean sql = object.optBoolean("sql");
|
boolean sql = object.optBoolean("sql");
|
||||||
String name = object.optString("name");
|
String name = object.optString("name");
|
||||||
int minZoom = object.optInt("minZoom", 1);
|
int minZoom = object.optInt("minZoom");
|
||||||
int maxZoom = object.optInt("maxZoom", 17);
|
int maxZoom = object.optInt("maxZoom");
|
||||||
String url = object.optString("url");
|
String url = object.optString("url");
|
||||||
String randoms = object.optString("randoms");
|
String randoms = object.optString("randoms");
|
||||||
boolean ellipsoid = object.optBoolean("ellipsoid", false);
|
boolean ellipsoid = object.optBoolean("ellipsoid", false);
|
||||||
|
|
Loading…
Reference in a new issue