diff --git a/OsmAnd/src/net/osmand/plus/views/layers/RouteLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/RouteLayer.java index f2f1ba24b5..e74b0242ce 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/RouteLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/RouteLayer.java @@ -141,6 +141,8 @@ public class RouteLayer extends OsmandMapLayer implements IContextMenuProvider { attrs.defaultWidth = (int) (12 * density); attrs.defaultWidth3 = (int) (7 * density); attrs.defaultColor = view.getResources().getColor(R.color.nav_track); + attrs.shadowPaint.setColor(0x80000000); + attrs.shadowPaint.setStrokeCap(Cap.ROUND); attrs.paint3.setStrokeCap(Cap.BUTT); attrs.paint3.setColor(Color.WHITE); attrs.paint2.setStrokeCap(Cap.BUTT); diff --git a/OsmAnd/src/net/osmand/plus/views/layers/geometry/GeometryWay.java b/OsmAnd/src/net/osmand/plus/views/layers/geometry/GeometryWay.java index 7e9a511286..2cfb950200 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/geometry/GeometryWay.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/geometry/GeometryWay.java @@ -168,7 +168,7 @@ public abstract class GeometryWay> styleMap, int locationIdx) { + return simplification.getQuick(locationIdx) == 0 && !styleMap.containsKey(locationIdx); + } + protected boolean shouldAddLocation(TByteArrayList simplification, double leftLon, double rightLon, double bottomLat, double topLat, GeometryWayProvider provider, int currLocationIdx) { double lat = provider.getLatitude(currLocationIdx); @@ -358,7 +362,18 @@ public abstract class GeometryWay>> paths = new ArrayList<>(); canvas.rotate(-tb.getRotate(), tb.getCenterPixelX(), tb.getCenterPixelY()); calculatePath(tb, tx, ty, styles, paths); - for (Pair> pc : paths) { + + drawer.drawFullBorder(canvas, tb.getZoom(), paths); + drawer.drawSegmentBorder(canvas, tb.getZoom(), paths.get(0).first, paths.get(0).second); + for (int i = 1; i <= paths.size(); i++) { + if (i != paths.size()) { + Pair> prev = paths.get(i); + if (prev.second.hasPathLine()) { + drawer.drawSegmentBorder(canvas, tb.getZoom(), prev.first, prev.second); + } + } + + Pair> pc = paths.get(i - 1); GeometryWayStyle style = pc.second; if (style.hasPathLine()) { drawer.drawPath(canvas, pc.first, style); diff --git a/OsmAnd/src/net/osmand/plus/views/layers/geometry/GeometryWayDrawer.java b/OsmAnd/src/net/osmand/plus/views/layers/geometry/GeometryWayDrawer.java index 494375d404..2b607563e5 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/geometry/GeometryWayDrawer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/geometry/GeometryWayDrawer.java @@ -7,6 +7,7 @@ import android.graphics.Paint; import android.graphics.Path; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; +import android.util.Pair; import net.osmand.data.RotatedTileBox; @@ -89,6 +90,12 @@ public class GeometryWayDrawer { } } + protected void drawFullBorder(Canvas canvas, int zoom, List>> paths) { + } + + protected void drawSegmentBorder(Canvas canvas, int zoom, Path path, GeometryWayStyle style) { + } + protected PathPoint getArrowPathPoint(float iconx, float icony, GeometryWayStyle style, double angle) { return new PathPoint(iconx, icony, angle, style); } diff --git a/OsmAnd/src/net/osmand/plus/views/layers/geometry/RouteGeometryWay.java b/OsmAnd/src/net/osmand/plus/views/layers/geometry/RouteGeometryWay.java index bbac19c8fe..d78653b93a 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/geometry/RouteGeometryWay.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/geometry/RouteGeometryWay.java @@ -36,7 +36,7 @@ public class RouteGeometryWay extends GeometryWay> styleMap, int locationIdx) { + return scaleType == null ? + super.shouldSkipLocation(simplification, styleMap, locationIdx) : + simplification.getQuick(locationIdx) == 0; + } + @Override protected void addLocation(RotatedTileBox tb, int locationIdx, GeometryWayStyle style, List tx, List ty, List angles, List distances, double dist, List> styles) { super.addLocation(tb, getLocationProvider().getLatitude(locationIdx), diff --git a/OsmAnd/src/net/osmand/plus/views/layers/geometry/RouteGeometryWayDrawer.java b/OsmAnd/src/net/osmand/plus/views/layers/geometry/RouteGeometryWayDrawer.java index 8c1d9a8868..060370e546 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/geometry/RouteGeometryWayDrawer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/geometry/RouteGeometryWayDrawer.java @@ -5,14 +5,36 @@ import android.graphics.LinearGradient; import android.graphics.Paint; import android.graphics.Path; import android.graphics.Shader; +import android.util.Pair; +import net.osmand.plus.views.MapTileLayer; import net.osmand.plus.views.layers.geometry.RouteGeometryWay.GeometryGradientWayStyle; +import java.util.List; + public class RouteGeometryWayDrawer extends GeometryWayDrawer { + private final int BORDER_TYPE_ZOOM_THRESHOLD = MapTileLayer.DEFAULT_MIN_ZOOM; - public RouteGeometryWayDrawer(RouteGeometryWayContext context) { + private final boolean drawBorder; + + public RouteGeometryWayDrawer(RouteGeometryWayContext context, boolean drawBorder) { super(context); + this.drawBorder = drawBorder; + } + + @Override + protected void drawFullBorder(Canvas canvas, int zoom, List>> paths) { + if (drawBorder && zoom > BORDER_TYPE_ZOOM_THRESHOLD) { + Paint borderPaint = getContext().getAttrs().shadowPaint; + Path fullPath = new Path(); + for (Pair> path : paths) { + if (path.second instanceof GeometryGradientWayStyle) { + fullPath.addPath(path.first); + } + } + canvas.drawPath(fullPath, borderPaint); + } } @Override @@ -26,4 +48,11 @@ public class RouteGeometryWayDrawer extends GeometryWayDrawer style) { + if (drawBorder && zoom < BORDER_TYPE_ZOOM_THRESHOLD) { + canvas.drawPath(path, getContext().getAttrs().shadowPaint); + } + } } \ No newline at end of file