Allow a single intersection in a cross-road of sliproads, #4348/3

This commit is contained in:
Michael Krasnyk 2017-09-11 17:13:29 +02:00 committed by Patrick Niklaus
parent 38ab22ee7c
commit a7ea6e5327
2 changed files with 17 additions and 3 deletions

View File

@ -1050,4 +1050,4 @@ Feature: Slipways and Dedicated Turn Lanes
When I route I should get
| waypoints | route | turns | locations |
| s,f | sab,ae,dbcef,dbcef | depart,turn right,turn slight right,arrive | s,a,e,f |
| s,f | sab,dbcef,dbcef | depart,turn right,arrive | s,a,f |

View File

@ -493,7 +493,21 @@ operator()(const NodeID /*nid*/, const EdgeID source_edge_id, Intersection inter
continue;
}
if (node_based_graph.GetTarget(candidate_road.eid) == main_road_intersection->node)
// Check that the cross-road `candidate_road_target` that starts at `d` ends at
// main intersection node `c` or has a common node `e` with a cross-road from `c`
// a ... b .... c a ... b .... c
// ` . ` .
// ` . ` e...
// ` . ` .
// d d
//
const auto candidate_road_target = node_based_graph.GetTarget(candidate_road.eid);
if ((candidate_road_target == main_road_intersection->node) ||
(candidate_road_target == node_based_graph.GetTarget(crossing_road.eid) &&
util::bearing::angleBetween(candidate_road.bearing, crossing_road.bearing) <
FUZZY_ANGLE_DIFFERENCE &&
(getTurnDirection(candidate_road.angle) == DirectionModifier::SharpRight ||
getTurnDirection(candidate_road.angle) == DirectionModifier::SharpLeft)))
{
sliproad.instruction.type = TurnType::Sliproad;
sliproad_found = true;