fix duration of direct connection

This commit is contained in:
Moritz Kobitzsch 2016-04-01 18:15:11 +02:00 committed by Patrick Niklaus
parent ef1fb08723
commit 89d56e1cd1
3 changed files with 11 additions and 3 deletions

View File

@ -93,7 +93,7 @@ class RouteAPI : public BaseAPI
auto leg_geometry = guidance::assembleGeometry( auto leg_geometry = guidance::assembleGeometry(
BaseAPI::facade, path_data, phantoms.source_phantom, phantoms.target_phantom); BaseAPI::facade, path_data, phantoms.source_phantom, phantoms.target_phantom);
auto leg = guidance::assembleLeg(BaseAPI::facade, path_data, leg_geometry, 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) if (parameters.steps)
{ {

View File

@ -99,12 +99,12 @@ template <typename DataFacadeT>
RouteLeg assembleLeg(const DataFacadeT &facade, RouteLeg assembleLeg(const DataFacadeT &facade,
const std::vector<PathData> &route_data, const std::vector<PathData> &route_data,
const LegGeometry &leg_geometry, const LegGeometry &leg_geometry,
const PhantomNode &source_node,
const PhantomNode &target_node, const PhantomNode &target_node,
const bool target_traversed_in_reverse) const bool target_traversed_in_reverse)
{ {
const auto target_duration = const auto target_duration =
(target_traversed_in_reverse ? target_node.reverse_weight (target_traversed_in_reverse ? target_node.reverse_weight : target_node.forward_weight) /
: target_node.forward_weight) /
10.; 10.;
auto distance = std::accumulate(leg_geometry.segment_distances.begin(), auto distance = std::accumulate(leg_geometry.segment_distances.begin(),
@ -135,7 +135,14 @@ RouteLeg assembleLeg(const DataFacadeT &facade,
// `forward_offset`: duration of (c, d) // `forward_offset`: duration of (c, d)
// path_data will have entries for (s,b), (b, c), (c, d) but (d, t) is only // 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. // 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; 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); auto summary_array = detail::summarizeRoute<detail::MAX_USED_SEGMENTS>(route_data);
BOOST_ASSERT(detail::MAX_USED_SEGMENTS > 0); BOOST_ASSERT(detail::MAX_USED_SEGMENTS > 0);

View File

@ -352,6 +352,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
// the following is the core of the loop. // the following is the core of the loop.
unsigned distance = edge_data1.distance; unsigned distance = edge_data1.distance;
std::cout << "Distance: " << distance << std::endl;
if (m_traffic_lights.find(node_v) != m_traffic_lights.end()) if (m_traffic_lights.find(node_v) != m_traffic_lights.end())
{ {
distance += profile_properties.traffic_signal_penalty; distance += profile_properties.traffic_signal_penalty;