Add support for opposite approach request parameter (#6842)

* Added approach on the opposite side of the road.

* Additional test and docs coverage for opposite approach

---------

Co-authored-by: Aleksandrs Saveljevs <Aleksandrs.Saveljevs@gmail.com>
This commit is contained in:
Michael Bell
2024-04-03 19:59:15 +01:00
committed by GitHub
parent 367933fc1a
commit 8ef366e061
12 changed files with 400 additions and 38 deletions
+7 -2
View File
@@ -560,6 +560,10 @@ inline bool argumentsToParameter(const Napi::CallbackInfo &args,
{
params->approaches.push_back(osrm::Approach::CURB);
}
else if (approach_str == "opposite")
{
params->approaches.push_back(osrm::Approach::OPPOSITE);
}
else if (approach_str == "unrestricted")
{
params->approaches.push_back(osrm::Approach::UNRESTRICTED);
@@ -567,13 +571,14 @@ inline bool argumentsToParameter(const Napi::CallbackInfo &args,
else
{
ThrowError(args.Env(),
"'approaches' param must be one of [curb, unrestricted]");
"'approaches' param must be one of [curb, opposite, unrestricted]");
return false;
}
}
else
{
ThrowError(args.Env(), "Approach must be a string: [curb, unrestricted] or null");
ThrowError(args.Env(),
"Approach must be a string: [curb, opposite, unrestricted] or null");
return false;
}
}