don't collapse highway ramps into uturns (#4074)

This commit is contained in:
Moritz Kobitzsch 2017-05-23 11:42:23 +02:00 committed by Daniel J. H
parent a58139dfb5
commit ceaf065d0e
5 changed files with 52 additions and 4 deletions

View File

@ -14,6 +14,7 @@
- #4075 Changed counting of exits on service roundabouts
- Bugfixes
- Fixed a copy/paste issue assigning wrong directions in similar turns (left over right)
- #4074: fixed a bug that would announce entering highway ramps as u-turns
# 5.7.1
- Bugfixes

View File

@ -60,8 +60,8 @@ Feature: Basic Routing
| bc | | 101 |
When I route I should get
| waypoints | route | summary |
| a,c | road, | road, 101 |
| waypoints | route | summary |
| a,c | road,, | road, 101 |
Scenario: Only Refs
Given the node map

View File

@ -1279,3 +1279,43 @@ Feature: Simple Turns
When I route I should get
| waypoints | route | turns |
| a,d | foo,bar,bar | depart,turn slight right,arrive |
Scenario: UTurn onto ramp
Given the node map
"""
a - - - b - c
.|
_________________ de
h-g-----------------------f
"""
And the ways
| nodes | name | ref | oneway | highway |
| abc | Road | | yes | primary |
| ce | other | | yes | primary |
| cdg | | | yes | motorway_link |
| fgh | | C 42 | yes | motorway |
When I route I should get
| waypoints | route | ref | turns |
| a,h | Road,,, | ,,C 42,C 42 | depart,on ramp right,merge slight left,arrive |
Scenario: UTurn onto ramp (same ref)
Given the node map
"""
a - - - b - c
.|
_________________ de
h-g-----------------------f
"""
And the ways
| nodes | name | ref | oneway | highway |
| abc | Road | C 42 | yes | primary |
| ce | other | | yes | primary |
| cdg | | | yes | motorway_link |
| fgh | | C 42 | yes | motorway |
When I route I should get
| waypoints | route | ref | turns |
| a,h | Road,,, | C 42,,C 42,C 42 | depart,on ramp right,merge slight left,arrive |

View File

@ -123,8 +123,9 @@ inline bool requiresNameAnnounced(const std::string &from_name,
(names_are_equal && ref_is_removed) || is_suffix_change;
const auto needs_announce =
// " (Ref)" -> "Name "
(from_name.empty() && !from_ref.empty() && !to_name.empty() && to_ref.empty());
// " (Ref)" -> "Name " and reverse
(from_name.empty() && !from_ref.empty() && !to_name.empty() && to_ref.empty()) ||
(!from_name.empty() && from_ref.empty() && to_name.empty() && !to_ref.empty());
const auto pronunciation_changes = from_pronunciation != to_pronunciation;

View File

@ -147,6 +147,12 @@ bool isUTurn(const RouteStepIterator step_prior_to_intersection,
step_prior_to_intersection, step_entering_intersection, step_leaving_intersection))
return false;
// uturns only allowed on turns
if (!hasTurnType(*step_entering_intersection, TurnType::Turn) &&
!hasTurnType(*step_entering_intersection, TurnType::Continue) &&
!hasTurnType(*step_entering_intersection, TurnType::EndOfRoad))
return false;
// the most basic condition for a uturn is that we actually turn around
const bool takes_u_turn = bearingsAreReversed(
util::bearing::reverse(step_entering_intersection->intersections.front()