From 3eeb3cb6c61f248f2369d550ca331098b6b4fdd4 Mon Sep 17 00:00:00 2001 From: Moritz Kobitzsch Date: Mon, 7 Nov 2016 15:53:14 +0100 Subject: [PATCH] fix collapsing of roundabout instructions --- CHANGELOG.md | 5 +++ features/guidance/roundabout.feature | 50 +++++++++++++++++++++++++ src/engine/guidance/post_processing.cpp | 9 +++++ 3 files changed, 64 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6db567b35..f1b4d00c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,11 @@ - Debug Tiles - Added support for turn penalties +# 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 diff --git a/features/guidance/roundabout.feature b/features/guidance/roundabout.feature index a29b0c68e..65a0ce261 100644 --- a/features/guidance/roundabout.feature +++ b/features/guidance/roundabout.feature @@ -418,3 +418,53 @@ Feature: Basic Roundabout 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 | diff --git a/src/engine/guidance/post_processing.cpp b/src/engine/guidance/post_processing.cpp index e347ccc08..e7d2841cc 100644 --- a/src/engine/guidance/post_processing.cpp +++ b/src/engine/guidance/post_processing.cpp @@ -498,6 +498,10 @@ void collapseTurnAt(std::vector &steps, BOOST_ASSERT(one_back_index < steps.size()); const auto ¤t_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; // This function assumes driving on the right hand side of the streat BOOST_ASSERT(!one_back_step.intersections.empty() && !current_step.intersections.empty()); @@ -812,6 +816,11 @@ void collapseTurnAt(std::vector &steps, // bool isStaggeredIntersection(const RouteStep &previous, const RouteStep ¤t) { + //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