OpenWalnut  1.4.0
Public Member Functions | Private Member Functions | Private Attributes
WDendrogramGeode Class Reference

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

#include <WDendrogramGeode.h>

+ Inheritance diagram for WDendrogramGeode:

List of all members.

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
 ~WDendrogramGeode ()
 destructor
size_t getClickedCluster (int xClick, int yClick)
 calculate which cluster was clicked from given pixel coordinates

Private Member Functions

void create ()
 helper function the starts the layout process from the input data in the constructor
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
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
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
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

Private Attributes

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

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 34 of file WDendrogramGeode.cpp.

References create().

destructor

Definition at line 49 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 53 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 317 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 271 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 251 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 99 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 175 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

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().

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().

top cluster to draw the tree from

Definition at line 121 of file WDendrogramGeode.h.

Referenced by create(), and getClickedCluster().

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().

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().

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: