diff --git a/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java b/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java index 4c7f980e07..a1b17b5b0b 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java @@ -110,6 +110,20 @@ public class WaypointHelper { public boolean isPointPassed(LocationPointWrapper point) { return route.isPointPassed(point.routeIndex); } + + public boolean isAmenityNoPassed(Amenity a) { + if (a != null) { + List points = locationPoints.get(POI); + for (LocationPointWrapper point : points) { + if (point.point instanceof AmenityLocationPoint) { + if (a.equals(((AmenityLocationPoint) point.point).a)) { + return !isPointPassed(point); + } + } + } + } + return false; + } public void removeVisibleLocationPoint(LocationPointWrapper lp) { if (lp.type < locationPoints.size()) { diff --git a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java index 9f874881b8..723e683f13 100644 --- a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java @@ -36,6 +36,7 @@ import net.osmand.osm.PoiType; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.helpers.WaypointHelper; import net.osmand.plus.poi.PoiUIFilter; import net.osmand.plus.render.RenderingIcons; import net.osmand.plus.routing.IRouteInformationListener; @@ -222,6 +223,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon if (objects != null) { float iconSize = poiBackground.getWidth() * 3 / 2; QuadTree boundIntersections = initBoundIntersections(tileBox); + WaypointHelper wph = app.getWaypointHelper(); for (Amenity o : objects) { float x = tileBox.getPixXFromLatLon(o.getLocation().getLatitude(), o.getLocation() @@ -230,7 +232,8 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon .getLongitude()); if (tileBox.containsPoint(x, y, iconSize)) { - if (intersects(boundIntersections, x, y, iconSize, iconSize)) { + if (intersects(boundIntersections, x, y, iconSize, iconSize) || + (app.getSettings().SHOW_NEARBY_POI.get() && wph.isRouteCalculated() && !wph.isAmenityNoPassed(o))) { canvas.drawBitmap(poiBackgroundSmall, x - poiBackgroundSmall.getWidth() / 2, y - poiBackgroundSmall.getHeight() / 2, paintIconBackground); smallObjectsLatLon.add(new LatLon(o.getLocation().getLatitude(), o.getLocation().getLongitude()));