Fix be attentive with route recalculation
This commit is contained in:
parent
9e87ec17e9
commit
a410e2b565
1 changed files with 15 additions and 10 deletions
|
@ -336,9 +336,13 @@ public class RoutePlannerFrontEnd {
|
||||||
List<RouteSegmentResult> prev = ctx.previouslyCalculatedRoute;
|
List<RouteSegmentResult> prev = ctx.previouslyCalculatedRoute;
|
||||||
long id = points.get(1).getRoad().id;
|
long id = points.get(1).getRoad().id;
|
||||||
int ss = points.get(1).getSegmentStart();
|
int ss = points.get(1).getSegmentStart();
|
||||||
|
int px = points.get(1).getRoad().getPoint31XTile(ss);
|
||||||
|
int py = points.get(1).getRoad().getPoint31YTile(ss);
|
||||||
for (int i = 0; i < prev.size(); i++) {
|
for (int i = 0; i < prev.size(); i++) {
|
||||||
RouteSegmentResult rsr = prev.get(i);
|
RouteSegmentResult rsr = prev.get(i);
|
||||||
if (id == rsr.getObject().getId() && ss == rsr.getEndPointIndex()) {
|
if (id == rsr.getObject().getId()) {
|
||||||
|
if (MapUtils.getDistance(rsr.getPoint(rsr.getEndPointIndex()), MapUtils.get31LatitudeY(py),
|
||||||
|
MapUtils.get31LongitudeX(px)) < 50) {
|
||||||
firstPartRecalculatedRoute = new ArrayList<RouteSegmentResult>(i + 1);
|
firstPartRecalculatedRoute = new ArrayList<RouteSegmentResult>(i + 1);
|
||||||
restPartRecalculatedRoute = new ArrayList<RouteSegmentResult>(prev.size() - i);
|
restPartRecalculatedRoute = new ArrayList<RouteSegmentResult>(prev.size() - i);
|
||||||
for (int k = 0; k < prev.size(); k++) {
|
for (int k = 0; k < prev.size(); k++) {
|
||||||
|
@ -353,6 +357,7 @@ public class RoutePlannerFrontEnd {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
List<RouteSegmentResult> results = new ArrayList<RouteSegmentResult>();
|
List<RouteSegmentResult> results = new ArrayList<RouteSegmentResult>();
|
||||||
for (int i = 0; i < points.size() - 1; i++) {
|
for (int i = 0; i < points.size() - 1; i++) {
|
||||||
RoutingContext local = new RoutingContext(ctx);
|
RoutingContext local = new RoutingContext(ctx);
|
||||||
|
|
Loading…
Reference in a new issue