handle throughabouts -- do not announce going through

This commit is contained in:
Moritz Kobitzsch 2017-07-25 17:19:33 +02:00
parent 8c9ae4d3b4
commit 0affec8f17
4 changed files with 34 additions and 12 deletions

View File

@ -14,6 +14,7 @@
- Pass functions instead of strings to `WayHandlers.run()`, so it's possible to mix in your own functions.
- Reorders arguments to `WayHandlers` functions to match `process_way()`.
- Profiles must return a hash of profile functions. This makes it easier for profiles to include each other.
- Guidance: add support for throughabouts
# 5.9.2
- API:

View File

@ -567,5 +567,5 @@ Feature: Basic Roundabout
| ab | residential | in | | |
When I route I should get
| waypoints | turns | route |
| a,f | depart,turn right,roundabout turn straight exit-1,arrive | in,through,through,through |
| waypoints | turns | route |
| a,f | depart,turn right,arrive | in,through,through |

View File

@ -763,7 +763,7 @@ Feature: Basic Roundabout
When I route I should get
| waypoints | bearings | route | turns |
| e,f | 90 90 | edf,edf,edf | depart,roundabout-exit-1,arrive |
| e,f | 90 90 | edf,edf | depart,arrive |
| e,h | 90 135 | edf,gch,gch | depart,roundabout-exit-2,arrive |
| g,f | 45 90 | gch,edf,edf | depart,roundabout-exit-2,arrive |
| g,h | 45 135 | gch,gch,gch | depart,roundabout-exit-1,arrive |
@ -843,6 +843,6 @@ Feature: Basic Roundabout
When I route I should get
| from | to | route | turns | distance |
| e | k | ebds,ebds,ds,ufghl,jhik,jhik | depart,rotary-exit-1,rotary-exit-1,rstur-exit-2,turn right,arrive | 189.1m |
| 1 | k | ebds,ds,ufghl,jhik,jhik | depart,rotary-exit-1,rstur-exit-2,turn right,arrive | 159.1m |
| from | to | route | turns | distance |
| e | k | ebds,ufghl,jhik,jhik | depart,rstur-exit-2,turn right,arrive | 189.1m |
| 1 | k | ebds,ufghl,jhik,jhik | depart,rstur-exit-2,turn right,arrive | 159.1m |

View File

@ -504,15 +504,23 @@ Intersection RoundaboutHandler::handleRoundabouts(const RoundaboutType roundabou
}
else
{
bool crossing_roundabout = false;
for (std::size_t cnt = 0, idx = lhs ? intersection.size() - 1 : 0;
cnt < intersection.size();
++cnt, idx += step)
{
auto &road = intersection[idx];
if (!road.entry_allowed)
continue;
auto &turn = road;
auto &turn = intersection[idx];
const auto &out_data = node_based_graph.GetEdgeData(turn.eid);
// A roundabout consists of exactly two roads at an intersection. by toggeling this
// flag, we can switch between roads crossing the roundabout and roads that are on the
// same side as via_eid.
if (out_data.roundabout || out_data.circular)
crossing_roundabout = !crossing_roundabout;
if (!turn.entry_allowed)
continue;
if (out_data.roundabout || out_data.circular)
{
if (can_exit_roundabout_separately)
@ -524,8 +532,21 @@ Intersection RoundaboutHandler::handleRoundabouts(const RoundaboutType roundabou
}
else
{
turn.instruction = TurnInstruction::ENTER_AND_EXIT_ROUNDABOUT(
roundabout_type, getTurnDirection(turn.angle));
// Distinguish between throughabouts and entering a roundabout to directly exit: In
// case of a throughabout, both enter and exit do not show roundabout tags (as we
// already have checked, when arriving here) and the enter/exit are nearly straight
// and on different sides of the roundabouts
if (util::angularDeviation(turn.angle, STRAIGHT_ANGLE) < FUZZY_ANGLE_DIFFERENCE &&
crossing_roundabout)
{
turn.instruction = getInstructionForObvious(
intersection.size(), via_eid, isThroughStreet(idx, intersection), turn);
}
else
{
turn.instruction = TurnInstruction::ENTER_AND_EXIT_ROUNDABOUT(
roundabout_type, getTurnDirection(turn.angle));
}
}
}
}