Fixup for last commit

This commit is contained in:
Patrick Niklaus 2016-03-17 20:55:55 +01:00
parent 3058135f55
commit 10f8bf53b4

View File

@ -305,9 +305,10 @@ template <class DataFacadeT, class Derived> class BasicRoutingInterface
BOOST_ASSERT(weight_vector.size() == id_vector.size()); BOOST_ASSERT(weight_vector.size() == id_vector.size());
// ed.distance should be total_weight + penalties (turn, stop, etc) // ed.distance should be total_weight + penalties (turn, stop, etc)
BOOST_ASSERT(ed.distance >= total_weight); BOOST_ASSERT(ed.distance >= total_weight);
const bool is_first_segment = unpacked_path.empty();
const std::size_t start_index = const std::size_t start_index =
(unpacked_path.empty() (is_first_segment
? ((start_traversed_in_reverse) ? ((start_traversed_in_reverse)
? id_vector.size() - ? id_vector.size() -
phantom_node_pair.source_phantom.fwd_segment_position - 1 phantom_node_pair.source_phantom.fwd_segment_position - 1
@ -327,18 +328,22 @@ template <class DataFacadeT, class Derived> class BasicRoutingInterface
unpacked_path.back().turn_instruction = turn_instruction; unpacked_path.back().turn_instruction = turn_instruction;
unpacked_path.back().duration_until_turn += (ed.distance - total_weight); unpacked_path.back().duration_until_turn += (ed.distance - total_weight);
// Given this geometry: if (is_first_segment)
// U---v---w---x---Z {
// s // Given this geometry:
// The above code will create segments for (v, w), (w,x) and (x, Z). // U---v---w---x---Z
// However the first segment duration needs to be adjusted to the fact that the // s
// source phantom is in the middle of the segment. // The above code will create segments for (v, w), (w,x) and (x, Z).
// We do this by subtracting v--s from the duration. // However the first segment duration needs to be adjusted to the fact that the
BOOST_ASSERT(unpacked_path.front().duration_until_turn >= // source phantom is in the middle of the segment.
phantom_node_pair.source_phantom.forward_weight); // We do this by subtracting v--s from the duration.
unpacked_path.front().duration_until_turn -= BOOST_ASSERT(unpacked_path.front().duration_until_turn >=
start_traversed_in_reverse ? phantom_node_pair.source_phantom.forward_weight : phantom_node_pair.source_phantom.forward_weight);
phantom_node_pair.source_phantom.reverse_weight; unpacked_path.front().duration_until_turn -=
start_traversed_in_reverse
? phantom_node_pair.source_phantom.forward_weight
: phantom_node_pair.source_phantom.reverse_weight;
}
} }
} }
std::vector<unsigned> id_vector; std::vector<unsigned> id_vector;