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,12 +117,7 @@ public class MapMultiSelectionMenu extends BaseMenuController {
pointDescription = contextObject.getObjectName(selectedObj);
}
if (ll == null) {
if (selectedObj instanceof Amenity) {
Amenity a = ((Amenity) selectedObj);
ll = a.getLocation();
} else {
ll = latLon;
}
}
if (pointDescription == null) {
pointDescription = new PointDescription(latLon.getLatitude(), latLon.getLongitude());

View file

@ -654,12 +654,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
pointDescription = provider.getObjectName(selectedObj);
}
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) {
String title = pointDescription == null ? "" : pointDescription.getName();

View file

@ -92,6 +92,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
private TIntArrayList tx = new TIntArrayList();
private TIntArrayList ty = new TIntArrayList();
private List<Amenity> amenities = new ArrayList<>();
private Path linePath = new Path();
private LatLon fingerLocation;
@ -512,6 +513,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
@Override
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()) {
return;
}
@ -535,7 +537,12 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
continue;
}
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) {
if (o instanceof MapMarker) {
return ((MapMarker) o).point;
} else if (o instanceof Amenity) {
Amenity amenity = (Amenity) o;
if (amenities.contains(amenity)) {
return amenity.getLocation();
}
}
return null;
}