-
Notifications
You must be signed in to change notification settings - Fork 0
/
tree.h
47 lines (39 loc) · 1.21 KB
/
tree.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef TREE_H
#define TREE_H
#include "cell.h"
class Tree_Iterator;
class Tree
{
public:
static Point get_cell_grid_pos(Point const & cell_center,
unsigned int lvl,
Point const & root_cell_center,
double root_cell_size);
Tree(unsigned int dim);
virtual void set_root(Cell* root);
virtual void build_tree(int max_elements, int min_level = 2) = 0;
virtual Cell* get_root();
virtual const Cell* get_root() const;
virtual const std::vector<Cell*> & get_leaves() const;
virtual std::vector<Cell*> & get_leaves();
virtual const std::vector<Cell*> & get_cells() const;
virtual ~Tree();
virtual Tree_Iterator* upward_iterator() = 0;
virtual Tree_Iterator* downward_iterator() = 0;
protected:
virtual Tree_Iterator* bfs_iterator() = 0;
unsigned int m_dim;
Cell* m_root;
std::vector<Cell*> m_cells;
std::vector<Cell*> m_leaves;
//for tree code based representation
std::vector<std::vector<unsigned int> > m_lvl_ids;
unsigned int m_max_level;
};
class Tree_Iterator
{
public:
virtual Cell* next() = 0;
virtual bool has_next() = 0;
};
#endif