From 9bd2b0deaa28fd3b5cca52e1181fc3f1a7dbffb1 Mon Sep 17 00:00:00 2001 From: Moritz Kobitzsch Date: Tue, 23 May 2017 11:59:08 +0200 Subject: [PATCH] fix invalid turn angle in forks --- CHANGELOG.md | 3 ++- features/guidance/turn.feature | 19 +++++++++++++++++++ .../guidance/intersection_generator.cpp | 1 + .../guidance/intersection_handler.cpp | 2 +- src/extractor/guidance/turn_handler.cpp | 6 +++--- 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7106a26bc..a461f0d45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,8 @@ - .osrm.nodes file was renamed to .nbg_nodes and .ebg_nodes was added - Guidance - #4075 Changed counting of exits on service roundabouts - + - Bugfixes + - Fixed a copy/paste issue assigning wrong directions in similar turns (left over right) # 5.7.1 - Bugfixes diff --git a/features/guidance/turn.feature b/features/guidance/turn.feature index dbc8809ad..cc39956f8 100644 --- a/features/guidance/turn.feature +++ b/features/guidance/turn.feature @@ -1260,3 +1260,22 @@ Feature: Simple Turns | waypoints | route | turns | | a,d | Goethe,Fried,Fried | depart,continue left,arrive | | a,g | Goethe,Fried,Fried | depart,turn right,arrive | + + # Conflicting roads (https://www.openstreetmap.org/export#map=19/37.57805/-77.46049) + Scenario: Turning at forklike structure + Given the node map + """ + c d + - - - b - - - a + - + e + """ + And the ways + | nodes | name | oneway | highway | + | abc | foo | no | residential | + | bd | bar | yes | residential | + | eb | some | yes | tertiary_link | + + When I route I should get + | waypoints | route | turns | + | a,d | foo,bar,bar | depart,turn slight right,arrive | diff --git a/src/extractor/guidance/intersection_generator.cpp b/src/extractor/guidance/intersection_generator.cpp index 7c4ee53b3..0fac8a0b7 100644 --- a/src/extractor/guidance/intersection_generator.cpp +++ b/src/extractor/guidance/intersection_generator.cpp @@ -145,6 +145,7 @@ IntersectionGenerator::ComputeIntersectionShape(const NodeID node_at_center_of_i intersection.end(), makeCompareShapeDataAngleToBearing(base_bearing)); } + return intersection; } diff --git a/src/extractor/guidance/intersection_handler.cpp b/src/extractor/guidance/intersection_handler.cpp index c57241410..57a8e872b 100644 --- a/src/extractor/guidance/intersection_handler.cpp +++ b/src/extractor/guidance/intersection_handler.cpp @@ -278,7 +278,7 @@ void IntersectionHandler::assignFork(const EdgeID via_edge, // right side of fork if (low_priority_left && !low_priority_right) - right.instruction = {suppressed_right_type, DirectionModifier::SlightLeft}; + right.instruction = {suppressed_right_type, DirectionModifier::SlightRight}; else { if (low_priority_right && !low_priority_left) diff --git a/src/extractor/guidance/turn_handler.cpp b/src/extractor/guidance/turn_handler.cpp index c46e8659e..aff5699f7 100644 --- a/src/extractor/guidance/turn_handler.cpp +++ b/src/extractor/guidance/turn_handler.cpp @@ -705,9 +705,8 @@ void TurnHandler::handleDistinctConflict(const EdgeID via_edge, const auto left_classification = node_based_graph.GetEdgeData(left.eid).road_classification; const auto right_classification = node_based_graph.GetEdgeData(right.eid).road_classification; - if (canBeSeenAsFork(left_classification, right_classification)) - assignFork(via_edge, left, right); - else if (left_classification.GetPriority() > right_classification.GetPriority()) + + if (left_classification.GetPriority() > right_classification.GetPriority()) { // FIXME this should possibly know about the actual roads? // here we don't know about the intersection size. To be on the save side, @@ -726,6 +725,7 @@ void TurnHandler::handleDistinctConflict(const EdgeID via_edge, right.instruction = {findBasicTurnType(via_edge, right), DirectionModifier::SlightRight}; } + return; } const auto left_type = findBasicTurnType(via_edge, left); const auto right_type = findBasicTurnType(via_edge, right);