use of net.osmand.NativeLibrary.NativeRouteSearchResult in project Osmand by osmandapp.
the class RoutingContext method loadSubregionTile.
public void loadSubregionTile(final RoutingSubregionTile ts, boolean loadObjectsInMemory, List<RouteDataObject> toLoad, TLongHashSet excludeNotAllowed) {
boolean wasUnloaded = ts.isUnloaded();
int ucount = ts.getUnloadCont();
if (nativeLib == null) {
long now = System.nanoTime();
try {
BinaryMapIndexReader reader = reverseMap.get(ts.subregion.routeReg);
ts.setLoadedNonNative();
List<RouteDataObject> res = reader.loadRouteIndexData(ts.subregion);
// System.out.println(ts.subregion.shiftToData + " " + res);
if (toLoad != null) {
toLoad.addAll(res);
} else {
for (RouteDataObject ro : res) {
if (ro != null) {
if (config.router.acceptLine(ro)) {
if (excludeNotAllowed != null && !excludeNotAllowed.contains(ro.getId())) {
ts.add(ro);
}
} else if (excludeNotAllowed != null && ro.getId() > 0) {
excludeNotAllowed.add(ro.getId());
if (ts.excludedIds == null) {
ts.excludedIds = new TLongHashSet();
}
ts.excludedIds.add(ro.getId());
}
}
}
}
} catch (IOException e) {
throw new RuntimeException("Loading data exception", e);
}
timeToLoad += (System.nanoTime() - now);
} else {
long now = System.nanoTime();
NativeRouteSearchResult ns = nativeLib.loadRouteRegion(ts.subregion, loadObjectsInMemory);
// System.out.println(ts.subregion.shiftToData + " " + Arrays.toString(ns.objects));
ts.setLoadedNative(ns, this);
timeToLoad += (System.nanoTime() - now);
}
loadedTiles++;
if (wasUnloaded) {
if (ucount == 1) {
loadedPrevUnloadedTiles++;
}
} else {
if (global != null) {
global.allRoutes += ts.tileStatistics.allRoutes;
global.coordinates += ts.tileStatistics.coordinates;
}
distinctLoadedTiles++;
}
global.size += ts.tileStatistics.size;
}
Aggregations