From c638e01dfd6658774c5df7d316587a02d9b6429b Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 4 Jun 2020 18:37:49 +0200 Subject: [PATCH] Fix route calculation --- .../main/java/net/osmand/router/RouteResultPreparation.java | 5 +++-- .../src/main/java/net/osmand/router/RouteSegmentResult.java | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) 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 8849f122ec..9628dff602 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java @@ -1,5 +1,6 @@ package net.osmand.router; +import net.osmand.NativeLibrary; import net.osmand.PlatformUtil; import net.osmand.binary.BinaryMapIndexReader; import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule; @@ -1721,7 +1722,7 @@ public class RouteResultPreparation { } } Iterator it; - if(rr.getPreAttachedRoutes(pointInd) != null) { + if (rr.getPreAttachedRoutes(pointInd) != null) { final RouteSegmentResult[] list = rr.getPreAttachedRoutes(pointInd); it = new Iterator() { int i = 0; @@ -1740,7 +1741,7 @@ public class RouteResultPreparation { public void remove() { } }; - } else if (recalculation) { + } else if (recalculation || ctx.nativeLib == null) { RouteSegment rt = ctx.loadRouteSegment(road.getPoint31XTile(pointInd), road.getPoint31YTile(pointInd), ctx.config.memoryLimitation); it = rt == null ? null : rt.getIterator(); } else { diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RouteSegmentResult.java b/OsmAnd-java/src/main/java/net/osmand/router/RouteSegmentResult.java index cd8f0466f5..9b8e72435e 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RouteSegmentResult.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RouteSegmentResult.java @@ -403,7 +403,7 @@ public class RouteSegmentResult implements StringExternalizable } public void copyPreattachedRoutes(RouteSegmentResult toCopy, int shift) { - if(toCopy.preAttachedRoutes != null) { + if (toCopy.preAttachedRoutes != null) { int l = toCopy.preAttachedRoutes.length - shift; preAttachedRoutes = new RouteSegmentResult[l][]; System.arraycopy(toCopy.preAttachedRoutes, shift, preAttachedRoutes, 0, l); @@ -412,7 +412,7 @@ public class RouteSegmentResult implements StringExternalizable public RouteSegmentResult[] getPreAttachedRoutes(int routeInd) { int st = Math.abs(routeInd - startPointIndex); - if(preAttachedRoutes != null && st < preAttachedRoutes.length) { + if (preAttachedRoutes != null && st < preAttachedRoutes.length) { return preAttachedRoutes[st]; } return null; @@ -421,7 +421,7 @@ public class RouteSegmentResult implements StringExternalizable public List getAttachedRoutes(int routeInd) { int st = Math.abs(routeInd - startPointIndex); List list = attachedRoutes[st]; - if(list == null) { + if (list == null) { return Collections.emptyList(); } return list;