Skip to content

Commit

Permalink
Handle motorway forks with links as a normal motorway ...
Browse files Browse the repository at this point in the history
passing some ramps or mering onto another motorway
  • Loading branch information
oxidase committed Feb 16, 2018
1 parent 4ffca4a commit fe5d39c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 4 additions & 4 deletions features/guidance/motorway.feature
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ Feature: Motorway Guidance
| cd | motorway_link |

When I route I should get
| waypoints | route | turns |
| a,d | abce,cd,cd | depart,turn straight,arrive |
| a,e | abce,abce,abce | depart,fork slight left,arrive |
| a,f | abce,cf,cf | depart,fork slight right,arrive |
| waypoints | route | turns |
| a,d | abce,cd,cd | depart,off ramp slight left,arrive |
| a,e | abce,abce | depart,arrive |
| a,f | abce,cf,cf | depart,turn slight right,arrive |
7 changes: 5 additions & 2 deletions src/guidance/motorway_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,10 @@ Intersection MotorwayHandler::fromMotorway(const EdgeID via_eid, Intersection in
}
else
{
const unsigned exiting_motorways = countExitingMotorways(intersection);
const auto valid_exits = std::count_if(intersection.begin(),
intersection.end(),
[](const auto &road) { return road.entry_allowed; });
const auto exiting_motorways = countExitingMotorways(intersection);

if (exiting_motorways == 0)
{
Expand All @@ -233,7 +236,7 @@ Intersection MotorwayHandler::fromMotorway(const EdgeID via_eid, Intersection in
}
}
}
else if (exiting_motorways == 1)
else if (exiting_motorways == 1 || exiting_motorways != valid_exits)
{
// normal motorway passing some ramps or mering onto another motorway
if (intersection.size() == 2)
Expand Down

0 comments on commit fe5d39c

Please sign in to comment.