Merge pull request #7900 from osmandapp/ShowAlongTheRouteFix

Show Along The Route POI icons size Fix
This commit is contained in:
max-klaus 2019-11-11 17:54:00 +03:00 committed by GitHub
commit 6e801c232e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View file

@ -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<LocationPointWrapper> 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()) {

View file

@ -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<QuadRect> 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()));