don't collapse with mode changes
This commit is contained in:
parent
3d4b39be7d
commit
836e8bdff0
@ -98,3 +98,48 @@ Feature: Staggered Intersections
|
|||||||
| waypoints | route | turns |
|
| waypoints | route | turns |
|
||||||
| a,g | Oak St,Cedar Dr,Elm St,Elm St | depart,turn right,turn left,arrive |
|
| a,g | Oak St,Cedar Dr,Elm St,Elm St | depart,turn right,turn left,arrive |
|
||||||
| g,a | Elm St,Cedar Dr,Oak St,Oak St | depart,turn right,turn left,arrive |
|
| g,a | Elm St,Cedar Dr,Oak St,Oak St | depart,turn right,turn left,arrive |
|
||||||
|
|
||||||
|
Scenario: Staggered Intersection: do not collapse if a mode change is involved
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
j
|
||||||
|
a b c
|
||||||
|
d
|
||||||
|
e f g
|
||||||
|
h
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway | name | route |
|
||||||
|
| abc | primary | to_sea | |
|
||||||
|
| ef | | to_sea | ferry |
|
||||||
|
| fg | primary | road | |
|
||||||
|
| jcdeh | primary | road | |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route | turns | modes |
|
||||||
|
| 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
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
j
|
||||||
|
a b c
|
||||||
|
d
|
||||||
|
e f g
|
||||||
|
h
|
||||||
|
i
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway | name |
|
||||||
|
| abc | primary | Oak St |
|
||||||
|
| efg | residential | Oak St |
|
||||||
|
| jcdehi | 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 |
|
||||||
|
|
||||||
|
@ -443,7 +443,7 @@ std::size_t getPreviousIndex(std::size_t index, const std::vector<RouteStep> &st
|
|||||||
--index;
|
--index;
|
||||||
|
|
||||||
return index;
|
return index;
|
||||||
};
|
}
|
||||||
|
|
||||||
void collapseUTurn(std::vector<RouteStep> &steps,
|
void collapseUTurn(std::vector<RouteStep> &steps,
|
||||||
const std::size_t two_back_index,
|
const std::size_t two_back_index,
|
||||||
@ -853,7 +853,9 @@ bool isStaggeredIntersection(const RouteStep &previous, const RouteStep ¤t
|
|||||||
// We are only interested in the distance between the first and the second.
|
// We are only interested in the distance between the first and the second.
|
||||||
const auto is_short = previous.distance < MAX_STAGGERED_DISTANCE;
|
const auto is_short = previous.distance < MAX_STAGGERED_DISTANCE;
|
||||||
|
|
||||||
return is_short && (left_right || right_left);
|
const auto no_mode_change = previous.mode == current.mode;
|
||||||
|
|
||||||
|
return is_short && (left_right || right_left) && no_mode_change;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user