Update review findings

This commit is contained in:
Michael Krasnyk
2017-01-26 17:28:27 +01:00
committed by Patrick Niklaus
parent 6b143c5e1d
commit ad594cb2e4
15 changed files with 90 additions and 85 deletions
+10 -8
View File
@@ -78,7 +78,7 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
geometry.annotations.emplace_back(
LegGeometry::Annotation{current_distance,
path_point.duration_until_turn / 10.,
path_point.weight_until_turn / 10.,
path_point.weight_until_turn / facade.GetWeightMultiplier(),
path_point.datasource_id});
geometry.locations.push_back(std::move(coordinate));
geometry.osm_node_ids.push_back(facade.GetOSMNodeIDOfNode(path_point.turn_via_node));
@@ -92,13 +92,15 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
const std::vector<DatasourceID> forward_datasources =
facade.GetUncompressedForwardDatasources(target_node.packed_geometry_id);
// FIXME this is wrong. We need to check for traversal direction here
// and for the case of a local path (target and source on the same edge)
geometry.annotations.emplace_back(
LegGeometry::Annotation{current_distance,
target_node.forward_duration / 10.,
target_node.forward_weight / 10.,
forward_datasources[target_node.fwd_segment_position]});
// FIXME if source and target phantoms are on the same segment then duration and weight
// will be from one projected point till end of segment
// testbot/weight.feature:Start and target on the same and adjacent edge
geometry.annotations.emplace_back(LegGeometry::Annotation{
current_distance,
(reversed_target ? target_node.reverse_duration : target_node.forward_duration) / 10.,
(reversed_target ? target_node.reverse_weight : target_node.forward_weight) /
facade.GetWeightMultiplier(),
forward_datasources[target_node.fwd_segment_position]});
geometry.segment_offsets.push_back(geometry.locations.size());
geometry.locations.push_back(target_node.location);
+11 -1
View File
@@ -138,6 +138,10 @@ inline RouteLeg assembleLeg(const datafacade::BaseDataFacade &facade,
route_data.begin(), route_data.end(), 0, [](const double sum, const PathData &data) {
return sum + data.duration_until_turn;
});
auto weight = std::accumulate(
route_data.begin(), route_data.end(), 0, [](const double sum, const PathData &data) {
return sum + data.weight_until_turn;
});
// s
// |
@@ -165,6 +169,8 @@ inline RouteLeg assembleLeg(const datafacade::BaseDataFacade &facade,
{
duration -= (target_traversed_in_reverse ? source_node.reverse_duration
: source_node.forward_duration);
weight -=
(target_traversed_in_reverse ? source_node.reverse_weight : source_node.forward_weight);
}
std::string summary;
@@ -196,7 +202,11 @@ inline RouteLeg assembleLeg(const datafacade::BaseDataFacade &facade,
summary = boost::algorithm::join(summary_names, ", ");
}
return RouteLeg{duration / 10., distance, summary, {}};
return RouteLeg{std::round(distance * 10.) / 10.,
duration / 10.,
duration / facade.GetWeightMultiplier(),
summary,
{}};
}
} // namespace guidance
+2 -1
View File
@@ -10,8 +10,9 @@ namespace guidance
struct Route
{
double duration;
double distance;
double duration;
double weight;
};
}
}
+2 -1
View File
@@ -17,8 +17,9 @@ namespace guidance
struct RouteLeg
{
double duration;
double distance;
double duration;
double weight;
std::string summary;
std::vector<RouteStep> steps;
};
+1 -4
View File
@@ -14,10 +14,7 @@ const constexpr auto DEFAULT_MAX_SPEED = 180 / 3.6; // 180kmph -> m/s
struct ProfileProperties
{
enum
{
MAX_WEIGHT_NAME_LENGTH = 255
};
static constexpr int MAX_WEIGHT_NAME_LENGTH = 255;
ProfileProperties()
: traffic_signal_penalty(0), u_turn_penalty(0),