From 06ccfd281be40c8ec8e6df6fd741088659e4fd70 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Sat, 27 Feb 2016 09:33:28 +0300 Subject: [PATCH] Hide map marker ovelapped by waypoint --- .../src/net/osmand/plus/views/MapMarkersLayer.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java index 7a1253595b..af41f07410 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java @@ -22,6 +22,7 @@ import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.OsmAndConstants; import net.osmand.plus.R; +import net.osmand.plus.TargetPointsHelper.TargetPoint; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.views.ContextMenuLayer.IContextMenuProvider; import net.osmand.plus.views.ContextMenuLayer.IContextMenuProviderSelection; @@ -250,7 +251,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi List activeMapMarkers = markersHelper.getActiveMapMarkers(); for (int i = 0; i < activeMapMarkers.size(); i++) { MapMarker marker = activeMapMarkers.get(i); - if (isLocationVisible(tb, marker)) { + if (isLocationVisible(tb, marker) && !overlappedByWaypoint(marker)) { Bitmap bmp = getMapMarkerBitmap(marker.colorIndex); int marginX = bmp.getWidth() / 6; int marginY = bmp.getHeight(); @@ -304,6 +305,16 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi return tx >= 0 && tx <= tb.getPixWidth() && ty >= widgetHeight && ty <= tb.getPixHeight(); } + public boolean overlappedByWaypoint(MapMarker marker) { + List targetPoints = map.getMyApplication().getTargetPointsHelper().getAllPoints(); + for (TargetPoint t : targetPoints) { + if (t.point.equals(marker.point)) { + return true; + } + } + return false; + } + @Override public void destroyLayer() { }