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
+8 -6
View File
@@ -241,8 +241,8 @@ util::json::Object makeRouteStep(guidance::RouteStep step, util::json::Value geo
{
util::json::Object route_step;
route_step.values["distance"] = std::round(step.distance * 10) / 10.;
route_step.values["duration"] = std::round(step.duration * 10) / 10.;
route_step.values["weight"] = step.weight; // We should round to weight_precision here
route_step.values["duration"] = step.duration;
route_step.values["weight"] = step.weight;
route_step.values["name"] = std::move(step.name);
if (!step.ref.empty())
route_step.values["ref"] = std::move(step.ref);
@@ -280,9 +280,10 @@ util::json::Object makeRoute(const guidance::Route &route,
const char *weight_name)
{
util::json::Object json_route;
json_route.values["distance"] = route.distance;
json_route.values["duration"] = route.duration;
json_route.values["weight"] = route.weight;
json_route.values["weight_name"] = weight_name;
json_route.values["distance"] = std::round(route.distance * 10) / 10.;
json_route.values["duration"] = std::round(route.duration * 10) / 10.;
json_route.values["legs"] = std::move(legs);
if (geometry)
{
@@ -309,8 +310,9 @@ util::json::Object makeWaypoint(const util::Coordinate location, std::string nam
util::json::Object makeRouteLeg(guidance::RouteLeg leg, util::json::Array steps)
{
util::json::Object route_leg;
route_leg.values["distance"] = std::round(leg.distance * 10) / 10.;
route_leg.values["duration"] = std::round(leg.duration * 10) / 10.;
route_leg.values["distance"] = leg.distance;
route_leg.values["duration"] = leg.duration;
route_leg.values["weight"] = leg.weight;
route_leg.values["summary"] = std::move(leg.summary);
route_leg.values["steps"] = std::move(steps);
return route_leg;
+5 -1
View File
@@ -19,8 +19,12 @@ Route assembleRoute(const std::vector<RouteLeg> &route_legs)
route_legs.begin(), route_legs.end(), 0., [](const double sum, const RouteLeg &leg) {
return sum + leg.duration;
});
auto weight = std::accumulate(
route_legs.begin(), route_legs.end(), 0., [](const double sum, const RouteLeg &leg) {
return sum + leg.weight;
});
return Route{duration, distance};
return Route{distance, duration, weight};
}
} // namespace guidance
+2 -2
View File
@@ -41,7 +41,7 @@ bool findPreviousIntersection(const NodeID node_v,
* PREVIOUS_ID. To verify that find, we check the intersection using our PREVIOUS_ID candidate
* to check the intersection at NODE for via_edge
*/
const constexpr double COMBINE_WEIGHT_CUTOFF = 30;
const constexpr double COMBINE_DISTANCE_CUTOFF = 30;
const auto coordinate_extractor = intersection_generator.GetCoordinateExtractor();
const auto coordinates_along_via_edge =
@@ -53,7 +53,7 @@ bool findPreviousIntersection(const NodeID node_v,
// we check if via-edge is too short. In this case the previous turn cannot influence the turn
// at via_edge and the intersection at NODE_W
if (via_edge_length > COMBINE_WEIGHT_CUTOFF)
if (via_edge_length > COMBINE_DISTANCE_CUTOFF)
return false;
// Node -> Via_Edge -> Intersection[0 == UTURN] -> reverse_of(via_edge) -> Intersection at
@@ -382,9 +382,6 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
"duration",
&InternalExtractorEdge::duration_data);
// context.state.new_usertype<InternalExtractorEdge::WeightData>(
// "WeightData", "weight", &InternalExtractorEdge::WeightData::weight_data);
context.state.new_usertype<ExternalMemoryNode>("EdgeTarget",
"lon",
&lonToDouble<ExternalMemoryNode>,