Merge pull request #9564 from osmandapp/fix_open_track

Fix plan a route open track
This commit is contained in:
Vitaliy 2020-08-03 16:53:17 +03:00 committed by GitHub
commit 7162ed430d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -236,14 +236,6 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
mainIcon = (ImageView) mainView.findViewById(R.id.main_icon);
final NewGpxData newGpxData = editingCtx.getNewGpxData();
if (newGpxData != null) {
List<WptPt> points = newGpxData.getGpxFile().getRoutePoints();
if (!points.isEmpty()) {
ApplicationMode snapToRoadAppMode = ApplicationMode
.valueOfStringKey(points.get(points.size() - 1).getProfileType(), null);
if (snapToRoadAppMode != null) {
enableSnapToRoadMode(snapToRoadAppMode);
}
}
ActionType actionType = newGpxData.getActionType();
if (actionType == ActionType.ADD_SEGMENT || actionType == ActionType.EDIT_SEGMENT) {
mainIcon.setImageDrawable(getActiveIcon(R.drawable.ic_action_polygom_dark));
@ -502,6 +494,14 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
showSnapToRoadControls();
if (newGpxData != null && !gpxPointsAdded) {
List<WptPt> points = newGpxData.getGpxFile().getRoutePoints();
if (!points.isEmpty()) {
ApplicationMode snapToRoadAppMode = ApplicationMode
.valueOfStringKey(points.get(points.size() - 1).getProfileType(), null);
if (snapToRoadAppMode != null) {
enableSnapToRoadMode(snapToRoadAppMode);
}
}
ActionType actionType = newGpxData.getActionType();
if (actionType == ActionType.ADD_ROUTE_POINTS) {
displayRoutePoints();
@ -820,7 +820,10 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
public void addNewGpxData(GPXFile gpxFile) {
QuadRect rect = gpxFile.getRect();
TrkSegment segment = getTrkSegment(gpxFile);
NewGpxData newGpxData = new NewGpxData(gpxFile, rect, ActionType.EDIT_SEGMENT, segment);
NewGpxData newGpxData = new NewGpxData(gpxFile, rect, segment == null
? ActionType.ADD_ROUTE_POINTS
: ActionType.EDIT_SEGMENT,
segment);
editingCtx.setNewGpxData(newGpxData);
initMeasurementMode(newGpxData);
QuadRect qr = newGpxData.getRect();