diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java b/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java index 3356a60e56..9efa3dc4b5 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java @@ -1256,7 +1256,7 @@ public class RouteResultPreparation { if (turn == TurnType.TU || sturn == TurnType.TU || tturn == TurnType.TU) { possiblyLeftTurn = true; } - if (turn == TurnType.TRU || sturn == TurnType.TRU || sturn == TurnType.TRU) { + if (turn == TurnType.TRU || sturn == TurnType.TRU || tturn == TurnType.TRU) { possiblyRightTurn = true; } } @@ -1740,10 +1740,8 @@ public class RouteResultPreparation { } }; } else { - // Here we assume that all segments should be attached by native - it = null; -// RouteSegment rt = ctx.loadRouteSegment(road.getPoint31XTile(pointInd), road.getPoint31YTile(pointInd), ctx.config.memoryLimitation); -// it = rt == null ? null : rt.getIterator(); + RouteSegment rt = ctx.loadRouteSegment(road.getPoint31XTile(pointInd), road.getPoint31YTile(pointInd), ctx.config.memoryLimitation); + it = rt == null ? null : rt.getIterator(); } // try to attach all segments except with current id while (it != null && it.hasNext()) { diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RoutingContext.java b/OsmAnd-java/src/main/java/net/osmand/router/RoutingContext.java index 5f548408e6..791faaec04 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RoutingContext.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RoutingContext.java @@ -326,7 +326,7 @@ public class RoutingContext { } else { long now = System.nanoTime(); - NativeRouteSearchResult ns = nativeLib.loadRouteRegion(ts.subregion, loadObjectsInMemory); + NativeRouteSearchResult ns = nativeLib.loadRouteRegion(ts.subregion, true); // System.out.println(ts.subregion.shiftToData + " " + Arrays.toString(ns.objects)); ts.setLoadedNative(ns, this); timeToLoad += (System.nanoTime() - now); @@ -654,8 +654,14 @@ public class RoutingContext { private RouteSegment loadRouteSegment(int x31, int y31, RoutingContext ctx, TLongObjectHashMap excludeDuplications, RouteSegment original, List subregions, int subregionIndex) { access++; - if (routes != null) { + if (routes != null || (searchResult != null && searchResult.objects != null)) { long l = (((long) x31) << 31) + (long) y31; + if (routes == null) { + RouteDataObject[] rdos = searchResult.objects; + for (int n = 0; n < rdos.length; n++) { + add(rdos[n]); + } + } RouteSegment segment = routes.get(l); while (segment != null) { RouteDataObject ro = segment.road;