Adapts all unit tests and benchmarks to compile under v5 again
This commit is contained in:
parent
0f0db4c823
commit
1486098065
@ -1,14 +1,16 @@
|
|||||||
#include "extractor/query_node.hpp"
|
|
||||||
#include "util/static_rtree.hpp"
|
|
||||||
#include "extractor/edge_based_node.hpp"
|
|
||||||
#include "engine/geospatial_query.hpp"
|
#include "engine/geospatial_query.hpp"
|
||||||
|
#include "extractor/query_node.hpp"
|
||||||
|
#include "extractor/edge_based_node.hpp"
|
||||||
|
#include "util/static_rtree.hpp"
|
||||||
#include "util/timing_util.hpp"
|
#include "util/timing_util.hpp"
|
||||||
#include "mocks/mock_datafacade.hpp"
|
|
||||||
#include "util/coordinate.hpp"
|
#include "util/coordinate.hpp"
|
||||||
|
#include "mocks/mock_datafacade.hpp"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
|
#include <boost/filesystem/fstream.hpp>
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace benchmarks
|
namespace benchmarks
|
||||||
@ -77,7 +79,8 @@ void benchmark(BenchStaticRTree &rtree, BenchQuery &geo_query, unsigned num_quer
|
|||||||
std::vector<util::Coordinate> queries;
|
std::vector<util::Coordinate> queries;
|
||||||
for (unsigned i = 0; i < num_queries; i++)
|
for (unsigned i = 0; i < num_queries; i++)
|
||||||
{
|
{
|
||||||
queries.emplace_back(lat_udist(mt_rand), lon_udist(mt_rand));
|
queries.emplace_back(util::FixedLongitude{lon_udist(mt_rand)},
|
||||||
|
util::FixedLatitude{lat_udist(mt_rand)});
|
||||||
}
|
}
|
||||||
|
|
||||||
benchmarkQuery(queries, "raw RTree queries (1 result)", [&rtree](const util::Coordinate &q)
|
benchmarkQuery(queries, "raw RTree queries (1 result)", [&rtree](const util::Coordinate &q)
|
||||||
@ -126,9 +129,8 @@ int main(int argc, char **argv)
|
|||||||
auto coords = osrm::benchmarks::loadCoordinates(nodes_path);
|
auto coords = osrm::benchmarks::loadCoordinates(nodes_path);
|
||||||
|
|
||||||
osrm::benchmarks::BenchStaticRTree rtree(ram_path, file_path, coords);
|
osrm::benchmarks::BenchStaticRTree rtree(ram_path, file_path, coords);
|
||||||
std::unique_ptr<osrm::benchmarks::MockDataFacade> mockfacade_ptr(
|
osrm::test::MockDataFacade mockfacade;
|
||||||
new osrm::benchmarks::MockDataFacade);
|
osrm::benchmarks::BenchQuery query(rtree, coords, mockfacade);
|
||||||
osrm::benchmarks::BenchQuery query(rtree, coords, *mockfacade_ptr);
|
|
||||||
|
|
||||||
osrm::benchmarks::benchmark(rtree, query, 10000);
|
osrm::benchmarks::benchmark(rtree, query, 10000);
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
|
#include "util/coordinate.hpp"
|
||||||
#include "util/coordinate_calculation.hpp"
|
#include "util/coordinate_calculation.hpp"
|
||||||
|
|
||||||
#include "util/string_util.hpp"
|
|
||||||
#include "util/trigonometry_table.hpp"
|
#include "util/trigonometry_table.hpp"
|
||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
@ -8,6 +7,7 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
@ -260,11 +260,13 @@ double computeAngle(const Coordinate first, const Coordinate second, const Coord
|
|||||||
Coordinate interpolateLinear(double factor, const Coordinate from, const Coordinate to)
|
Coordinate interpolateLinear(double factor, const Coordinate from, const Coordinate to)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(0 <= factor && factor <= 1.0);
|
BOOST_ASSERT(0 <= factor && factor <= 1.0);
|
||||||
return {
|
|
||||||
from.lon +
|
FloatLongitude interpolated_lon{((1. - factor) * static_cast<std::int32_t>(from.lon)) +
|
||||||
toFixed(FloatLongitude(factor * static_cast<double>(toFloating(to.lon - from.lon)))),
|
(factor * static_cast<std::int32_t>(to.lon))};
|
||||||
from.lat +
|
FloatLatitude interpolated_lat{((1. - factor) * static_cast<std::int32_t>(from.lat)) +
|
||||||
toFixed(FloatLatitude(factor * static_cast<double>(toFloating(to.lat - from.lat))))};
|
(factor * static_cast<std::int32_t>(to.lat))};
|
||||||
|
|
||||||
|
return {std::move(interpolated_lon), std::move(interpolated_lat)};
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace mercator
|
namespace mercator
|
||||||
|
@ -31,16 +31,15 @@ BOOST_AUTO_TEST_CASE(long_road_test)
|
|||||||
CompressedEdgeContainer container;
|
CompressedEdgeContainer container;
|
||||||
|
|
||||||
std::vector<InputEdge> edges = {
|
std::vector<InputEdge> edges = {
|
||||||
// source, target, distance, edge_id, name_id, access_restricted, reversed, roundabout,
|
// src, tgt, dist, edge_id, name_id, access_restricted, fwd, bkwd, roundabout, travel_mode
|
||||||
// travel_mode
|
{0, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{0, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{1, 0, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{1, 0, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{1, 2, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{1, 2, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{2, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{2, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{2, 3, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{2, 3, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{3, 2, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{3, 2, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{3, 4, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{3, 4, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{4, 3, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE}};
|
||||||
{4, 3, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT}};
|
|
||||||
|
|
||||||
BOOST_ASSERT(edges[0].data.IsCompatibleTo(edges[2].data));
|
BOOST_ASSERT(edges[0].data.IsCompatibleTo(edges[2].data));
|
||||||
BOOST_ASSERT(edges[2].data.IsCompatibleTo(edges[4].data));
|
BOOST_ASSERT(edges[2].data.IsCompatibleTo(edges[4].data));
|
||||||
@ -72,20 +71,19 @@ BOOST_AUTO_TEST_CASE(loop_test)
|
|||||||
CompressedEdgeContainer container;
|
CompressedEdgeContainer container;
|
||||||
|
|
||||||
std::vector<InputEdge> edges = {
|
std::vector<InputEdge> edges = {
|
||||||
// source, target, distance, edge_id, name_id, access_restricted, forward, backward,
|
// src, tgt, dist, edge_id, name_id, access_restricted, fwd, bkwd, roundabout, travel_mode
|
||||||
// roundabout, travel_mode
|
{0, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{0, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{0, 5, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{0, 5, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{1, 0, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{1, 0, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{1, 2, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{1, 2, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{2, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{2, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{2, 3, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{2, 3, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{3, 2, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{3, 2, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{3, 4, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{3, 4, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{4, 3, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{4, 3, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{4, 5, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{4, 5, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{5, 0, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{5, 0, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{5, 4, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{5, 4, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
BOOST_ASSERT(edges.size() == 12);
|
BOOST_ASSERT(edges.size() == 12);
|
||||||
@ -129,14 +127,13 @@ BOOST_AUTO_TEST_CASE(t_intersection)
|
|||||||
CompressedEdgeContainer container;
|
CompressedEdgeContainer container;
|
||||||
|
|
||||||
std::vector<InputEdge> edges = {
|
std::vector<InputEdge> edges = {
|
||||||
// source, target, distance, edge_id, name_id, access_restricted, reversed, roundabout,
|
// src, tgt, dist, edge_id, name_id, access_restricted, fwd, bkwd, roundabout, travel_mode
|
||||||
// travel_mode
|
{0, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{0, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{1, 0, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{1, 0, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{1, 2, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{1, 2, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{1, 3, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{1, 3, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{2, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{2, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{3, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{3, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
BOOST_ASSERT(edges[0].data.IsCompatibleTo(edges[1].data));
|
BOOST_ASSERT(edges[0].data.IsCompatibleTo(edges[1].data));
|
||||||
@ -167,12 +164,11 @@ BOOST_AUTO_TEST_CASE(street_name_changes)
|
|||||||
CompressedEdgeContainer container;
|
CompressedEdgeContainer container;
|
||||||
|
|
||||||
std::vector<InputEdge> edges = {
|
std::vector<InputEdge> edges = {
|
||||||
// source, target, distance, edge_id, name_id, access_restricted, forward, backward,
|
// src, tgt, dist, edge_id, name_id, access_restricted, fwd, bkwd, roundabout, travel_mode
|
||||||
// roundabout, travel_mode
|
{0, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{0, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{1, 0, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{1, 0, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{1, 2, 1, SPECIAL_EDGEID, 1, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{1, 2, 1, SPECIAL_EDGEID, 1, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{2, 1, 1, SPECIAL_EDGEID, 1, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{2, 1, 1, SPECIAL_EDGEID, 1, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
BOOST_ASSERT(edges[0].data.IsCompatibleTo(edges[1].data));
|
BOOST_ASSERT(edges[0].data.IsCompatibleTo(edges[1].data));
|
||||||
@ -199,12 +195,11 @@ BOOST_AUTO_TEST_CASE(direction_changes)
|
|||||||
CompressedEdgeContainer container;
|
CompressedEdgeContainer container;
|
||||||
|
|
||||||
std::vector<InputEdge> edges = {
|
std::vector<InputEdge> edges = {
|
||||||
// source, target, distance, edge_id, name_id, access_restricted, reverse, roundabout,
|
// src, tgt, dist, edge_id, name_id, access_restricted, fwd, bkwd, roundabout, travel_mode
|
||||||
// travel_mode
|
{0, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{0, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{1, 0, 1, SPECIAL_EDGEID, 0, false, true, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{1, 0, 1, SPECIAL_EDGEID, 0, false, true, false, true, TRAVEL_MODE_DEFAULT},
|
{1, 2, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{1, 2, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
{2, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||||
{2, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Graph graph(5, edges);
|
Graph graph(5, edges);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
// implements all data storage when shared memory _IS_ used
|
// implements all data storage when shared memory _IS_ used
|
||||||
|
|
||||||
|
#include "extractor/guidance/turn_instruction.hpp"
|
||||||
#include "engine/datafacade/datafacade_base.hpp"
|
#include "engine/datafacade/datafacade_base.hpp"
|
||||||
#include "contractor/query_edge.hpp"
|
#include "contractor/query_edge.hpp"
|
||||||
|
|
||||||
@ -11,18 +12,17 @@ namespace osrm
|
|||||||
namespace test
|
namespace test
|
||||||
{
|
{
|
||||||
|
|
||||||
template <class EdgeDataT>
|
class MockDataFacade final : public engine::datafacade::BaseDataFacade
|
||||||
class MockDataFacadeT final : public osrm::engine::datafacade::BaseDataFacade<EdgeDataT>
|
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
EdgeDataT foo;
|
EdgeData foo;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
unsigned GetNumberOfNodes() const { return 0; }
|
unsigned GetNumberOfNodes() const { return 0; }
|
||||||
unsigned GetNumberOfEdges() const { return 0; }
|
unsigned GetNumberOfEdges() const { return 0; }
|
||||||
unsigned GetOutDegree(const NodeID /* n */) const { return 0; }
|
unsigned GetOutDegree(const NodeID /* n */) const { return 0; }
|
||||||
NodeID GetTarget(const EdgeID /* e */) const { return SPECIAL_NODEID; }
|
NodeID GetTarget(const EdgeID /* e */) const { return SPECIAL_NODEID; }
|
||||||
const EdgeDataT &GetEdgeData(const EdgeID /* e */) const { return foo; }
|
const EdgeData &GetEdgeData(const EdgeID /* e */) const { return foo; }
|
||||||
EdgeID BeginEdges(const NodeID /* n */) const { return SPECIAL_EDGEID; }
|
EdgeID BeginEdges(const NodeID /* n */) const { return SPECIAL_EDGEID; }
|
||||||
EdgeID EndEdges(const NodeID /* n */) const { return SPECIAL_EDGEID; }
|
EdgeID EndEdges(const NodeID /* n */) const { return SPECIAL_EDGEID; }
|
||||||
osrm::engine::datafacade::EdgeRange GetAdjacentEdgeRange(const NodeID /* node */) const
|
osrm::engine::datafacade::EdgeRange GetAdjacentEdgeRange(const NodeID /* node */) const
|
||||||
@ -40,10 +40,9 @@ class MockDataFacadeT final : public osrm::engine::datafacade::BaseDataFacade<Ed
|
|||||||
{
|
{
|
||||||
return SPECIAL_EDGEID;
|
return SPECIAL_EDGEID;
|
||||||
}
|
}
|
||||||
util::FixedPointCoordinate GetCoordinateOfNode(const unsigned /* id */) const
|
util::Coordinate GetCoordinateOfNode(const unsigned /* id */) const
|
||||||
{
|
{
|
||||||
FixedPointCoordinate foo(0, 0);
|
return {util::FixedLongitude{0}, util::FixedLatitude{0}};
|
||||||
return foo;
|
|
||||||
}
|
}
|
||||||
bool EdgeIsCompressed(const unsigned /* id */) const { return false; }
|
bool EdgeIsCompressed(const unsigned /* id */) const { return false; }
|
||||||
unsigned GetGeometryIndexForEdgeID(const unsigned /* id */) const { return SPECIAL_NODEID; }
|
unsigned GetGeometryIndexForEdgeID(const unsigned /* id */) const { return SPECIAL_NODEID; }
|
||||||
@ -55,48 +54,99 @@ class MockDataFacadeT final : public osrm::engine::datafacade::BaseDataFacade<Ed
|
|||||||
std::vector<EdgeWeight> & /* result_weights */) const
|
std::vector<EdgeWeight> & /* result_weights */) const
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
extractor::TurnInstruction GetTurnInstructionForEdgeID(const unsigned /* id */) const
|
extractor::guidance::TurnInstruction GetTurnInstructionForEdgeID(const unsigned /* id */) const
|
||||||
{
|
{
|
||||||
return osrm::extractor::TurnInstruction::NoTurn;
|
return extractor::guidance::TurnInstruction::NO_TURN();
|
||||||
}
|
}
|
||||||
extractor::TravelMode GetTravelModeForEdgeID(const unsigned /* id */) const
|
extractor::TravelMode GetTravelModeForEdgeID(const unsigned /* id */) const
|
||||||
{
|
{
|
||||||
return TRAVEL_MODE_DEFAULT;
|
return TRAVEL_MODE_INACCESSIBLE;
|
||||||
}
|
}
|
||||||
std::vector<typename osrm::engine::datafacade::BaseDataFacade<EdgeDataT>::RTreeLeaf>
|
std::vector<RTreeLeaf> GetEdgesInBox(const util::Coordinate /* south_west */,
|
||||||
GetEdgesInBox(const util::FixedPointCoordinate & /* south_west */,
|
const util::Coordinate /*north_east */)
|
||||||
const util::FixedPointCoordinate & /*north_east */)
|
|
||||||
{
|
{
|
||||||
std::vector<typename osrm::engine::datafacade::BaseDataFacade<EdgeDataT>::RTreeLeaf> foo;
|
return {};
|
||||||
return foo;
|
|
||||||
}
|
}
|
||||||
std::vector<osrm::engine::PhantomNodeWithDistance>
|
|
||||||
NearestPhantomNodesInRange(const util::FixedPointCoordinate /* input_coordinate */,
|
std::vector<engine::PhantomNodeWithDistance>
|
||||||
const float /* max_distance */,
|
NearestPhantomNodesInRange(const util::Coordinate /*input_coordinate*/,
|
||||||
const int /* bearing = 0 */,
|
const float /*max_distance*/,
|
||||||
const int /* bearing_range = 180 */)
|
const int /*bearing*/,
|
||||||
|
const int /*bearing_range*/)
|
||||||
{
|
{
|
||||||
std::vector<osrm::engine::PhantomNodeWithDistance> foo;
|
return {};
|
||||||
return foo;
|
|
||||||
}
|
}
|
||||||
std::vector<osrm::engine::PhantomNodeWithDistance>
|
|
||||||
NearestPhantomNodes(const util::FixedPointCoordinate /* input_coordinate */,
|
std::vector<engine::PhantomNodeWithDistance>
|
||||||
const unsigned /* max_results */,
|
NearestPhantomNodesInRange(const util::Coordinate /*input_coordinate*/,
|
||||||
const int /* bearing = 0 */,
|
const float /*max_distance*/)
|
||||||
const int /* bearing_range = 180 */)
|
|
||||||
{
|
{
|
||||||
std::vector<osrm::engine::PhantomNodeWithDistance> foo;
|
return {};
|
||||||
return foo;
|
|
||||||
}
|
}
|
||||||
std::pair<osrm::engine::PhantomNode, osrm::engine::PhantomNode>
|
|
||||||
NearestPhantomNodeWithAlternativeFromBigComponent(
|
std::vector<engine::PhantomNodeWithDistance>
|
||||||
const util::FixedPointCoordinate /* input_coordinate */,
|
NearestPhantomNodes(const util::Coordinate /*input_coordinate*/,
|
||||||
const int /* bearing = 0 */,
|
const unsigned /*max_results*/,
|
||||||
const int /* bearing_range = 180 */)
|
const double /*max_distance*/,
|
||||||
|
const int /*bearing*/,
|
||||||
|
const int /*bearing_range*/)
|
||||||
{
|
{
|
||||||
std::pair<osrm::engine::PhantomNode, osrm::engine::PhantomNode> foo;
|
return {};
|
||||||
return foo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<engine::PhantomNodeWithDistance>
|
||||||
|
NearestPhantomNodes(const util::Coordinate /*input_coordinate*/,
|
||||||
|
const unsigned /*max_results*/,
|
||||||
|
const int /*bearing*/,
|
||||||
|
const int /*bearing_range*/)
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<engine::PhantomNodeWithDistance>
|
||||||
|
NearestPhantomNodes(const util::Coordinate /*input_coordinate*/, const unsigned /*max_results*/)
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<engine::PhantomNodeWithDistance>
|
||||||
|
NearestPhantomNodes(const util::Coordinate /*input_coordinate*/,
|
||||||
|
const unsigned /*max_results*/,
|
||||||
|
const double /*max_distance*/)
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
std::pair<engine::PhantomNode, engine::PhantomNode>
|
||||||
|
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate /*input_coordinate*/)
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
std::pair<engine::PhantomNode, engine::PhantomNode>
|
||||||
|
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate /*input_coordinate*/,
|
||||||
|
const double /*max_distance*/)
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
std::pair<engine::PhantomNode, engine::PhantomNode>
|
||||||
|
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate /*input_coordinate*/,
|
||||||
|
const double /*max_distance*/,
|
||||||
|
const int /*bearing*/,
|
||||||
|
const int /*bearing_range*/)
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
std::pair<engine::PhantomNode, engine::PhantomNode>
|
||||||
|
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate /*input_coordinate*/,
|
||||||
|
const int /*bearing*/,
|
||||||
|
const int /*bearing_range*/)
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
};
|
||||||
|
|
||||||
unsigned GetCheckSum() const { return 0; }
|
unsigned GetCheckSum() const { return 0; }
|
||||||
bool IsCoreNode(const NodeID /* id */) const { return false; }
|
bool IsCoreNode(const NodeID /* id */) const { return false; }
|
||||||
unsigned GetNameIndexFromEdgeID(const unsigned /* id */) const { return 0; }
|
unsigned GetNameIndexFromEdgeID(const unsigned /* id */) const { return 0; }
|
||||||
@ -105,9 +155,7 @@ class MockDataFacadeT final : public osrm::engine::datafacade::BaseDataFacade<Ed
|
|||||||
std::string GetTimestamp() const { return ""; }
|
std::string GetTimestamp() const { return ""; }
|
||||||
bool GetUTurnsDefault() const override { return true; }
|
bool GetUTurnsDefault() const override { return true; }
|
||||||
};
|
};
|
||||||
|
} // ns test
|
||||||
using MockDataFacade = MockDataFacadeT<contractor::QueryEdge::EdgeData>;
|
} // ns osrm
|
||||||
} // osrm::test::
|
|
||||||
} // osrm::
|
|
||||||
|
|
||||||
#endif // MOCK_DATAFACADE_HPP
|
#endif // MOCK_DATAFACADE_HPP
|
||||||
|
@ -303,19 +303,18 @@ BOOST_AUTO_TEST_CASE(regression_test)
|
|||||||
using Edge = std::pair<unsigned, unsigned>;
|
using Edge = std::pair<unsigned, unsigned>;
|
||||||
GraphFixture fixture(
|
GraphFixture fixture(
|
||||||
{
|
{
|
||||||
Coord{FloatLongitude{0.0}, FloatLatitude{40.0}}, //
|
Coord{FloatLongitude{0.0}, FloatLatitude{40.0}}, //
|
||||||
Coord{FloatLongitude{5.0}, FloatLatitude{35.0}}, //
|
Coord{FloatLongitude{5.0}, FloatLatitude{35.0}}, //
|
||||||
Coord{FloatLongitude{5.0},
|
Coord{FloatLongitude{5.0},
|
||||||
FloatLatitude{
|
FloatLatitude{
|
||||||
5.0,
|
5.0, }}, //
|
||||||
}}, //
|
Coord{FloatLongitude{10.0}, FloatLatitude{0.0}}, //
|
||||||
Coord{FloatLongitude{10.0}, FloatLatitude{0.0}}, //
|
Coord{FloatLongitude{10.0}, FloatLatitude{20.0}}, //
|
||||||
Coord{FloatLongitude{10.0}, FloatLatitude{20.0}}, //
|
Coord{FloatLongitude{5.0}, FloatLatitude{20.0}}, //
|
||||||
Coord{FloatLongitude{5.0}, FloatLatitude{20.0}}, //
|
Coord{FloatLongitude{100.0}, FloatLatitude{40.0}}, //
|
||||||
Coord{FloatLongitude{100.0}, FloatLatitude{40.0}}, //
|
Coord{FloatLongitude{105.0}, FloatLatitude{35.0}}, //
|
||||||
Coord{FloatLongitude{105.0}, FloatLatitude{35.0}}, //
|
Coord{FloatLongitude{105.0}, FloatLatitude{5.0}}, //
|
||||||
Coord{FloatLongitude{105.0}, FloatLatitude{5.0}}, //
|
Coord{FloatLongitude{110.0}, FloatLatitude{0.0}}, //
|
||||||
Coord{FloatLongitude{110.0}, FloatLatitude{0.0}}, //
|
|
||||||
},
|
},
|
||||||
{Edge(0, 1), Edge(2, 3), Edge(4, 5), Edge(6, 7), Edge(8, 9)});
|
{Edge(0, 1), Edge(2, 3), Edge(4, 5), Edge(6, 7), Edge(8, 9)});
|
||||||
|
|
||||||
@ -399,8 +398,8 @@ BOOST_AUTO_TEST_CASE(bearing_tests)
|
|||||||
using Edge = std::pair<unsigned, unsigned>;
|
using Edge = std::pair<unsigned, unsigned>;
|
||||||
GraphFixture fixture(
|
GraphFixture fixture(
|
||||||
{
|
{
|
||||||
Coord(FloatLongitude(0.0), FloatLatitude(0.0)),
|
Coord(FloatLongitude(0.0), FloatLatitude(0.0)),
|
||||||
Coord(FloatLongitude(10.0), FloatLatitude(10.0)),
|
Coord(FloatLongitude(10.0), FloatLatitude(10.0)),
|
||||||
},
|
},
|
||||||
{Edge(0, 1), Edge(1, 0)});
|
{Edge(0, 1), Edge(1, 0)});
|
||||||
|
|
||||||
@ -408,9 +407,9 @@ BOOST_AUTO_TEST_CASE(bearing_tests)
|
|||||||
std::string nodes_path;
|
std::string nodes_path;
|
||||||
build_rtree<GraphFixture, MiniStaticRTree>("test_bearing", &fixture, leaves_path, nodes_path);
|
build_rtree<GraphFixture, MiniStaticRTree>("test_bearing", &fixture, leaves_path, nodes_path);
|
||||||
MiniStaticRTree rtree(nodes_path, leaves_path, fixture.coords);
|
MiniStaticRTree rtree(nodes_path, leaves_path, fixture.coords);
|
||||||
std::unique_ptr<MockDataFacade> mockfacade_ptr(new MockDataFacade);
|
MockDataFacade mockfacade;
|
||||||
engine::GeospatialQuery<MiniStaticRTree, MockDataFacade> query(rtree, fixture.coords,
|
engine::GeospatialQuery<MiniStaticRTree, MockDataFacade> query(rtree, fixture.coords,
|
||||||
*mockfacade_ptr);
|
mockfacade);
|
||||||
|
|
||||||
Coordinate input(FloatLongitude(5.1), FloatLatitude(5.0));
|
Coordinate input(FloatLongitude(5.1), FloatLatitude(5.0));
|
||||||
|
|
||||||
@ -462,11 +461,11 @@ BOOST_AUTO_TEST_CASE(bbox_search_tests)
|
|||||||
|
|
||||||
GraphFixture fixture(
|
GraphFixture fixture(
|
||||||
{
|
{
|
||||||
Coord(FloatLongitude(0.0), FloatLatitude(0.0)),
|
Coord(FloatLongitude(0.0), FloatLatitude(0.0)),
|
||||||
Coord(FloatLongitude(1.0), FloatLatitude(1.0)),
|
Coord(FloatLongitude(1.0), FloatLatitude(1.0)),
|
||||||
Coord(FloatLongitude(2.0), FloatLatitude(2.0)),
|
Coord(FloatLongitude(2.0), FloatLatitude(2.0)),
|
||||||
Coord(FloatLongitude(3.0), FloatLatitude(3.0)),
|
Coord(FloatLongitude(3.0), FloatLatitude(3.0)),
|
||||||
Coord(FloatLongitude(4.0), FloatLatitude(4.0)),
|
Coord(FloatLongitude(4.0), FloatLatitude(4.0)),
|
||||||
},
|
},
|
||||||
{Edge(0, 1), Edge(1, 2), Edge(2, 3), Edge(3, 4)});
|
{Edge(0, 1), Edge(1, 2), Edge(2, 3), Edge(3, 4)});
|
||||||
|
|
||||||
@ -474,20 +473,20 @@ BOOST_AUTO_TEST_CASE(bbox_search_tests)
|
|||||||
std::string nodes_path;
|
std::string nodes_path;
|
||||||
build_rtree<GraphFixture, MiniStaticRTree>("test_bbox", &fixture, leaves_path, nodes_path);
|
build_rtree<GraphFixture, MiniStaticRTree>("test_bbox", &fixture, leaves_path, nodes_path);
|
||||||
MiniStaticRTree rtree(nodes_path, leaves_path, fixture.coords);
|
MiniStaticRTree rtree(nodes_path, leaves_path, fixture.coords);
|
||||||
std::unique_ptr<MockDataFacade> mockfacade_ptr(new MockDataFacade);
|
MockDataFacade mockfacade;
|
||||||
engine::GeospatialQuery<MiniStaticRTree, MockDataFacade> query(rtree, fixture.coords,
|
engine::GeospatialQuery<MiniStaticRTree, MockDataFacade> query(rtree, fixture.coords,
|
||||||
*mockfacade_ptr);
|
mockfacade);
|
||||||
|
|
||||||
{
|
{
|
||||||
RectangleInt2D bbox = {FloatLongitude(0.5), FloatLongitude(1.5), FloatLatitude(0.5),
|
RectangleInt2D bbox = {
|
||||||
FloatLatitude(1.5)};
|
FloatLongitude(0.5), FloatLongitude(1.5), FloatLatitude(0.5), FloatLatitude(1.5)};
|
||||||
auto results = query.Search(bbox);
|
auto results = query.Search(bbox);
|
||||||
BOOST_CHECK_EQUAL(results.size(), 2);
|
BOOST_CHECK_EQUAL(results.size(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
RectangleInt2D bbox = {FloatLongitude(1.5), FloatLongitude(3.5), FloatLatitude(1.5),
|
RectangleInt2D bbox = {
|
||||||
FloatLatitude(3.5)};
|
FloatLongitude(1.5), FloatLongitude(3.5), FloatLatitude(1.5), FloatLatitude(3.5)};
|
||||||
auto results = query.Search(bbox);
|
auto results = query.Search(bbox);
|
||||||
BOOST_CHECK_EQUAL(results.size(), 3);
|
BOOST_CHECK_EQUAL(results.size(), 3);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user