Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2016-01-14 18:11:39 +01:00
commit 0f8d141acd
3 changed files with 35 additions and 2 deletions

View file

@ -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();
}

View file

@ -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;
}
});

View file

@ -30,6 +30,7 @@ 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<TargetPoint> it = targetPoints.getIntermediatePoints().iterator();
if(it.hasNext()) {
pointToNavigate = it.next();