|
Krita Source Code Documentation
|
The KoRTree class is a template class that provides a R-tree. More...
#include <KoRTree.h>
Classes | |
| class | LeafNode |
| class | Node |
| class | NonLeafNode |
Public Member Functions | |
| virtual void | clear () |
| QList< T > | contained (const QRectF &point) const |
| Find all data item which contain the point The items are sorted by insertion time in ascending order. | |
| QList< T > | contains (const QPointF &point) const |
| Find all data item which contain the point The items are sorted by insertion time in ascending order. | |
| bool | contains (const T &data) |
| Show if a shape is a part of the tree. | |
| virtual void | insert (const QRectF &bb, const T &data) |
| Insert data item into the tree. | |
| virtual QList< T > | intersects (const QRectF &rect) const |
| Find all data items which intersects rect The items are sorted by insertion time in ascending order. | |
| QList< QRectF > | keys () const |
| Find all data rectangles The order is NOT guaranteed to be the same as that used by values(). | |
| KoRTree (int capacity, int minimum) | |
| Constructor. | |
| void | remove (const T &data) |
| Remove a data item from the tree. | |
| QList< T > | values () const |
| Find all data items The order is NOT guaranteed to be the same as that used by keys(). | |
| virtual | ~KoRTree () |
| Destructor. | |
Protected Member Functions | |
| virtual void | adjustTree (Node *node1, Node *node2) |
| virtual void | condenseTree (Node *node, QVector< Node * > &reinsert) |
| virtual LeafNode * | createLeafNode (int capacity, int level, Node *parent) |
| virtual NonLeafNode * | createNonLeafNode (int capacity, int level, Node *parent) |
| void | insert (Node *node) |
| void | insertHelper (const QRectF &bb, const T &data, int id) |
| QPair< int, int > | pickNext (Node *node, QVector< bool > &marker, Node *group1, Node *group2) |
| QPair< int, int > | pickSeeds (Node *node) |
| QPair< Node *, Node * > | splitNode (Node *node) |
Protected Attributes | |
| int | m_capacity |
| QMap< T, LeafNode * > | m_leafMap |
| int | m_minimum |
| Node * | m_root |
The KoRTree class is a template class that provides a R-tree.
This class implements a R-tree as described in "R-TREES. A DYNAMIC INDEX STRUCTURE FOR SPATIAL SEARCHING" by Antonin Guttman
It only supports 2 dimensional bounding boxes which are represented by a QRectF. For node splitting the Quadratic-Cost Algorithm is used as described by Guttman.
Constructor.
| capacity | the capacity a node can take |
| minimum | the minimum filling of a node max 0.5 * capacity |
Definition at line 342 of file KoRTree.h.
Definition at line 673 of file KoRTree.h.
References KoRTree< T >::Node::boundingBox(), KoRTree< T >::NonLeafNode::insert(), KoRTree< T >::Node::isRoot(), KoRTree< T >::Node::level(), KoRTree< T >::Node::parent(), and KoRTree< T >::Node::place().
Definition at line 127 of file KoRTree.h.
References KoRTree< T >::createLeafNode(), KoRTree< T >::m_capacity, KoRTree< T >::m_leafMap, and KoRTree< T >::m_root.
|
protectedvirtual |
WARNING: here we leave the tree in an inconsistent state! 'reinsert' nodes may still be kept in m_leafMap structure, but we will not remove them for the efficiency reasons. They are guaranteed to be readded in remove().
Definition at line 715 of file KoRTree.h.
References KoRTree< T >::Node::boundingBox(), KoRTree< T >::Node::childCount(), KoRTree< T >::Node::clear(), KoRTree< T >::NonLeafNode::getNode(), KoRTree< T >::Node::isLeaf(), KoRTree< T >::Node::isRoot(), KoRTree< T >::Node::parent(), KoRTree< T >::Node::place(), and KoRTree< T >::Node::setParent().
Find all data item which contain the point The items are sorted by insertion time in ascending order.
| point | which should be contained in the objects |
Definition at line 502 of file KoRTree.h.
Find all data item which contain the point The items are sorted by insertion time in ascending order.
| point | which should be contained in the objects |
Definition at line 494 of file KoRTree.h.
| bool KoRTree< T >::contains | ( | const T & | data | ) |
|
inlineprotectedvirtual |
Insert data item into the tree.
This will insert a data item into the tree. If necessary the tree will adjust itself.
| data | |
| bb |
Definition at line 359 of file KoRTree.h.
References KIS_SAFE_ASSERT_RECOVER_NOOP.
Definition at line 414 of file KoRTree.h.
References KoRTree< T >::Node::boundingBox(), KoRTree< T >::Node::childCount(), KoRTree< T >::NonLeafNode::chooseNode(), KoRTree< T >::NonLeafNode::insert(), and KoRTree< T >::Node::level().
|
protected |
Definition at line 368 of file KoRTree.h.
References KoRTree< T >::Node::childCount(), KoRTree< T >::LeafNode::chooseLeaf(), KoRTree< T >::LeafNode::getData(), and KoRTree< T >::LeafNode::insert().
Find all data items which intersects rect The items are sorted by insertion time in ascending order.
| rect | where the objects have to be in |
Definition at line 486 of file KoRTree.h.
Find all data rectangles The order is NOT guaranteed to be the same as that used by values().
Definition at line 511 of file KoRTree.h.
|
protected |
Definition at line 641 of file KoRTree.h.
References KoRTree< T >::Node::boundingBox(), and KoRTree< T >::Node::childBoundingBox().
Definition at line 616 of file KoRTree.h.
References KoRTree< T >::Node::childBoundingBox(), s1, and s2.
Remove a data item from the tree.
This removed a data item from the tree. If necessary the tree will adjust itself.
| data |
WARNING: after calling condenseTree() the temporary enters an inconsistent state! m_leafMap still points to the nodes now stored in 'reinsert' list, although they are not a part of the hierarchy. This state does not cause any use visible changes, but should be considered while implementing sanity checks.
Definition at line 440 of file KoRTree.h.
References KoRTree< T >::Node::childBoundingBox(), KoRTree< T >::Node::childCount(), KoRTree< T >::Node::clear(), KoRTree< T >::LeafNode::getData(), KoRTree< T >::LeafNode::getDataId(), KoRTree< T >::NonLeafNode::getNode(), KIS_SAFE_ASSERT_RECOVER, KIS_SAFE_ASSERT_RECOVER_RETURN, and KoRTree< T >::LeafNode::remove().
|
protected |
Definition at line 544 of file KoRTree.h.
References KoRTree< T >::Node::childCount(), KoRTree< T >::Node::clear(), KoRTree< T >::Node::isLeaf(), KoRTree< T >::Node::level(), KoRTree< T >::Node::move(), and KoRTree< T >::Node::parent().
|
protected |
|
protected |