Update roads only maps
This commit is contained in:
parent
f8f214a7db
commit
b434d0ddcd
6 changed files with 35 additions and 15 deletions
|
@ -50,6 +50,7 @@ public class IndexConstants {
|
|||
public static final String LIVE_INDEX_DIR= "live/";
|
||||
public static final String TOURS_INDEX_DIR= "tours/";
|
||||
public static final String SRTM_INDEX_DIR = "srtm/"; //$NON-NLS-1$
|
||||
public static final String ROADS_INDEX_DIR = "roads/"; //$NON-NLS-1$
|
||||
public static final String WIKI_INDEX_DIR = "wiki/"; //$NON-NLS-1$
|
||||
public static final String AV_INDEX_DIR = "avnotes/"; //$NON-NLS-1$
|
||||
public static final String VOICE_INDEX_DIR = "voice/"; //$NON-NLS-1$
|
||||
|
|
|
@ -74,7 +74,7 @@ public class BinaryInspector {
|
|||
// "-zoom=15",
|
||||
// "-bbox=1.74,51.17,1.75,51.16",
|
||||
// "-vstats",
|
||||
"/Users/victorshcherb/osmand/temp/Angola_cuanza-sul_africa_2.srtm.obf"
|
||||
"/Users/victorshcherb/osmand/temp/Czech-republic_jihovychod_europe_2.road.obf"
|
||||
});
|
||||
} else {
|
||||
in.inspector(args);
|
||||
|
|
|
@ -88,6 +88,7 @@ public class LocalIndexHelper {
|
|||
List<LocalIndexInfo> result = new ArrayList<LocalIndexInfo>();
|
||||
|
||||
loadObfData(app.getAppPath(IndexConstants.MAPS_PATH), result, false, loadTask, loadedMaps);
|
||||
loadObfData(app.getAppPath(IndexConstants.ROADS_INDEX_DIR), result, false, loadTask, loadedMaps);
|
||||
loadObfData(app.getAppPath(IndexConstants.BACKUP_INDEX_DIR), result, true, loadTask, loadedMaps);
|
||||
loadTilesData(app.getAppPath(IndexConstants.TILES_INDEX_DIR), result, false, loadTask);
|
||||
loadSrtmData(app.getAppPath(IndexConstants.SRTM_INDEX_DIR), result, loadTask);
|
||||
|
|
|
@ -78,11 +78,12 @@ public class DownloadActivityType {
|
|||
}
|
||||
|
||||
public boolean isAccepted(String fileName) {
|
||||
if (ROADS_FILE == this || NORMAL_FILE == this) {
|
||||
return fileName.endsWith(addVersionToExt(IndexConstants.BINARY_MAP_INDEX_EXT_ZIP,
|
||||
IndexConstants.BINARY_MAP_VERSION))
|
||||
if(NORMAL_FILE == this) {
|
||||
return fileName.endsWith(addVersionToExt(IndexConstants.BINARY_MAP_INDEX_EXT_ZIP, IndexConstants.BINARY_MAP_VERSION))
|
||||
|| fileName.endsWith(IndexConstants.EXTRA_ZIP_EXT)
|
||||
|| fileName.endsWith(IndexConstants.SQLITE_EXT);
|
||||
} else if(ROADS_FILE == this) {
|
||||
return fileName.endsWith(addVersionToExt(IndexConstants.BINARY_ROAD_MAP_INDEX_EXT_ZIP, IndexConstants.BINARY_MAP_VERSION));
|
||||
} else if (VOICE_FILE == this) {
|
||||
return fileName.endsWith(addVersionToExt(IndexConstants.VOICE_INDEX_EXT_ZIP, IndexConstants.VOICE_VERSION));
|
||||
} else if (WIKIPEDIA_FILE == this) {
|
||||
|
@ -98,13 +99,15 @@ public class DownloadActivityType {
|
|||
}
|
||||
|
||||
public File getDownloadFolder(OsmandApplication ctx, IndexItem indexItem) {
|
||||
if (ROADS_FILE == this || NORMAL_FILE == this) {
|
||||
if (NORMAL_FILE == this) {
|
||||
if(indexItem.fileName.endsWith(IndexConstants.SQLITE_EXT)) {
|
||||
return ctx.getAppPath(IndexConstants.TILES_INDEX_DIR);
|
||||
}
|
||||
return ctx.getAppPath(IndexConstants.MAPS_PATH);
|
||||
} else if (VOICE_FILE == this) {
|
||||
return ctx.getAppPath(IndexConstants.VOICE_INDEX_DIR);
|
||||
} else if (ROADS_FILE == this) {
|
||||
return ctx.getAppPath(IndexConstants.ROADS_INDEX_DIR);
|
||||
} else if (SRTM_COUNTRY_FILE == this) {
|
||||
return ctx.getAppPath(IndexConstants.SRTM_INDEX_DIR);
|
||||
} else if (WIKIPEDIA_FILE == this) {
|
||||
|
@ -143,7 +146,7 @@ public class DownloadActivityType {
|
|||
return "";
|
||||
}
|
||||
} else if (ROADS_FILE == this) {
|
||||
return "-roads" + BINARY_MAP_INDEX_EXT;
|
||||
return IndexConstants.BINARY_ROAD_MAP_INDEX_EXT;
|
||||
} else if (VOICE_FILE == this) {
|
||||
return "";
|
||||
} else if (SRTM_COUNTRY_FILE == this) {
|
||||
|
@ -292,7 +295,7 @@ public class DownloadActivityType {
|
|||
return baseNameWithoutVersion + IndexConstants.BINARY_WIKI_MAP_INDEX_EXT;
|
||||
}
|
||||
if (this == DownloadActivityType.ROADS_FILE) {
|
||||
baseNameWithoutVersion += "-roads";
|
||||
return baseNameWithoutVersion + IndexConstants.BINARY_ROAD_MAP_INDEX_EXT;
|
||||
}
|
||||
baseNameWithoutVersion += IndexConstants.BINARY_MAP_INDEX_EXT;
|
||||
return baseNameWithoutVersion;
|
||||
|
|
|
@ -344,6 +344,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
|||
File parent = new File(i.getPathToData()).getParentFile();
|
||||
if(i.getType() == LocalIndexType.SRTM_DATA){
|
||||
parent = getMyApplication().getAppPath(IndexConstants.SRTM_INDEX_DIR);
|
||||
} else if(i.getFileName().endsWith(IndexConstants.ROADS_INDEX_DIR)){
|
||||
parent = getMyApplication().getAppPath(IndexConstants.ROADS_INDEX_DIR);
|
||||
} else if(i.getType() == LocalIndexType.WIKI_DATA){
|
||||
parent = getMyApplication().getAppPath(IndexConstants.WIKI_INDEX_DIR);
|
||||
} else if(i.getType() == LocalIndexType.MAP_DATA){
|
||||
|
@ -1112,16 +1114,9 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
|||
|
||||
|
||||
private String getMapDescription(String fileName){
|
||||
int ls = fileName.lastIndexOf(".");
|
||||
String name = fileName;
|
||||
if (ls >= 0) {
|
||||
name = fileName.substring(0, ls);
|
||||
}
|
||||
|
||||
if (name.endsWith("-roads")) {
|
||||
if (fileName.endsWith(IndexConstants.BINARY_ROAD_MAP_INDEX_EXT)) {
|
||||
return ctx.getString(R.string.download_roads_only_item);
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import java.text.MessageFormat;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -586,17 +587,34 @@ public class ResourceManager {
|
|||
return files;
|
||||
}
|
||||
|
||||
private void renameRoadsFiles(ArrayList<File> files, File roadsPath) {
|
||||
Iterator<File> it = files.iterator();
|
||||
while(it.hasNext()) {
|
||||
File f = it.next();
|
||||
if (f.getName().endsWith("-roads" + IndexConstants.BINARY_MAP_INDEX_EXT)) {
|
||||
f.renameTo(new File(roadsPath, f.getName().replace("-roads" + IndexConstants.BINARY_MAP_INDEX_EXT,
|
||||
IndexConstants.BINARY_ROAD_MAP_INDEX_EXT)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> indexingMaps(final IProgress progress) {
|
||||
long val = System.currentTimeMillis();
|
||||
ArrayList<File> files = new ArrayList<File>();
|
||||
File appPath = context.getAppPath(null);
|
||||
File roadsPath = context.getAppPath(IndexConstants.ROADS_INDEX_DIR);
|
||||
roadsPath.mkdirs();
|
||||
|
||||
collectFiles(appPath, IndexConstants.BINARY_MAP_INDEX_EXT, files);
|
||||
renameRoadsFiles(files, roadsPath);
|
||||
collectFiles(roadsPath, IndexConstants.BINARY_MAP_INDEX_EXT, files);
|
||||
if(!Version.isFreeVersion(context)) {
|
||||
collectFiles(context.getAppPath(IndexConstants.WIKI_INDEX_DIR), IndexConstants.BINARY_MAP_INDEX_EXT, files);
|
||||
}
|
||||
if(OsmandPlugin.getEnabledPlugin(SRTMPlugin.class) != null) {
|
||||
collectFiles(context.getAppPath(IndexConstants.SRTM_INDEX_DIR), IndexConstants.BINARY_MAP_INDEX_EXT, files);
|
||||
}
|
||||
|
||||
if(context.getSettings().BETA_TESTING_LIVE_UPDATES.get()) {
|
||||
collectFiles(context.getAppPath(IndexConstants.LIVE_INDEX_DIR), IndexConstants.BINARY_MAP_INDEX_EXT, files);
|
||||
}
|
||||
|
@ -714,6 +732,8 @@ public class ResourceManager {
|
|||
return warnings;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void initMapBoundariesCacheNative() {
|
||||
File indCache = context.getAppPath(INDEXES_CACHE);
|
||||
if (indCache.exists()) {
|
||||
|
|
Loading…
Reference in a new issue