OpenWalnut  1.3.1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
WDendrogramGeode Class Reference

Class creates a dendrogram from a hierarchical clustering. More...

#include <WDendrogramGeode.h>

+ Inheritance diagram for WDendrogramGeode:

Public Member Functions

 WDendrogramGeode (WHierarchicalTree *tree, size_t cluster, bool useLevel=true, size_t minClusterSize=1, float xSize=1000.f, float ySize=500.f, float xOffset=0.0f, float yOffset=0.0f)
 constructor More...
 
 ~WDendrogramGeode ()
 destructor More...
 
size_t getClickedCluster (int xClick, int yClick)
 calculate which cluster was clicked from given pixel coordinates More...
 

Private Member Functions

void create ()
 helper function the starts the layout process from the input data in the constructor More...
 
void layoutLevel (size_t cluster, float left, float right)
 recursive funtion that lays out the tree from top to bottom, height of the joins is determined by the level of the cluster More...
 
void layoutValue (size_t cluster, float left, float right)
 recursive funtion that lays out the tree from top to bottom, height of the joins is determined by the similarity value of the cluster More...
 
void getClickClusterRecursive (size_t cluster, float left, float right)
 recurse function that follows the layout to determine the cluster from pixel coordinates, used when the level of the cluster is used for height More...
 
void getClickClusterRecursive2 (size_t cluster, float left, float right)
 recurse function that follows the layout to determine the cluster from pixel coordinates, used when the customData value is used for height More...
 

Private Attributes

WHierarchicalTreem_tree
 the tree to work on More...
 
size_t m_rootCluster
 top cluster to draw the tree from More...
 
osg::ref_ptr< osg::Vec4Array > m_colors
 color array More...
 
osg::Vec3Array * m_vertexArray
 vertex array More...
 
osg::DrawElementsUInt * m_lineArray
 line array More...
 
size_t m_minClusterSize
 minimum cluster size to be considered while laying out the dendrogram More...
 
float m_xSize
 x size in pixel of the final dendrogram More...
 
float m_ySize
 y size in pixel of the final dendrogram More...
 
float m_xOff
 x offset More...
 
float m_yOff
 y offset More...
 
float m_xMult
 helper variable for the recursive function More...
 
float m_yMult
 helper variable for the recursive function More...
 
int m_xClicked
 stores the click position for use int he recursive function More...
 
int m_yClicked
 stores the click position for use int he recursive function More...
 
bool m_useLevel
 flag indicating if the level or the value of a cluster will be used for the height of join More...
 
size_t m_clickedCluster
 the clicked cluster More...
 

Detailed Description

Class creates a dendrogram from a hierarchical clustering.

Definition at line 40 of file WDendrogramGeode.h.

Constructor & Destructor Documentation

WDendrogramGeode::WDendrogramGeode ( WHierarchicalTree tree,
size_t  cluster,
bool  useLevel = true,
size_t  minClusterSize = 1,
float  xSize = 1000.f,
float  ySize = 500.f,
float  xOffset = 0.0f,
float  yOffset = 0.0f 
)

constructor

Class implements a dendrogram as an osg geode.

Parameters
treereference to the tree object to work on
clusterroot cluster for the dendrogram
useLevelif true the height of a node is determined by the level of the cluster
minClusterSizeminimum for cluster to be drawn, when i the whole tree is drawn
xSizenumber of pixel to scale the tree on along the x axis
ySizenumber of pixel to scale the tree on along the y axis
xOffsettranslation alogn the x axis
yOffsettranslation alogn the y axis

Definition at line 33 of file WDendrogramGeode.cpp.

References create().

WDendrogramGeode::~WDendrogramGeode ( )

destructor

Definition at line 48 of file WDendrogramGeode.cpp.

Member Function Documentation

void WDendrogramGeode::create ( )
private

helper function the starts the layout process from the input data in the constructor

Definition at line 52 of file WDendrogramGeode.cpp.

References WHierarchicalTree::getLevel(), layoutLevel(), layoutValue(), m_colors, m_lineArray, m_rootCluster, m_tree, m_useLevel, m_vertexArray, m_xMult, m_xOff, m_xSize, m_yMult, m_yOff, m_ySize, and WHierarchicalTree::size().

Referenced by WDendrogramGeode().

void WDendrogramGeode::getClickClusterRecursive ( size_t  cluster,
float  left,
float  right 
)
private

recurse function that follows the layout to determine the cluster from pixel coordinates, used when the level of the cluster is used for height

Parameters
clustercluster to check against coordinates
leftleft boundary of cluster
rightright boundary of cluster

Definition at line 316 of file WDendrogramGeode.cpp.

References WHierarchicalTree::getChildren(), WHierarchicalTree::getLevel(), m_clickedCluster, m_minClusterSize, m_tree, m_xClicked, m_yClicked, and WHierarchicalTree::size().

Referenced by getClickedCluster().

void WDendrogramGeode::getClickClusterRecursive2 ( size_t  cluster,
float  left,
float  right 
)
private

recurse function that follows the layout to determine the cluster from pixel coordinates, used when the customData value is used for height

Parameters
clustercluster to check against coordinates
leftleft boundary of cluster
rightright boundary of cluster

Definition at line 270 of file WDendrogramGeode.cpp.

