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.");
82 : instanceList(a_instanceList), searchRect(rect) {
89 for(InstanceTree::InstanceList::const_iterator it(list.begin()); it != list.end(); ++it) {
91 if( searchRect.contains(
Point(coords.
x,coords.
y)) ) {
92 instanceList.push_back(*it);
101 Rect rect(point.
x, point.
y, w, h);
104 node->apply_visitor(collector);
106 node = node->parent();
108 for(InstanceList::const_iterator it(node->data().begin()); it != node->data().end(); ++it) {
109 ModelCoordinate coords = (*it)->getLocationRef().getLayerCoordinates();
114 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.
Base class for all fife classes Used e.g.
static Logger _log(LM_AUDIO)
bool contains(const PointType2D< T > &point) const
Checks whether a rectangle contains a Point.
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.
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
ModelCoordinate getLayerCoordinates() const
Gets cell precision layer coordinates set to this location.
InstanceTree()
Constructor.
An Instance is an "instantiation" of an Object at a Location.