Refactoring enum Approach in enum class.

Suppress "engine::"

Signed-off-by: FILLAU Jean-Maxime <jean-maxime.fillau@mapotempo.com>
This commit is contained in:
FILLAU Jean-Maxime 2017-05-29 16:13:15 +02:00 committed by Patrick Niklaus
parent c573cdb0ae
commit 98ad9d8b61
6 changed files with 81 additions and 77 deletions

View File

@ -28,15 +28,17 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef OSRM_ENGINE_APPROACH_HPP #ifndef OSRM_ENGINE_APPROACH_HPP
#define OSRM_ENGINE_APPROACH_HPP #define OSRM_ENGINE_APPROACH_HPP
#include <cstdint>
namespace osrm namespace osrm
{ {
namespace engine namespace engine
{ {
enum Approach enum class Approach : std::uint8_t
{ {
CURB, CURB = 0,
UNRESTRICTED UNRESTRICTED = 1
}; };
} }

View File

@ -652,7 +652,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
std::vector<PhantomNodeWithDistance> std::vector<PhantomNodeWithDistance>
NearestPhantomNodesInRange(const util::Coordinate input_coordinate, NearestPhantomNodesInRange(const util::Coordinate input_coordinate,
const float max_distance, const float max_distance,
const engine::Approach approach) const override final const Approach approach) const override final
{ {
BOOST_ASSERT(m_geospatial_query.get()); BOOST_ASSERT(m_geospatial_query.get());
@ -665,7 +665,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
const float max_distance, const float max_distance,
const int bearing, const int bearing,
const int bearing_range, const int bearing_range,
const engine::Approach approach) const override final const Approach approach) const override final
{ {
BOOST_ASSERT(m_geospatial_query.get()); BOOST_ASSERT(m_geospatial_query.get());
@ -676,7 +676,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
std::vector<PhantomNodeWithDistance> std::vector<PhantomNodeWithDistance>
NearestPhantomNodes(const util::Coordinate input_coordinate, NearestPhantomNodes(const util::Coordinate input_coordinate,
const unsigned max_results, const unsigned max_results,
const engine::Approach approach) const override final const Approach approach) const override final
{ {
BOOST_ASSERT(m_geospatial_query.get()); BOOST_ASSERT(m_geospatial_query.get());
@ -687,7 +687,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
NearestPhantomNodes(const util::Coordinate input_coordinate, NearestPhantomNodes(const util::Coordinate input_coordinate,
const unsigned max_results, const unsigned max_results,
const double max_distance, const double max_distance,
const engine::Approach approach) const override final const Approach approach) const override final
{ {
BOOST_ASSERT(m_geospatial_query.get()); BOOST_ASSERT(m_geospatial_query.get());
@ -700,7 +700,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
const unsigned max_results, const unsigned max_results,
const int bearing, const int bearing,
const int bearing_range, const int bearing_range,
const engine::Approach approach) const override final const Approach approach) const override final
{ {
BOOST_ASSERT(m_geospatial_query.get()); BOOST_ASSERT(m_geospatial_query.get());
@ -714,7 +714,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
const double max_distance, const double max_distance,
const int bearing, const int bearing,
const int bearing_range, const int bearing_range,
const engine::Approach approach) const override final const Approach approach) const override final
{ {
BOOST_ASSERT(m_geospatial_query.get()); BOOST_ASSERT(m_geospatial_query.get());
@ -722,9 +722,9 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
input_coordinate, max_results, max_distance, bearing, bearing_range, approach); input_coordinate, max_results, max_distance, bearing, bearing_range, approach);
} }
std::pair<PhantomNode, PhantomNode> NearestPhantomNodeWithAlternativeFromBigComponent( std::pair<PhantomNode, PhantomNode>
const util::Coordinate input_coordinate, NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const engine::Approach approach) const override final const Approach approach) const override final
{ {
BOOST_ASSERT(m_geospatial_query.get()); BOOST_ASSERT(m_geospatial_query.get());
@ -732,10 +732,10 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
input_coordinate, approach); input_coordinate, approach);
} }
std::pair<PhantomNode, PhantomNode> NearestPhantomNodeWithAlternativeFromBigComponent( std::pair<PhantomNode, PhantomNode>
const util::Coordinate input_coordinate, NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const double max_distance, const double max_distance,
const engine::Approach approach) const override final const Approach approach) const override final
{ {
BOOST_ASSERT(m_geospatial_query.get()); BOOST_ASSERT(m_geospatial_query.get());
@ -743,12 +743,12 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
input_coordinate, max_distance, approach); input_coordinate, max_distance, approach);
} }
std::pair<PhantomNode, PhantomNode> NearestPhantomNodeWithAlternativeFromBigComponent( std::pair<PhantomNode, PhantomNode>
const util::Coordinate input_coordinate, NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const double max_distance, const double max_distance,
const int bearing, const int bearing,
const int bearing_range, const int bearing_range,
const engine::Approach approach) const override final const Approach approach) const override final
{ {
BOOST_ASSERT(m_geospatial_query.get()); BOOST_ASSERT(m_geospatial_query.get());
@ -756,11 +756,11 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
input_coordinate, max_distance, bearing, bearing_range, approach); input_coordinate, max_distance, bearing, bearing_range, approach);
} }
std::pair<PhantomNode, PhantomNode> NearestPhantomNodeWithAlternativeFromBigComponent( std::pair<PhantomNode, PhantomNode>
const util::Coordinate input_coordinate, NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const int bearing, const int bearing,
const int bearing_range, const int bearing_range,
const engine::Approach approach) const override final const Approach approach) const override final
{ {
BOOST_ASSERT(m_geospatial_query.get()); BOOST_ASSERT(m_geospatial_query.get());

View File

@ -95,11 +95,11 @@ class BaseDataFacade
const float max_distance, const float max_distance,
const int bearing, const int bearing,
const int bearing_range, const int bearing_range,
const engine::Approach approach) const = 0; const Approach approach) const = 0;
virtual std::vector<PhantomNodeWithDistance> virtual std::vector<PhantomNodeWithDistance>
NearestPhantomNodesInRange(const util::Coordinate input_coordinate, NearestPhantomNodesInRange(const util::Coordinate input_coordinate,
const float max_distance, const float max_distance,
const engine::Approach approach) const = 0; const Approach approach) const = 0;
virtual std::vector<PhantomNodeWithDistance> virtual std::vector<PhantomNodeWithDistance>
NearestPhantomNodes(const util::Coordinate input_coordinate, NearestPhantomNodes(const util::Coordinate input_coordinate,
@ -107,41 +107,41 @@ class BaseDataFacade
const double max_distance, const double max_distance,
const int bearing, const int bearing,
const int bearing_range, const int bearing_range,
const engine::Approach approach) const = 0; const Approach approach) const = 0;
virtual std::vector<PhantomNodeWithDistance> virtual std::vector<PhantomNodeWithDistance>
NearestPhantomNodes(const util::Coordinate input_coordinate, NearestPhantomNodes(const util::Coordinate input_coordinate,
const unsigned max_results, const unsigned max_results,
const int bearing, const int bearing,
const int bearing_range, const int bearing_range,
const engine::Approach approach) const = 0; const Approach approach) const = 0;
virtual std::vector<PhantomNodeWithDistance> virtual std::vector<PhantomNodeWithDistance>
NearestPhantomNodes(const util::Coordinate input_coordinate, NearestPhantomNodes(const util::Coordinate input_coordinate,
const unsigned max_results, const unsigned max_results,
const engine::Approach approach) const = 0; const Approach approach) const = 0;
virtual std::vector<PhantomNodeWithDistance> virtual std::vector<PhantomNodeWithDistance>
NearestPhantomNodes(const util::Coordinate input_coordinate, NearestPhantomNodes(const util::Coordinate input_coordinate,
const unsigned max_results, const unsigned max_results,
const double max_distance, const double max_distance,
const engine::Approach approach) const = 0; const Approach approach) const = 0;
virtual std::pair<PhantomNode, PhantomNode> virtual std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate, NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const engine::Approach approach) const = 0; const Approach approach) const = 0;
virtual std::pair<PhantomNode, PhantomNode> virtual std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate, NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const double max_distance, const double max_distance,
const engine::Approach approach) const = 0; const Approach approach) const = 0;
virtual std::pair<PhantomNode, PhantomNode> virtual std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate, NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const double max_distance, const double max_distance,
const int bearing, const int bearing,
const int bearing_range, const int bearing_range,
const engine::Approach approach) const = 0; const Approach approach) const = 0;
virtual std::pair<PhantomNode, PhantomNode> virtual std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate, NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const int bearing, const int bearing,
const int bearing_range, const int bearing_range,
const engine::Approach approach) const = 0; const Approach approach) const = 0;
virtual bool HasLaneData(const EdgeID id) const = 0; virtual bool HasLaneData(const EdgeID id) const = 0;
virtual util::guidance::LaneTupleIdPair GetLaneData(const EdgeID id) const = 0; virtual util::guidance::LaneTupleIdPair GetLaneData(const EdgeID id) const = 0;

