• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/geometries/geometries.hpp>
13 #include <boost/geometry/geometries/point_xy.hpp>
14 
15 template <typename Value, typename Point, typename Params>
test_all()16 void test_all()
17 {
18     typedef bg::model::box<Point> Box;
19     typedef bg::model::segment<Point> Seg;
20     typedef bg::model::ring<Point> Ring;
21     typedef bg::model::polygon<Point> Poly;
22     typedef bg::model::multi_polygon<Poly> MPoly;
23     typedef bg::model::linestring<Point> Ls;
24     typedef bg::model::multi_linestring<Ls> MLs;
25     typedef bg::model::multi_point<Point> MPt;
26 
27     bgi::rtree<Value, Params> rt;
28     std::vector<Value> found;
29 
30     rt.query(bgi::intersects(Point()), back_inserter(found));
31     rt.query(bgi::intersects(Seg()), back_inserter(found));
32     rt.query(bgi::intersects(Box()), back_inserter(found));
33     rt.query(bgi::intersects(Ring()), back_inserter(found));
34     rt.query(bgi::intersects(Poly()), back_inserter(found));
35     rt.query(bgi::intersects(MPoly()), back_inserter(found));
36     rt.query(bgi::intersects(Ls()), back_inserter(found));
37     rt.query(bgi::intersects(MLs()), back_inserter(found));
38     rt.query(bgi::intersects(MPt()), back_inserter(found));
39 }
40 
test_main(int,char * [])41 int test_main(int, char* [])
42 {
43     typedef bg::model::d2::point_xy<double> Pt;
44     typedef bg::model::box<Pt> Box;
45 
46     test_all< Pt, Pt, bgi::linear<16> >();
47     test_all< Pt, Pt, bgi::quadratic<4> >();
48     test_all< Pt, Pt, bgi::rstar<4> >();
49 
50     test_all< Box, Pt, bgi::linear<16> >();
51     test_all< Box, Pt, bgi::quadratic<4> >();
52     test_all< Box, Pt, bgi::rstar<4> >();
53 
54     return 0;
55 }
56