don't provide turn-straight next to suppress-straight

This commit is contained in:
Moritz Kobitzsch 2016-10-05 10:44:41 +02:00
parent d964b81308
commit 378322f6e3
2 changed files with 87 additions and 5 deletions

View File

@ -1080,3 +1080,73 @@ Feature: Simple Turns
| f,a | depart,arrive | Hermannstr,Hermannstr |
| y,f | depart,arrive | Hermannstr,Hermannstr |
| f,y | depart,arrive | Hermannstr,Hermannstr |
# http://www.openstreetmap.org/#map=18/39.28158/-76.62291
@3002
Scenario: Obvious Index wigh very narrow turn to the right
Given the node map
| a | | b | | | | | | c |
| | | | | | | | | d |
And the ways
| nodes | highway | name |
| abc | primary | road |
| bd | primary_link | |
When I route I should get
| waypoints | turns | route |
| a,c | depart,arrive | road,road |
| a,d | depart,turn slight right,arrive | road,, |
# http://www.openstreetmap.org/#map=18/39.28158/-76.62291
@3002
Scenario: Obvious Index wigh very narrow turn to the right
Given the node map
| a | | b | | | | | | c | |
| | | | | e | | | | d | f |
And the ways
| nodes | highway | name |
| abc | primary | road |
| bd | primary_link | |
| edf | primary_link | |
When I route I should get
| waypoints | turns | route |
| a,c | depart,arrive | road,road |
| a,f | depart,turn slight right,arrive | road,, |
# http://www.openstreetmap.org/#map=18/39.28158/-76.62291
@3002
Scenario: Obvious Index wigh very narrow turn to the left
Given the node map
| | | | | | | | | d |
| a | | b | | | | | | c |
And the ways
| nodes | highway | name |
| abc | primary | road |
| bd | primary_link | |
When I route I should get
| waypoints | turns | route |
| a,c | depart,arrive | road,road |
| a,d | depart,turn slight left,arrive | road,, |
# http://www.openstreetmap.org/#map=18/39.28158/-76.62291
@3002
Scenario: Obvious Index wigh very narrow turn to the left
Given the node map
| | | | | e | | | | d | f |
| a | | b | | | | | | c | |
And the ways
| nodes | highway | name |
| abc | primary | road |
| bd | primary_link | |
| edf | primary_link | |
When I route I should get
| waypoints | turns | route |
| a,f | depart,turn slight left,arrive | road,, |
| a,c | depart,arrive | road,road |

View File

@ -1,7 +1,7 @@
#include "extractor/guidance/turn_handler.hpp"
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/intersection_scenario_three_way.hpp"
#include "extractor/guidance/toolkit.hpp"
#include "extractor/guidance/turn_handler.hpp"
#include "util/guidance/toolkit.hpp"
@ -166,6 +166,8 @@ Intersection TurnHandler::handleThreeWayTurn(const EdgeID via_edge, Intersection
}
else
{
const auto direction_at_one = getTurnDirection(intersection[1].turn.angle);
const auto direction_at_two = getTurnDirection(intersection[2].turn.angle);
if (obvious_index == 1)
{
intersection[1].turn.instruction = getInstructionForObvious(
@ -173,8 +175,13 @@ Intersection TurnHandler::handleThreeWayTurn(const EdgeID via_edge, Intersection
}
else
{
intersection[1].turn.instruction = {findBasicTurnType(via_edge, intersection[1]),
getTurnDirection(intersection[1].turn.angle)};
if (obvious_index != 0 && direction_at_one == direction_at_two &&
direction_at_one == DirectionModifier::Straight)
intersection[1].turn.instruction = {findBasicTurnType(via_edge, intersection[1]),
DirectionModifier::SlightRight};
else
intersection[1].turn.instruction = {findBasicTurnType(via_edge, intersection[1]),
direction_at_one};
}
if (obvious_index == 2)
@ -184,8 +191,13 @@ Intersection TurnHandler::handleThreeWayTurn(const EdgeID via_edge, Intersection
}
else
{
intersection[2].turn.instruction = {findBasicTurnType(via_edge, intersection[2]),
getTurnDirection(intersection[2].turn.angle)};
if (obvious_index != 0 && direction_at_one == direction_at_two &&
direction_at_two == DirectionModifier::Straight)
intersection[2].turn.instruction = {findBasicTurnType(via_edge, intersection[2]),
DirectionModifier::SlightLeft};
else
intersection[2].turn.instruction = {findBasicTurnType(via_edge, intersection[2]),
direction_at_two};
}
}
return intersection;