Allow specifing a weight for routing that is independent of duration
This commit is contained in:
committed by
Patrick Niklaus
parent
e463733138
commit
279f8aabfb
@@ -242,6 +242,7 @@ 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["name"] = std::move(step.name);
|
||||
if (!step.ref.empty())
|
||||
route_step.values["ref"] = std::move(step.ref);
|
||||
@@ -275,9 +276,11 @@ util::json::Object makeRouteStep(guidance::RouteStep step, util::json::Value geo
|
||||
|
||||
util::json::Object makeRoute(const guidance::Route &route,
|
||||
util::json::Array legs,
|
||||
boost::optional<util::json::Value> geometry)
|
||||
boost::optional<util::json::Value> geometry,
|
||||
const char *weight_name)
|
||||
{
|
||||
util::json::Object json_route;
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user