check for compatibility in post-processing (#3227)

This commit is contained in:
Moritz Kobitzsch 2016-11-02 23:59:35 +01:00 committed by Daniel Patterson
parent 9d24a4422a
commit 388d84a89e
3 changed files with 27 additions and 3 deletions

View File

@ -20,6 +20,7 @@
- fixed a bug where polyline decoding on a defective polyline could end up in out-of-bound access on a vector
- fixed compile errors in tile unit-test framework
- fixed a bug that could result in inconsistent behaviour when collapsing instructions
- fixed a bug that could result in crashes when leaving a ferry directly onto a motorway ramp
- Debug Tiles
- Added support for turn penalties

View File

@ -255,3 +255,24 @@ Feature: Ramp Guidance
| waypoints | route | turns |
| a,d | , | depart,arrive |
| b,d | , | depart,arrive |
Scenario: Ferry Onto A Ramp
Given the node map
"""
d - e - g
|
a - b ~ ~ ~ ~ ~ ~ ~ c
` f
"""
And the ways
| nodes | highway | route | name | ref |
| ab | primary | | boarding | |
| bc | | ferry | boaty mc boatface | m2 |
| cf | | ferry | boaty mc boatface | |
| cd | | ferry | boaty mc boatface's cousin | |
| de | motorway_link | | | |
When I route I should get
| waypoints | route |
| a,e | boarding,boaty mc boatface,boaty mc boatface's cousin,, |

View File

@ -462,7 +462,7 @@ void collapseUTurn(std::vector<RouteStep> &steps,
// additionall collapse a name-change as welll
const auto next_step_index = step_index + 1;
const bool continues_with_name_change =
(next_step_index < steps.size()) &&
(next_step_index < steps.size()) && compatible(steps[step_index], steps[next_step_index]) &&
((steps[next_step_index].maneuver.instruction.type == TurnType::UseLane &&
steps[next_step_index].maneuver.instruction.direction_modifier ==
DirectionModifier::Straight) ||
@ -777,7 +777,8 @@ void collapseTurnAt(std::vector<RouteStep> &steps,
invalidateStep(steps[step_index]);
}
else if (TurnType::Suppressed == current_step.maneuver.instruction.type &&
!isNoticeableNameChange(one_back_step, current_step))
!isNoticeableNameChange(one_back_step, current_step) &&
compatible(one_back_step, current_step))
{
steps[one_back_index] = elongate(std::move(steps[one_back_index]), current_step);
const auto angle = findTotalTurnAngle(one_back_step, current_step);
@ -787,7 +788,8 @@ void collapseTurnAt(std::vector<RouteStep> &steps,
invalidateStep(steps[step_index]);
}
else if (TurnType::Turn == one_back_step.maneuver.instruction.type &&
TurnType::OnRamp == current_step.maneuver.instruction.type)
TurnType::OnRamp == current_step.maneuver.instruction.type &&
compatible(one_back_step, current_step))
{
// turning onto a ramp makes the first turn into a ramp
steps[one_back_index] = elongate(std::move(steps[one_back_index]), current_step);