Fix waypoints swapping and deleting
This commit is contained in:
parent
95f1f77e9c
commit
c999ffd542
1 changed files with 20 additions and 6 deletions
|
@ -1487,13 +1487,18 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
public void run() {
|
public void run() {
|
||||||
if (visibleType == DashboardType.WAYPOINTS || visibleType == DashboardType.WAYPOINTS_FLAT) {
|
if (visibleType == DashboardType.WAYPOINTS || visibleType == DashboardType.WAYPOINTS_FLAT) {
|
||||||
List<TargetPoint> allTargets = new ArrayList<>();
|
List<TargetPoint> allTargets = new ArrayList<>();
|
||||||
|
TargetPoint start = null;
|
||||||
if (items != null) {
|
if (items != null) {
|
||||||
for (Object obj : items) {
|
for (Object obj : items) {
|
||||||
if (obj instanceof LocationPointWrapper) {
|
if (obj instanceof LocationPointWrapper) {
|
||||||
LocationPointWrapper p = (LocationPointWrapper) obj;
|
LocationPointWrapper p = (LocationPointWrapper) obj;
|
||||||
if (p.getPoint() instanceof TargetPoint) {
|
if (p.getPoint() instanceof TargetPoint) {
|
||||||
TargetPoint t = (TargetPoint) p.getPoint();
|
TargetPoint t = (TargetPoint) p.getPoint();
|
||||||
t.intermediate = true;
|
if (t.start) {
|
||||||
|
start = t;
|
||||||
|
} else {
|
||||||
|
t.intermediate = true;
|
||||||
|
}
|
||||||
allTargets.add(t);
|
allTargets.add(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1503,15 +1508,24 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TargetPointsHelper targetPointsHelper = getMyApplication().getTargetPointsHelper();
|
TargetPointsHelper targetPointsHelper = getMyApplication().getTargetPointsHelper();
|
||||||
if (allTargets.size() > 0) {
|
if (start != null) {
|
||||||
TargetPoint start = allTargets.remove(0);
|
int startInd = allTargets.indexOf(start);
|
||||||
targetPointsHelper.setStartPoint(new LatLon(start.getLatitude(), start.getLongitude()),
|
TargetPoint first = allTargets.remove(0);
|
||||||
false, start.getPointDescription(getMyApplication()));
|
if (startInd != 0) {
|
||||||
|
start.start = false;
|
||||||
|
start.intermediate = startInd != allTargets.size() - 1;
|
||||||
|
if (targetPointsHelper.getPointToStart() == null) {
|
||||||
|
start.getOriginalPointDescription().setName(start.getLatitude() + ", " + start.getLongitude());
|
||||||
|
}
|
||||||
|
first.start = true;
|
||||||
|
first.intermediate = false;
|
||||||
|
targetPointsHelper.setStartPoint(new LatLon(first.getLatitude(), first.getLongitude()),
|
||||||
|
false, first.getPointDescription(getMyApplication()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
targetPointsHelper.reorderAllTargetPoints(allTargets, false);
|
targetPointsHelper.reorderAllTargetPoints(allTargets, false);
|
||||||
newRouteIsCalculated(false, new ValueHolder<Boolean>());
|
newRouteIsCalculated(false, new ValueHolder<Boolean>());
|
||||||
targetPointsHelper.updateRouteAndRefresh(true);
|
targetPointsHelper.updateRouteAndRefresh(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 50);
|
}, 50);
|
||||||
|
|
Loading…
Reference in a new issue