Get selectedGpxFile for route points
This commit is contained in:
parent
fba0b42119
commit
1ededaec5a
4 changed files with 17 additions and 3 deletions
|
@ -1255,6 +1255,10 @@ public class GPXUtilities {
|
|||
return g;
|
||||
}
|
||||
|
||||
public boolean containsRoutePoint(WptPt point) {
|
||||
return getRoutePoints().contains(point);
|
||||
}
|
||||
|
||||
public List<WptPt> getRoutePoints() {
|
||||
List<WptPt> points = new ArrayList<>();
|
||||
for (int i = 0; i < routes.size(); i++) {
|
||||
|
|
|
@ -209,9 +209,10 @@ public class GpxSelectionHelper {
|
|||
}
|
||||
|
||||
public SelectedGpxFile getSelectedGPXFile(WptPt point) {
|
||||
for (SelectedGpxFile g : selectedGPXFiles) {
|
||||
if (g.getGpxFile().containsPoint(point)) {
|
||||
return g;
|
||||
for (SelectedGpxFile selectedGpxFile : selectedGPXFiles) {
|
||||
GPXFile gpxFile = selectedGpxFile.getGpxFile();
|
||||
if (gpxFile.containsPoint(point) || gpxFile.containsRoutePoint(point)) {
|
||||
return selectedGpxFile;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -110,6 +110,7 @@ import static net.osmand.plus.track.OptionsCard.SHOW_ON_MAP_BUTTON_INDEX;
|
|||
import static net.osmand.plus.track.OptionsCard.UPLOAD_OSM_BUTTON_INDEX;
|
||||
import static net.osmand.plus.track.TrackPointsCard.ADD_WAYPOINT_INDEX;
|
||||
import static net.osmand.plus.track.TrackPointsCard.DELETE_WAYPOINTS_INDEX;
|
||||
import static net.osmand.plus.track.TrackPointsCard.OPEN_WAYPOINT_INDEX;
|
||||
|
||||
public class TrackMenuFragment extends ContextMenuScrollFragment implements CardListener,
|
||||
SegmentActionsListener, RenameCallback, OnTrackFileMoveListener, OnPointsDeleteListener,
|
||||
|
@ -823,6 +824,8 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
|||
} else {
|
||||
pointsCard.setSelectionMode(true);
|
||||
}
|
||||
} else if (buttonIndex == OPEN_WAYPOINT_INDEX) {
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ public class TrackPointsCard extends BaseCard implements OnChildClickListener, O
|
|||
|
||||
public static final int ADD_WAYPOINT_INDEX = 0;
|
||||
public static final int DELETE_WAYPOINTS_INDEX = 1;
|
||||
public static final int OPEN_WAYPOINT_INDEX = 2;
|
||||
|
||||
private final TrackDisplayHelper displayHelper;
|
||||
private final GpxDisplayItemType[] filterTypes = new GpxDisplayItemType[] {GpxDisplayItemType.TRACK_POINTS, GpxDisplayItemType.TRACK_ROUTE_POINTS};
|
||||
|
@ -177,6 +178,11 @@ public class TrackPointsCard extends BaseCard implements OnChildClickListener, O
|
|||
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
|
||||
GpxDisplayItem item = adapter.getChild(groupPosition, childPosition);
|
||||
if (item != null && item.locationStart != null) {
|
||||
CardListener cardListener = getListener();
|
||||
if (cardListener != null) {
|
||||
cardListener.onCardButtonPressed(this, OPEN_WAYPOINT_INDEX);
|
||||
}
|
||||
|
||||
LatLon location = new LatLon(item.locationStart.lat, item.locationStart.lon);
|
||||
PointDescription description = new PointDescription(PointDescription.POINT_TYPE_WPT, item.name);
|
||||
mapActivity.getContextMenu().show(location, description, item.locationStart);
|
||||
|
|
Loading…
Reference in a new issue