diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index 9c19de02c2..fff8f9fa48 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -760,6 +760,7 @@ public class MapActivityActions implements DialogProvider { routingHelper.setRoutePlanningMode(false); settings.LAST_ROUTING_APPLICATION_MODE = settings.APPLICATION_MODE.get(); settings.APPLICATION_MODE.set(settings.DEFAULT_APPLICATION_MODE.get()); + getMyApplication().getTargetPointsHelper().clearStartPoint(false); mapActivity.updateApplicationModeSettings(); mapActivity.getDashboard().clearDeletedPoints(); } diff --git a/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java b/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java index 30aec6ce18..b46772ebe0 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java @@ -390,6 +390,21 @@ public class WaypointDialogHelper { @Override public boolean onMenuItemClick(MenuItem item) { // switch start & finish + TargetPointsHelper targetPointsHelper = app.getTargetPointsHelper(); + TargetPoint start = targetPointsHelper.getPointToStart(); + TargetPoint finish = targetPointsHelper.getPointToNavigate(); + targetPointsHelper.setStartPoint(new LatLon(finish.getLatitude(), + finish.getLongitude()), false, finish.getPointDescription(ctx)); + if (start == null) { + Location loc = app.getLocationProvider().getLastKnownLocation(); + if (loc != null) { + targetPointsHelper.navigateToPoint(new LatLon(loc.getLatitude(), + loc.getLongitude()), true, -1); + } + } else { + targetPointsHelper.navigateToPoint(new LatLon(start.getLatitude(), + start.getLongitude()), true, -1, start.getPointDescription(ctx)); + } return true; } }); diff --git a/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java b/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java index 505c59476d..b5ba9a46a6 100644 --- a/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java @@ -29,7 +29,8 @@ public class PointNavigationLayer extends OsmandMapLayer implements IContextMenu private OsmandMapTileView view; private float[] calculations = new float[2]; - + + private Bitmap startPoint; private Bitmap targetPoint; private Bitmap intermediatePoint; private Bitmap arrowToDestination; @@ -59,6 +60,7 @@ public class PointNavigationLayer extends OsmandMapLayer implements IContextMenu textPaint.setTextSize(sp * 18); textPaint.setTextAlign(Align.CENTER); textPaint.setAntiAlias(true); + startPoint = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_intermediate_point); targetPoint = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_target_point); intermediatePoint = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_intermediate_point); arrowToDestination = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_arrow_to_destination); @@ -79,8 +81,21 @@ public class PointNavigationLayer extends OsmandMapLayer implements IContextMenu if(tb.getZoom() < 3) { return; } - int index = 0; + TargetPointsHelper targetPoints = map.getMyApplication().getTargetPointsHelper(); + TargetPoint pointToStart = targetPoints.getPointToStart(); + if (pointToStart != null) { + if (isLocationVisible(tb, pointToStart)) { + int marginX = startPoint.getWidth() / 6; + int marginY = startPoint.getHeight(); + int locationX = tb.getPixXFromLonNoRot(pointToStart.getLongitude()); + int locationY = tb.getPixYFromLatNoRot(pointToStart.getLatitude()); + canvas.rotate(-tb.getRotate(), locationX, locationY); + canvas.drawBitmap(startPoint, locationX - marginX, locationY - marginY, bitmapPaint); + } + } + + int index = 0; for (TargetPoint ip : targetPoints.getIntermediatePoints()) { index ++; if (isLocationVisible(tb, ip)) { @@ -95,6 +110,7 @@ public class PointNavigationLayer extends OsmandMapLayer implements IContextMenu canvas.rotate(tb.getRotate(), locationX, locationY); } } + TargetPoint pointToNavigate = targetPoints.getPointToNavigate(); if (isLocationVisible(tb, pointToNavigate)) { int marginX = targetPoint.getWidth() / 6; @@ -104,6 +120,7 @@ public class PointNavigationLayer extends OsmandMapLayer implements IContextMenu canvas.rotate(-tb.getRotate(), locationX, locationY); canvas.drawBitmap(targetPoint, locationX - marginX, locationY - marginY, bitmapPaint); } + Iterator it = targetPoints.getIntermediatePoints().iterator(); if(it.hasNext()) { pointToNavigate = it.next();