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 |
|
| 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 |
|
| 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
|
Given the node map
|
||||||
"""
|
"""
|
||||||
j
|
j
|
||||||
a b c
|
a b c
|
||||||
d
|
|
||||||
e f g
|
e f g
|
||||||
h
|
k l m
|
||||||
i
|
i
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | highway | name |
|
| nodes | highway | name |
|
||||||
| abc | primary | Oak St |
|
| abc | primary | Oak St |
|
||||||
| efg | residential | Oak St |
|
| efg | residential | Elm St |
|
||||||
| jcdehi | residential | Cedar Dr |
|
| klm | residential | Oak St |
|
||||||
|
| jceki | residential | Cedar Dr |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns |
|
| waypoints | route | turns |
|
||||||
| a,g | 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 |
|
||||||
| g,a | 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;
|
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
|
} // namespace
|
||||||
@ -1164,8 +1168,8 @@ std::vector<RouteStep> collapseTurns(std::vector<RouteStep> steps)
|
|||||||
invalidateStep(steps[index]);
|
invalidateStep(steps[index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If we look at two consecutive name changes, we can check for a name oszillation.
|
// If we look at two consecutive name changes, we can check for a name oscillation.
|
||||||
// A name oszillation changes from name A shortly to name B and back to A.
|
// A name oscillation changes from name A shortly to name B and back to A.
|
||||||
// In these cases, the name change will be suppressed.
|
// In these cases, the name change will be suppressed.
|
||||||
else if (one_back_index > 0 && compatible(current_step, one_back_step) &&
|
else if (one_back_index > 0 && compatible(current_step, one_back_step) &&
|
||||||
((isCollapsableInstruction(current_step.maneuver.instruction) &&
|
((isCollapsableInstruction(current_step.maneuver.instruction) &&
|
||||||
|
Loading…
Reference in New Issue
Block a user