added list for found amenities in collectObjectsFromPoint

This commit is contained in:
Chumva 2018-03-12 12:28:23 +02:00
parent 92500c00fa
commit a6ad3977e5
3 changed files with 14 additions and 12 deletions

View file

@ -117,13 +117,8 @@ public class MapMultiSelectionMenu extends BaseMenuController {
pointDescription = contextObject.getObjectName(selectedObj); pointDescription = contextObject.getObjectName(selectedObj);
} }
if (ll == null) { if (ll == null) {
if (selectedObj instanceof Amenity) {
Amenity a = ((Amenity) selectedObj);
ll = a.getLocation();
} else {
ll = latLon; ll = latLon;
} }
}
if (pointDescription == null) { if (pointDescription == null) {
pointDescription = new PointDescription(latLon.getLatitude(), latLon.getLongitude()); pointDescription = new PointDescription(latLon.getLatitude(), latLon.getLongitude());
} }

View file

@ -654,13 +654,8 @@ public class ContextMenuLayer extends OsmandMapLayer {
pointDescription = provider.getObjectName(selectedObj); pointDescription = provider.getObjectName(selectedObj);
} }
if (latLon == null) { if (latLon == null) {
if (selectedObj instanceof Amenity) {
Amenity a = ((Amenity) selectedObj);
latLon = a.getLocation();
} else {
latLon = getLatLon(point, tileBox); latLon = getLatLon(point, tileBox);
} }
}
if (mInAddGpxPointMode) { if (mInAddGpxPointMode) {
String title = pointDescription == null ? "" : pointDescription.getName(); String title = pointDescription == null ? "" : pointDescription.getName();
mAddGpxPointBottomSheetHelper.setTitle(title); mAddGpxPointBottomSheetHelper.setTitle(title);

View file

@ -92,6 +92,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
private TIntArrayList tx = new TIntArrayList(); private TIntArrayList tx = new TIntArrayList();
private TIntArrayList ty = new TIntArrayList(); private TIntArrayList ty = new TIntArrayList();
private List<Amenity> amenities = new ArrayList<>();
private Path linePath = new Path(); private Path linePath = new Path();
private LatLon fingerLocation; private LatLon fingerLocation;
@ -512,6 +513,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
@Override @Override
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) { public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) {
amenities.clear();
if (tileBox.getZoom() < 3 || !map.getMyApplication().getSettings().USE_MAP_MARKERS.get()) { if (tileBox.getZoom() < 3 || !map.getMyApplication().getSettings().USE_MAP_MARKERS.get()) {
return; return;
} }
@ -535,7 +537,12 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
continue; continue;
} }
Amenity mapObj = getMapObjectByMarker(marker); Amenity mapObj = getMapObjectByMarker(marker);
o.add(mapObj == null ? marker : mapObj); if (mapObj != null) {
amenities.add(mapObj);
o.add(mapObj);
} else {
o.add(marker);
}
} }
} }
} }
@ -568,6 +575,11 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
public LatLon getObjectLocation(Object o) { public LatLon getObjectLocation(Object o) {
if (o instanceof MapMarker) { if (o instanceof MapMarker) {
return ((MapMarker) o).point; return ((MapMarker) o).point;
} else if (o instanceof Amenity) {
Amenity amenity = (Amenity) o;
if (amenities.contains(amenity)) {
return amenity.getLocation();
}
} }
return null; return null;
} }