Avoid -> Exclude

This commit is contained in:
Patrick Niklaus 2017-08-16 20:21:19 +00:00 committed by Patrick Niklaus
parent 45140ca9f7
commit d09f5c0e3a
27 changed files with 145 additions and 142 deletions

View File

@ -1,5 +1,5 @@
@routing @testbot @avoid @mld @routing @testbot @exclude @mld
Feature: Testbot - Avoid flags Feature: Testbot - Exclude flags
Background: Background:
Given the profile "testbot" Given the profile "testbot"
Given the node map Given the node map
@ -12,15 +12,15 @@ Feature: Testbot - Avoid flags
And the ways And the ways
| nodes | highway | toll | # | | nodes | highway | toll | # |
| ab | primary | | always drivable | | ab | primary | | always drivable |
| bc | motorway | | not drivable for avoid=motorway and avoid=motorway,toll | | bc | motorway | | not drivable for exclude=motorway and exclude=motorway,toll |
| be | primary | yes | not drivable for avoid=toll and avoid=motorway,toll | | be | primary | yes | not drivable for exclude=toll and exclude=motorway,toll |
| ef | primary | yes | not drivable for avoid=toll and avoid=motorway,toll | | ef | primary | yes | not drivable for exclude=toll and exclude=motorway,toll |
| fc | primary | yes | not drivable for avoid=toll and avoid=motorway,toll | | fc | primary | yes | not drivable for exclude=toll and exclude=motorway,toll |
| cd | motorway | yes | not drivable for avoid=motorway avoid=toll and avoid=motorway,toll | | cd | motorway | yes | not drivable for exclude=motorway exclude=toll and exclude=motorway,toll |
| fg | primary | | always drivable | | fg | primary | | always drivable |
| gd | primary | | always drivable | | gd | primary | | always drivable |
Scenario: Testbot - avoid nothing Scenario: Testbot - exclude nothing
When I route I should get When I route I should get
| from | to | route | | from | to | route |
| a | d | ab,bc,cd,cd | | a | d | ab,bc,cd,cd |
@ -28,9 +28,9 @@ Feature: Testbot - Avoid flags
| a | c | ab,bc,bc | | a | c | ab,bc,bc |
| a | f | ab,be,ef,ef | | a | f | ab,be,ef,ef |
Scenario: Testbot - avoid motorway Scenario: Testbot - exclude motorway
Given the query options Given the query options
| avoid | motorway | | exclude | motorway |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
@ -39,9 +39,9 @@ Feature: Testbot - Avoid flags
| a | c | ab,be,ef,fc,fc | | a | c | ab,be,ef,fc,fc |
| a | f | ab,be,ef,ef | | a | f | ab,be,ef,ef |
Scenario: Testbot - avoid toll Scenario: Testbot - exclude toll
Given the query options Given the query options
| avoid | toll | | exclude | toll |
When I route I should get When I route I should get
| from | to | route | | from | to | route |
@ -51,9 +51,9 @@ Feature: Testbot - Avoid flags
| a | f | | | a | f | |
| f | d | fg,gd,gd | | f | d | fg,gd,gd |
Scenario: Testbot - avoid motorway and toll Scenario: Testbot - exclude motorway and toll
Given the query options Given the query options
| avoid | motorway,toll | | exclude | motorway,toll |
When I route I should get When I route I should get
| from | to | route | | from | to | route |

View File

@ -56,7 +56,7 @@ template <typename AlgorithmT> struct HasManyToManySearch final : std::false_typ
template <typename AlgorithmT> struct HasGetTileTurns final : std::false_type template <typename AlgorithmT> struct HasGetTileTurns final : std::false_type
{ {
}; };
template <typename AlgorithmT> struct HasAvoidFlags final : std::false_type template <typename AlgorithmT> struct HasExcludeFlags final : std::false_type
{ {
}; };
@ -114,7 +114,7 @@ template <> struct HasManyToManySearch<mld::Algorithm> final : std::true_type
template <> struct HasGetTileTurns<mld::Algorithm> final : std::true_type template <> struct HasGetTileTurns<mld::Algorithm> final : std::true_type
{ {
}; };
template <> struct HasAvoidFlags<mld::Algorithm> final : std::true_type template <> struct HasExcludeFlags<mld::Algorithm> final : std::true_type
{ {
}; };
} }

View File

@ -68,7 +68,7 @@ struct BaseParameters
std::vector<boost::optional<double>> radiuses; std::vector<boost::optional<double>> radiuses;
std::vector<boost::optional<Bearing>> bearings; std::vector<boost::optional<Bearing>> bearings;
std::vector<boost::optional<Approach>> approaches; std::vector<boost::optional<Approach>> approaches;
std::vector<std::string> avoid; std::vector<std::string> exclude;
// Adds hints to response which can be included in subsequent requests, see `hints` above. // Adds hints to response which can be included in subsequent requests, see `hints` above.
bool generate_hints = true; bool generate_hints = true;
@ -79,9 +79,9 @@ struct BaseParameters
std::vector<boost::optional<Bearing>> bearings_ = {}, std::vector<boost::optional<Bearing>> bearings_ = {},
std::vector<boost::optional<Approach>> approaches_ = {}, std::vector<boost::optional<Approach>> approaches_ = {},
bool generate_hints_ = true, bool generate_hints_ = true,
std::vector<std::string> avoid = {}) std::vector<std::string> exclude = {})
: coordinates(coordinates_), hints(hints_), radiuses(radiuses_), bearings(bearings_), : coordinates(coordinates_), hints(hints_), radiuses(radiuses_), bearings(bearings_),
approaches(approaches_), avoid(std::move(avoid)), generate_hints(generate_hints_) approaches(approaches_), exclude(std::move(exclude)), generate_hints(generate_hints_)
{ {
} }

View File