View File

@ -16,8 +16,6 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include <util/log.hpp>
namespace osrm namespace osrm
{ {
namespace engine namespace engine
@ -54,13 +52,13 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
std::vector<PhantomNodeWithDistance> std::vector<PhantomNodeWithDistance>
NearestPhantomNodesInRange(const util::Coordinate input_coordinate, NearestPhantomNodesInRange(const util::Coordinate input_coordinate,
const double max_distance, const double max_distance,
const engine::Approach approach) const const Approach approach) const
{ {
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(HasValidEdge(segment), return boolPairAnd(HasValidEdge(segment),
approach_usage(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,
const CandidateSegment &segment) { const CandidateSegment &segment) {
@ -77,7 +75,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
const double max_distance, const double max_distance,
const int bearing, const int bearing,
const int bearing_range, const int bearing_range,
const engine::Approach approach) const const Approach approach) const
{ {
auto results = rtree.Nearest( auto results = rtree.Nearest(
input_coordinate, input_coordinate,
@ -86,7 +84,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
auto use_direction = boolPairAnd( auto use_direction = boolPairAnd(
CheckSegmentBearing(segment, bearing, bearing_range), HasValidEdge(segment)); CheckSegmentBearing(segment, bearing, bearing_range), HasValidEdge(segment));
use_direction = use_direction =
boolPairAnd(use_direction, approach_usage(input_coordinate, segment, approach)); boolPairAnd(use_direction, CheckApproach(input_coordinate, segment, approach));
return use_direction; return use_direction;
}, },
[this, max_distance, input_coordinate](const std::size_t, [this, max_distance, input_coordinate](const std::size_t,
@ -104,7 +102,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
const unsigned max_results, const unsigned max_results,
const int bearing, const int bearing,
const int bearing_range, const int bearing_range,
const engine::Approach approach) const const Approach approach) const
{ {
auto results = rtree.Nearest( auto results = rtree.Nearest(
input_coordinate, input_coordinate,
@ -113,7 +111,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
auto use_direction = boolPairAnd( auto use_direction = boolPairAnd(
CheckSegmentBearing(segment, bearing, bearing_range), HasValidEdge(segment)); CheckSegmentBearing(segment, bearing, bearing_range), HasValidEdge(segment));
return boolPairAnd(use_direction, return boolPairAnd(use_direction,
approach_usage(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 &) {
return num_results >= max_results; return num_results >= max_results;
@ -131,7 +129,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
const double max_distance, const double max_distance,
const int bearing, const int bearing,
const int bearing_range, const int bearing_range,
const engine::Approach approach) const const Approach approach) const
{ {
auto results = rtree.Nearest( auto results = rtree.Nearest(
input_coordinate, input_coordinate,
@ -140,7 +138,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
auto use_direction = boolPairAnd( auto use_direction = boolPairAnd(
CheckSegmentBearing(segment, bearing, bearing_range), HasValidEdge(segment)); CheckSegmentBearing(segment, bearing, bearing_range), HasValidEdge(segment));
return boolPairAnd(use_direction, return boolPairAnd(use_direction,
approach_usage(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,
const CandidateSegment &segment) { const CandidateSegment &segment) {
@ -156,13 +154,13 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
std::vector<PhantomNodeWithDistance> std::vector<PhantomNodeWithDistance>
NearestPhantomNodes(const util::Coordinate input_coordinate, NearestPhantomNodes(const util::Coordinate input_coordinate,
const unsigned max_results, const unsigned max_results,
const engine::Approach approach) const const Approach approach) const
{ {
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(HasValidEdge(segment), return boolPairAnd(HasValidEdge(segment),
approach_usage(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 &) {
return num_results >= max_results; return num_results >= max_results;
@ -177,13 +175,13 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
NearestPhantomNodes(const util::Coordinate input_coordinate, NearestPhantomNodes(const util::Coordinate input_coordinate,
const unsigned max_results, const unsigned max_results,
const double max_distance, const double max_distance,
const engine::Approach approach) const const Approach approach) const
{ {
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(HasValidEdge(segment), return boolPairAnd(HasValidEdge(segment),
approach_usage(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,
const CandidateSegment &segment) { const CandidateSegment &segment) {
@ -199,7 +197,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
std::pair<PhantomNode, PhantomNode> std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate, NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const double max_distance, const double max_distance,
const engine::Approach approach) const const Approach approach) const
{ {
bool has_small_component = false; bool has_small_component = false;
bool has_big_component = false; bool has_big_component = false;
@ -212,8 +210,8 @@ 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);
use_directions = boolPairAnd(use_directions, valid_edges); use_directions = boolPairAnd(use_directions, valid_edges);
use_directions = boolPairAnd(use_directions, use_directions =
approach_usage(input_coordinate, segment, approach)); boolPairAnd(use_directions, CheckApproach(input_coordinate, segment, approach));
if (use_directions.first || use_directions.second) if (use_directions.first || use_directions.second)
{ {
@ -243,7 +241,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
// a second phantom node is return that is the nearest coordinate in a big component. // a second phantom node is return that is the nearest coordinate in a big component.
std::pair<PhantomNode, PhantomNode> std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate, NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const engine::Approach approach) const const Approach approach) const
{ {
bool has_small_component = false; bool has_small_component = false;
bool has_big_component = false; bool has_big_component = false;
@ -257,8 +255,8 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
const auto valid_edges = HasValidEdge(segment); const auto valid_edges = HasValidEdge(segment);
use_directions = boolPairAnd(use_directions, valid_edges); use_directions = boolPairAnd(use_directions, valid_edges);
use_directions = boolPairAnd(use_directions, use_directions =
approach_usage(input_coordinate, segment, approach)); boolPairAnd(use_directions, CheckApproach(input_coordinate, segment, approach));
if (use_directions.first || use_directions.second) if (use_directions.first || use_directions.second)
{ {
@ -288,7 +286,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate, NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const int bearing, const int bearing,
const int bearing_range, const int bearing_range,
const engine::Approach approach) const const Approach approach) const
{ {
bool has_small_component = false; bool has_small_component = false;
bool has_big_component = false; bool has_big_component = false;
@ -312,7 +310,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range), boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range),
HasValidEdge(segment)); HasValidEdge(segment));
use_directions = boolPairAnd( use_directions = boolPairAnd(
use_directions, approach_usage(input_coordinate, segment, approach)); use_directions, CheckApproach(input_coordinate, segment, approach));
if (use_directions.first || use_directions.second) if (use_directions.first || use_directions.second)
{ {
@ -344,7 +342,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
const double max_distance, const double max_distance,
const int bearing, const int bearing,
const int bearing_range, const int bearing_range,
const engine::Approach approach) const const Approach approach) const
{ {
bool has_small_component = false; bool has_small_component = false;
bool has_big_component = false; bool has_big_component = false;
@ -368,7 +366,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range), boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range),
HasValidEdge(segment)); HasValidEdge(segment));
use_directions = boolPairAnd( use_directions = boolPairAnd(
use_directions, approach_usage(input_coordinate, segment, approach)); use_directions, CheckApproach(input_coordinate, segment, approach));
if (use_directions.first || use_directions.second) if (use_directions.first || use_directions.second)
{ {
@ -601,13 +599,13 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
return datafacade.GetComponentID(data.forward_segment_id.id).is_tiny; return datafacade.GetComponentID(data.forward_segment_id.id).is_tiny;
} }
std::pair<bool, bool> approach_usage(const util::Coordinate &input_coordinate, std::pair<bool, bool> CheckApproach(const util::Coordinate &input_coordinate,
const CandidateSegment &segment, const CandidateSegment &segment,
const engine::Approach approach) const const Approach approach) const
{ {
bool isOnewaySegment = bool isOnewaySegment =
!(segment.data.forward_segment_id.enabled && segment.data.reverse_segment_id.enabled); !(segment.data.forward_segment_id.enabled && segment.data.reverse_segment_id.enabled);
if (!isOnewaySegment && approach == CURB) if (!isOnewaySegment && approach == Approach::CURB)
{ {
// Check the counter clockwise // Check the counter clockwise
// //

View File

@ -306,7 +306,7 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo<v8::Value> &arg
if (!approaches->IsArray()) if (!approaches->IsArray())
{ {
Nan::ThrowError("Approaches must be an array of arrays of numbers"); Nan::ThrowError("Approaches must be an arrays of strings");
return false; return false;
} }
@ -326,7 +326,7 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo<v8::Value> &arg
if (approach_raw->IsNull()) if (approach_raw->IsNull())
{ {
params->bearings.emplace_back(); params->approaches.emplace_back();
} }
else if (approach_raw->IsString()) else if (approach_raw->IsString())
{ {
@ -343,7 +343,7 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo<v8::Value> &arg
} }
else else
{ {
Nan::ThrowError("'approach' param must be one of [curb, unrestricted]"); Nan::ThrowError("'approaches' param must be one of [curb, unrestricted]");
return false; return false;
} }
} }

View File

@ -363,7 +363,8 @@ BOOST_AUTO_TEST_CASE(radius_regression_test)
Coordinate input(FloatLongitude{5.2}, FloatLatitude{5.0}); Coordinate input(FloatLongitude{5.2}, FloatLatitude{5.0});
{ {
auto results = query.NearestPhantomNodesInRange(input, 0.01, osrm::engine::UNRESTRICTED); auto results =
query.NearestPhantomNodesInRange(input, 0.01, osrm::engine::Approach::UNRESTRICTED);
BOOST_CHECK_EQUAL(results.size(), 0); BOOST_CHECK_EQUAL(results.size(), 0);
} }
} }
@ -390,19 +391,21 @@ BOOST_AUTO_TEST_CASE(bearing_tests)
Coordinate input(FloatLongitude{5.1}, FloatLatitude{5.0}); Coordinate input(FloatLongitude{5.1}, FloatLatitude{5.0});
{ {
auto results = query.NearestPhantomNodes(input, 5, osrm::engine::UNRESTRICTED); auto results = query.NearestPhantomNodes(input, 5, osrm::engine::Approach::UNRESTRICTED);
BOOST_CHECK_EQUAL(results.size(), 2); BOOST_CHECK_EQUAL(results.size(), 2);
BOOST_CHECK_EQUAL(results.back().phantom_node.forward_segment_id.id, 0); BOOST_CHECK_EQUAL(results.back().phantom_node.forward_segment_id.id, 0);
BOOST_CHECK_EQUAL(results.back().phantom_node.reverse_segment_id.id, 1); BOOST_CHECK_EQUAL(results.back().phantom_node.reverse_segment_id.id, 1);
} }
{ {
auto results = query.NearestPhantomNodes(input, 5, 270, 10, osrm::engine::UNRESTRICTED); auto results =
query.NearestPhantomNodes(input, 5, 270, 10, osrm::engine::Approach::UNRESTRICTED);
BOOST_CHECK_EQUAL(results.size(), 0); BOOST_CHECK_EQUAL(results.size(), 0);
} }
{ {
auto results = query.NearestPhantomNodes(input, 5, 45, 10, osrm::engine::UNRESTRICTED); auto results =
query.NearestPhantomNodes(input, 5, 45, 10, osrm::engine::Approach::UNRESTRICTED);
BOOST_CHECK_EQUAL(results.size(), 2); BOOST_CHECK_EQUAL(results.size(), 2);
BOOST_CHECK(results[0].phantom_node.forward_segment_id.enabled); BOOST_CHECK(results[0].phantom_node.forward_segment_id.enabled);
@ -415,19 +418,20 @@ BOOST_AUTO_TEST_CASE(bearing_tests)
} }
{ {
auto results = query.NearestPhantomNodesInRange(input, 11000, osrm::engine::UNRESTRICTED); auto results =
query.NearestPhantomNodesInRange(input, 11000, osrm::engine::Approach::UNRESTRICTED);
BOOST_CHECK_EQUAL(results.size(), 2); BOOST_CHECK_EQUAL(results.size(), 2);
} }
{ {
auto results = auto results = query.NearestPhantomNodesInRange(
query.NearestPhantomNodesInRange(input, 11000, 270, 10, osrm::engine::UNRESTRICTED); input, 11000, 270, 10, osrm::engine::Approach::UNRESTRICTED);
BOOST_CHECK_EQUAL(results.size(), 0); BOOST_CHECK_EQUAL(results.size(), 0);
} }
{ {
auto results = auto results = query.NearestPhantomNodesInRange(
query.NearestPhantomNodesInRange(input, 11000, 45, 10, osrm::engine::UNRESTRICTED); input, 11000, 45, 10, osrm::engine::Approach::UNRESTRICTED);
BOOST_CHECK_EQUAL(results.size(), 2); BOOST_CHECK_EQUAL(results.size(), 2);
BOOST_CHECK(results[0].phantom_node.forward_segment_id.enabled); BOOST_CHECK(results[0].phantom_node.forward_segment_id.enabled);