Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
jafar::lgl::Quadtree< T, RasterT > Class Template Reference

Class for quadtree utility of the module. More...


Detailed Description

template<typename T, class RasterT>
class jafar::lgl::Quadtree< T, RasterT >

Class for quadtree utility of the module.

T is the bundle class of each cell, T must have some methods : T.xsize(), T.ysize()

Definition at line 46 of file Quadtree.hpp.

#include <Quadtree.hpp>

Inheritance diagram for jafar::lgl::Quadtree< T, RasterT >:
Inheritance graph
[legend]

List of all members.

Public Types

enum  { QUADTREE_TOP_LEFT_CELL = 0, QUADTREE_TOP_RIGHT_CELL, QUADTREE_BOTTOM_LEFT_CELL, QUADTREE_BOTTOM_RIGHT_CELL }
 The quadrant index in the children array.
enum  UNWISE_SIZE_DIVISION_POLITIC { LEFTTOP, BOTTOMRIGHT, BALANCE }
 Adapted politic enumeration. More...

Public Member Functions

 Quadtree (RasterT *_raster, UNWISE_SIZE_DIVISION_POLITIC _uspolitic=LEFTTOP)
 Constructor from the raster.
 ~Quadtree ()
 Destructor.
QuadNodeInternal< T, RasterT > * getRootCell () const
 This method provides access to the origin Cell of a quadtree.
bool getClusterForCell (const RasterCellIndex &cell, RasterRect &cluster) const
 Get the cluster (represented by a rectangle) that contains the given raster cell.
bool getClusterForCell (const RasterCellIndex &cell, RasterCellIndex &clusterRoot) const
 Get the cluster (represented by the index of its origin) that contains the given raster cell.
bool getAdjacentClusters (const RasterCellIndex &root_cell, Decomp::SIDE side, std::list< RasterCellIndex > &clusters) const
 Get all adjacents clusters of a given cluster.
getData (const RasterRect &rect) const
 Return the cost of a zone inside the quadtree, the zone should correspond to a cluster.
getData (const RasterCellIndex &cluster) const
 Return the cost of a cluster represented by this origin.
std::list< QuadNodeLeaf< T,
RasterT > * > 
getFullLeavesList () const
 Getter for leaves' list.

Private Member Functions

QuadNodeLeaf< T, RasterT > * getLeafForCell (const RasterCellIndex &cell) const
 Get the cluster (the tree leaf) that contains the given raster cell.
QuadNodeLeaf< T, RasterT > * getLeafForRect (const RasterRect &rect) const
void setNewLeaf (QuadNodeLeaf< T, RasterT > *leaf, bool multiCluster=false)
 Update the Decomp accordingly to the QuadNodeLeaf raster coverage and keep track on all the QuadTree leaves.

Private Attributes

QuadNodeInternal< T, RasterT > * root
 Pointer to root node.
UNWISE_SIZE_DIVISION_POLITIC uspolitic
 The politic of division when the cell size is not multiple of 2.
std::list< QuadNodeLeaf< T,
RasterT > * > 
allLeaves
 List of all tree's leaves.

Friends

class QuadNode< T, RasterT >
class QuadNodeInternal< T, RasterT >
class QuadNodeLeaf< T, RasterT >

Member Enumeration Documentation

template<typename T, class RasterT>
enum jafar::lgl::Quadtree::UNWISE_SIZE_DIVISION_POLITIC

Adapted politic enumeration.

An adapted politic is used when the size (xsize or ysize) is not multiple of 2 LEFTTOP = if the xsize=2*i+1 => the left top child will have the xsize = i+1 and the top right xsize=i (the same for ysize) BALANCE means at one level

Definition at line 60 of file Quadtree.hpp.


Member Function Documentation

template<typename T , class RasterT >
bool jafar::lgl::Quadtree< T, RasterT >::getAdjacentClusters ( const RasterCellIndex root_cell,
Decomp::SIDE  side,
std::list< RasterCellIndex > &  clusters 
) const [virtual]

Get all adjacents clusters of a given cluster.

The returned clusters are represented by their origins cells

Implements jafar::lgl::TDecomposer< T, RasterT >.

Definition at line 467 of file Quadtree.hpp.

References jafar::lgl::DecompCluster::xsize, and jafar::lgl::DecompCluster::ysize.

template<typename T , class RasterT >
T jafar::lgl::Quadtree< T, RasterT >::getData ( const RasterRect rect) const [virtual]

Return the cost of a zone inside the quadtree, the zone should correspond to a cluster.

Return the cost of a zone.

Implements jafar::lgl::TDecomposer< T, RasterT >.

Definition at line 620 of file Quadtree.hpp.

References jafar::lgl::RasterRect::xtopleft, and jafar::lgl::RasterRect::ytopleft.

template<typename T , class RasterT >
std::list< QuadNodeLeaf< T, RasterT > * > jafar::lgl::Quadtree< T, RasterT >::getFullLeavesList ( ) const

Getter for leaves' list.

Returns:
The full leaves list held in the STL list allLeaves

Definition at line 415 of file Quadtree.hpp.

template<typename T, class RasterT>
void jafar::lgl::Quadtree< T, RasterT >::setNewLeaf ( QuadNodeLeaf< T, RasterT > *  leaf,
bool  multiCluster = false 
) [private]

Update the Decomp accordingly to the QuadNodeLeaf raster coverage and keep track on all the QuadTree leaves.

Parameters:
leafQuadNodeLeaf to keep track on.
multiClusterboolean that is true in case we are facing a cluster which can not be decomposed in a quadtree, this includes all clusters with at least one dimension to the unit.

Keeping track on all leaves thanks to this line

Definition at line 677 of file Quadtree.hpp.

References jafar::lgl::RasterRect::xend(), jafar::lgl::RasterRect::xroot(), jafar::lgl::RasterRect::yend(), and jafar::lgl::RasterRect::yroot().


Member Data Documentation

template<typename T, class RasterT>
std::list<QuadNodeLeaf<T,RasterT>*> jafar::lgl::Quadtree< T, RasterT >::allLeaves [private]

List of all tree's leaves.

Each new leaf is pushed into that list to keep track on it.

Definition at line 141 of file Quadtree.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:41 for Jafar by doxygen 1.7.6.1
LAAS-CNRS