use lambda instead of bindy
This commit is contained in:
parent
ab91a05680
commit
c885d03830
@ -86,7 +86,7 @@ class RouteAPI : public BaseAPI
|
|||||||
annotations_store.values.reserve(leg.annotations.size());
|
annotations_store.values.reserve(leg.annotations.size());
|
||||||
std::for_each(leg.annotations.begin(),
|
std::for_each(leg.annotations.begin(),
|
||||||
leg.annotations.end(),
|
leg.annotations.end(),
|
||||||
[Get, &annotations_store](const guidance::LegGeometry::Annotation &step) {
|
[Get, &annotations_store](const auto &step) {
|
||||||
annotations_store.values.push_back(Get(step));
|
annotations_store.values.push_back(Get(step));
|
||||||
});
|
});
|
||||||
return annotations_store;
|
return annotations_store;
|
||||||
@ -237,32 +237,31 @@ class RouteAPI : public BaseAPI
|
|||||||
|
|
||||||
if (parameters.annotations_type & RouteParameters::AnnotationsType::Duration)
|
if (parameters.annotations_type & RouteParameters::AnnotationsType::Duration)
|
||||||
{
|
{
|
||||||
annotation.values["duration"] =
|
annotation.values["duration"] = GetAnnotations(
|
||||||
GetAnnotations(leg_geometry,
|
leg_geometry, [](const guidance::LegGeometry::Annotation &anno) {
|
||||||
std::bind(&guidance::LegGeometry::Annotation::duration,
|
return anno.duration;
|
||||||
std::placeholders::_1));
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parameters.annotations_type & RouteParameters::AnnotationsType::Distance)
|
if (parameters.annotations_type & RouteParameters::AnnotationsType::Distance)
|
||||||
{
|
{
|
||||||
annotation.values["distance"] =
|
annotation.values["distance"] = GetAnnotations(
|
||||||
GetAnnotations(leg_geometry,
|
leg_geometry, [](const guidance::LegGeometry::Annotation &anno) {
|
||||||
std::bind(&guidance::LegGeometry::Annotation::distance,
|
return anno.distance;
|
||||||
std::placeholders::_1));
|
});
|
||||||
}
|
}
|
||||||
if (parameters.annotations_type & RouteParameters::AnnotationsType::Weight)
|
if (parameters.annotations_type & RouteParameters::AnnotationsType::Weight)
|
||||||
{
|
{
|
||||||
annotation.values["weight"] =
|
annotation.values["weight"] = GetAnnotations(
|
||||||
GetAnnotations(leg_geometry,
|
leg_geometry,
|
||||||
std::bind(&guidance::LegGeometry::Annotation::weight,
|
[](const guidance::LegGeometry::Annotation &anno) { return anno.weight; });
|
||||||
std::placeholders::_1));
|
|
||||||
}
|
}
|
||||||
if (parameters.annotations_type & RouteParameters::AnnotationsType::Datasources)
|
if (parameters.annotations_type & RouteParameters::AnnotationsType::Datasources)
|
||||||
{
|
{
|
||||||
annotation.values["datasources"] =
|
annotation.values["datasources"] = GetAnnotations(
|
||||||
GetAnnotations(leg_geometry,
|
leg_geometry, [](const guidance::LegGeometry::Annotation &anno) {
|
||||||
std::bind(&guidance::LegGeometry::Annotation::datasource,
|
return anno.datasource;
|
||||||
std::placeholders::_1));
|
});
|
||||||
}
|
}
|
||||||
if (parameters.annotations_type & RouteParameters::AnnotationsType::Nodes)
|
if (parameters.annotations_type & RouteParameters::AnnotationsType::Nodes)
|
||||||
{
|
{
|
||||||
|
@ -120,7 +120,7 @@ struct RouteParameters : public BaseParameters
|
|||||||
const boost::optional<bool> continue_straight_,
|
const boost::optional<bool> continue_straight_,
|
||||||
Args... args_)
|
Args... args_)
|
||||||
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
|
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
|
||||||
annotations_type{annotations_}, annotations{true}, geometries{geometries_},
|
annotations_type{annotations_}, annotations{annotations_ == AnnotationsType::None ? false : true}, geometries{geometries_},
|
||||||
overview{overview_}, continue_straight{continue_straight_}
|
overview{overview_}, continue_straight{continue_straight_}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -152,6 +152,12 @@ inline RouteParameters::AnnotationsType operator|(RouteParameters::AnnotationsTy
|
|||||||
static_cast<std::underlying_type_t<RouteParameters::AnnotationsType>>(rhs));
|
static_cast<std::underlying_type_t<RouteParameters::AnnotationsType>>(rhs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline RouteParameters::AnnotationsType operator|=(RouteParameters::AnnotationsType lhs,
|
||||||
|
RouteParameters::AnnotationsType rhs)
|
||||||
|
{
|
||||||
|
return lhs = lhs | rhs;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,6 @@ struct RouteParametersGrammar : public BaseParametersGrammar<Iterator, Signature
|
|||||||
engine::api::RouteParameters::AnnotationsType &route_param) {
|
engine::api::RouteParameters::AnnotationsType &route_param) {
|
||||||
route_parameters.annotations_type = route_parameters.annotations_type | route_param;
|
route_parameters.annotations_type = route_parameters.annotations_type | route_param;
|
||||||
route_parameters.annotations = route_parameters.annotations_type != engine::api::RouteParameters::AnnotationsType::None;
|
route_parameters.annotations = route_parameters.annotations_type != engine::api::RouteParameters::AnnotationsType::None;
|
||||||
return route_parameters;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
geometries_type.add("geojson", engine::api::RouteParameters::GeometriesType::GeoJSON)(
|
geometries_type.add("geojson", engine::api::RouteParameters::GeometriesType::GeoJSON)(
|
||||||
|
Loading…
Reference in New Issue
Block a user