fix turn angle for roundabout

This commit is contained in:
Kseniia 2021-01-21 15:49:04 +02:00
parent d416ef0a6a
commit b523294d6d

View file

@ -1189,6 +1189,7 @@ public class RouteResultPreparation {
RouteSegmentResult last = rr; RouteSegmentResult last = rr;
RouteSegmentResult firstRoundabout = rr; RouteSegmentResult firstRoundabout = rr;
RouteSegmentResult lastRoundabout = 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;
@ -1218,9 +1219,9 @@ public class RouteResultPreparation {
// usually covers less than expected // usually covers less than expected
float turnAngleBasedOnCircle = (float) -MapUtils.degreesDiff(firstRoundabout.getBearingBegin(), lastRoundabout.getBearingEnd() + 180); float turnAngleBasedOnCircle = (float) -MapUtils.degreesDiff(firstRoundabout.getBearingBegin(), lastRoundabout.getBearingEnd() + 180);
if(Math.abs(turnAngleBasedOnOutRoads - turnAngleBasedOnCircle) > 180) { if(Math.abs(turnAngleBasedOnOutRoads - turnAngleBasedOnCircle) > 180) {
t.setTurnAngle(turnAngleBasedOnCircle ) ; t.setTurnAngle(turnAngleBasedOnCircle) ;
} else { } else {
t.setTurnAngle((turnAngleBasedOnCircle + turnAngleBasedOnOutRoads) / 2) ; t.setTurnAngle(turnAngleBasedOnOutRoads) ;
} }
return t; return t;
} }