Allow -1.0 as unlimited for default_radius value (#6599)

This commit is contained in:
Whytro
2023-05-31 14:52:35 +09:00
committed by GitHub
parent 0ca913132a
commit 72da455185
8 changed files with 74 additions and 18 deletions
+9 -7
View File
@@ -13,13 +13,15 @@ bool EngineConfig::IsValid() const
return v == -1 || v > limit;
};
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_radius_map_matching, 0) &&
unlimited_or_more_than(max_locations_trip, 2) &&
unlimited_or_more_than(max_locations_viaroute, 2) &&
unlimited_or_more_than(max_results_nearest, 0) &&
max_alternatives >= 0;
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_radius_map_matching, 0) &&
unlimited_or_more_than(max_locations_trip, 2) &&
unlimited_or_more_than(max_locations_viaroute, 2) &&
unlimited_or_more_than(max_results_nearest, 0) &&
(!default_radius.has_value() || unlimited_or_more_than(*default_radius, 0)) &&
max_alternatives >= 0;
return ((use_shared_memory && all_path_are_empty) || (use_mmap && storage_config.IsValid()) ||
storage_config.IsValid()) &&
+2 -2
View File
@@ -181,7 +181,7 @@ Status MatchPlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
if (tidied.parameters.radiuses.empty())
{
search_radiuses.resize(tidied.parameters.coordinates.size(),
default_radius.has_value()
default_radius.has_value() && *default_radius != -1.0
? *default_radius
: routing_algorithms::DEFAULT_GPS_PRECISION * RADIUS_MULTIPLIER);
}
@@ -199,7 +199,7 @@ Status MatchPlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
}
else
{
return default_radius.has_value()
return default_radius.has_value() && *default_radius != -1.0
? *default_radius
: routing_algorithms::DEFAULT_GPS_PRECISION * RADIUS_MULTIPLIER;
}