add check/test for intermediary intersections
This commit is contained in:
parent
836e8bdff0
commit
3680fc9d90
@ -121,25 +121,25 @@ Feature: Staggered Intersections
|
||||
| a,g | to_sea,road,to_sea,road,road | depart,turn right,turn left,notification straight,arrive | driving,driving,ferry,driving,driving |
|
||||
| g,a | road,to_sea,road,to_sea,to_sea | depart,notification straight,turn right,turn left,arrive | driving,ferry,driving,driving,driving |
|
||||
|
||||
Scenario: Staggered Intersection: do not collapse if a road class change is involved
|
||||
Scenario: Staggered Intersection: do not collapse intermediary intersections
|
||||
Given the node map
|
||||
"""
|
||||
j
|
||||
a b c
|
||||
d
|
||||
e f g
|
||||
h
|
||||
k l m
|
||||
i
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | highway | name |
|
||||
| abc | primary | Oak St |
|
||||
| efg | residential | Oak St |
|
||||
| jcdehi | residential | Cedar Dr |
|
||||
| efg | residential | Elm St |
|
||||
| klm | residential | Oak St |
|
||||
| jceki | residential | Cedar Dr |
|
||||
|
||||
When I route I should get
|
||||
| waypoints | route | turns |
|
||||
| a,g | Oak St,Cedar Dr,Oak St,Oak St | depart,turn right,turn left,arrive |
|
||||
| g,a | Oak St,Cedar Dr,Oak St,Oak St | depart,turn right,turn left,arrive |
|
||||
| a,m | Oak St,Cedar Dr,Oak St,Oak St | depart,turn right,turn left,arrive |
|
||||
| m,a | Oak St,Cedar Dr,Oak St,Oak St | depart,turn right,turn left,arrive |
|
||||
|
||||
|
@ -855,7 +855,11 @@ bool isStaggeredIntersection(const RouteStep &previous, const RouteStep ¤t
|
||||
|
||||
const auto no_mode_change = previous.mode == current.mode;
|
||||
|
||||
return is_short && (left_right || right_left) && no_mode_change;
|
||||
// previous step maneuver intersections should be length 1 to indicate that
|
||||
// there are no intersections between the two potentially collapsible turns
|
||||
const auto no_intermediary_intersections = previous.intersections.size() == 1;
|
||||
|
||||
return is_short && (left_right || right_left) && no_mode_change && no_intermediary_intersections;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@ -1164,8 +1168,8 @@ std::vector<RouteStep> collapseTurns(std::vector<RouteStep> steps)
|
||||
invalidateStep(steps[index]);
|
||||
}
|
||||
}
|
||||
// If we look at two consecutive name changes, we can check for a name oszillation.
|
||||
// A name oszillation changes from name A shortly to name B and back to A.
|
||||
// If we look at two consecutive name changes, we can check for a name oscillation.
|
||||
// A name oscillation changes from name A shortly to name B and back to A.
|
||||
// In these cases, the name change will be suppressed.
|
||||
else if (one_back_index > 0 && compatible(current_step, one_back_step) &&
|
||||
((isCollapsableInstruction(current_step.maneuver.instruction) &&
|
||||
|
Loading…
Reference in New Issue
Block a user