OpenWalnut  1.5.0dev
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:
+ Collaboration 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...
 
bool inDendrogramArea (const WVector2f &pos) const
 calculates if the given position is within the view area of the dendrogram 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::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().

+ Here is the call graph for this function:

◆ ~WDendrogramGeode()

WDendrogramGeode::~WDendrogramGeode ( )

destructor

Definition at line 49 of file WDendrogramGeode.cpp.

Member Function Documentation

◆ create()

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getClickClusterRecursive()

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getClickClusterRecursive2()

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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

Referenced by WMClusterDisplay::dendrogramClick(), and WMClusterDisplayVoxels::dendrogramClick().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ inDendrogramArea()

bool WDendrogramGeode::inDendrogramArea ( const WVector2f pos) const

calculates if the given position is within the view area of the dendrogram

Parameters
posthe position within the view
Returns
true if pos is within the dendrogram area, otherwise false

Definition at line 363 of file WDendrogramGeode.cpp.

References m_xOff, m_xSize, m_yOff, and m_ySize.

Referenced by WMClusterDisplay::dendrogramClick().

+ Here is the caller graph for this function:

◆ layoutLevel()

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ layoutValue()

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_clickedCluster

size_t WDendrogramGeode::m_clickedCluster
private

the clicked cluster

Definition at line 150 of file WDendrogramGeode.h.

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

◆ m_colors

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

color array

Definition at line 130 of file WDendrogramGeode.h.

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

◆ m_lineArray

osg::DrawElementsUInt* WDendrogramGeode::m_lineArray
private

line array

Definition at line 134 of file WDendrogramGeode.h.

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

◆ m_minClusterSize

size_t WDendrogramGeode::m_minClusterSize
private

minimum cluster size to be considered while laying out the dendrogram

Definition at line 136 of file WDendrogramGeode.h.

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

◆ m_rootCluster

size_t WDendrogramGeode::m_rootCluster
private

top cluster to draw the tree from

Definition at line 128 of file WDendrogramGeode.h.

Referenced by create(), and getClickedCluster().

◆ m_tree

WHierarchicalTree* WDendrogramGeode::m_tree
private

◆ m_useLevel

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 148 of file WDendrogramGeode.h.

Referenced by create(), and getClickedCluster().

◆ m_vertexArray

osg::Vec3Array* WDendrogramGeode::m_vertexArray
private

vertex array

Definition at line 132 of file WDendrogramGeode.h.

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

◆ m_xClicked

int WDendrogramGeode::m_xClicked
private

stores the click position for use int he recursive function

Definition at line 145 of file WDendrogramGeode.h.

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

◆ m_xMult

float WDendrogramGeode::m_xMult
private

helper variable for the recursive function

Definition at line 142 of file WDendrogramGeode.h.

Referenced by create().

◆ m_xOff

float WDendrogramGeode::m_xOff
private

x offset

Definition at line 140 of file WDendrogramGeode.h.

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

◆ m_xSize

float WDendrogramGeode::m_xSize
private

x size in pixel of the final dendrogram

Definition at line 138 of file WDendrogramGeode.h.

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

◆ m_yClicked

int WDendrogramGeode::m_yClicked
private

stores the click position for use int he recursive function

Definition at line 146 of file WDendrogramGeode.h.

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

◆ m_yMult

float WDendrogramGeode::m_yMult
private

helper variable for the recursive function

Definition at line 143 of file WDendrogramGeode.h.

Referenced by create().

◆ m_yOff

float WDendrogramGeode::m_yOff
private

y offset

Definition at line 141 of file WDendrogramGeode.h.

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

◆ m_ySize

float WDendrogramGeode::m_ySize
private

y size in pixel of the final dendrogram

Definition at line 139 of file WDendrogramGeode.h.

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


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