fix bug cause roundabout based on circle is completely incorrect

This commit is contained in:
Victor Shcherb 2021-01-21 17:49:04 +01:00
parent b8787e4121
commit 97e6395def

View file

@ -1187,14 +1187,11 @@ public class RouteResultPreparation {
RouteSegmentResult rr) { RouteSegmentResult rr) {
int exit = 1; int exit = 1;
RouteSegmentResult last = rr; RouteSegmentResult last = rr;
RouteSegmentResult firstRoundabout = rr;
RouteSegmentResult lastRoundabout = rr;
for (int j = i; j < result.size(); j++) { for (int j = i; j < result.size(); j++) {
RouteSegmentResult rnext = result.get(j); RouteSegmentResult rnext = result.get(j);
last = rnext; last = rnext;
if (rnext.getObject().roundabout()) { if (rnext.getObject().roundabout()) {
lastRoundabout = rnext;
boolean plus = rnext.getStartPointIndex() < rnext.getEndPointIndex(); boolean plus = rnext.getStartPointIndex() < rnext.getEndPointIndex();
int k = rnext.getStartPointIndex(); int k = rnext.getStartPointIndex();
if (j == i) { if (j == i) {
@ -1216,13 +1213,7 @@ public class RouteResultPreparation {
TurnType t = TurnType.getExitTurn(exit, 0, leftSide); TurnType t = TurnType.getExitTurn(exit, 0, leftSide);
// usually covers more than expected // usually covers more than expected
float turnAngleBasedOnOutRoads = (float) MapUtils.degreesDiff(last.getBearingBegin(), prev.getBearingEnd()); float turnAngleBasedOnOutRoads = (float) MapUtils.degreesDiff(last.getBearingBegin(), prev.getBearingEnd());
// usually covers less than expected
float turnAngleBasedOnCircle = (float) -MapUtils.degreesDiff(firstRoundabout.getBearingBegin(), lastRoundabout.getBearingEnd() + 180);
if(Math.abs(turnAngleBasedOnOutRoads - turnAngleBasedOnCircle) > 180) {
t.setTurnAngle(turnAngleBasedOnCircle) ;
} else {
t.setTurnAngle(turnAngleBasedOnOutRoads) ; t.setTurnAngle(turnAngleBasedOnOutRoads) ;
}
return t; return t;
} }