| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
TeSAM::TeAdaptativeKdTree< KdTreeNode > Class Template Reference

A class that represents a two dimensional K-d Tree (2-d Tree) that store data-elements into the leafs. More...

`#include <TeKdTree.h>`

Inheritance diagram for TeSAM::TeAdaptativeKdTree< KdTreeNode >:

List of all members.

## Public Types

typedef KdTreeNode::kdKey | kdKey
| Export key type.
typedef KdTreeNode::kdData | kdData
| Export data type.
typedef KdTreeNode::kdDataItem | kdDataItem
| Export data item type.
typedef KdTreeNode | kdNode
| Export node type.

## Public Member Functions

| TeAdaptativeKdTree (const TeBox &box, const unsigned int &bucketSize=12)
| Constructor.
void | setBucketSize (const unsigned int &size)
| Sets bucket size for leaf nodes.
const unsigned int & | getBucketSize (void) const
| Sets bucket size for leaf nodes.
void | build (vector< pair< kdKey, kdDataItem > > &dataSet)
| Inserts the data set into the tree.
void | nearestNeighborSearch (const kdKey &key, vector< kdDataItem > &report, vector< double > &sqrDists, const unsigned int &k) const
| Search the nearest data in nodes: you must pass an array of kdDataItem of size "k" with coordinates values (X() and Y()) adjusted to TeMAXFLOAT (this dummy values will be replaced at processing time), and if not all neighbors are found so sqrDists will contains TeMAXFLOAT in array index.
void | search (const TeBox &rect, vector< KdTreeNode * > &report) const
| Range search query.
void | search (const TeBox &rect, vector< kdDataItem > &report) const
| Range search query: the refinement is already done.

## Protected Member Functions

KdTreeNode * | build (vector< pair< kdKey, kdDataItem > > &dataSet, double averageValue, const TeBox &mbr)
| Build the tree recursivily.
void | search (const TeBox &rect, KdTreeNode *node, vector< KdTreeNode * > &report) const
| Recursive range query.
void | nearestNeighborSearch (KdTreeNode *node, const kdKey &key, vector< kdDataItem > &report, vector< double > &sqrDists, TeBox &rect) const
| Recursive nearest neighbor search.
void | update (KdTreeNode *node, const kdKey &key, vector< kdDataItem > &report, vector< double > &sqrDists, TeBox &rect) const
| Update neighbor list.
double | average (vector< pair< kdKey, kdDataItem > > &dataSet, const char &discriminator) const
| Returns the average value along the axis.

## Protected Attributes

unsigned int | bucketSize_
| Bucket size (maximum number of elements in each node)

## Detailed Description

### template<class KdTreeNode>
class TeSAM::TeAdaptativeKdTree< KdTreeNode >

A class that represents a two dimensional K-d Tree (2-d Tree) that store data-elements into the leafs.

WARNING:

1. This type of tree stores the data only in the leaf nodes.

2. The process of construction expect that the tree is almost balanced

3. This type of tree may be of special interest of NEAREST NEIGHBOR SEARCH QUERIES.

4. After a box search it will be necessary to do a refinement.

## Member Typedef Documentation

template<class KdTreeNode >

typedef KdTreeNode::kdData TeSAM::TeAdaptativeKdTree< KdTreeNode >::kdData

Export data type.

template<class KdTreeNode >

typedef KdTreeNode::kdDataItem TeSAM::TeAdaptativeKdTree< KdTreeNode >::kdDataItem

Export data item type.

template<class KdTreeNode >

typedef KdTreeNode::kdKey TeSAM::TeAdaptativeKdTree< KdTreeNode >::kdKey

Export key type.

template<class KdTreeNode >

typedef KdTreeNode TeSAM::TeAdaptativeKdTree< KdTreeNode >::kdNode

Export node type.

## Constructor & Destructor Documentation

template<class KdTreeNode >

TeSAM::TeAdaptativeKdTree< KdTreeNode >::TeAdaptativeKdTree | ( | const TeBox & | box,
|  | const unsigned int & | bucketSize = `12`
| ) |  | `[inline]`

Constructor.

## Member Function Documentation

template<class KdTreeNode >

double TeSAM::TeAdaptativeKdTree< KdTreeNode >::average | ( | vector< pair< kdKey, kdDataItem > > & | dataSet,
|  | const char & | discriminator
| ) |  | const`[inline, protected]`

Returns the average value along the axis.

template<class KdTreeNode >

void TeSAM::TeAdaptativeKdTree< KdTreeNode >::build | ( | vector< pair< kdKey, kdDataItem > > & | dataSet | ) | `[inline]`

Inserts the data set into the tree.

template<class KdTreeNode >

KdTreeNode * TeSAM::TeAdaptativeKdTree< KdTreeNode >::build | ( | vector< pair< kdKey, kdDataItem > > & | dataSet,
|  | double | averageValue,
|  | const TeBox & | mbr
| ) |  | `[inline, protected]`

Build the tree recursivily.

template<class KdTreeNode >

const unsigned int& TeSAM::TeAdaptativeKdTree< KdTreeNode >::getBucketSize | ( | void |  | ) | const`[inline]`

Sets bucket size for leaf nodes.

template<class KdTreeNode >

void TeSAM::TeAdaptativeKdTree< KdTreeNode >::nearestNeighborSearch | ( | KdTreeNode * | node,
|  | const kdKey & | key,
|  | vector< kdDataItem > & | report,
|  | vector< double > & | sqrDists,
|  | TeBox & | rect
| ) |  | const`[inline, protected]`

Recursive nearest neighbor search.

template<class KdTreeNode >

void TeSAM::TeAdaptativeKdTree< KdTreeNode >::nearestNeighborSearch | ( | const kdKey & | key,
|  | vector< kdDataItem > & | report,
|  | vector< double > & | sqrDists,
|  | const unsigned int & | k
| ) |  | const`[inline]`

Search the nearest data in nodes: you must pass an array of kdDataItem of size "k" with coordinates values (X() and Y()) adjusted to TeMAXFLOAT (this dummy values will be replaced at processing time), and if not all neighbors are found so sqrDists will contains TeMAXFLOAT in array index.

template<class KdTreeNode >

void TeSAM::TeAdaptativeKdTree< KdTreeNode >::search | ( | const TeBox & | rect,
|  | vector< kdDataItem > & | report
| ) |  | const`[inline]`

Range search query: the refinement is already done.

template<class KdTreeNode >

void TeSAM::TeAdaptativeKdTree< KdTreeNode >::search | ( | const TeBox & | rect,
|  | vector< KdTreeNode * > & | report
| ) |  | const`[inline]`

Range search query.

template<class KdTreeNode >

void TeSAM::TeAdaptativeKdTree< KdTreeNode >::search | ( | const TeBox & | rect,
|  | KdTreeNode * | node,
|  | vector< KdTreeNode * > & | report
| ) |  | const`[inline, protected]`

Recursive range query.

template<class KdTreeNode >

void TeSAM::TeAdaptativeKdTree< KdTreeNode >::setBucketSize | ( | const unsigned int & | size | ) | `[inline]`

Sets bucket size for leaf nodes.

template<class KdTreeNode >

void TeSAM::TeAdaptativeKdTree< KdTreeNode >::update | ( | KdTreeNode * | node,
|  | const kdKey & | key,
|  | vector< kdDataItem > & | report,
|  | vector< double > & | sqrDists,
|  | TeBox & | rect
| ) |  | const`[inline, protected]`

Update neighbor list.

## Member Data Documentation

template<class KdTreeNode >

unsigned int TeSAM::TeAdaptativeKdTree< KdTreeNode >::bucketSize_`[protected]`

Bucket size (maximum number of elements in each node)

The documentation for this class was generated from the following file:

- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeKdTree.h

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines