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;
|
return g;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean containsRoutePoint(WptPt point) {
|
||||||
|
return getRoutePoints().contains(point);
|
||||||
|
}
|
||||||
|
|
||||||
public List<WptPt> getRoutePoints() {
|
public List<WptPt> getRoutePoints() {
|
||||||
List<WptPt> points = new ArrayList<>();
|
List<WptPt> points = new ArrayList<>();
|
||||||
for (int i = 0; i < routes.size(); i++) {
|
for (int i = 0; i < routes.size(); i++) {
|
||||||
|
|
|
@ -209,9 +209,10 @@ public class GpxSelectionHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public SelectedGpxFile getSelectedGPXFile(WptPt point) {
|
public SelectedGpxFile getSelectedGPXFile(WptPt point) {
|
||||||
for (SelectedGpxFile g : selectedGPXFiles) {
|
for (SelectedGpxFile selectedGpxFile : selectedGPXFiles) {
|
||||||
if (g.getGpxFile().containsPoint(point)) {
|
GPXFile gpxFile = selectedGpxFile.getGpxFile();
|
||||||
return g;
|
if (gpxFile.containsPoint(point) || gpxFile.containsRoutePoint(point)) {
|
||||||
|
return selectedGpxFile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
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.OptionsCard.UPLOAD_OSM_BUTTON_INDEX;
|
||||||
import static net.osmand.plus.track.TrackPointsCard.ADD_WAYPOINT_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.DELETE_WAYPOINTS_INDEX;
|
||||||
|
import static net.osmand.plus.track.TrackPointsCard.OPEN_WAYPOINT_INDEX;
|
||||||
|
|
||||||
public class TrackMenuFragment extends ContextMenuScrollFragment implements CardListener,
|
public class TrackMenuFragment extends ContextMenuScrollFragment implements CardListener,
|
||||||
SegmentActionsListener, RenameCallback, OnTrackFileMoveListener, OnPointsDeleteListener,
|
SegmentActionsListener, RenameCallback, OnTrackFileMoveListener, OnPointsDeleteListener,
|
||||||
|
@ -823,6 +824,8 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
} else {
|
} else {
|
||||||
pointsCard.setSelectionMode(true);
|
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 ADD_WAYPOINT_INDEX = 0;
|
||||||
public static final int DELETE_WAYPOINTS_INDEX = 1;
|
public static final int DELETE_WAYPOINTS_INDEX = 1;
|
||||||
|
public static final int OPEN_WAYPOINT_INDEX = 2;
|
||||||
|
|
||||||
private final TrackDisplayHelper displayHelper;
|
private final TrackDisplayHelper displayHelper;
|
||||||
private final GpxDisplayItemType[] filterTypes = new GpxDisplayItemType[] {GpxDisplayItemType.TRACK_POINTS, GpxDisplayItemType.TRACK_ROUTE_POINTS};
|
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) {
|
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
|
||||||
GpxDisplayItem item = adapter.getChild(groupPosition, childPosition);
|
GpxDisplayItem item = adapter.getChild(groupPosition, childPosition);
|
||||||
if (item != null && item.locationStart != null) {
|
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);
|
LatLon location = new LatLon(item.locationStart.lat, item.locationStart.lon);
|
||||||
PointDescription description = new PointDescription(PointDescription.POINT_TYPE_WPT, item.name);
|
PointDescription description = new PointDescription(PointDescription.POINT_TYPE_WPT, item.name);
|
||||||
mapActivity.getContextMenu().show(location, description, item.locationStart);
|
mapActivity.getContextMenu().show(location, description, item.locationStart);
|
||||||
|
|
Loading…
Reference in a new issue