Fix crash on extracting Berlin in guidance

This commit is contained in:
Patrick Niklaus 2016-03-05 19:31:59 +01:00
parent fecd3d27ac
commit 01c4b3f7a3

View File

@ -523,21 +523,20 @@ handleMotorwayRamp(const NodeID from,
{ {
unsigned num_valid_turns = countValid(turn_candidates); unsigned num_valid_turns = countValid(turn_candidates);
// ramp straight into a motorway/ramp // ramp straight into a motorway/ramp
if (num_valid_turns == 1) if (turn_candidates.size() == 2 && num_valid_turns == 1)
{ {
BOOST_ASSERT(!turn_candidates[0].valid); BOOST_ASSERT(!turn_candidates[0].valid);
BOOST_ASSERT(isMotorwayClass(turn_candidates[1].eid, node_based_graph)); BOOST_ASSERT(isMotorwayClass(turn_candidates[1].eid, node_based_graph));
turn_candidates[1].instruction = turn_candidates[1].instruction =
noTurnOrNewName(from, via_edge, turn_candidates[1], node_based_graph); noTurnOrNewName(from, via_edge, turn_candidates[1], node_based_graph);
//{TurnType::Merge,
// getTurnDirection(turn_candidates[1].angle)};
} }
else if (turn_candidates.size() == 3) else if (turn_candidates.size() == 3)
{ {
// merging onto a passing highway / or two ramps merging onto the same highway // merging onto a passing highway / or two ramps merging onto the same highway
if (num_valid_turns == 1) if (num_valid_turns == 1)
{ {
BOOST_ASSERT(!turn_candidates[0].valid);
// check order of highways // check order of highways
// 4 // 4
// 5 3 // 5 3
@ -565,6 +564,7 @@ handleMotorwayRamp(const NodeID from,
} }
else else
{ {
BOOST_ASSERT(turn_candidates[2].valid);
if (isMotorwayClass(turn_candidates[2].eid, node_based_graph)) if (isMotorwayClass(turn_candidates[2].eid, node_based_graph))
{ {
// circular order (5-0) onto 4 // circular order (5-0) onto 4
@ -581,11 +581,13 @@ handleMotorwayRamp(const NodeID from,
noTurnOrNewName(from, via_edge, turn_candidates[1], node_based_graph); noTurnOrNewName(from, via_edge, turn_candidates[1], node_based_graph);
} }
} }
else else
{ {
BOOST_ASSERT(num_valid_turns == 2);
// UTurn on ramps is not possible // UTurn on ramps is not possible
BOOST_ASSERT(turn_candidates[1].valid && turn_candidates[2].valid); BOOST_ASSERT(!turn_candidates[0].valid);
BOOST_ASSERT(turn_candidates[1].valid);
BOOST_ASSERT(turn_candidates[2].valid);
// two motorways starting at end of ramp (fork) // two motorways starting at end of ramp (fork)
// M M // M M
// \ / // \ /
@ -680,7 +682,6 @@ handleMotorwayJunction(const NodeID from,
{ {
return handleFromMotorway(from, via_edge, std::move(turn_candidates), node_based_graph); return handleFromMotorway(from, via_edge, std::move(turn_candidates), node_based_graph);
} }
else // coming from a ramp else // coming from a ramp
{ {
return handleMotorwayRamp(from, via_edge, std::move(turn_candidates), node_based_graph); return handleMotorwayRamp(from, via_edge, std::move(turn_candidates), node_based_graph);