Parse table annotations param correctly (#5050)

* fix incorrect parameter parsing for node osrm and add tests

* fix boost spirit grammar parsing for annotations

* return NotImplemented when distance annotation is requested for MLD in table plugin

* update docs
This commit is contained in:
Kajari Ghosh
2018-04-24 11:05:35 -04:00
committed by GitHub
parent c628ecbf24
commit 89f6e2d55b
11 changed files with 95 additions and 27 deletions
+9 -1
View File
@@ -85,10 +85,18 @@ Status TablePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
bool request_distance = params.annotations & api::TableParameters::AnnotationsType::Distance;
bool request_duration = params.annotations & api::TableParameters::AnnotationsType::Duration;
if (request_distance && !algorithms.SupportsDistanceAnnotationType())
{
return Error("NotImplemented",
"The distance annotations calculation is not implemented for the chosen "
"search algorithm.",
result);
}
auto result_tables_pair = algorithms.ManyToManySearch(
snapped_phantoms, params.sources, params.destinations, request_distance, request_duration);
if ((request_duration & result_tables_pair.first.empty()) ||
if ((request_duration && result_tables_pair.first.empty()) ||
(request_distance && result_tables_pair.second.empty()))
{
return Error("NoTable", "No table found", result);