fix r-tree abort location
This commit is contained in:
parent
6b89803534
commit
ae45ad1ad2
@ -441,6 +441,14 @@ class StaticRTree
|
||||
// inspecting an actual road segment
|
||||
auto ¤t_candidate = current_query_node.node.template get<CandidateSegment>();
|
||||
|
||||
// to allow returns of no-results if too restrictive filtering, this needs to be done here
|
||||
// even though performance would indicate that we want to stop after adding the first candidate
|
||||
if (terminate(results.size(), current_candidate))
|
||||
{
|
||||
traversal_queue = std::priority_queue<QueryCandidate>{};
|
||||
break;
|
||||
}
|
||||
|
||||
auto use_segment = filter(current_candidate);
|
||||
if (!use_segment.first && !use_segment.second)
|
||||
{
|
||||
@ -451,12 +459,6 @@ class StaticRTree
|
||||
|
||||
// store phantom node in result vector
|
||||
results.push_back(std::move(current_candidate.data));
|
||||
|
||||
if (terminate(results.size(), current_candidate))
|
||||
{
|
||||
traversal_queue = std::priority_queue<QueryCandidate>{};
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,10 +230,10 @@ void sampling_verify_rtree(RTreeT &rtree,
|
||||
auto lsnn_u = result_lsnn.back().u;
|
||||
auto lsnn_v = result_lsnn.back().v;
|
||||
|
||||
const double rtree_dist = coordinate_calculation::perpendicularDistance(
|
||||
coords[rtree_u], coords[rtree_v], q);
|
||||
const double lsnn_dist = coordinate_calculation::perpendicularDistance(
|
||||
coords[lsnn_u], coords[lsnn_v], q);
|
||||
const double rtree_dist =
|
||||
coordinate_calculation::perpendicularDistance(coords[rtree_u], coords[rtree_v], q);
|
||||
const double lsnn_dist =
|
||||
coordinate_calculation::perpendicularDistance(coords[lsnn_u], coords[lsnn_v], q);
|
||||
|
||||
BOOST_CHECK_CLOSE(rtree_dist, lsnn_dist, 0.0001);
|
||||
}
|
||||
@ -335,6 +335,34 @@ BOOST_AUTO_TEST_CASE(regression_test)
|
||||
BOOST_CHECK_EQUAL(result_ls.front().v, result_rtree.front().v);
|
||||
}
|
||||
|
||||
// Bug: If you querry a point with a narrow radius, no result should be returned
|
||||
BOOST_AUTO_TEST_CASE(radius_regression_test)
|
||||
{
|
||||
using Coord = std::pair<FloatLongitude, FloatLatitude>;
|
||||
using Edge = std::pair<unsigned, unsigned>;
|
||||
GraphFixture fixture(
|
||||
{
|
||||
Coord(FloatLongitude(0.0), FloatLatitude(0.0)),
|
||||
Coord(FloatLongitude(10.0), FloatLatitude(10.0)),
|
||||
},
|
||||
{Edge(0, 1), Edge(1, 0)});
|
||||
|
||||
std::string leaves_path;
|
||||
std::string nodes_path;
|
||||
build_rtree<GraphFixture, MiniStaticRTree>("test_angle", &fixture, leaves_path, nodes_path);
|
||||
MiniStaticRTree rtree(nodes_path, leaves_path, fixture.coords);
|
||||
MockDataFacade mockfacade;
|
||||
engine::GeospatialQuery<MiniStaticRTree, MockDataFacade> query(rtree, fixture.coords,
|
||||
mockfacade);
|
||||
|
||||
Coordinate input(FloatLongitude(5.2), FloatLatitude(5.0));
|
||||
|
||||
{
|
||||
auto results = query.NearestPhantomNodesInRange(input, 0.01);
|
||||
BOOST_CHECK_EQUAL(results.size(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(bearing_tests)
|
||||
{
|
||||
using Coord = std::pair<FloatLongitude, FloatLatitude>;
|
||||
|
Loading…
Reference in New Issue
Block a user