Change line style for plan route

This commit is contained in:
Alexander Sytnyk 2017-10-10 13:31:28 +03:00
parent 6ed43e7fc1
commit bb52aaaf33
2 changed files with 12 additions and 11 deletions

View file

@ -354,6 +354,10 @@ public class PlanRouteFragment extends Fragment {
@Override
public void onApplicationModeItemClick(ApplicationMode mode) {
if (planRouteContext.getSnappedMode() != mode) {
MapMarkersLayer layer = getMapMarkersLayer();
if (layer != null) {
layer.setDefaultAppMode(mode == ApplicationMode.DEFAULT);
}
planRouteContext.getSnappedToRoadPoints().clear();
planRouteContext.setSnappedMode(mode);
planRouteContext.recreateSnapTrkSegment();

View file

@ -71,7 +71,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
private final RenderingLineAttributes lineAttrs = new RenderingLineAttributes("measureDistanceLine");
private final RenderingLineAttributes textAttrs = new RenderingLineAttributes("rulerLineFont");
private Paint paint;
private final RenderingLineAttributes planRouteAttrs = new RenderingLineAttributes("markerPlanRouteline");
private TrkSegment route;
private TIntArrayList tx = new TIntArrayList();
@ -81,6 +81,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
private ContextMenuLayer contextMenuLayer;
private boolean inPlanRouteMode;
private boolean defaultAppMode = true;
public MapMarkersLayer(MapActivity map) {
this.map = map;
@ -98,6 +99,10 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
this.inPlanRouteMode = inPlanRouteMode;
}
public void setDefaultAppMode(boolean defaultAppMode) {
this.defaultAppMode = defaultAppMode;
}
private void initUI() {
bitmapPaint = new Paint();
bitmapPaint.setDither(true);
@ -120,15 +125,6 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
bitmapPaintDestTeal = createPaintDest(R.color.marker_teal);
bitmapPaintDestPurple = createPaintDest(R.color.marker_purple);
paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(7 * view.getDensity());
paint.setAntiAlias(true);
paint.setStrokeCap(Paint.Cap.ROUND);
paint.setStrokeJoin(Paint.Join.ROUND);
paint.setColor(ContextCompat.getColor(map, R.color.marker_red));
paint.setAlpha(200);
float textSize = TEXT_SIZE * map.getResources().getDisplayMetrics().density;
textAttrs.paint.setTextSize(textSize);
textAttrs.paint2.setTextSize(textSize);
@ -207,9 +203,10 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
List<MapMarker> activeMapMarkers = markersHelper.getMapMarkers();
if (route != null && route.points.size() > 0) {
planRouteAttrs.updatePaints(view, nightMode, tileBox);
route.renders.clear();
route.renders.add(new Renderable.StandardTrack(new ArrayList<>(route.points), 17.2));
route.drawRenderers(view.getZoom(), paint, canvas, tileBox);
route.drawRenderers(view.getZoom(), defaultAppMode ? planRouteAttrs.paint : planRouteAttrs.paint2, canvas, tileBox);
}
if (map.getMyApplication().getSettings().SHOW_LINES_TO_FIRST_MARKERS.get() && myLoc != null) {