fix bug cause roundabout based on circle is completely incorrect
This commit is contained in:
parent
97e6395def
commit
d7828b4bf0
1 changed files with 10 additions and 1 deletions
|
@ -1187,11 +1187,14 @@ 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) {
|
||||||
|
@ -1213,7 +1216,13 @@ 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());
|
||||||
t.setTurnAngle(turnAngleBasedOnOutRoads) ;
|
float turnAngleBasedOnCircle = (float) -MapUtils.degreesDiff(firstRoundabout.getBearingBegin(), lastRoundabout.getBearingEnd() + 180);
|
||||||
|
if (Math.abs(turnAngleBasedOnOutRoads) > 120) {
|
||||||
|
// correctly identify if angle is +- 180, so we approach from left or right side
|
||||||
|
t.setTurnAngle(turnAngleBasedOnCircle) ;
|
||||||
|
} else {
|
||||||
|
t.setTurnAngle(turnAngleBasedOnOutRoads) ;
|
||||||
|
}
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue