Allow -1.0 as unlimited for default_radius value
This commit is contained in:
parent
d51631401e
commit
922e81a6f8
@ -10,6 +10,7 @@
|
|||||||
- NodeJS:
|
- NodeJS:
|
||||||
- CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452)
|
- CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452)
|
||||||
- Misc:
|
- Misc:
|
||||||
|
- CHANGED: Allow -1.0 as unlimited for default_radius value. []()
|
||||||
- CHANGED: Move vector in CSVFilesParser instead copying it. [#6470](https://github.com/Project-OSRM/osrm-backend/pull/6470)
|
- CHANGED: Move vector in CSVFilesParser instead copying it. [#6470](https://github.com/Project-OSRM/osrm-backend/pull/6470)
|
||||||
- REMOVED: Get rid of unused functions in util/json_util.hpp. [#6446](https://github.com/Project-OSRM/osrm-backend/pull/6446)
|
- REMOVED: Get rid of unused functions in util/json_util.hpp. [#6446](https://github.com/Project-OSRM/osrm-backend/pull/6446)
|
||||||
- FIXED: Apply workaround for Conan installation issue on CI. [#6442](https://github.com/Project-OSRM/osrm-backend/pull/6442)
|
- FIXED: Apply workaround for Conan installation issue on CI. [#6442](https://github.com/Project-OSRM/osrm-backend/pull/6442)
|
||||||
|
|||||||
@ -83,7 +83,7 @@ struct EngineConfig final
|
|||||||
int max_locations_map_matching = -1;
|
int max_locations_map_matching = -1;
|
||||||
double max_radius_map_matching = -1.0;
|
double max_radius_map_matching = -1.0;
|
||||||
int max_results_nearest = -1;
|
int max_results_nearest = -1;
|
||||||
boost::optional<double> default_radius;
|
boost::optional<double> default_radius = -1.0;
|
||||||
int max_alternatives = 3; // set an arbitrary upper bound; can be adjusted by user
|
int max_alternatives = 3; // set an arbitrary upper bound; can be adjusted by user
|
||||||
bool use_shared_memory = true;
|
bool use_shared_memory = true;
|
||||||
boost::filesystem::path memory_file;
|
boost::filesystem::path memory_file;
|
||||||
|
|||||||
@ -72,7 +72,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
|||||||
[this, &max_distance, &max_results, input_coordinate](const std::size_t num_results,
|
[this, &max_distance, &max_results, input_coordinate](const std::size_t num_results,
|
||||||
const CandidateSegment &segment) {
|
const CandidateSegment &segment) {
|
||||||
return (max_results && num_results >= *max_results) ||
|
return (max_results && num_results >= *max_results) ||
|
||||||
(max_distance &&
|
(max_distance && max_distance != -1.0 &&
|
||||||
CheckSegmentDistance(input_coordinate, segment, *max_distance));
|
CheckSegmentDistance(input_coordinate, segment, *max_distance));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -163,7 +163,8 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
|||||||
auto distance = GetSegmentDistance(input_coordinate, segment);
|
auto distance = GetSegmentDistance(input_coordinate, segment);
|
||||||
auto further_than_big_component = distance > big_component_distance;
|
auto further_than_big_component = distance > big_component_distance;
|
||||||
auto no_more_candidates = has_big_component && further_than_big_component;
|
auto no_more_candidates = has_big_component && further_than_big_component;
|
||||||
auto too_far_away = max_distance && distance > *max_distance;
|
auto too_far_away =
|
||||||
|
max_distance && max_distance != -1.0 && distance > *max_distance;
|
||||||
|
|
||||||
// Time to terminate the search when:
|
// Time to terminate the search when:
|
||||||
// 1. We've found a node from a big component and the next candidate is further away
|
// 1. We've found a node from a big component and the next candidate is further away
|
||||||
|
|||||||
@ -13,12 +13,14 @@ bool EngineConfig::IsValid() const
|
|||||||
return v == -1 || v > limit;
|
return v == -1 || v > limit;
|
||||||
};
|
};
|
||||||
|
|
||||||
const bool limits_valid = unlimited_or_more_than(max_locations_distance_table, 2) &&
|
const bool limits_valid =
|
||||||
|
unlimited_or_more_than(max_locations_distance_table, 2) &&
|
||||||
unlimited_or_more_than(max_locations_map_matching, 2) &&
|
unlimited_or_more_than(max_locations_map_matching, 2) &&
|
||||||
unlimited_or_more_than(max_radius_map_matching, 0) &&
|
unlimited_or_more_than(max_radius_map_matching, 0) &&
|
||||||
unlimited_or_more_than(max_locations_trip, 2) &&
|
unlimited_or_more_than(max_locations_trip, 2) &&
|
||||||
unlimited_or_more_than(max_locations_viaroute, 2) &&
|
unlimited_or_more_than(max_locations_viaroute, 2) &&
|
||||||
unlimited_or_more_than(max_results_nearest, 0) &&
|
unlimited_or_more_than(max_results_nearest, 0) &&
|
||||||
|
(!default_radius.has_value() || unlimited_or_more_than(*default_radius, 0)) &&
|
||||||
max_alternatives >= 0;
|
max_alternatives >= 0;
|
||||||
|
|
||||||
return ((use_shared_memory && all_path_are_empty) || (use_mmap && storage_config.IsValid()) ||
|
return ((use_shared_memory && all_path_are_empty) || (use_mmap && storage_config.IsValid()) ||
|
||||||
|
|||||||
@ -181,7 +181,7 @@ Status MatchPlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
|||||||
if (tidied.parameters.radiuses.empty())
|
if (tidied.parameters.radiuses.empty())
|
||||||
{
|
{
|
||||||
search_radiuses.resize(tidied.parameters.coordinates.size(),
|
search_radiuses.resize(tidied.parameters.coordinates.size(),
|
||||||
default_radius.has_value()
|
default_radius.has_value() && *default_radius != -1.0
|
||||||
? *default_radius
|
? *default_radius
|
||||||
: routing_algorithms::DEFAULT_GPS_PRECISION * RADIUS_MULTIPLIER);
|
: routing_algorithms::DEFAULT_GPS_PRECISION * RADIUS_MULTIPLIER);
|
||||||
}
|
}
|
||||||
@ -199,7 +199,7 @@ Status MatchPlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return default_radius.has_value()
|
return default_radius.has_value() && *default_radius != -1.0
|
||||||
? *default_radius
|
? *default_radius
|
||||||
: routing_algorithms::DEFAULT_GPS_PRECISION * RADIUS_MULTIPLIER;
|
: routing_algorithms::DEFAULT_GPS_PRECISION * RADIUS_MULTIPLIER;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@
|
|||||||
#include <boost/algorithm/string/case_conv.hpp>
|
#include <boost/algorithm/string/case_conv.hpp>
|
||||||
#include <boost/any.hpp>
|
#include <boost/any.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
#include <boost/optional/optional_io.hpp>
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
@ -149,7 +150,7 @@ inline unsigned generateServerProgramOptions(const int argc,
|
|||||||
value<double>(&config.max_radius_map_matching)->default_value(-1.0),
|
value<double>(&config.max_radius_map_matching)->default_value(-1.0),
|
||||||
"Max. radius size supported in map matching query. Default: unlimited.") //
|
"Max. radius size supported in map matching query. Default: unlimited.") //
|
||||||
("default-radius",
|
("default-radius",
|
||||||
value<boost::optional<double>>(&config.default_radius),
|
value<boost::optional<double>>(&config.default_radius)->default_value(-1.0),
|
||||||
"Default radius size for queries. Default: unlimited.");
|
"Default radius size for queries. Default: unlimited.");
|
||||||
|
|
||||||
// hidden options, will be allowed on command line, but will not be shown to the user
|
// hidden options, will be allowed on command line, but will not be shown to the user
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user