Add abstraction to change the data facade at compile time
This commit is contained in:
committed by
Patrick Niklaus
parent
b2ed46efb5
commit
49f0b1eb59
@@ -109,8 +109,7 @@ void filterCandidates(const std::vector<util::Coordinate> &coordinates,
|
||||
}
|
||||
}
|
||||
|
||||
Status MatchPlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
|
||||
const RoutingAlgorithmsInterface &algorithms,
|
||||
Status MatchPlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
||||
const api::MatchParameters ¶meters,
|
||||
util::json::Object &json_result) const
|
||||
{
|
||||
@@ -121,6 +120,8 @@ Status MatchPlugin::HandleRequest(const datafacade::ContiguousInternalMemoryData
|
||||
json_result);
|
||||
}
|
||||
|
||||
const auto &facade = algorithms.GetFacade();
|
||||
|
||||
BOOST_ASSERT(parameters.IsValid());
|
||||
|
||||
// enforce maximum number of locations for performance reasons
|
||||
|
||||
@@ -19,14 +19,14 @@ namespace plugins
|
||||
|
||||
NearestPlugin::NearestPlugin(const int max_results_) : max_results{max_results_} {}
|
||||
|
||||
Status
|
||||
NearestPlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
|
||||
const RoutingAlgorithmsInterface & /*algorithms*/,
|
||||
const api::NearestParameters ¶ms,
|
||||
util::json::Object &json_result) const
|
||||
Status NearestPlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
||||
const api::NearestParameters ¶ms,
|
||||
util::json::Object &json_result) const
|
||||
{
|
||||
BOOST_ASSERT(params.IsValid());
|
||||
|
||||
const auto &facade = algorithms.GetFacade();
|
||||
|
||||
if (max_results > 0 &&
|
||||
(boost::numeric_cast<std::int64_t>(params.number_of_results) > max_results))
|
||||
{
|
||||
|
||||
@@ -28,8 +28,7 @@ TablePlugin::TablePlugin(const int max_locations_distance_table)
|
||||
{
|
||||
}
|
||||
|
||||
Status TablePlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
|
||||
const RoutingAlgorithmsInterface &algorithms,
|
||||
Status TablePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
||||
const api::TableParameters ¶ms,
|
||||
util::json::Object &result) const
|
||||
{
|
||||
@@ -67,6 +66,7 @@ Status TablePlugin::HandleRequest(const datafacade::ContiguousInternalMemoryData
|
||||
return Error("TooBig", "Too many table coordinates", result);
|
||||
}
|
||||
|
||||
const auto &facade = algorithms.GetFacade();
|
||||
auto phantom_nodes = GetPhantomNodes(facade, params);
|
||||
|
||||
if (phantom_nodes.size() != params.coordinates.size())
|
||||
|
||||
@@ -230,10 +230,7 @@ FixedPoint coordinatesToTilePoint(const util::Coordinate point, const BBox &tile
|
||||
return FixedPoint{px, py};
|
||||
}
|
||||
|
||||
std::vector<RTreeLeaf> getEdges(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
|
||||
unsigned x,
|
||||
unsigned y,
|
||||
unsigned z)
|
||||
std::vector<RTreeLeaf> getEdges(const DataFacadeBase &facade, unsigned x, unsigned y, unsigned z)
|
||||
{
|
||||
double min_lon, min_lat, max_lon, max_lat;
|
||||
|
||||
@@ -274,7 +271,7 @@ std::vector<std::size_t> getEdgeIndex(const std::vector<RTreeLeaf> &edges)
|
||||
return sorted_edge_indexes;
|
||||
}
|
||||
|
||||
void encodeVectorTile(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
|
||||
void encodeVectorTile(const DataFacadeBase &facade,
|
||||
unsigned x,
|
||||
unsigned y,
|
||||
unsigned z,
|
||||
@@ -882,13 +879,13 @@ void encodeVectorTile(const datafacade::ContiguousInternalMemoryDataFacadeBase &
|
||||
}
|
||||
}
|
||||
|
||||
Status TilePlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
|
||||
const RoutingAlgorithmsInterface &algorithms,
|
||||
Status TilePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
||||
const api::TileParameters ¶meters,
|
||||
std::string &pbf_buffer) const
|
||||
{
|
||||
BOOST_ASSERT(parameters.IsValid());
|
||||
|
||||
const auto &facade = algorithms.GetFacade();
|
||||
auto edges = getEdges(facade, parameters.x, parameters.y, parameters.z);
|
||||
|
||||
auto edge_index = getEdgeIndex(edges);
|
||||
|
||||
@@ -142,8 +142,7 @@ void ManipulateTableForFSE(const std::size_t source_id,
|
||||
//********* End of changes to table *************************************
|
||||
}
|
||||
|
||||
Status TripPlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
|
||||
const RoutingAlgorithmsInterface &algorithms,
|
||||
Status TripPlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
||||
const api::TripParameters ¶meters,
|
||||
util::json::Object &json_result) const
|
||||
{
|
||||
@@ -192,6 +191,7 @@ Status TripPlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataF
|
||||
return Error("InvalidValue", "Invalid coordinate value.", json_result);
|
||||
}
|
||||
|
||||
const auto &facade = algorithms.GetFacade();
|
||||
auto phantom_node_pairs = GetPhantomNodes(facade, parameters);
|
||||
if (phantom_node_pairs.size() != number_of_locations)
|
||||
{
|
||||
|
||||
@@ -26,11 +26,9 @@ ViaRoutePlugin::ViaRoutePlugin(int max_locations_viaroute, int max_alternatives)
|
||||
{
|
||||
}
|
||||
|
||||
Status
|
||||
ViaRoutePlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
|
||||
const RoutingAlgorithmsInterface &algorithms,
|
||||
const api::RouteParameters &route_parameters,
|
||||
util::json::Object &json_result) const
|
||||
Status ViaRoutePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
||||
const api::RouteParameters &route_parameters,
|
||||
util::json::Object &json_result) const
|
||||
{
|
||||
BOOST_ASSERT(route_parameters.IsValid());
|
||||
|
||||
@@ -75,6 +73,7 @@ ViaRoutePlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataFaca
|
||||
return Error("InvalidValue", "Invalid coordinate value.", json_result);
|
||||
}
|
||||
|
||||
const auto &facade = algorithms.GetFacade();
|
||||
auto phantom_node_pairs = GetPhantomNodes(facade, route_parameters);
|
||||
if (phantom_node_pairs.size() != route_parameters.coordinates.size())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user