@ -212,7 +212,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
using SharedGeospatialQuery = GeospatialQuery<SharedRTree, BaseDataFacade>; using SharedGeospatialQuery = GeospatialQuery<SharedRTree, BaseDataFacade>;
using RTreeNode = SharedRTree::TreeNode; using RTreeNode = SharedRTree::TreeNode;
extractor::ClassData avoid_mask; extractor::ClassData exclude_mask;
std::string m_timestamp; std::string m_timestamp;
extractor::ProfileProperties *m_profile_properties; extractor::ProfileProperties *m_profile_properties;
extractor::Datasources *m_datasources; extractor::Datasources *m_datasources;
@ -249,12 +249,12 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
void InitializeProfilePropertiesPointer(storage::DataLayout &data_layout, void InitializeProfilePropertiesPointer(storage::DataLayout &data_layout,
char *memory_block, char *memory_block,
const std::size_t avoid_index) const std::size_t exclude_index)
{ {
m_profile_properties = data_layout.GetBlockPtr<extractor::ProfileProperties>( m_profile_properties = data_layout.GetBlockPtr<extractor::ProfileProperties>(
memory_block, storage::DataLayout::PROPERTIES); memory_block, storage::DataLayout::PROPERTIES);
avoid_mask = m_profile_properties->avoidable_classes[avoid_index]; exclude_mask = m_profile_properties->excludable_classes[exclude_index];
} }
void InitializeTimestampPointer(storage::DataLayout &data_layout, char *memory_block) void InitializeTimestampPointer(storage::DataLayout &data_layout, char *memory_block)
@ -546,7 +546,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
void InitializeInternalPointers(storage::DataLayout &data_layout, void InitializeInternalPointers(storage::DataLayout &data_layout,
char *memory_block, char *memory_block,
const std::size_t avoid_index) const std::size_t exclude_index)
{ {
InitializeChecksumPointer(data_layout, memory_block); InitializeChecksumPointer(data_layout, memory_block);
InitializeNodeInformationPointers(data_layout, memory_block); InitializeNodeInformationPointers(data_layout, memory_block);
@ -557,7 +557,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
InitializeTimestampPointer(data_layout, memory_block); InitializeTimestampPointer(data_layout, memory_block);
InitializeNamePointers(data_layout, memory_block); InitializeNamePointers(data_layout, memory_block);
InitializeTurnLaneDescriptionsPointers(data_layout, memory_block); InitializeTurnLaneDescriptionsPointers(data_layout, memory_block);
InitializeProfilePropertiesPointer(data_layout, memory_block, avoid_index); InitializeProfilePropertiesPointer(data_layout, memory_block, exclude_index);
InitializeRTreePointers(data_layout, memory_block); InitializeRTreePointers(data_layout, memory_block);
InitializeIntersectionClassPointers(data_layout, memory_block); InitializeIntersectionClassPointers(data_layout, memory_block);
} }
@ -566,10 +566,10 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
// allows switching between process_memory/shared_memory datafacade, based on the type of // allows switching between process_memory/shared_memory datafacade, based on the type of
// allocator // allocator
ContiguousInternalMemoryDataFacadeBase(std::shared_ptr<ContiguousBlockAllocator> allocator_, ContiguousInternalMemoryDataFacadeBase(std::shared_ptr<ContiguousBlockAllocator> allocator_,
const std::size_t avoid_index) const std::size_t exclude_index)
: allocator(std::move(allocator_)) : allocator(std::move(allocator_))
{ {
InitializeInternalPointers(allocator->GetLayout(), allocator->GetMemory(), avoid_index); InitializeInternalPointers(allocator->GetLayout(), allocator->GetMemory(), exclude_index);
} }
// node and edge information access // node and edge information access
@ -810,9 +810,9 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
return edge_based_node_data.GetClassData(id); return edge_based_node_data.GetClassData(id);
} }
bool AvoidNode(const NodeID id) const override final bool ExcludeNode(const NodeID id) const override final
{ {
return (edge_based_node_data.GetClassData(id) & avoid_mask) > 0; return (edge_based_node_data.GetClassData(id) & exclude_mask) > 0;
} }
std::vector<std::string> GetClasses(const extractor::ClassData class_data) const override final std::vector<std::string> GetClasses(const extractor::ClassData class_data) const override final
@ -940,8 +940,8 @@ class ContiguousInternalMemoryDataFacade<CH>
{ {
public: public:
ContiguousInternalMemoryDataFacade(std::shared_ptr<ContiguousBlockAllocator> allocator, ContiguousInternalMemoryDataFacade(std::shared_ptr<ContiguousBlockAllocator> allocator,
const std::size_t avoid_index) const std::size_t exclude_index)
: ContiguousInternalMemoryDataFacadeBase(allocator, avoid_index), : ContiguousInternalMemoryDataFacadeBase(allocator, exclude_index),
ContiguousInternalMemoryAlgorithmDataFacade<CH>(allocator) ContiguousInternalMemoryAlgorithmDataFacade<CH>(allocator)
{ {
@ -955,8 +955,8 @@ class ContiguousInternalMemoryDataFacade<CoreCH> final
{ {
public: public:
ContiguousInternalMemoryDataFacade(std::shared_ptr<ContiguousBlockAllocator> allocator, ContiguousInternalMemoryDataFacade(std::shared_ptr<ContiguousBlockAllocator> allocator,
const std::size_t avoid_index) const std::size_t exclude_index)
: ContiguousInternalMemoryDataFacade<CH>(allocator, avoid_index), : ContiguousInternalMemoryDataFacade<CH>(allocator, exclude_index),
ContiguousInternalMemoryAlgorithmDataFacade<CoreCH>(allocator) ContiguousInternalMemoryAlgorithmDataFacade<CoreCH>(allocator)
{ {
@ -977,15 +977,15 @@ template <> class ContiguousInternalMemoryAlgorithmDataFacade<MLD> : public Algo
void InitializeInternalPointers(storage::DataLayout &data_layout, void InitializeInternalPointers(storage::DataLayout &data_layout,
char *memory_block, char *memory_block,
const std::size_t avoid_index) const std::size_t exclude_index)
{ {
InitializeMLDDataPointers(data_layout, memory_block, avoid_index); InitializeMLDDataPointers(data_layout, memory_block, exclude_index);
InitializeGraphPointer(data_layout, memory_block); InitializeGraphPointer(data_layout, memory_block);
} }
void InitializeMLDDataPointers(storage::DataLayout &data_layout, void InitializeMLDDataPointers(storage::DataLayout &data_layout,
char *memory_block, char *memory_block,
const std::size_t avoid_index) const std::size_t exclude_index)
{ {
if (data_layout.GetBlockSize(storage::DataLayout::MLD_PARTITION) > 0) if (data_layout.GetBlockSize(storage::DataLayout::MLD_PARTITION) > 0)
{ {
@ -1013,9 +1013,9 @@ template <> class ContiguousInternalMemoryAlgorithmDataFacade<MLD> : public Algo
} }
const auto weights_block_id = static_cast<storage::DataLayout::BlockID>( const auto weights_block_id = static_cast<storage::DataLayout::BlockID>(
storage::DataLayout::MLD_CELL_WEIGHTS_0 + avoid_index); storage::DataLayout::MLD_CELL_WEIGHTS_0 + exclude_index);
const auto durations_block_id = static_cast<storage::DataLayout::BlockID>( const auto durations_block_id = static_cast<storage::DataLayout::BlockID>(
storage::DataLayout::MLD_CELL_DURATIONS_0 + avoid_index); storage::DataLayout::MLD_CELL_DURATIONS_0 + exclude_index);
if (data_layout.GetBlockSize(weights_block_id) > 0) if (data_layout.GetBlockSize(weights_block_id) > 0)
{ {
@ -1098,10 +1098,10 @@ template <> class ContiguousInternalMemoryAlgorithmDataFacade<MLD> : public Algo
public: public:
ContiguousInternalMemoryAlgorithmDataFacade( ContiguousInternalMemoryAlgorithmDataFacade(
std::shared_ptr<ContiguousBlockAllocator> allocator_, const std::size_t avoid_index) std::shared_ptr<ContiguousBlockAllocator> allocator_, const std::size_t exclude_index)
: allocator(std::move(allocator_)) : allocator(std::move(allocator_))
{ {
InitializeInternalPointers(allocator->GetLayout(), allocator->GetMemory(), avoid_index); InitializeInternalPointers(allocator->GetLayout(), allocator->GetMemory(), exclude_index);
} }
const partition::MultiLevelPartitionView &GetMultiLevelPartition() const override const partition::MultiLevelPartitionView &GetMultiLevelPartition() const override
@ -1159,9 +1159,9 @@ class ContiguousInternalMemoryDataFacade<MLD> final
private: private:
public: public:
ContiguousInternalMemoryDataFacade(std::shared_ptr<ContiguousBlockAllocator> allocator, ContiguousInternalMemoryDataFacade(std::shared_ptr<ContiguousBlockAllocator> allocator,
const std::size_t avoid_index) const std::size_t exclude_index)
: ContiguousInternalMemoryDataFacadeBase(allocator, avoid_index), : ContiguousInternalMemoryDataFacadeBase(allocator, exclude_index),
ContiguousInternalMemoryAlgorithmDataFacade<MLD>(allocator, avoid_index) ContiguousInternalMemoryAlgorithmDataFacade<MLD>(allocator, exclude_index)
{ {
} }

View File

@ -94,7 +94,7 @@ class BaseDataFacade
virtual extractor::ClassData GetClassData(const NodeID id) const = 0; virtual extractor::ClassData GetClassData(const NodeID id) const = 0;
virtual bool AvoidNode(const NodeID id) const = 0; virtual bool ExcludeNode(const NodeID id) const = 0;
virtual std::vector<std::string> GetClasses(const extractor::ClassData class_data) const = 0; virtual std::vector<std::string> GetClasses(const extractor::ClassData class_data) const = 0;

View File

@ -23,7 +23,7 @@ namespace engine
// This class selects the right facade for // This class selects the right facade for
template <template <typename A> class FacadeT, typename AlgorithmT> class DataFacadeFactory template <template <typename A> class FacadeT, typename AlgorithmT> class DataFacadeFactory
{ {
static constexpr auto has_avoid_flags = routing_algorithms::HasAvoidFlags<AlgorithmT>{}; static constexpr auto has_exclude_flags = routing_algorithms::HasExcludeFlags<AlgorithmT>{};
public: public:
using Facade = FacadeT<AlgorithmT>; using Facade = FacadeT<AlgorithmT>;
@ -31,17 +31,17 @@ template <template <typename A> class FacadeT, typename AlgorithmT> class DataFa
template <typename AllocatorT> template <typename AllocatorT>
DataFacadeFactory(std::shared_ptr<AllocatorT> allocator) DataFacadeFactory(std::shared_ptr<AllocatorT> allocator)
: DataFacadeFactory(allocator, has_avoid_flags) : DataFacadeFactory(allocator, has_exclude_flags)
{ {
} }
template <typename ParameterT> std::shared_ptr<const Facade> Get(const ParameterT &params) const template <typename ParameterT> std::shared_ptr<const Facade> Get(const ParameterT &params) const
{ {
return Get(params, has_avoid_flags); return Get(params, has_exclude_flags);
} }
private: private:
// Algorithm with avoid flags // Algorithm with exclude flags
template <typename AllocatorT> template <typename AllocatorT>
DataFacadeFactory(std::shared_ptr<AllocatorT> allocator, std::true_type) DataFacadeFactory(std::shared_ptr<AllocatorT> allocator, std::true_type)
{ {
@ -63,7 +63,7 @@ template <template <typename A> class FacadeT, typename AlgorithmT> class DataFa
} }
} }
// Algorithm without avoid flags // Algorithm without exclude flags
template <typename AllocatorT> template <typename AllocatorT>
DataFacadeFactory(std::shared_ptr<AllocatorT> allocator, std::false_type) DataFacadeFactory(std::shared_ptr<AllocatorT> allocator, std::false_type)
{ {
@ -75,10 +75,10 @@ template <template <typename A> class FacadeT, typename AlgorithmT> class DataFa
return facades[0]; return facades[0];
} }
// Default for non-avoid flags: return only facade // Default for non-exclude flags: return only facade
std::shared_ptr<const Facade> Get(const api::BaseParameters &params, std::false_type) const std::shared_ptr<const Facade> Get(const api::BaseParameters &params, std::false_type) const
{ {
if (!params.avoid.empty()) if (!params.exclude.empty())
{ {
return {}; return {};
} }
@ -86,7 +86,7 @@ template <template <typename A> class FacadeT, typename AlgorithmT> class DataFa
return facades[0]; return facades[0];
} }
// TileParameters don't drive from BaseParameters and generally don't have use for avoid flags // TileParameters don't drive from BaseParameters and generally don't have use for exclude flags
std::shared_ptr<const Facade> Get(const api::TileParameters &, std::true_type) const std::shared_ptr<const Facade> Get(const api::TileParameters &, std::true_type) const
{ {
return facades[0]; return facades[0];
@ -95,11 +95,11 @@ template <template <typename A> class FacadeT, typename AlgorithmT> class DataFa
// Selection logic for finding the corresponding datafacade for the given parameters // Selection logic for finding the corresponding datafacade for the given parameters
std::shared_ptr<const Facade> Get(const api::BaseParameters &params, std::true_type) const std::shared_ptr<const Facade> Get(const api::BaseParameters &params, std::true_type) const
{ {
if (params.avoid.empty()) if (params.exclude.empty())
return facades[0]; return facades[0];
extractor::ClassData mask = 0; extractor::ClassData mask = 0;
for (const auto &name : params.avoid) for (const auto &name : params.exclude)
{ {
auto class_mask_iter = name_to_class.find(name); auto class_mask_iter = name_to_class.find(name);
if (class_mask_iter == name_to_class.end()) if (class_mask_iter == name_to_class.end())
@ -112,18 +112,19 @@ template <template <typename A> class FacadeT, typename AlgorithmT> class DataFa
} }
} }
auto avoid_iter = std::find( auto exclude_iter = std::find(
properties->avoidable_classes.begin(), properties->avoidable_classes.end(), mask); properties->excludable_classes.begin(), properties->excludable_classes.end(), mask);
if (avoid_iter != properties->avoidable_classes.end()) if (exclude_iter != properties->excludable_classes.end())
{ {
auto avoid_index = std::distance(properties->avoidable_classes.begin(), avoid_iter); auto exclude_index =
return facades[avoid_index]; std::distance(properties->excludable_classes.begin(), exclude_iter);
return facades[exclude_index];
} }
return {}; return {};
} }
std::array<std::shared_ptr<const Facade>, extractor::MAX_AVOIDABLE_CLASSES> facades; std::array<std::shared_ptr<const Facade>, extractor::MAX_EXCLUDABLE_CLASSES> facades;
std::unordered_map<std::string, extractor::ClassData> name_to_class; std::unordered_map<std::string, extractor::ClassData> name_to_class;
const extractor::ProfileProperties *properties = nullptr; const extractor::ProfileProperties *properties = nullptr;
}; };

View File

@ -57,7 +57,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
auto results = rtree.Nearest( auto results = rtree.Nearest(
input_coordinate, input_coordinate,
[this, approach, &input_coordinate](const CandidateSegment &segment) { [this, approach, &input_coordinate](const CandidateSegment &segment) {
return boolPairAnd(boolPairAnd(HasValidEdge(segment), CheckSegmentAvoid(segment)), return boolPairAnd(boolPairAnd(HasValidEdge(segment), CheckSegmentExclude(segment)),
CheckApproach(input_coordinate, segment, approach)); CheckApproach(input_coordinate, segment, approach));
}, },
[this, max_distance, input_coordinate](const std::size_t, [this, max_distance, input_coordinate](const std::size_t,
@ -83,7 +83,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
const CandidateSegment &segment) { const CandidateSegment &segment) {
auto use_direction = auto use_direction =
boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range), boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range),
boolPairAnd(HasValidEdge(segment), CheckSegmentAvoid(segment))); boolPairAnd(HasValidEdge(segment), CheckSegmentExclude(segment)));
use_direction = use_direction =
boolPairAnd(use_direction, CheckApproach(input_coordinate, segment, approach)); boolPairAnd(use_direction, CheckApproach(input_coordinate, segment, approach));
return use_direction; return use_direction;
@ -111,7 +111,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
const CandidateSegment &segment) { const CandidateSegment &segment) {
auto use_direction = auto use_direction =
boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range), boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range),
boolPairAnd(HasValidEdge(segment), CheckSegmentAvoid(segment))); boolPairAnd(HasValidEdge(segment), CheckSegmentExclude(segment)));
return boolPairAnd(use_direction, return boolPairAnd(use_direction,
CheckApproach(input_coordinate, segment, approach)); CheckApproach(input_coordinate, segment, approach));
}, },
@ -139,7 +139,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
const CandidateSegment &segment) { const CandidateSegment &segment) {
auto use_direction = auto use_direction =
boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range), boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range),
boolPairAnd(HasValidEdge(segment), CheckSegmentAvoid(segment))); boolPairAnd(HasValidEdge(segment), CheckSegmentExclude(segment)));
return boolPairAnd(use_direction, return boolPairAnd(use_direction,
CheckApproach(input_coordinate, segment, approach)); CheckApproach(input_coordinate, segment, approach));
}, },
@ -162,7 +162,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
auto results = rtree.Nearest( auto results = rtree.Nearest(
input_coordinate, input_coordinate,
[this, approach, &input_coordinate](const CandidateSegment &segment) { [this, approach, &input_coordinate](const CandidateSegment &segment) {
return boolPairAnd(boolPairAnd(HasValidEdge(segment), CheckSegmentAvoid(segment)), return boolPairAnd(boolPairAnd(HasValidEdge(segment), CheckSegmentExclude(segment)),
CheckApproach(input_coordinate, segment, approach)); CheckApproach(input_coordinate, segment, approach));
}, },
[max_results](const std::size_t num_results, const CandidateSegment &) { [max_results](const std::size_t num_results, const CandidateSegment &) {
@ -183,7 +183,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
auto results = rtree.Nearest( auto results = rtree.Nearest(
input_coordinate, input_coordinate,
[this, approach, &input_coordinate](const CandidateSegment &segment) { [this, approach, &input_coordinate](const CandidateSegment &segment) {
return boolPairAnd(boolPairAnd(HasValidEdge(segment), CheckSegmentAvoid(segment)), return boolPairAnd(boolPairAnd(HasValidEdge(segment), CheckSegmentExclude(segment)),
CheckApproach(input_coordinate, segment, approach)); CheckApproach(input_coordinate, segment, approach));
}, },
[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,
@ -212,7 +212,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
(!has_small_component || (!has_big_component && !IsTinyComponent(segment))); (!has_small_component || (!has_big_component && !IsTinyComponent(segment)));
auto use_directions = std::make_pair(use_segment, use_segment); auto use_directions = std::make_pair(use_segment, use_segment);
const auto valid_edges = HasValidEdge(segment); const auto valid_edges = HasValidEdge(segment);
const auto admissible_segments = CheckSegmentAvoid(segment); const auto admissible_segments = CheckSegmentExclude(segment);
use_directions = boolPairAnd(use_directions, admissible_segments); use_directions = boolPairAnd(use_directions, admissible_segments);
use_directions = boolPairAnd(use_directions, valid_edges); use_directions = boolPairAnd(use_directions, valid_edges);
use_directions = use_directions =
@ -259,7 +259,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
auto use_directions = std::make_pair(use_segment, use_segment); auto use_directions = std::make_pair(use_segment, use_segment);
const auto valid_edges = HasValidEdge(segment); const auto valid_edges = HasValidEdge(segment);
const auto admissible_segments = CheckSegmentAvoid(segment); const auto admissible_segments = CheckSegmentExclude(segment);
use_directions = boolPairAnd(use_directions, admissible_segments); use_directions = boolPairAnd(use_directions, admissible_segments);
use_directions = boolPairAnd(use_directions, valid_edges); use_directions = boolPairAnd(use_directions, valid_edges);
use_directions = use_directions =
@ -309,7 +309,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
auto use_segment = auto use_segment =
(!has_small_component || (!has_big_component && !IsTinyComponent(segment))); (!has_small_component || (!has_big_component && !IsTinyComponent(segment)));
auto use_directions = std::make_pair(use_segment, use_segment); auto use_directions = std::make_pair(use_segment, use_segment);
const auto admissible_segments = CheckSegmentAvoid(segment); const auto admissible_segments = CheckSegmentExclude(segment);
use_directions = boolPairAnd(use_directions, HasValidEdge(segment)); use_directions = boolPairAnd(use_directions, HasValidEdge(segment));
if (use_segment) if (use_segment)
@ -367,7 +367,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
auto use_segment = auto use_segment =
(!has_small_component || (!has_big_component && !IsTinyComponent(segment))); (!has_small_component || (!has_big_component && !IsTinyComponent(segment)));
auto use_directions = std::make_pair(use_segment, use_segment); auto use_directions = std::make_pair(use_segment, use_segment);
const auto admissible_segments = CheckSegmentAvoid(segment); const auto admissible_segments = CheckSegmentExclude(segment);
use_directions = boolPairAnd(use_directions, HasValidEdge(segment)); use_directions = boolPairAnd(use_directions, HasValidEdge(segment));
if (use_segment) if (use_segment)
@ -539,18 +539,18 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
max_distance; max_distance;
} }
std::pair<bool, bool> CheckSegmentAvoid(const CandidateSegment &segment) const std::pair<bool, bool> CheckSegmentExclude(const CandidateSegment &segment) const
{ {
std::pair<bool, bool> valid = {true, true}; std::pair<bool, bool> valid = {true, true};
if (segment.data.forward_segment_id.enabled && if (segment.data.forward_segment_id.enabled &&
datafacade.AvoidNode(segment.data.forward_segment_id.id)) datafacade.ExcludeNode(segment.data.forward_segment_id.id))
{ {
valid.first = false; valid.first = false;
} }
if (segment.data.reverse_segment_id.enabled && if (segment.data.reverse_segment_id.enabled &&
datafacade.AvoidNode(segment.data.reverse_segment_id.id)) datafacade.ExcludeNode(segment.data.reverse_segment_id.id))
{ {
valid.second = false; valid.second = false;
} }

View File

@ -46,14 +46,14 @@ class BasePlugin
return true; return true;
} }
if (!algorithms.HasAvoidFlags() && !params.avoid.empty()) if (!algorithms.HasExcludeFlags() && !params.exclude.empty())
{ {
Error("NotImplemented", "This algorithm does not support avoid flags.", result); Error("NotImplemented", "This algorithm does not support exclude flags.", result);
return false; return false;
} }
if (algorithms.HasAvoidFlags() && !params.avoid.empty()) if (algorithms.HasExcludeFlags() && !params.exclude.empty())
{ {
Error("InvalidValue", "Avoid flag combination is not supported.", result); Error("InvalidValue", "Exclude flag combination is not supported.", result);
return false; return false;
} }

View File

@ -54,7 +54,7 @@ class RoutingAlgorithmsInterface
virtual bool HasMapMatching() const = 0; virtual bool HasMapMatching() const = 0;
virtual bool HasManyToManySearch() const = 0; virtual bool HasManyToManySearch() const = 0;
virtual bool HasGetTileTurns() const = 0; virtual bool HasGetTileTurns() const = 0;
virtual bool HasAvoidFlags() const = 0; virtual bool HasExcludeFlags() const = 0;
virtual bool IsValid() const = 0; virtual bool IsValid() const = 0;
}; };
@ -129,9 +129,9 @@ template <typename Algorithm> class RoutingAlgorithms final : public RoutingAlgo
return routing_algorithms::HasGetTileTurns<Algorithm>::value; return routing_algorithms::HasGetTileTurns<Algorithm>::value;
} }
bool HasAvoidFlags() const final override bool HasExcludeFlags() const final override
{ {
return routing_algorithms::HasAvoidFlags<Algorithm>::value; return routing_algorithms::HasExcludeFlags<Algorithm>::value;
} }
bool IsValid() const final override { return static_cast<bool>(facade); } bool IsValid() const final override { return static_cast<bool>(facade); }

View File

@ -148,7 +148,7 @@ void routingStep(const DataFacade<Algorithm> &facade,
const auto node = forward_heap.DeleteMin(); const auto node = forward_heap.DeleteMin();
const auto weight = forward_heap.GetKey(node); const auto weight = forward_heap.GetKey(node);
BOOST_ASSERT(!facade.AvoidNode(node)); BOOST_ASSERT(!facade.ExcludeNode(node));
// Upper bound for the path source -> target with // Upper bound for the path source -> target with
// weight(source -> node) = weight weight(to -> target) ≤ reverse_weight // weight(source -> node) = weight weight(to -> target) ≤ reverse_weight
@ -238,7 +238,7 @@ void routingStep(const DataFacade<Algorithm> &facade,
{ {
const NodeID to = facade.GetTarget(edge); const NodeID to = facade.GetTarget(edge);
if (!facade.AvoidNode(to) && if (!facade.ExcludeNode(to) &&
checkParentCellRestriction(partition.GetCell(level + 1, to), args...)) checkParentCellRestriction(partition.GetCell(level + 1, to), args...))
{ {
BOOST_ASSERT_MSG(edge_data.weight > 0, "edge_weight invalid"); BOOST_ASSERT_MSG(edge_data.weight > 0, "edge_weight invalid");

View File

@ -13,7 +13,7 @@ namespace extractor
using ClassData = std::uint8_t; using ClassData = std::uint8_t;
constexpr ClassData INAVLID_CLASS_DATA = std::numeric_limits<ClassData>::max(); constexpr ClassData INAVLID_CLASS_DATA = std::numeric_limits<ClassData>::max();
static const std::uint8_t MAX_CLASS_INDEX = 8 - 1; static const std::uint8_t MAX_CLASS_INDEX = 8 - 1;
static const std::uint8_t MAX_AVOIDABLE_CLASSES = 8; static const std::uint8_t MAX_EXCLUDABLE_CLASSES = 8;
inline bool isSubset(const ClassData lhs, const ClassData rhs) { return (lhs & rhs) == lhs; } inline bool isSubset(const ClassData lhs, const ClassData rhs) { return (lhs & rhs) == lhs; }

View File

@ -30,7 +30,7 @@ struct ProfileProperties
use_turn_restrictions(false), left_hand_driving(false), fallback_to_duration(true), use_turn_restrictions(false), left_hand_driving(false), fallback_to_duration(true),
weight_name{"duration"}, call_tagless_node_function(true) weight_name{"duration"}, call_tagless_node_function(true)
{ {
std::fill(avoidable_classes.begin(), avoidable_classes.end(), INAVLID_CLASS_DATA); std::fill(excludable_classes.begin(), excludable_classes.end(), INAVLID_CLASS_DATA);
BOOST_ASSERT(weight_name[MAX_WEIGHT_NAME_LENGTH] == '\0'); BOOST_ASSERT(weight_name[MAX_WEIGHT_NAME_LENGTH] == '\0');
} }
@ -73,19 +73,19 @@ struct ProfileProperties
return std::string(weight_name); return std::string(weight_name);
} }
// Mark this combination of classes as avoidable // Mark this combination of classes as excludable
void SetAvoidableClasses(std::size_t index, ClassData classes) void SetExcludableClasses(std::size_t index, ClassData classes)
{ {
avoidable_classes[index] = classes; excludable_classes[index] = classes;
} }
// Check if this classes are avoidable // Check if this classes are excludable
boost::optional<std::size_t> ClassesAreAvoidable(ClassData classes) const boost::optional<std::size_t> ClassesAreExcludable(ClassData classes) const
{ {
auto iter = std::find(avoidable_classes.begin(), avoidable_classes.end(), classes); auto iter = std::find(excludable_classes.begin(), excludable_classes.end(), classes);
if (iter != avoidable_classes.end()) if (iter != excludable_classes.end())
{ {
return std::distance(avoidable_classes.begin(), iter); return std::distance(excludable_classes.begin(), iter);
} }
return {}; return {};
@ -130,8 +130,8 @@ struct ProfileProperties
char weight_name[MAX_WEIGHT_NAME_LENGTH + 1]; char weight_name[MAX_WEIGHT_NAME_LENGTH + 1];
//! stores the names of each class //! stores the names of each class
std::array<char[MAX_CLASS_NAME_LENGTH + 1], MAX_CLASS_INDEX + 1> class_names; std::array<char[MAX_CLASS_NAME_LENGTH + 1], MAX_CLASS_INDEX + 1> class_names;
//! stores the masks of avoidable class combinations //! stores the masks of excludable class combinations
std::array<ClassData, MAX_AVOIDABLE_CLASSES> avoidable_classes; std::array<ClassData, MAX_EXCLUDABLE_CLASSES> excludable_classes;
unsigned weight_precision = 1; unsigned weight_precision = 1;
bool force_split_edges = false; bool force_split_edges = false;
bool call_tagless_node_function = true; bool call_tagless_node_function = true;

View File

@ -52,7 +52,7 @@ class ScriptingEnvironment
virtual const ProfileProperties &GetProfileProperties() = 0; virtual const ProfileProperties &GetProfileProperties() = 0;
virtual std::vector<std::vector<std::string>> GetAvoidableClasses() = 0; virtual std::vector<std::vector<std::string>> GetExcludableClasses() = 0;
virtual std::vector<std::string> GetClassNames() = 0; virtual std::vector<std::string> GetClassNames() = 0;
virtual std::vector<std::string> GetNameSuffixList() = 0; virtual std::vector<std::string> GetNameSuffixList() = 0;
virtual std::vector<std::string> GetRestrictions() = 0; virtual std::vector<std::string> GetRestrictions() = 0;

View File

@ -58,7 +58,7 @@ class Sol2ScriptingEnvironment final : public ScriptingEnvironment
const ProfileProperties &GetProfileProperties() override; const ProfileProperties &GetProfileProperties() override;
std::vector<std::vector<std::string>> GetAvoidableClasses() override; std::vector<std::vector<std::string>> GetExcludableClasses() override;
std::vector<std::string> GetNameSuffixList() override; std::vector<std::string> GetNameSuffixList() override;
std::vector<std::string> GetClassNames() override; std::vector<std::string> GetClassNames() override;
std::vector<std::string> GetRestrictions() override; std::vector<std::string> GetRestrictions() override;

View File

@ -162,16 +162,16 @@ struct BaseParametersGrammar : boost::spirit::qi::grammar<Iterator, Signature>
(-approach_type % (-approach_type %
';')[ph::bind(&engine::api::BaseParameters::approaches, qi::_r1) = qi::_1]; ';')[ph::bind(&engine::api::BaseParameters::approaches, qi::_r1) = qi::_1];
avoid_rule = qi::lit("avoid=") > exclude_rule = qi::lit("exclude=") >
(qi::as_string[+qi::char_("a-zA-Z")] % (qi::as_string[+qi::char_("a-zA-Z")] %
',')[ph::bind(&engine::api::BaseParameters::avoid, qi::_r1) = qi::_1]; ',')[ph::bind(&engine::api::BaseParameters::exclude, qi::_r1) = qi::_1];
base_rule = radiuses_rule(qi::_r1) // base_rule = radiuses_rule(qi::_r1) //
| hints_rule(qi::_r1) // | hints_rule(qi::_r1) //
| bearings_rule(qi::_r1) // | bearings_rule(qi::_r1) //
| generate_hints_rule(qi::_r1) // | generate_hints_rule(qi::_r1) //
| approach_rule(qi::_r1) // | approach_rule(qi::_r1) //
| avoid_rule(qi::_r1); | exclude_rule(qi::_r1);
} }
protected: protected:
@ -185,7 +185,7 @@ struct BaseParametersGrammar : boost::spirit::qi::grammar<Iterator, Signature>
qi::rule<Iterator, Signature> generate_hints_rule; qi::rule<Iterator, Signature> generate_hints_rule;
qi::rule<Iterator, Signature> approach_rule; qi::rule<Iterator, Signature> approach_rule;
qi::rule<Iterator, Signature> avoid_rule; qi::rule<Iterator, Signature> exclude_rule;
qi::rule<Iterator, osrm::engine::Bearing()> bearing_rule; qi::rule<Iterator, osrm::engine::Bearing()> bearing_rule;
qi::rule<Iterator, osrm::util::Coordinate()> location_rule; qi::rule<Iterator, osrm::util::Coordinate()> location_rule;

View File

@ -104,8 +104,8 @@ function setup()
'toll', 'motorway', 'ferry', 'restricted' 'toll', 'motorway', 'ferry', 'restricted'
}, },
-- classes to support for avoid flags -- classes to support for exclude flags
avoidable = Sequence { excludable = Sequence {
Set {'toll'}, Set {'toll'},
Set {'motorway'}, Set {'motorway'},
Set {'ferry'} Set {'ferry'}

View File

@ -19,7 +19,9 @@ function setup()
use_turn_restrictions = true use_turn_restrictions = true
}, },
avoidable = { classes = {["motorway"] = true, ["toll"] = true},
excludable = {
[1] = {["motorway"] = true}, [1] = {["motorway"] = true},
[2] = {["toll"] = true}, [2] = {["toll"] = true},
[3] = {["motorway"] = true, ["toll"] = true} [3] = {["motorway"] = true, ["toll"] = true}

View File

@ -93,12 +93,12 @@ auto LoadAndUpdateEdgeExpandedGraph(const CustomizationConfig &config,
} }
std::vector<std::vector<bool>> std::vector<std::vector<bool>>
avoidFlagsToNodeFilter(const MultiLevelEdgeBasedGraph &graph, excludeFlagsToNodeFilter(const MultiLevelEdgeBasedGraph &graph,
const extractor::EdgeBasedNodeDataContainer &node_data, const extractor::EdgeBasedNodeDataContainer &node_data,
const extractor::ProfileProperties &properties) const extractor::ProfileProperties &properties)
{ {
std::vector<std::vector<bool>> filters; std::vector<std::vector<bool>> filters;
for (auto mask : properties.avoidable_classes) for (auto mask : properties.excludable_classes)
{ {
if (mask != extractor::INAVLID_CLASS_DATA) if (mask != extractor::INAVLID_CLASS_DATA)
{ {
@ -155,7 +155,7 @@ int Customizer::Run(const CustomizationConfig &config)
util::Log() << "Loading partition data took " << TIMER_SEC(loading_data) << " seconds"; util::Log() << "Loading partition data took " << TIMER_SEC(loading_data) << " seconds";
TIMER_START(cell_customize); TIMER_START(cell_customize);
auto filter = avoidFlagsToNodeFilter(graph, node_data, properties); auto filter = excludeFlagsToNodeFilter(graph, node_data, properties);
auto metrics = filterToMetrics(graph, storage, mlp, filter); auto metrics = filterToMetrics(graph, storage, mlp, filter);
TIMER_STOP(cell_customize); TIMER_STOP(cell_customize);
util::Log() << "Cells customization took " << TIMER_SEC(cell_customize) << " seconds"; util::Log() << "Cells customization took " << TIMER_SEC(cell_customize) << " seconds";

View File

@ -518,8 +518,8 @@ void unpackPackedPaths(InputIt first,
forward_heap.Insert(source, 0, {source}); forward_heap.Insert(source, 0, {source});
reverse_heap.Insert(target, 0, {target}); reverse_heap.Insert(target, 0, {target});
BOOST_ASSERT(!facade.AvoidNode(source)); BOOST_ASSERT(!facade.ExcludeNode(source));
BOOST_ASSERT(!facade.AvoidNode(target)); BOOST_ASSERT(!facade.ExcludeNode(target));
// TODO: when structured bindings will be allowed change to // TODO: when structured bindings will be allowed change to
// auto [subpath_weight, subpath_source, subpath_target, subpath] = ... // auto [subpath_weight, subpath_source, subpath_target, subpath] = ...

View File

@ -111,7 +111,7 @@ void relaxOutgoingEdges(const DataFacade<mld::Algorithm> &facade,
typename SearchEngineData<mld::Algorithm>::ManyToManyQueryHeap &query_heap, typename SearchEngineData<mld::Algorithm>::ManyToManyQueryHeap &query_heap,
const PhantomNode &phantom_node) const PhantomNode &phantom_node)
{ {
BOOST_ASSERT(!facade.AvoidNode(node)); BOOST_ASSERT(!facade.ExcludeNode(node));
const auto &partition = facade.GetMultiLevelPartition(); const auto &partition = facade.GetMultiLevelPartition();
const auto &cells = facade.GetCellStorage(); const auto &cells = facade.GetCellStorage();
@ -140,7 +140,7 @@ void relaxOutgoingEdges(const DataFacade<mld::Algorithm> &facade,
BOOST_ASSERT(!shortcut_durations.empty()); BOOST_ASSERT(!shortcut_durations.empty());
const NodeID to = *destination; const NodeID to = *destination;
if (facade.AvoidNode(to)) if (facade.ExcludeNode(to))
{ {
continue; continue;
} }
@ -174,7 +174,7 @@ void relaxOutgoingEdges(const DataFacade<mld::Algorithm> &facade,
BOOST_ASSERT(!shortcut_durations.empty()); BOOST_ASSERT(!shortcut_durations.empty());
const NodeID to = *source; const NodeID to = *source;
if (facade.AvoidNode(to)) if (facade.ExcludeNode(to))
{ {
continue; continue;
} }
@ -206,7 +206,7 @@ void relaxOutgoingEdges(const DataFacade<mld::Algorithm> &facade,
if (DIRECTION == FORWARD_DIRECTION ? data.forward : data.backward) if (DIRECTION == FORWARD_DIRECTION ? data.forward : data.backward)
{ {
const NodeID to = facade.GetTarget(edge); const NodeID to = facade.GetTarget(edge);
if (facade.AvoidNode(to)) if (facade.ExcludeNode(to))
{ {
continue; continue;
} }

View File

@ -114,21 +114,21 @@ void SetClassNames(const std::vector<std::string> &class_names,
} }
// Converts the class name list to a mask list // Converts the class name list to a mask list
void SetAvoidableClasses(const ExtractorCallbacks::ClassesMap &classes_map, void SetExcludableClasses(const ExtractorCallbacks::ClassesMap &classes_map,
const std::vector<std::vector<std::string>> &avoidable_classes, const std::vector<std::vector<std::string>> &excludable_classes,
ProfileProperties &profile_properties) ProfileProperties &profile_properties)
{ {
if (avoidable_classes.size() > MAX_AVOIDABLE_CLASSES) if (excludable_classes.size() > MAX_EXCLUDABLE_CLASSES)
{ {
throw util::exception("Only " + std::to_string(MAX_AVOIDABLE_CLASSES) + throw util::exception("Only " + std::to_string(MAX_EXCLUDABLE_CLASSES) +
" avoidable combinations allowed."); " excludable combinations allowed.");
} }
// The avoid index 0 is reserve for not avoiding anything // The exclude index 0 is reserve for not excludeing anything
profile_properties.SetAvoidableClasses(0, 0); profile_properties.SetExcludableClasses(0, 0);
std::size_t combination_index = 1; std::size_t combination_index = 1;
for (const auto &combination : avoidable_classes) for (const auto &combination : excludable_classes)
{ {
ClassData mask = 0; ClassData mask = 0;
for (const auto &name : combination) for (const auto &name : combination)
@ -137,7 +137,7 @@ void SetAvoidableClasses(const ExtractorCallbacks::ClassesMap &classes_map,
if (iter == classes_map.end()) if (iter == classes_map.end())
{ {
util::Log(logWARNING) util::Log(logWARNING)
<< "Unknown class name " + name + " in avoidable combination. Ignoring."; << "Unknown class name " + name + " in excludable combination. Ignoring.";
} }
else else
{ {
@ -147,7 +147,7 @@ void SetAvoidableClasses(const ExtractorCallbacks::ClassesMap &classes_map,
if (mask > 0) if (mask > 0)
{ {
profile_properties.SetAvoidableClasses(combination_index++, mask); profile_properties.SetExcludableClasses(combination_index++, mask);
} }
} }
} }
@ -414,8 +414,8 @@ Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment,
auto profile_properties = scripting_environment.GetProfileProperties(); auto profile_properties = scripting_environment.GetProfileProperties();
SetClassNames(scripting_environment.GetClassNames(), classes_map, profile_properties); SetClassNames(scripting_environment.GetClassNames(), classes_map, profile_properties);
auto avoidable_classes = scripting_environment.GetAvoidableClasses(); auto excludable_classes = scripting_environment.GetExcludableClasses();
SetAvoidableClasses(classes_map, avoidable_classes, profile_properties); SetExcludableClasses(classes_map, excludable_classes, profile_properties);
files::writeProfileProperties(config.GetPath(".osrm.properties").string(), profile_properties); files::writeProfileProperties(config.GetPath(".osrm.properties").string(), profile_properties);
TIMER_STOP(extracting); TIMER_STOP(extracting);

View File

@ -727,13 +727,13 @@ Sol2ScriptingEnvironment::GetStringListsFromTable(const std::string &table_name)
return string_lists; return string_lists;
} }
std::vector<std::vector<std::string>> Sol2ScriptingEnvironment::GetAvoidableClasses() std::vector<std::vector<std::string>> Sol2ScriptingEnvironment::GetExcludableClasses()
{ {
auto &context = GetSol2Context(); auto &context = GetSol2Context();
switch (context.api_version) switch (context.api_version)
{ {
case 2: case 2:
return Sol2ScriptingEnvironment::GetStringListsFromTable("avoidable"); return Sol2ScriptingEnvironment::GetStringListsFromTable("excludable");
default: default:
return {}; return {};
} }

View File

@ -284,7 +284,7 @@ BOOST_AUTO_TEST_CASE(four_levels_test)
storage_rec.GetCell(metric_rec, 2, 1).GetInWeight(12)); storage_rec.GetCell(metric_rec, 2, 1).GetInWeight(12));
} }
BOOST_AUTO_TEST_CASE(avoid_test) BOOST_AUTO_TEST_CASE(exclude_test)
{ {
// 0 --- 1 --- 5 --- 6 // 0 --- 1 --- 5 --- 6
// | / | | | // | / | | |
@ -305,7 +305,7 @@ BOOST_AUTO_TEST_CASE(avoid_test)
BOOST_REQUIRE_EQUAL(mlp.GetNumberOfLevels(), 4); BOOST_REQUIRE_EQUAL(mlp.GetNumberOfLevels(), 4);
auto graph = makeGraph(mlp, edges); auto graph = makeGraph(mlp, edges);
// avoid node 0, 3 and 7 // exclude node 0, 3 and 7
std::vector<bool> node_filter = {false, true, true, false, true, true, true, false}; std::vector<bool> node_filter = {false, true, true, false, true, true, true, false};
CellCustomizer customizer(mlp); CellCustomizer customizer(mlp);

View File

@ -340,7 +340,7 @@ class ContiguousInternalMemoryDataFacade<routing_algorithms::offline::Algorithm>
unsigned GetWeightPrecision() const override { return 0; } unsigned GetWeightPrecision() const override { return 0; }
double GetWeightMultiplier() const override { return 1; } double GetWeightMultiplier() const override { return 1; }
ComponentID GetComponentID(NodeID) const override { return ComponentID{}; } ComponentID GetComponentID(NodeID) const override { return ComponentID{}; }
bool AvoidNode(const NodeID) const override { return false; } bool ExcludeNode(const NodeID) const override { return false; }
util::guidance::TurnBearing PreTurnBearing(const EdgeID /*eid*/) const override util::guidance::TurnBearing PreTurnBearing(const EdgeID /*eid*/) const override
{ {

View File

@ -28,7 +28,7 @@ class MockBaseDataFacade : public engine::datafacade::BaseDataFacade
using StringView = util::StringView; using StringView = util::StringView;
public: public:
bool AvoidNode(const NodeID) const override { return false; }; bool ExcludeNode(const NodeID) const override { return false; };
util::Coordinate GetCoordinateOfNode(const NodeID /* id */) const override util::Coordinate GetCoordinateOfNode(const NodeID /* id */) const override
{ {

View File

@ -27,7 +27,7 @@ class MockScriptingEnvironment : public extractor::ScriptingEnvironment
} }
std::vector<std::string> GetNameSuffixList() override final { return {}; } std::vector<std::string> GetNameSuffixList() override final { return {}; }
std::vector<std::vector<std::string>> GetAvoidableClasses() override final { return {}; }; std::vector<std::vector<std::string>> GetExcludableClasses() override final { return {}; };
std::vector<std::string> GetClassNames() override { return {}; }; std::vector<std::string> GetClassNames() override { return {}; };
std::vector<std::string> GetRestrictions() override final { return {}; } std::vector<std::string> GetRestrictions() override final { return {}; }

View File

@ -472,11 +472,11 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
CHECK_EQUAL_RANGE(reference_20.coordinates, result_20->coordinates); CHECK_EQUAL_RANGE(reference_20.coordinates, result_20->coordinates);
CHECK_EQUAL_RANGE(reference_20.hints, result_20->hints); CHECK_EQUAL_RANGE(reference_20.hints, result_20->hints);
// avoid flags // exclude flags
RouteParameters reference_21{}; RouteParameters reference_21{};
reference_21.avoid = {"ferry", "motorway"}; reference_21.exclude = {"ferry", "motorway"};
reference_21.coordinates = coords_1; reference_21.coordinates = coords_1;
auto result_21 = parseParameters<RouteParameters>("1,2;3,4?avoid=ferry,motorway"); auto result_21 = parseParameters<RouteParameters>("1,2;3,4?exclude=ferry,motorway");
BOOST_CHECK(result_21); BOOST_CHECK(result_21);
BOOST_CHECK_EQUAL(reference_21.steps, result_21->steps); BOOST_CHECK_EQUAL(reference_21.steps, result_21->steps);
BOOST_CHECK_EQUAL(reference_21.alternatives, result_21->alternatives); BOOST_CHECK_EQUAL(reference_21.alternatives, result_21->alternatives);
@ -490,7 +490,7 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
CHECK_EQUAL_RANGE(reference_21.approaches, result_21->approaches); CHECK_EQUAL_RANGE(reference_21.approaches, result_21->approaches);
CHECK_EQUAL_RANGE(reference_21.coordinates, result_21->coordinates); CHECK_EQUAL_RANGE(reference_21.coordinates, result_21->coordinates);
CHECK_EQUAL_RANGE(reference_21.hints, result_21->hints); CHECK_EQUAL_RANGE(reference_21.hints, result_21->hints);
CHECK_EQUAL_RANGE(reference_21.avoid, result_21->avoid); CHECK_EQUAL_RANGE(reference_21.exclude, result_21->exclude);
} }
BOOST_AUTO_TEST_CASE(valid_table_urls) BOOST_AUTO_TEST_CASE(valid_table_urls)