From 2e685f71829c804857f3d6803c18ee128f44bfe6 Mon Sep 17 00:00:00 2001 From: PaulStets Date: Thu, 18 Mar 2021 11:40:41 +0200 Subject: [PATCH] Sync gpx reverse with ios --- .../routepreparationmenu/RoutingOptionsHelper.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RoutingOptionsHelper.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RoutingOptionsHelper.java index 5f405c90b6..068d9ac4b7 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RoutingOptionsHelper.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RoutingOptionsHelper.java @@ -245,10 +245,16 @@ public class RoutingOptionsHelper { TargetPoint pointToStart = tg.getPointToStart(); TargetPoint pointToNavigate = tg.getPointToNavigate(); if (rp.getFile().hasRoute()) { - tg.clearStartPoint(false); - Location finishLoc = ps.get(ps.size() - 1); - tg.navigateToPoint(new LatLon(finishLoc.getLatitude(), finishLoc.getLongitude()), - false, -1, pointToNavigate != null ? pointToNavigate.getOriginalPointDescription() : null); + TargetPoint endPoint = selected ? pointToStart : null; + Location lastLoc = ps.get(ps.size() - 1); + Location firstLoc = ps.get(0); + LatLon firstLatLon = new LatLon(firstLoc.getLatitude(), firstLoc.getLongitude()); + LatLon endLocation = endPoint != null ? endPoint.point : new LatLon(lastLoc.getLatitude(), lastLoc.getLongitude()); + LatLon startLoc = selected ? firstLatLon : (pointToNavigate != null ? pointToNavigate.point : firstLatLon); + tg.navigateToPoint(endLocation, false, -1); + if (pointToStart != null) { + tg.setStartPoint(startLoc, false, null); + } tg.updateRouteAndRefresh(true); } else { Location first = ps.get(0);