Adjusted handling/init of default_radius value
This commit is contained in:
parent
0c9563095a
commit
981b7accb3
@ -22,11 +22,11 @@ class MatchPlugin : public BasePlugin
|
||||
|
||||
MatchPlugin(const int max_locations_map_matching,
|
||||
const double max_radius_map_matching,
|
||||
const boost::optional<double> default_radius)
|
||||
: max_locations_map_matching(max_locations_map_matching),
|
||||
boost::optional<double> default_radius)
|
||||
: BasePlugin(std::move(default_radius))
|
||||
, max_locations_map_matching(max_locations_map_matching),
|
||||
max_radius_map_matching(max_radius_map_matching)
|
||||
{
|
||||
this->default_radius = default_radius;
|
||||
}
|
||||
|
||||
Status HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
||||
|
||||
@ -13,7 +13,7 @@ namespace osrm::engine::plugins
|
||||
class NearestPlugin final : public BasePlugin
|
||||
{
|
||||
public:
|
||||
explicit NearestPlugin(const int max_results, const boost::optional<double> default_radius);
|
||||
explicit NearestPlugin(const int max_results, boost::optional<double> default_radius);
|
||||
|
||||
Status HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
||||
const api::NearestParameters ¶ms,
|
||||
|
||||
@ -27,6 +27,13 @@ namespace osrm::engine::plugins
|
||||
class BasePlugin
|
||||
{
|
||||
protected:
|
||||
BasePlugin() = default;
|
||||
|
||||
BasePlugin(boost::optional<double> default_radius_)
|
||||
: default_radius(std::move(default_radius_))
|
||||
{
|
||||
}
|
||||
|
||||
bool CheckAllCoordinates(const std::vector<util::Coordinate> &coordinates) const
|
||||
{
|
||||
return !std::any_of(
|
||||
@ -321,7 +328,7 @@ class BasePlugin
|
||||
std::to_string(missing_index);
|
||||
}
|
||||
|
||||
boost::optional<double> default_radius;
|
||||
const boost::optional<double> default_radius;
|
||||
};
|
||||
} // namespace osrm::engine::plugins
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ class TablePlugin final : public BasePlugin
|
||||
{
|
||||
public:
|
||||
explicit TablePlugin(const int max_locations_distance_table,
|
||||
const boost::optional<double> default_radius);
|
||||
boost::optional<double> default_radius);
|
||||
|
||||
Status HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
||||
const api::TableParameters ¶ms,
|
||||
|
||||
@ -32,10 +32,10 @@ class TripPlugin final : public BasePlugin
|
||||
const bool roundtrip) const;
|
||||
|
||||
public:
|
||||
explicit TripPlugin(const int max_locations_trip_, const boost::optional<double> default_radius)
|
||||
: max_locations_trip(max_locations_trip_)
|
||||
explicit TripPlugin(const int max_locations_trip_, boost::optional<double> default_radius)
|
||||
: BasePlugin(std::move(default_radius))
|
||||
, max_locations_trip(max_locations_trip_)
|
||||
{
|
||||
this->default_radius = default_radius;
|
||||
}
|
||||
|
||||
Status HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
||||
|
||||
@ -27,7 +27,7 @@ class ViaRoutePlugin final : public BasePlugin
|
||||
public:
|
||||
explicit ViaRoutePlugin(int max_locations_viaroute,
|
||||
int max_alternatives,
|
||||
const boost::optional<double> default_radius);
|
||||
boost::optional<double> default_radius);
|
||||
|
||||
Status HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
||||
const api::RouteParameters &route_parameters,
|
||||
|
||||
@ -10,10 +10,10 @@
|
||||
namespace osrm::engine::plugins
|
||||
{
|
||||
|
||||
NearestPlugin::NearestPlugin(const int max_results_, const boost::optional<double> default_radius_)
|
||||
: max_results{max_results_}
|
||||
NearestPlugin::NearestPlugin(const int max_results_, boost::optional<double> default_radius_)
|
||||
: BasePlugin(std::move(default_radius_))
|
||||
, max_results{max_results_}
|
||||
{
|
||||
this->default_radius = default_radius_;
|
||||
}
|
||||
|
||||
Status NearestPlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
||||
|
||||
@ -15,10 +15,10 @@ namespace osrm::engine::plugins
|
||||
{
|
||||
|
||||
TablePlugin::TablePlugin(const int max_locations_distance_table,
|
||||
const boost::optional<double> default_radius)
|
||||
: max_locations_distance_table(max_locations_distance_table)
|
||||
boost::optional<double> default_radius)
|
||||
: BasePlugin(std::move(default_radius))
|
||||
, max_locations_distance_table(max_locations_distance_table)
|
||||
{
|
||||
this->default_radius = default_radius;
|
||||
}
|
||||
|
||||
Status TablePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
||||
|
||||
@ -17,10 +17,10 @@ namespace osrm::engine::plugins
|
||||
|
||||
ViaRoutePlugin::ViaRoutePlugin(int max_locations_viaroute,
|
||||
int max_alternatives,
|
||||
const boost::optional<double> default_radius)
|
||||
: max_locations_viaroute(max_locations_viaroute), max_alternatives(max_alternatives)
|
||||
boost::optional<double> default_radius)
|
||||
: BasePlugin(std::move(default_radius))
|
||||
, max_locations_viaroute(max_locations_viaroute), max_alternatives(max_alternatives)
|
||||
{
|
||||
this->default_radius = default_radius;
|
||||
}
|
||||
|
||||
Status ViaRoutePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user