References WHierarchicalTree::getChildren(), WHierarchicalTree::getCustomData(), WHierarchicalTree::getLevel(), m_clickedCluster, m_minClusterSize, m_tree, m_xClicked, m_yClicked, m_ySize, and WHierarchicalTree::size().

Referenced by getClickedCluster().

size_t WDendrogramGeode::getClickedCluster ( int  xClick,
int  yClick 
)

calculate which cluster was clicked from given pixel coordinates

Parameters
xClickthe x coordinate
yClickthe y coordinate
Returns
the cluster id, will return the root cluster if no cluster can be determinded

Definition at line 250 of file WDendrogramGeode.cpp.

References getClickClusterRecursive(), getClickClusterRecursive2(), WHierarchicalTree::getLevel(), m_clickedCluster, m_rootCluster, m_tree, m_useLevel, m_xClicked, m_xOff, m_xSize, m_yClicked, m_yOff, m_ySize, and WHierarchicalTree::size().

void WDendrogramGeode::layoutLevel ( size_t  cluster,
float  left,
float  right 
)
private

recursive funtion that lays out the tree from top to bottom, height of the joins is determined by the level of the cluster

Parameters
clusterthe current cluster to work on
leftleft border of the current subcluster
rightright border of the current subcluster

Definition at line 98 of file WDendrogramGeode.cpp.

References WHierarchicalTree::getChildren(), WHierarchicalTree::getColor(), WHierarchicalTree::getLevel(), m_colors, m_lineArray, m_minClusterSize, m_tree, m_vertexArray, and WHierarchicalTree::size().

Referenced by create().

void WDendrogramGeode::layoutValue ( size_t  cluster,
float  left,
float  right 
)
private

recursive funtion that lays out the tree from top to bottom, height of the joins is determined by the similarity value of the cluster

Parameters
clusterthe current cluster to work on
leftleft border of the current subcluster
rightright border of the current subcluster

Definition at line 174 of file WDendrogramGeode.cpp.

References WHierarchicalTree::getChildren(), WHierarchicalTree::getColor(), WHierarchicalTree::getCustomData(), WHierarchicalTree::getLevel(), m_colors, m_lineArray, m_minClusterSize, m_tree, m_vertexArray, and WHierarchicalTree::size().

Referenced by create().

Member Data Documentation

size_t WDendrogramGeode::m_clickedCluster
private

the clicked cluster

Definition at line 143 of file WDendrogramGeode.h.

Referenced by getClickClusterRecursive(), getClickClusterRecursive2(), and getClickedCluster().

osg::ref_ptr<osg::Vec4Array> WDendrogramGeode::m_colors
private

color array

Definition at line 123 of file WDendrogramGeode.h.

Referenced by create(), layoutLevel(), and layoutValue().

osg::DrawElementsUInt* WDendrogramGeode::m_lineArray
private

line array

Definition at line 127 of file WDendrogramGeode.h.

Referenced by create(), layoutLevel(), and layoutValue().

size_t WDendrogramGeode::m_minClusterSize
private

minimum cluster size to be considered while laying out the dendrogram

Definition at line 129 of file WDendrogramGeode.h.

Referenced by getClickClusterRecursive(), getClickClusterRecursive2(), layoutLevel(), and layoutValue().

size_t WDendrogramGeode::m_rootCluster
private

top cluster to draw the tree from

Definition at line 121 of file WDendrogramGeode.h.

Referenced by create(), and getClickedCluster().

WHierarchicalTree* WDendrogramGeode::m_tree
private
bool WDendrogramGeode::m_useLevel
private

flag indicating if the level or the value of a cluster will be used for the height of join

Definition at line 141 of file WDendrogramGeode.h.

Referenced by create(), and getClickedCluster().

osg::Vec3Array* WDendrogramGeode::m_vertexArray
private

vertex array

Definition at line 125 of file WDendrogramGeode.h.

Referenced by create(), layoutLevel(), and layoutValue().

int WDendrogramGeode::m_xClicked
private

stores the click position for use int he recursive function

Definition at line 138 of file WDendrogramGeode.h.

Referenced by getClickClusterRecursive(), getClickClusterRecursive2(), and getClickedCluster().

float WDendrogramGeode::m_xMult
private

helper variable for the recursive function

Definition at line 135 of file WDendrogramGeode.h.

Referenced by create().

float WDendrogramGeode::m_xOff
private

x offset

Definition at line 133 of file WDendrogramGeode.h.

Referenced by create(), and getClickedCluster().

float WDendrogramGeode::m_xSize
private

x size in pixel of the final dendrogram

Definition at line 131 of file WDendrogramGeode.h.

Referenced by create(), and getClickedCluster().

int WDendrogramGeode::m_yClicked
private

stores the click position for use int he recursive function

Definition at line 139 of file WDendrogramGeode.h.

Referenced by getClickClusterRecursive(), getClickClusterRecursive2(), and getClickedCluster().

float WDendrogramGeode::m_yMult
private

helper variable for the recursive function

Definition at line 136 of file WDendrogramGeode.h.

Referenced by create().

float WDendrogramGeode::m_yOff
private

y offset

Definition at line 134 of file WDendrogramGeode.h.

Referenced by create(), and getClickedCluster().

float WDendrogramGeode::m_ySize
private

y size in pixel of the final dendrogram

Definition at line 132 of file WDendrogramGeode.h.

Referenced by create(), getClickClusterRecursive2(), and getClickedCluster().


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