Allow users to specify a class for each way
This adds the ability to mark ways with a user-defined class in the profile. This class information will be included in the response as property of the RouteStep object.
This commit is contained in:
committed by
Patrick Niklaus
parent
d52d530cbe
commit
44739f2dc3
@@ -265,6 +265,18 @@ util::json::Object makeRouteStep(guidance::RouteStep step, util::json::Value geo
|
||||
route_step.values["maneuver"] = makeStepManeuver(std::move(step.maneuver));
|
||||
route_step.values["geometry"] = std::move(geometry);
|
||||
|
||||
if (!step.classes.empty())
|
||||
{
|
||||
util::json::Array classes;
|
||||
classes.values.reserve(step.classes.size());
|
||||
std::transform(
|
||||
step.classes.begin(),
|
||||
step.classes.end(),
|
||||
std::back_inserter(classes.values),
|
||||
[](const std::string &class_name) { return util::json::String{class_name}; });
|
||||
route_step.values["classes"] = std::move(classes);
|
||||
}
|
||||
|
||||
util::json::Array intersections;
|
||||
intersections.values.reserve(step.intersections.size());
|
||||
std::transform(step.intersections.begin(),
|
||||
|
||||
Reference in New Issue
Block a user