use of net.osmand.data.FavouritePoint.BackgroundType in project Osmand by osmandapp.
the class ContextMenuLayer method selectObjectsForContextMenu.
@NonNull
private Map<Object, IContextMenuProvider> selectObjectsForContextMenu(RotatedTileBox tileBox, PointF point, boolean acquireObjLatLon, boolean unknownLocation) {
Map<LatLon, BackgroundType> pressedLatLonFull = new HashMap<>();
Map<LatLon, BackgroundType> pressedLatLonSmall = new HashMap<>();
Map<Object, IContextMenuProvider> selectedObjects = new HashMap<>();
List<Object> s = new ArrayList<>();
for (OsmandMapLayer lt : view.getLayers()) {
if (lt instanceof IContextMenuProvider) {
s.clear();
final IContextMenuProvider l = (IContextMenuProvider) lt;
l.collectObjectsFromPoint(point, tileBox, s, unknownLocation);
for (Object o : s) {
selectedObjects.put(o, l);
if (acquireObjLatLon && l.isObjectClickable(o)) {
LatLon latLon = l.getObjectLocation(o);
BackgroundType backgroundType = DEFAULT_BACKGROUND_TYPE;
if (o instanceof OsmBugsLayer.OpenStreetNote) {
backgroundType = BackgroundType.COMMENT;
}
if (o instanceof FavouritePoint) {
backgroundType = ((FavouritePoint) o).getBackgroundType();
}
if (o instanceof GPXUtilities.WptPt) {
backgroundType = BackgroundType.getByTypeName(((GPXUtilities.WptPt) o).getBackgroundType(), DEFAULT_BACKGROUND_TYPE);
}
if (lt.isPresentInFullObjects(latLon) && !pressedLatLonFull.containsKey(latLon)) {
pressedLatLonFull.put(latLon, backgroundType);
} else if (lt.isPresentInSmallObjects(latLon) && !pressedLatLonSmall.containsKey(latLon)) {
pressedLatLonSmall.put(latLon, backgroundType);
}
}
}
}
}
if (acquireObjLatLon) {
this.pressedLatLonFull = pressedLatLonFull;
this.pressedLatLonSmall = pressedLatLonSmall;
}
return selectedObjects;
}
Aggregations