Add type traits to disable plugins for specific algorithms
This commit is contained in:
committed by
Patrick Niklaus
parent
436b34ffea
commit
922e155763
@@ -113,6 +113,11 @@ Status MatchPlugin::HandleRequest(const datafacade::ContiguousInternalMemoryData
|
||||
const api::MatchParameters ¶meters,
|
||||
util::json::Object &json_result) const
|
||||
{
|
||||
if (!algorithms.HasMapMatching())
|
||||
{
|
||||
return Error("NotImplemented", "Map matching is not implemented for the chosen search algorithm.", json_result);
|
||||
}
|
||||
|
||||
BOOST_ASSERT(parameters.IsValid());
|
||||
|
||||
// enforce maximum number of locations for performance reasons
|
||||
@@ -209,7 +214,7 @@ Status MatchPlugin::HandleRequest(const datafacade::ContiguousInternalMemoryData
|
||||
// bi-directional
|
||||
// phantom nodes for possible uturns
|
||||
sub_routes[index] =
|
||||
algorithms.ShortestRouting(sub_routes[index].segment_end_coordinates, {false});
|
||||
algorithms.ShortestPathSearch(sub_routes[index].segment_end_coordinates, {false});
|
||||
BOOST_ASSERT(sub_routes[index].shortest_path_length != INVALID_EDGE_WEIGHT);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,11 @@ Status TablePlugin::HandleRequest(const datafacade::ContiguousInternalMemoryData
|
||||
const api::TableParameters ¶ms,
|
||||
util::json::Object &result) const
|
||||
{
|
||||
if (!algorithms.HasManyToManySearch())
|
||||
{
|
||||
return Error("NotImplemented", "Many to many search is not implemented for the chosen search algorithm.", result);
|
||||
}
|
||||
|
||||
BOOST_ASSERT(params.IsValid());
|
||||
|
||||
if (!CheckAllCoordinates(params.coordinates))
|
||||
@@ -62,7 +67,7 @@ Status TablePlugin::HandleRequest(const datafacade::ContiguousInternalMemoryData
|
||||
|
||||
auto snapped_phantoms = SnapPhantomNodes(GetPhantomNodes(facade, params));
|
||||
auto result_table =
|
||||
algorithms.ManyToManyRouting(snapped_phantoms, params.sources, params.destinations);
|
||||
algorithms.ManyToManySearch(snapped_phantoms, params.sources, params.destinations);
|
||||
|
||||
if (result_table.empty())
|
||||
{
|
||||
|
||||
@@ -756,9 +756,9 @@ Status TilePlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataF
|
||||
|
||||
// If we're zooming into 16 or higher, include turn data. Why? Because turns make the map
|
||||
// really cramped, so we don't bother including the data for tiles that span a large area.
|
||||
if (parameters.z >= MIN_ZOOM_FOR_TURNS)
|
||||
if (parameters.z >= MIN_ZOOM_FOR_TURNS && algorithms.HasGetTileTurns())
|
||||
{
|
||||
turns = algorithms.TileTurns(edges, edge_index);
|
||||
turns = algorithms.GetTileTurns(edges, edge_index);
|
||||
}
|
||||
|
||||
encodeVectorTile(
|
||||
|
||||
@@ -85,7 +85,7 @@ InternalRouteResult TripPlugin::ComputeRoute(const RoutingAlgorithmsInterface &a
|
||||
BOOST_ASSERT(min_route.segment_end_coordinates.size() == trip.size() - 1);
|
||||
}
|
||||
|
||||
min_route = algorithms.ShortestRouting(min_route.segment_end_coordinates, {false});
|
||||
min_route = algorithms.ShortestPathSearch(min_route.segment_end_coordinates, {false});
|
||||
BOOST_ASSERT_MSG(min_route.shortest_path_length < INVALID_EDGE_WEIGHT, "unroutable route");
|
||||
return min_route;
|
||||
}
|
||||
@@ -147,6 +147,15 @@ Status TripPlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataF
|
||||
const api::TripParameters ¶meters,
|
||||
util::json::Object &json_result) const
|
||||
{
|
||||
if (!algorithms.HasShortestPathSearch())
|
||||
{
|
||||
return Error("NotImplemented", "Shortest path search is not implemented for the chosen search algorithm.", json_result);
|
||||
}
|
||||
if (!algorithms.HasManyToManySearch())
|
||||
{
|
||||
return Error("NotImplemented", "Many to many search is not implemented for the chosen search algorithm.", json_result);
|
||||
}
|
||||
|
||||
BOOST_ASSERT(parameters.IsValid());
|
||||
const auto number_of_locations = parameters.coordinates.size();
|
||||
|
||||
@@ -201,7 +210,7 @@ Status TripPlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataF
|
||||
|
||||
// compute the duration table of all phantom nodes
|
||||
auto result_table = util::DistTableWrapper<EdgeWeight>(
|
||||
algorithms.ManyToManyRouting(snapped_phantoms, {}, {}), number_of_locations);
|
||||
algorithms.ManyToManySearch(snapped_phantoms, {}, {}), number_of_locations);
|
||||
|
||||
if (result_table.size() == 0)
|
||||
{
|
||||
|
||||
@@ -34,6 +34,16 @@ ViaRoutePlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataFaca
|
||||
{
|
||||
BOOST_ASSERT(route_parameters.IsValid());
|
||||
|
||||
if (!algorithms.HasShortestPathSearch() && route_parameters.coordinates.size() > 2)
|
||||
{
|
||||
return Error("NotImplemented", "Shortest path search is not implemented for the chosen search algorithm. Only two coordinates supported.", json_result);
|
||||
}
|
||||
|
||||
if (!algorithms.HasDirectShortestPathSearch() && !algorithms.HasShortestPathSearch())
|
||||
{
|
||||
return Error("NotImplemented", "Direct shortest path search is not implemented for the chosen search algorithm.", json_result);
|
||||
}
|
||||
|
||||
if (max_locations_viaroute > 0 &&
|
||||
(static_cast<int>(route_parameters.coordinates.size()) > max_locations_viaroute))
|
||||
{
|
||||
@@ -85,20 +95,17 @@ ViaRoutePlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataFaca
|
||||
};
|
||||
util::for_each_pair(snapped_phantoms, build_phantom_pairs);
|
||||
|
||||
if (1 == raw_route.segment_end_coordinates.size())
|
||||
if (1 == raw_route.segment_end_coordinates.size() && algorithms.HasAlternativePathSearch() && route_parameters.alternatives)
|
||||
{
|
||||
if (route_parameters.alternatives && algorithms.HasAlternativeRouting())
|
||||
{
|
||||
raw_route = algorithms.AlternativeRouting(raw_route.segment_end_coordinates.front());
|
||||
}
|
||||
else
|
||||
{
|
||||
raw_route = algorithms.DirectShortestPathRouting(raw_route.segment_end_coordinates);
|
||||
}
|
||||
raw_route = algorithms.AlternativePathSearch(raw_route.segment_end_coordinates.front());
|
||||
}
|
||||
else if (1 == raw_route.segment_end_coordinates.size() && algorithms.HasDirectShortestPathSearch())
|
||||
{
|
||||
raw_route = algorithms.DirectShortestPathSearch(raw_route.segment_end_coordinates);
|
||||
}
|
||||
else
|
||||
{
|
||||
raw_route = algorithms.ShortestRouting(raw_route.segment_end_coordinates,
|
||||
raw_route = algorithms.ShortestPathSearch(raw_route.segment_end_coordinates,
|
||||
route_parameters.continue_straight);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user