add invalid_fallback_speed

This commit is contained in:
Kajari Ghosh 2018-12-09 23:23:47 -05:00
parent 5621e555b7
commit 8575eef1c9
3 changed files with 4 additions and 3 deletions

View File

@ -59,7 +59,7 @@ struct TableParameters : public BaseParameters
{
std::vector<std::size_t> sources;
std::vector<std::size_t> destinations;
double fallback_speed = 0;
double fallback_speed = INVALID_FALLBACK_SPEED;
enum class FallbackCoordinateType
{

View File

@ -116,6 +116,7 @@ static const EdgeDuration MAXIMAL_EDGE_DURATION = std::numeric_limits<EdgeDurati
static const EdgeDistance MAXIMAL_EDGE_DISTANCE = std::numeric_limits<EdgeDistance>::max();
static const TurnPenalty INVALID_TURN_PENALTY = std::numeric_limits<TurnPenalty>::max();
static const EdgeDistance INVALID_EDGE_DISTANCE = std::numeric_limits<EdgeDistance>::max();
static const EdgeDistance INVALID_FALLBACK_SPEED = std::numeric_limits<double>::max();
// FIXME the bitfields we use require a reduced maximal duration, this should be kept consistent
// within the code base. For now we have to ensure that we don't case 30 bit to -1 and break any

View File

@ -96,7 +96,7 @@ Status TablePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
}
// Scan table for null results - if any exist, replace with distance estimates
if (params.fallback_speed > 0 || params.scale_factor > 0)
if (params.fallback_speed != INVALID_FALLBACK_SPEED || params.scale_factor > 0)
{
for (std::size_t row = 0; row < num_sources; row++)
{
@ -104,7 +104,7 @@ Status TablePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
{
const auto &table_index = row * num_destinations + column;
BOOST_ASSERT(table_index < result_tables_pair.first.size());
if (params.fallback_speed > 0 &&
if (params.fallback_speed != INVALID_FALLBACK_SPEED && params.fallback_speed > 0 &&
result_tables_pair.first[table_index] == MAXIMAL_EDGE_DURATION)
{
const auto &source =