Fix reverse route
This commit is contained in:
parent
c949f98329
commit
e60b99d2d4
1 changed files with 16 additions and 2 deletions
|
@ -32,8 +32,22 @@ public class ReversePointsCommand extends MeasurementModeCommand {
|
||||||
MeasurementEditingContext editingCtx = getEditingCtx();
|
MeasurementEditingContext editingCtx = getEditingCtx();
|
||||||
oldPoints = new ArrayList<>(editingCtx.getPoints());
|
oldPoints = new ArrayList<>(editingCtx.getPoints());
|
||||||
oldRoadSegmentData = editingCtx.getRoadSegmentData();
|
oldRoadSegmentData = editingCtx.getRoadSegmentData();
|
||||||
newPoints = new ArrayList<>(oldPoints);
|
newPoints = new ArrayList<>(oldPoints.size());
|
||||||
Collections.reverse(newPoints);
|
for (int i = oldPoints.size() - 1; i >= 0; i--) {
|
||||||
|
WptPt point = oldPoints.get(i);
|
||||||
|
WptPt prevPoint = i > 0 ? oldPoints.get(i - 1) : null;
|
||||||
|
WptPt newPoint = new WptPt(point);
|
||||||
|
newPoint.copyExtensions(point);
|
||||||
|
if (prevPoint != null) {
|
||||||
|
String profileType = prevPoint.getProfileType();
|
||||||
|
if (profileType != null) {
|
||||||
|
newPoint.setProfileType(profileType);
|
||||||
|
} else {
|
||||||
|
newPoint.removeProfileType();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newPoints.add(newPoint);
|
||||||
|
}
|
||||||
executeCommand();
|
executeCommand();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue