fix collapsing of roundabout instructions

This commit is contained in:
Moritz Kobitzsch 2016-11-07 15:53:14 +01:00
parent 513a799665
commit 3bde88eec5
3 changed files with 89 additions and 0 deletions

View File

@ -1,3 +1,8 @@
# 5.4.3
- Changes from 5.4.1
- Bugfixes
- #3254 Fixed a bug that could end up hiding roundabout instructions
# 5.4.2
- Changes from 5.4.1
- Bugfixes

View File

@ -403,3 +403,78 @@ Feature: Basic Roundabout
#| w,x | ll,egg,egg,tr,tr | depart,roundabout-exit-1,roundabout-exit-2,arrive |
| w,x | ll,egg,egg,tr,tr | depart,turn right,continue left,turn slight left,arrive |
<<<<<<< HEAD
=======
Scenario: Use Lane in Roundabout
Given the node map
"""
. i . . . .. .
.' '.
a - b. f - g
. |
'. 1 /
'. /
j - - - c . . e
' d '
' h
"""
#using roundabout as name, we can ignore whether we see a roundabout or a rotary here. Cucumber output will be the same
And the ways
| nodes | junction | name | oneway | turn:lanes:forward |
| ba | | left-out | yes | |
| jc | | left-in | yes | |
| dh | | right-bot-out | yes | |
| fg | | right-top-out | yes | |
| bc | roundabout | roundabout | yes | left;through\|through |
| cdefib | roundabout | roundabout | yes | |
When I route I should get
| waypoints | route | turns |
| 1,h | roundabout,right-bot-out,right-bot-out | depart,roundabout-exit-1,arrive |
@3254
Scenario: Driving up to and through a roundabout
Given the node map
| | g | | | | | | | a | | | | |
| | | | | | | | | | | | | |
| e | f | | | | | b | | | | d | | h |
| | | | | | | | | | | | | |
| | i | | | | | | | c | | | | |
| | | | | | | | | | | | | |
| | | | | | | | | k | | | | |
And the ways
| nodes | junction | name | highway |
| abcda | roundabout | roundabout | residential |
| gfi | | side | residential |
| efb | | left | residential |
| dh | | right | residential |
| ck | | bottom | residential |
When I route I should get
| waypoints | route | turns |
| e,h | left,right,right | depart,roundabout-exit-2,arrive |
@3254
Scenario: Driving up to and through a roundabout
Given the node map
| | g | | | | a | | | | |
| | | | | | | | | | |
| e | f | | b | | | | d | | h |
| | | | | | | | | | |
| | i | | | | c | | | | |
| | | | | | | | | | |
| | | | | | k | | | | |
And the ways
| nodes | junction | name | highway |
| abcda | roundabout | roundabout | residential |
| gfi | | side | residential |
| efb | | left | residential |
| dh | | right | residential |
| ck | | bottom | residential |
When I route I should get
| waypoints | route | turns |
| e,h | left,right,right | depart,roundabout-exit-2,arrive |

View File

@ -355,6 +355,10 @@ void collapseTurnAt(std::vector<RouteStep> &steps,
BOOST_ASSERT(one_back_index < steps.size());
const auto &current_step = steps[step_index];
const auto &one_back_step = steps[one_back_index];
// Don't collapse roundabouts
if (entersRoundabout(current_step.maneuver.instruction) ||
entersRoundabout(one_back_step.maneuver.instruction))
return;
// FIXME: this function assumes driving on the right hand side of the streat
const auto bearingsAreReversed = [](const double bearing_in, const double bearing_out) {
@ -521,6 +525,11 @@ void collapseTurnAt(std::vector<RouteStep> &steps,
//
bool isStaggeredIntersection(const RouteStep &previous, const RouteStep &current)
{
//don't touch roundabouts
if (entersRoundabout(previous.maneuver.instruction) ||
entersRoundabout(current.maneuver.instruction))
return false;
// Base decision on distance since the zig-zag is a visual clue.
// If adjusted, make sure to check validity of the is_right/is_left classification below
const constexpr auto MAX_STAGGERED_DISTANCE = 3; // debatable, but keep short to be on safe side