Merge pull request #4802 from osmandapp/PaulsBranch

Added flag to use live updates for native routing
This commit is contained in:
Alexey 2017-11-24 15:11:57 +03:00 committed by GitHub
commit ad301fbd64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View file

@ -116,8 +116,8 @@ public class NativeLibrary {
return getRouteDataObjects(rs.region.routeReg, rs.nativeHandler, x31, y31);
}
public boolean initMapFile(String filePath) {
return initBinaryMapFile(filePath);
public boolean initMapFile(String filePath, boolean useLive) {
return initBinaryMapFile(filePath, useLive);
}
public boolean initCacheMapFile(String filePath) {
@ -160,7 +160,7 @@ public class NativeLibrary {
protected static native void deleteSearchResult(long searchResultHandle);
protected static native boolean initBinaryMapFile(String filePath);
protected static native boolean initBinaryMapFile(String filePath, boolean useLive);
protected static native boolean initCacheMapFiles(String filePath);

View file

@ -294,6 +294,7 @@ public class MapRenderRepositories {
if(library == null) {
return;
}
boolean useLive = context.getSettings().USE_OSM_LIVE_FOR_ROUTING.get();
for (String mapName : files.keySet()) {
BinaryMapIndexReader fr = files.get(mapName);
if (fr != null && (fr.containsMapData(leftX, topY, rightX, bottomY, zoom) ||
@ -301,7 +302,7 @@ public class MapRenderRepositories {
if (!nativeFiles.contains(mapName)) {
long time = System.currentTimeMillis();
nativeFiles.add(mapName);
if (!library.initMapFile(fr.getFile().getAbsolutePath())) {
if (!library.initMapFile(fr.getFile().getAbsolutePath(), useLive)) {
continue;
}
log.debug("Native resource " + mapName + " initialized " + (System.currentTimeMillis() - time) + " ms"); //$NON-NLS-1$ //$NON-NLS-2$