fix duration of direct connection

This commit is contained in:
Moritz Kobitzsch
2016-04-01 18:15:11 +02:00
parent 144536a09d
commit 7f7d7816e5
3 changed files with 11 additions and 3 deletions
+1 -1
View File
@@ -93,7 +93,7 @@ class RouteAPI : public BaseAPI
auto leg_geometry = guidance::assembleGeometry(
BaseAPI::facade, path_data, phantoms.source_phantom, phantoms.target_phantom);
auto leg = guidance::assembleLeg(BaseAPI::facade, path_data, leg_geometry,
phantoms.target_phantom, reversed_target);
phantoms.source_phantom, phantoms.target_phantom, reversed_target);
if (parameters.steps)
{
+9 -2
View File
@@ -99,12 +99,12 @@ template <typename DataFacadeT>
RouteLeg assembleLeg(const DataFacadeT &facade,
const std::vector<PathData> &route_data,
const LegGeometry &leg_geometry,
const PhantomNode &source_node,
const PhantomNode &target_node,
const bool target_traversed_in_reverse)
{
const auto target_duration =
(target_traversed_in_reverse ? target_node.reverse_weight
: target_node.forward_weight) /
(target_traversed_in_reverse ? target_node.reverse_weight : target_node.forward_weight) /
10.;
auto distance = std::accumulate(leg_geometry.segment_distances.begin(),
@@ -135,7 +135,14 @@ RouteLeg assembleLeg(const DataFacadeT &facade,
// `forward_offset`: duration of (c, d)
// path_data will have entries for (s,b), (b, c), (c, d) but (d, t) is only
// caputed by the phantom node. So we need to add the target duration here.
// On local segments, the target duration is already part of the duration, however.
duration = duration + target_duration;
if (route_data.empty())
{
duration -=
(target_traversed_in_reverse ? source_node.reverse_weight : source_node.forward_weight) / 10;
}
auto summary_array = detail::summarizeRoute<detail::MAX_USED_SEGMENTS>(route_data);
BOOST_ASSERT(detail::MAX_USED_SEGMENTS > 0);