diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 5c90fb797e..09035696df 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -926,14 +926,14 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe return zoomDelta; } - public void navigateToPoint(LatLon point){ + public void navigateToPoint(LatLon point, boolean updateRoute){ if(point != null){ settings.setPointToNavigate(point.getLatitude(), point.getLongitude(), null); } else { settings.clearPointToNavigate(); } - if(routingHelper.isRouteBeingCalculated() || routingHelper.isRouteCalculated() || - routingHelper.isFollowingMode()) { + if(updateRoute && ( routingHelper.isRouteBeingCalculated() || routingHelper.isRouteCalculated() || + routingHelper.isFollowingMode())) { routingHelper.setFinalAndCurrentLocation(point, getLastKnownLocation(), routingHelper.getCurrentGPXRoute()); } mapLayers.getNavigationLayer().setPointToNavigate(point); diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index c1f1abfb36..01bbc7e175 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -747,10 +747,10 @@ public class MapActivityActions implements DialogProvider { intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); mapActivity.startActivity(intent); } else if (standardId == R.string.context_menu_item_navigate_point) { - mapActivity.navigateToPoint(new LatLon(latitude, longitude)); + mapActivity.navigateToPoint(new LatLon(latitude, longitude), true); } else if (standardId == R.string.context_menu_item_directions) { Location loc = mapActivity.getLastKnownLocation(); - mapActivity.navigateToPoint(new LatLon(latitude, longitude)); + mapActivity.navigateToPoint(new LatLon(latitude, longitude), false); // always enable and follow and let calculate it (GPS is not accessible in garage) getDirections(loc, true); } else if (standardId == R.string.context_menu_item_show_route) { @@ -917,18 +917,15 @@ public class MapActivityActions implements DialogProvider { } @Override public boolean onClick(MenuItem item) { - if (mapActivity.getMapLayers().getNavigationLayer().getPointToNavigate() != null) { - if (routingHelper.isRouteCalculated() || routingHelper.isFollowingMode() || routingHelper.isRouteBeingCalculated()) { - routingHelper.setFinalAndCurrentLocation(null, mapActivity.getLastKnownLocation(), routingHelper.getCurrentGPXRoute()); - // restore default mode - boolean changed = settings.APPLICATION_MODE.set(settings.PREV_APPLICATION_MODE.get()); - mapActivity.updateApplicationModeSettings(); - mapView.refreshMap(changed); - } else { - mapActivity.navigateToPoint(null); - } + if (routingHelper.isRouteCalculated() || routingHelper.isFollowingMode() || routingHelper.isRouteBeingCalculated()) { + routingHelper.setFinalAndCurrentLocation(null, mapActivity.getLastKnownLocation(), + routingHelper.getCurrentGPXRoute()); + // restore default mode + boolean changed = settings.APPLICATION_MODE.set(settings.PREV_APPLICATION_MODE.get()); + mapActivity.updateApplicationModeSettings(); + mapView.refreshMap(changed); } else { - mapActivity.navigateToPoint(new LatLon(mapView.getLatitude(), mapView.getLongitude())); + mapActivity.navigateToPoint(null, true); } mapView.refreshMap(); return true; diff --git a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java index d2a5a3b588..55fd56a61e 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java @@ -224,10 +224,8 @@ public class RoutingHelper { locationProjection.setLatitude(project.getLatitude()); locationProjection.setLongitude(project.getLongitude()); // we need to update bearing too - if (locationProjection.hasBearing()) { - float bearingTo = locationProjection.bearingTo(nextLocation); - locationProjection.setBearing(bearingTo); - } + float bearingTo = locationProjection.bearingTo(nextLocation); + locationProjection.setBearing(bearingTo); } } lastFixedLocation = currentLocation;