diff --git a/include/engine/api/route_api.hpp b/include/engine/api/route_api.hpp index 518850f81..b8fe9409e 100644 --- a/include/engine/api/route_api.hpp +++ b/include/engine/api/route_api.hpp @@ -86,7 +86,7 @@ class RouteAPI : public BaseAPI annotations_store.values.reserve(leg.annotations.size()); std::for_each(leg.annotations.begin(), leg.annotations.end(), - [Get, &annotations_store](const guidance::LegGeometry::Annotation &step) { + [Get, &annotations_store](const auto &step) { annotations_store.values.push_back(Get(step)); }); return annotations_store; @@ -237,32 +237,31 @@ class RouteAPI : public BaseAPI if (parameters.annotations_type & RouteParameters::AnnotationsType::Duration) { - annotation.values["duration"] = - GetAnnotations(leg_geometry, - std::bind(&guidance::LegGeometry::Annotation::duration, - std::placeholders::_1)); + annotation.values["duration"] = GetAnnotations( + leg_geometry, [](const guidance::LegGeometry::Annotation &anno) { + return anno.duration; + }); } if (parameters.annotations_type & RouteParameters::AnnotationsType::Distance) { - annotation.values["distance"] = - GetAnnotations(leg_geometry, - std::bind(&guidance::LegGeometry::Annotation::distance, - std::placeholders::_1)); + annotation.values["distance"] = GetAnnotations( + leg_geometry, [](const guidance::LegGeometry::Annotation &anno) { + return anno.distance; + }); } if (parameters.annotations_type & RouteParameters::AnnotationsType::Weight) { - annotation.values["weight"] = - GetAnnotations(leg_geometry, - std::bind(&guidance::LegGeometry::Annotation::weight, - std::placeholders::_1)); + annotation.values["weight"] = GetAnnotations( + leg_geometry, + [](const guidance::LegGeometry::Annotation &anno) { return anno.weight; }); } if (parameters.annotations_type & RouteParameters::AnnotationsType::Datasources) { - annotation.values["datasources"] = - GetAnnotations(leg_geometry, - std::bind(&guidance::LegGeometry::Annotation::datasource, - std::placeholders::_1)); + annotation.values["datasources"] = GetAnnotations( + leg_geometry, [](const guidance::LegGeometry::Annotation &anno) { + return anno.datasource; + }); } if (parameters.annotations_type & RouteParameters::AnnotationsType::Nodes) { diff --git a/include/engine/api/route_parameters.hpp b/include/engine/api/route_parameters.hpp index 23b64eefd..bb0a44c51 100644 --- a/include/engine/api/route_parameters.hpp +++ b/include/engine/api/route_parameters.hpp @@ -120,7 +120,7 @@ struct RouteParameters : public BaseParameters const boost::optional continue_straight_, Args... args_) : BaseParameters{std::forward(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_} { } @@ -152,6 +152,12 @@ inline RouteParameters::AnnotationsType operator|(RouteParameters::AnnotationsTy static_cast>(rhs)); } +inline RouteParameters::AnnotationsType operator|=(RouteParameters::AnnotationsType lhs, + RouteParameters::AnnotationsType rhs) +{ + return lhs = lhs | rhs; +} + } } } diff --git a/include/server/api/route_parameters_grammar.hpp b/include/server/api/route_parameters_grammar.hpp index 1d96b00bb..32b8deb13 100644 --- a/include/server/api/route_parameters_grammar.hpp +++ b/include/server/api/route_parameters_grammar.hpp @@ -46,7 +46,6 @@ struct RouteParametersGrammar : public BaseParametersGrammar