Merge pull request #4802 from osmandapp/PaulsBranch
Added flag to use live updates for native routing
This commit is contained in:
commit
ad301fbd64
2 changed files with 5 additions and 4 deletions
|
@ -116,8 +116,8 @@ public class NativeLibrary {
|
||||||
return getRouteDataObjects(rs.region.routeReg, rs.nativeHandler, x31, y31);
|
return getRouteDataObjects(rs.region.routeReg, rs.nativeHandler, x31, y31);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean initMapFile(String filePath) {
|
public boolean initMapFile(String filePath, boolean useLive) {
|
||||||
return initBinaryMapFile(filePath);
|
return initBinaryMapFile(filePath, useLive);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean initCacheMapFile(String filePath) {
|
public boolean initCacheMapFile(String filePath) {
|
||||||
|
@ -160,7 +160,7 @@ public class NativeLibrary {
|
||||||
|
|
||||||
protected static native void deleteSearchResult(long searchResultHandle);
|
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);
|
protected static native boolean initCacheMapFiles(String filePath);
|
||||||
|
|
||||||
|
|
|
@ -294,6 +294,7 @@ public class MapRenderRepositories {
|
||||||
if(library == null) {
|
if(library == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
boolean useLive = context.getSettings().USE_OSM_LIVE_FOR_ROUTING.get();
|
||||||
for (String mapName : files.keySet()) {
|
for (String mapName : files.keySet()) {
|
||||||
BinaryMapIndexReader fr = files.get(mapName);
|
BinaryMapIndexReader fr = files.get(mapName);
|
||||||
if (fr != null && (fr.containsMapData(leftX, topY, rightX, bottomY, zoom) ||
|
if (fr != null && (fr.containsMapData(leftX, topY, rightX, bottomY, zoom) ||
|
||||||
|
@ -301,7 +302,7 @@ public class MapRenderRepositories {
|
||||||
if (!nativeFiles.contains(mapName)) {
|
if (!nativeFiles.contains(mapName)) {
|
||||||
long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
nativeFiles.add(mapName);
|
nativeFiles.add(mapName);
|
||||||
if (!library.initMapFile(fr.getFile().getAbsolutePath())) {
|
if (!library.initMapFile(fr.getFile().getAbsolutePath(), useLive)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
log.debug("Native resource " + mapName + " initialized " + (System.currentTimeMillis() - time) + " ms"); //$NON-NLS-1$ //$NON-NLS-2$
|
log.debug("Native resource " + mapName + " initialized " + (System.currentTimeMillis() - time) + " ms"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
Loading…
Reference in a new issue