1 // Implementation: Testprogram for 1-dimensional Range Trees
2 // A two dimensional Range Tree is defined in this class.
3 // Ti is the type of each dimension of the tree.
4 
5 #include <CGAL/Range_tree_k.h>
6 #include "include/Tree_Traits.h"
7 #include <iostream>
8 #include <vector>
9 #include <iterator>
10 #include <utility>
11 
12 
13 
14 typedef  CGAL::Range_tree_1< CGAL::Tree_traits_1> Range_tree_1_type;
15 
main()16 int main()
17 {
18   typedef  CGAL::Tree_traits_1::Key Key;
19   typedef  CGAL::Tree_traits_1::Interval Interval;
20   std::vector<Key> InputList, OutputList;
21   std::vector<Key>::iterator first, last, current;
22 
23   InputList.push_back(8.0);
24   InputList.push_back(1.0);
25   InputList.push_back(3.9);
26   InputList.push_back(2.0);
27   InputList.push_back(5.0);
28   InputList.push_back(4.8);
29   InputList.push_back(7.7);
30   InputList.push_back(6.8);
31 
32   first = InputList.begin();
33   last = InputList.end();
34 
35   Range_tree_1_type Range_tree_1(first,last);
36 
37   Interval win(Interval(4.6, 6.8));
38 
39   std::cerr << "\n Window Query (4.6, 6.8) \n";
40   Range_tree_1.window_query(win, std::back_inserter(OutputList));
41   current=OutputList.begin();
42 
43   while(current!=OutputList.end())
44   {
45     std::cerr << (*current) << std::endl;
46     current++;
47   }
48 
49   if(Range_tree_1.range_tree_1->is_valid())
50     std::cerr << "Tree is valid\n";
51   else
52     std::cerr << "Tree is not valid\n";
53   return 0;
54 }
55