Adjust Straight direction modifiers of side roads in driveway handler

This commit is contained in:
Michael Krasnyk 2018-02-25 10:49:52 +01:00
parent 6f4af330ed
commit 4d0fb89489
2 changed files with 32 additions and 0 deletions

View File

@ -46,3 +46,23 @@ Feature: Driveways intersections
When I route I should get When I route I should get
| waypoints | route | turns | locations | | waypoints | route | turns | locations |
| a,d | ,second | depart,arrive | a,d | | a,d | ,second | depart,arrive | a,d |
Scenario: Road with a turn to service road
Given the node map
"""
/-----------------e
a---b------------------c
`-----------------d
"""
And the ways
| nodes | highway | name | oneway |
| abc | trunk | road | yes |
| bd | service | serv | yes |
| be | service | serv | yes |
When I route I should get
| waypoints | route | turns | locations |
| a,d | road,serv,serv | depart,turn slight right,arrive | a,b,d |
| a,e | road,serv,serv | depart,turn slight left,arrive | a,b,e |

View File

@ -78,6 +78,18 @@ operator()(const NodeID nid, const EdgeID source_edge_id, Intersection intersect
road->instruction.type = road->instruction.type =
isSameName(source_edge_id, road->eid) ? TurnType::NoTurn : TurnType::NewName; isSameName(source_edge_id, road->eid) ? TurnType::NoTurn : TurnType::NewName;
if (road->instruction.direction_modifier == DirectionModifier::Straight)
{
std::for_each(intersection.begin() + 1, road, [](auto &side_road) {
if (side_road.instruction.direction_modifier == DirectionModifier::Straight)
side_road.instruction.direction_modifier = DirectionModifier::SlightRight;
});
std::for_each(road + 1, intersection.end(), [](auto &side_road) {
if (side_road.instruction.direction_modifier == DirectionModifier::Straight)
side_road.instruction.direction_modifier = DirectionModifier::SlightLeft;
});
}
return intersection; return intersection;
} }