1 // Boost.Geometry Index
2 // Unit Test
3
4 // Copyright (c) 2016 Adam Wulkiewicz, Lodz, Poland.
5
6 // Use, modification and distribution is subject to the Boost Software License,
7 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
9
10 #include <rtree/test_rtree.hpp>
11
12 #include <boost/geometry/index/rtree.hpp>
13 #include <boost/geometry/geometries/geometries.hpp>
14
15 template <typename Params>
test_one()16 void test_one()
17 {
18 typedef bg::model::point<double, 2, bg::cs::cartesian> Pt;
19 typedef bgi::rtree<Pt, Params> Rtree;
20 Rtree rtree;
21
22 rtree.insert(Pt(0, 0));
23 rtree.insert(Pt(1, 1));
24 rtree.insert(Pt(2, 2));
25 rtree.insert(Pt(3, 3));
26 rtree.insert(Pt(4, 4));
27 rtree.insert(Pt(4, 3));
28 rtree.insert(Pt(0, 3));
29
30 for (typename Rtree::const_iterator it = rtree.begin() ; it != rtree.end() ; ++it)
31 {
32 std::vector<Pt> result;
33 rtree.query(bgi::contains(*it), std::back_inserter(result));
34 BOOST_CHECK(result.size() == 1);
35 }
36 }
37
test_main(int,char * [])38 int test_main(int, char* [])
39 {
40 test_one< bgi::linear<4> >();
41 test_one< bgi::quadratic<4> >();
42 test_one< bgi::rstar<4> >();
43
44 return 0;
45 }
46