fix continue on obvious

This commit is contained in:
Moritz Kobitzsch 2016-05-23 15:51:31 +02:00 committed by Patrick Niklaus
parent f96174ddbe
commit abed7690d0
No known key found for this signature in database
GPG Key ID: E426891B5F978B1B
2 changed files with 39 additions and 4 deletions

View File

@ -20,6 +20,39 @@ Feature: Continue Instructions
| a,c | abc,abc,abc | depart,continue left,arrive | | a,c | abc,abc,abc | depart,continue left,arrive |
| a,d | abc,bd,bd | depart,turn straight,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 Scenario: Road turning right
Given the node map Given the node map
| a | | b | d | | a | | b | d |

View File

@ -137,7 +137,8 @@ Intersection TurnHandler::handleThreeWayTurn(const EdgeID via_edge, Intersection
assignFork(via_edge, intersection[2], intersection[1]); assignFork(via_edge, intersection[2], intersection[1]);
} }
else if (isObviousOfTwo(intersection[1], intersection[2]) && 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 = intersection[1].turn.instruction =
getInstructionForObvious(intersection.size(), via_edge, false, intersection[1]); getInstructionForObvious(intersection.size(), via_edge, false, intersection[1]);
@ -145,7 +146,8 @@ Intersection TurnHandler::handleThreeWayTurn(const EdgeID via_edge, Intersection
DirectionModifier::SlightLeft}; DirectionModifier::SlightLeft};
} }
else if (isObviousOfTwo(intersection[2], intersection[1]) && 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 = intersection[2].turn.instruction =
getInstructionForObvious(intersection.size(), via_edge, false, intersection[2]); getInstructionForObvious(intersection.size(), via_edge, false, intersection[2]);
@ -198,7 +200,7 @@ Intersection TurnHandler::handleThreeWayTurn(const EdgeID via_edge, Intersection
else else
{ {
if (isObviousOfTwo(intersection[1], intersection[2]) && 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( intersection[1].turn.instruction = getInstructionForObvious(
3, via_edge, isThroughStreet(1, intersection), intersection[1]); 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]) && 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( intersection[2].turn.instruction = getInstructionForObvious(
3, via_edge, isThroughStreet(2, intersection), intersection[2]); 3, via_edge, isThroughStreet(2, intersection), intersection[2]);