52 list.push_back(instance);
54 FL_WARN(
_log,
"InstanceTree::addInstance() - Duplicate Instance. Ignoring.");
63 FL_WARN(
_log,
"InstanceTree::removeInstance() - Instance not part of tree.");
68 for(InstanceList::iterator i = list.begin(); i != list.end(); ++i) {
69 if((*i) == instance) {
74 FL_WARN(
_log,
"InstanceTree::removeInstance() - Instance part of tree but not found in the expected tree node.");
89 for(InstanceTree::InstanceList::const_iterator it(list.begin()); it != list.end(); ++it) {
100 Rect rect(point.
x, point.
y, w, h);
103 node->apply_visitor(collector);
105 node = node->parent();
107 for(InstanceList::const_iterator it(node->data().begin()); it != node->data().end(); ++it) {
108 ModelCoordinate coords = (*it)->getLocationRef().getLayerCoordinates();
113 node = node->parent();
#define FL_WARN(logger, msg)
bool visit(InstanceTree::InstanceTreeNode *node, int32_t d)
std::map< Instance *, InstanceTreeNode * > m_reverse
Node * find_container(int32_t x, int32_t y, int32_t w, int32_t h)
Find a container node for a given rectangle.
bool contains(const PointType2D< T > &point) const
Checks whether a rectangle contains a Point.
Base class for all fife classes Used e.g.
static Logger _log(LM_AUDIO)
DataType & data()
Return a reference to the data of the node.
InstanceListCollector(InstanceTree::InstanceList &a_instanceList, const Rect &rect)
InstanceTree::InstanceList & instanceList
Location & getLocationRef()
Gets reference of current location of instance.
ModelCoordinate getLayerCoordinates() const
Gets cell precision layer coordinates set to this location.
void findInstances(const ModelCoordinate &point, int32_t w, int32_t h, InstanceList &list)
Find all instances in a given area.
virtual ~InstanceTree()
Destructor.
InstanceQuadTree::Node InstanceTreeNode
void removeInstance(Instance *instance)
Removes an instance from the quad tree.
void addInstance(Instance *instance)
Adds an instance to the quad tree.
std::list< Instance * > InstanceList
InstanceTree()
Constructor.
An Instance is an "instantiation" of an Object at a Location.