From bb52aaaf33937a89592b679debf6bf220dd0f34a Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Tue, 10 Oct 2017 13:31:28 +0300 Subject: [PATCH] Change line style for plan route --- .../plus/mapmarkers/PlanRouteFragment.java | 4 ++++ .../osmand/plus/views/MapMarkersLayer.java | 19 ++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index 0cb5412410..ae1748118a 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -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(); diff --git a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java index 5afa424311..4b8de11729 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java @@ -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 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) {