Unpack paths and return total distance in matrix plugin for CH (#4990)

This commit is contained in:
Kajari Ghosh
2018-04-20 18:18:55 -04:00
committed by GitHub
parent 9970b7d580
commit 14860b62e9
38 changed files with 1886 additions and 538 deletions
+9 -4
View File
@@ -81,16 +81,21 @@ Status TablePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
}
auto snapped_phantoms = SnapPhantomNodes(phantom_nodes);
auto result_table =
algorithms.ManyToManySearch(snapped_phantoms, params.sources, params.destinations);
if (result_table.empty())
bool request_distance = params.annotations & api::TableParameters::AnnotationsType::Distance;
bool request_duration = params.annotations & api::TableParameters::AnnotationsType::Duration;
auto result_tables_pair = algorithms.ManyToManySearch(
snapped_phantoms, params.sources, params.destinations, request_distance, request_duration);
if ((request_duration & result_tables_pair.first.empty()) ||
(request_distance && result_tables_pair.second.empty()))
{
return Error("NoTable", "No table found", result);
}
api::TableAPI table_api{facade, params};
table_api.MakeResponse(result_table, snapped_phantoms, result);
table_api.MakeResponse(result_tables_pair, snapped_phantoms, result);
return Status::Ok;
}