diff --git a/features/guidance/continue.feature b/features/guidance/continue.feature index cc12434d7..aedb87806 100644 --- a/features/guidance/continue.feature +++ b/features/guidance/continue.feature @@ -20,6 +20,39 @@ Feature: Continue Instructions | a,c | abc,abc,abc | depart,continue left,arrive | | a,d | abc,bd,bd | depart,turn straight,arrive | + Scenario: Road turning left and straight + Given the node map + | | | c | | + | a | | b | d | + + And the ways + | nodes | highway | name | + | abc | primary | road | + | bd | primary | road | + + When I route I should get + | waypoints | route | turns | + | a,c | road,road,road | depart,continue left,arrive | + | a,d | road,road | depart,arrive | + + Scenario: Road turning left and straight + Given the node map + | | | c | | + | a | | b | d | + | | | e | | + + And the ways + | nodes | highway | name | + | abc | primary | road | + | bd | primary | road | + | be | primary | road | + + When I route I should get + | waypoints | route | turns | + | a,c | road,road,road | depart,continue left,arrive | + | a,d | road,road | depart,arrive | + | a,e | road,road,road | depart,continue right,arrive | + Scenario: Road turning right Given the node map | a | | b | d | diff --git a/src/extractor/guidance/turn_handler.cpp b/src/extractor/guidance/turn_handler.cpp index 3211fc3a8..bf9644065 100644 --- a/src/extractor/guidance/turn_handler.cpp +++ b/src/extractor/guidance/turn_handler.cpp @@ -137,7 +137,8 @@ Intersection TurnHandler::handleThreeWayTurn(const EdgeID via_edge, Intersection assignFork(via_edge, intersection[2], intersection[1]); } else if (isObviousOfTwo(intersection[1], intersection[2]) && - second_data.name_id != in_data.name_id) + (second_data.name_id != in_data.name_id || + first_data.name_id == second_data.name_id)) { intersection[1].turn.instruction = getInstructionForObvious(intersection.size(), via_edge, false, intersection[1]); @@ -145,7 +146,8 @@ Intersection TurnHandler::handleThreeWayTurn(const EdgeID via_edge, Intersection DirectionModifier::SlightLeft}; } else if (isObviousOfTwo(intersection[2], intersection[1]) && - first_data.name_id != in_data.name_id) + (first_data.name_id != in_data.name_id || + first_data.name_id == second_data.name_id)) { intersection[2].turn.instruction = getInstructionForObvious(intersection.size(), via_edge, false, intersection[2]); @@ -198,7 +200,7 @@ Intersection TurnHandler::handleThreeWayTurn(const EdgeID via_edge, Intersection else { if (isObviousOfTwo(intersection[1], intersection[2]) && - in_data.name_id != second_data.name_id) + (in_data.name_id != second_data.name_id || first_data.name_id == second_data.name_id)) { intersection[1].turn.instruction = getInstructionForObvious( 3, via_edge, isThroughStreet(1, intersection), intersection[1]); @@ -210,7 +212,7 @@ Intersection TurnHandler::handleThreeWayTurn(const EdgeID via_edge, Intersection } if (isObviousOfTwo(intersection[2], intersection[1]) && - in_data.name_id != first_data.name_id) + (in_data.name_id != first_data.name_id || first_data.name_id == second_data.name_id)) { intersection[2].turn.instruction = getInstructionForObvious( 3, via_edge, isThroughStreet(2, intersection), intersection[2]);