A class that represents a two dimensional K-d Tree (2-d Tree). More...
#include <Index.h>
Public Types | |
typedef KdTreeNode::kdData | kdData |
Export data type. More... | |
typedef KdTreeNode::kdDataItem | kdDataItem |
Export data item type. More... | |
typedef KdTreeNode::kdDataTag | kdDataTag |
Export data type. More... | |
typedef KdTreeNode::kdKey | kdKey |
Export key type. More... | |
Public Member Functions | |
void | buildOptimized (std::vector< std::pair< kdKey, kdDataItem > > &dataSet) |
It inserts the data in the tree and and keeps it balanced: the kdsort algorithm must be called before. More... | |
void | clear () |
It clears all tree nodes. More... | |
const te::gm::Envelope & | getMBR () const |
It gets the minimum bounding box of all elements in the tree. More... | |
Index (const te::gm::Envelope &mbr) | |
Constructor. More... | |
void | insert (const kdKey &key, const kdDataItem &item) |
It inserts the data with a given key in tree. More... | |
bool | isEmpty () const |
It returns true if the tree is empty and false otherwise. More... | |
void | search (const te::gm::Envelope &e, std::vector< KdTreeNode * > &report) const |
Range search query. More... | |
void | setMBR (const te::gm::Envelope &mbr) |
It sets the minimum bounding box of all elements in the tree. More... | |
const std::size_t & | size () const |
It returns the number of tree nodes. More... | |
~Index () | |
Destructor. More... | |
Private Member Functions | |
KdTreeNode * | buildOptimized (std::vector< std::pair< kdKey, kdDataItem > > &dataSet, const std::size_t &first, const std::size_t &last) |
It builds the tree recursively. More... | |
void | erase (KdTreeNode *node) |
It Erases a node from the tree and all nodes below it. More... | |
Index (const Index &rhs) | |
No copy constructor allowed. More... | |
void | insertData (KdTreeNode *&node, const kdDataItem &data, const kd_node_m_datasingle_tag &) |
It inserts data for single nodes, i.e. nodes that stores only one element. More... | |
Index & | operator= (const Index &rhs) |
No assignment operator allowed. More... | |
void | search (const te::gm::Envelope &e, KdTreeNode *node, const char &level, std::vector< KdTreeNode * > &report) const |
It inserts data for set nodes, i.e., nodes that may stores many element. More... | |
Private Attributes | |
te::gm::Envelope | m_mbr |
Minimum bounding box of all nodes. More... | |
KdTreeNode * | m_root |
Pointer to the root node. More... | |
std::size_t | m_size |
The size of the K-d Tree (number of nodes). More... | |
A class that represents a two dimensional K-d Tree (2-d Tree).
typedef KdTreeNode::kdData te::sam::kdtree::Index< KdTreeNode >::kdData |
typedef KdTreeNode::kdDataItem te::sam::kdtree::Index< KdTreeNode >::kdDataItem |
typedef KdTreeNode::kdDataTag te::sam::kdtree::Index< KdTreeNode >::kdDataTag |
typedef KdTreeNode::kdKey te::sam::kdtree::Index< KdTreeNode >::kdKey |
|
inline |
|
inline |
Destructor.
Definition at line 93 of file Index.h.
References te::sam::kdtree::Index< KdTreeNode >::clear().
|
private |
No copy constructor allowed.
rhs | The other index. |
|
inline |
It inserts the data in the tree and and keeps it balanced: the kdsort algorithm must be called before.
Definition at line 137 of file Index.h.
References te::sam::kdtree::Index< KdTreeNode >::m_root.
Referenced by te::sam::kdtree::Index< KdTreeNode >::buildOptimized().
|
inlineprivate |
It builds the tree recursively.
Definition at line 181 of file Index.h.
References te::sam::kdtree::Index< KdTreeNode >::buildOptimized(), and te::sam::kdtree::Index< KdTreeNode >::m_size.
|
inline |
It clears all tree nodes.
Definition at line 99 of file Index.h.
References te::sam::kdtree::Index< KdTreeNode >::erase(), te::sam::kdtree::Index< KdTreeNode >::m_root, and te::sam::kdtree::Index< KdTreeNode >::m_size.
Referenced by te::sam::kdtree::Index< KdTreeNode >::~Index().
|
inlineprivate |
It Erases a node from the tree and all nodes below it.
Definition at line 153 of file Index.h.
Referenced by te::sam::kdtree::Index< KdTreeNode >::clear().
|
inline |
It gets the minimum bounding box of all elements in the tree.
Definition at line 128 of file Index.h.
References te::sam::kdtree::Index< KdTreeNode >::m_mbr.
|
inline |
|
inlineprivate |
|
inline |
It returns true if the tree is empty and false otherwise.
Definition at line 116 of file Index.h.
References te::sam::kdtree::Index< KdTreeNode >::m_root.
|
private |
No assignment operator allowed.
rhs | The other index. |
|
inline |
Range search query.
Definition at line 144 of file Index.h.
References te::sam::kdtree::Index< KdTreeNode >::m_root.
|
inlineprivate |
It inserts data for set nodes, i.e., nodes that may stores many element.
Recursive range query.
Definition at line 310 of file Index.h.
References te::gm::Envelope::m_llx, te::gm::Envelope::m_lly, te::gm::Envelope::m_urx, and te::gm::Envelope::m_ury.
|
inline |
It sets the minimum bounding box of all elements in the tree.
Definition at line 122 of file Index.h.
References te::sam::kdtree::Index< KdTreeNode >::m_mbr.
|
inline |
It returns the number of tree nodes.
Definition at line 110 of file Index.h.
References te::sam::kdtree::Index< KdTreeNode >::m_size.
|
private |
Minimum bounding box of all nodes.
Definition at line 219 of file Index.h.
Referenced by te::sam::kdtree::Index< KdTreeNode >::getMBR(), and te::sam::kdtree::Index< KdTreeNode >::setMBR().
|
private |
Pointer to the root node.
Definition at line 218 of file Index.h.
Referenced by te::sam::kdtree::Index< KdTreeNode >::buildOptimized(), te::sam::kdtree::Index< KdTreeNode >::clear(), te::sam::kdtree::Index< KdTreeNode >::isEmpty(), and te::sam::kdtree::Index< KdTreeNode >::search().
|
private |
The size of the K-d Tree (number of nodes).
Definition at line 220 of file Index.h.
Referenced by te::sam::kdtree::Index< KdTreeNode >::buildOptimized(), te::sam::kdtree::Index< KdTreeNode >::clear(), and te::sam::kdtree::Index< KdTreeNode >::size().