Fix annotations=true handling in NodeJS bindings & libosrm (#6415)
This commit is contained in:
committed by
GitHub
parent
d65e8c7d1e
commit
fb1bb7a15b
@@ -439,7 +439,7 @@ class RouteAPI : public BaseAPI
|
||||
{
|
||||
// AnnotationsType uses bit flags, & operator checks if a property is set
|
||||
flatbuffers::Offset<flatbuffers::Vector<float>> speed;
|
||||
if (parameters.annotations_type & RouteParameters::AnnotationsType::Speed)
|
||||
if (requested_annotations & RouteParameters::AnnotationsType::Speed)
|
||||
{
|
||||
double prev_speed = 0;
|
||||
speed =
|
||||
@@ -778,7 +778,7 @@ class RouteAPI : public BaseAPI
|
||||
util::json::Object annotation;
|
||||
|
||||
// AnnotationsType uses bit flags, & operator checks if a property is set
|
||||
if (parameters.annotations_type & RouteParameters::AnnotationsType::Speed)
|
||||
if (requested_annotations & RouteParameters::AnnotationsType::Speed)
|
||||
{
|
||||
double prev_speed = 0;
|
||||
annotation.values["speed"] = GetAnnotations(
|
||||
|
||||
@@ -799,6 +799,9 @@ inline bool parseCommonParameters(const v8::Local<v8::Object> &obj, ParamType &p
|
||||
if (annotations->IsBoolean())
|
||||
{
|
||||
params->annotations = Nan::To<bool>(annotations).FromJust();
|
||||
params->annotations_type = params->annotations
|
||||
? osrm::RouteParameters::AnnotationsType::All
|
||||
: osrm::RouteParameters::AnnotationsType::None;
|
||||
}
|
||||
else if (annotations->IsArray())
|
||||
{
|
||||
@@ -845,6 +848,9 @@ inline bool parseCommonParameters(const v8::Local<v8::Object> &obj, ParamType &p
|
||||
Nan::ThrowError("this 'annotations' param is not supported");
|
||||
return false;
|
||||
}
|
||||
|
||||
params->annotations =
|
||||
params->annotations_type != osrm::RouteParameters::AnnotationsType::None;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user