22 #ifndef FIFE_INSTANCETREE_H
23 #define FIFE_INSTANCETREE_H
33 #include "util/base/fifeclass.h"
35 #include "util/structures/quadtree.h"
36 #include "model/metamodel/modelcoords.h"
42 class InstanceTree:
public FifeClass {
43 static const int kTreeDepth = 2;
45 typedef std::list<Instance*> InstanceList;
46 typedef QuadTree< InstanceList, kTreeDepth > InstanceQuadTree;
47 typedef InstanceQuadTree::Node InstanceTreeNode;
57 virtual ~InstanceTree();
67 void addInstance(Instance* instance);
76 void removeInstance(Instance* instance);
88 void findInstances(
const ModelCoordinate& point,
int w,
int h, InstanceList& lst);
92 template<
typename Visitor>
void applyVisitor(Visitor& visitor) {
93 m_tree.apply_visitor(visitor);
98 InstanceQuadTree m_tree;
99 std::map<Instance*,InstanceTreeNode*> m_reverse;