return speed annotations
This commit is contained in:
committed by
Patrick Niklaus
parent
316c7781a3
commit
062cae82a0
@@ -235,6 +235,14 @@ class RouteAPI : public BaseAPI
|
||||
auto &leg_geometry = leg_geometries[idx];
|
||||
util::json::Object annotation;
|
||||
|
||||
if (parameters.annotations_type & RouteParameters::AnnotationsType::Speed)
|
||||
{
|
||||
annotation.values["speed"] = GetAnnotations(
|
||||
leg_geometry, [](const guidance::LegGeometry::Annotation &anno) {
|
||||
return anno.distance / anno.duration;
|
||||
});
|
||||
}
|
||||
|
||||
if (parameters.annotations_type & RouteParameters::AnnotationsType::Duration)
|
||||
{
|
||||
annotation.values["duration"] = GetAnnotations(
|
||||
|
||||
@@ -75,7 +75,8 @@ struct RouteParameters : public BaseParameters
|
||||
Distance = 0x04,
|
||||
Weight = 0x08,
|
||||
Datasources = 0x10,
|
||||
All = Duration | Nodes | Distance | Weight | Datasources
|
||||
Speed = 0x20,
|
||||
All = Duration | Nodes | Distance | Weight | Datasources | Speed
|
||||
};
|
||||
|
||||
RouteParameters() = default;
|
||||
|
||||
@@ -61,7 +61,8 @@ struct RouteParametersGrammar : public BaseParametersGrammar<Iterator, Signature
|
||||
|
||||
annotations_type.add("duration", AnnotationsType::Duration)(
|
||||
"nodes", AnnotationsType::Nodes)("distance", AnnotationsType::Distance)(
|
||||
"weight", AnnotationsType::Weight)("datasources", AnnotationsType::Datasources);
|
||||
"weight", AnnotationsType::Weight)("datasources", AnnotationsType::Datasources)(
|
||||
"speed", AnnotationsType::Speed);
|
||||
|
||||
base_rule =
|
||||
BaseGrammar::base_rule(qi::_r1) |
|
||||
|
||||
Reference in New Issue
Block a user