OpenWalnut  1.5.0dev
Public Member Functions | Private Member Functions | Private Attributes | List of all members
WNonBinDendroGeode Class Reference

Class creates a dendrogram from a hierarchical clustering, and allows to click and select specific nodes. More...

#include <WNonBinDendroGeode.h>

+ Inheritance diagram for WNonBinDendroGeode:
+ Collaboration diagram for WNonBinDendroGeode:

Public Member Functions

 WNonBinDendroGeode (const WHtree &tree, const std::vector< WColor > &displayColors, size_t cluster, float xSize, float ySize, float xOffset, float yOffset, bool useHLevel=false, bool triangleLeaves=false, float hozLine=0)
 constructor More...
 
 ~WNonBinDendroGeode ()
 destructor More...
 
size_t getClickedCluster (int xClick, int yClick)
 calculate which cluster was clicked from given pixel coordinates More...
 
bool inDendrogramArea (int xClick, int yClick) 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 layout (const WHnode &cluster, const float leftLimit, const float rightLimit)
 recursive function that lays out the tree from top to bottom, height of the joins is determined by the hierarchical level of the cluster or distance value More...
 
void findClickedCluster (size_t cluster, float leftLimit, float rightLimit)
 recurse function that follows the layout to determine the cluster from pixel coordinates More...
 

Private Attributes

const WHtree m_tree
 the tree to work on More...
 
size_t m_rootCluster
 top cluster to draw the tree from More...
 
const std::vector< WColor > & m_displayColors
 stores a the current colors each node should be displayed, given the current selection More...
 
osg::ref_ptr< osg::Vec4Array > m_lineColors
 stores a the colors of each line that should be drawn More...
 
osg::Vec3Array * m_vertexArray
 vertex array More...
 
osg::DrawElementsUInt * m_lineArray
 line array 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 for dendrogram drawing in the screen More...
 
float m_yOff
 y offset for dendrogram drawing in the screen More...
 
float m_xUnit
 helper variable for x position in the node selection recursive function More...
 
float m_yUnit
 helper variable for y position in the node selection recursive function More...
 
float m_xClicked
 stores the click x position for use in the node selection recursive function More...
 
float m_yClicked
 stores the click y position for use in the node selection recursive function More...
 
bool m_useHLevel
 flag indicating if the level or the value of a cluster will be used for the height of join More...
 
bool m_triangleLeaves
 option to join leaves with straight lines, giving a triangle appearance to the bottom level More...
 
float m_hozLine
 determines if a horizontal line will be drawn to indicate aprtition level More...
 
size_t m_clickedCluster
 ID of the clicked cluster. More...
 

Detailed Description

Class creates a dendrogram from a hierarchical clustering, and allows to click and select specific nodes.

Definition at line 66 of file WNonBinDendroGeode.h.

Constructor & Destructor Documentation

◆ WNonBinDendroGeode()

WNonBinDendroGeode::WNonBinDendroGeode ( const WHtree tree,
const std::vector< WColor > &  displayColors,
size_t  cluster,
float  xSize,
float  ySize,
float  xOffset,
float  yOffset,
bool  useHLevel = false,
bool  triangleLeaves = false,
float  hozLine = 0 
)

constructor

Class implements a dendrogram as an osg geode.

Parameters
treetree object to work on
displayColorsvector of cluster selection colors
clusterroot cluster for the dendrogram
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
useHLevelif true the height of a node is determined by the hierarchical level of the cluster
triangleLeavesif set leaves will be joined by a straight line to the parent node
hozLineif != 0 a horizontal cuttting line will be drawn across the tree

Definition at line 58 of file WNonBinDendroGeode.cpp.

References create().

+ Here is the call graph for this function:

◆ ~WNonBinDendroGeode()

WNonBinDendroGeode::~WNonBinDendroGeode ( )

destructor

Definition at line 68 of file WNonBinDendroGeode.cpp.

Member Function Documentation

◆ create()

void WNonBinDendroGeode::create ( )
private

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

Definition at line 72 of file WNonBinDendroGeode.cpp.

References WHnode::getDistLevel(), WHnode::getHLevel(), WHnode::getID(), WHtree::getNode(), WHtree::getRoot(), WHnode::getSize(), layout(), m_hozLine, m_lineArray, m_lineColors, m_rootCluster, m_tree, m_useHLevel, m_vertexArray, m_xOff, m_xSize, m_xUnit, m_yOff, m_ySize, and m_yUnit.

Referenced by WNonBinDendroGeode().

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

◆ findClickedCluster()

void WNonBinDendroGeode::findClickedCluster ( size_t  cluster,
float  leftLimit,
float  rightLimit 
)
private

recurse function that follows the layout to determine the cluster from pixel coordinates

Parameters
clustercluster to check against coordinates
leftLimitleft boundary of cluster
rightLimitright boundary of cluster

Definition at line 249 of file WNonBinDendroGeode.cpp.

References WHnode::getChildren(), WHnode::getDistLevel(), WHnode::getHLevel(), WHnode::getID(), WHtree::getNode(), WHnode::getSize(), WHnode::isNode(), m_clickedCluster, m_tree, m_useHLevel, m_xClicked, m_xUnit, m_yClicked, m_yUnit, and WHtree::sortBySize().

Referenced by getClickedCluster().

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

◆ getClickedCluster()

size_t WNonBinDendroGeode::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 236 of file WNonBinDendroGeode.cpp.

References findClickedCluster(), WHtree::getNode(), WHnode::getSize(), m_clickedCluster, m_rootCluster, m_tree, m_xClicked, m_xOff, m_xUnit, m_yClicked, m_yOff, and m_yUnit.

Referenced by WMHierchClustDisplay::dendrogramClick(), and WMHierchClustDisplay::dendrogramClickRight().

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

◆ inDendrogramArea()

bool WNonBinDendroGeode::inDendrogramArea ( int  xClick,
int  yClick 
) const

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

Parameters
xClickthe x coordinate
yClickthe y coordinate
Returns
true if pos is within the dendrogram area, otherwise false

Definition at line 303 of file WNonBinDendroGeode.cpp.

References m_xOff, m_xSize, m_yOff, and m_ySize.

Referenced by WMHierchClustDisplay::dendrogramClick(), and WMHierchClustDisplay::dendrogramClickRight().

+ Here is the caller graph for this function:

◆ layout()

void WNonBinDendroGeode::layout ( const WHnode cluster,
const float  leftLimit,
const float  rightLimit 
)
private

recursive function that lays out the tree from top to bottom, height of the joins is determined by the hierarchical level of the cluster or distance value

Parameters
clusterthe current node cluster to work on
leftLimitleft border of the current subcluster
rightLimitright border of the current subcluster

Definition at line 153 of file WNonBinDendroGeode.cpp.

References WHnode::getChildren(), WHnode::getDistLevel(), WHnode::getHLevel(), WHnode::getID(), WHtree::getNode(), WHnode::getSize(), WHnode::isLeaf(), WHnode::isNode(), m_displayColors, m_lineArray, m_lineColors, m_tree, m_triangleLeaves, m_useHLevel, m_vertexArray, and WHtree::sortBySize().

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 WNonBinDendroGeode::m_clickedCluster
private

ID of the clicked cluster.

Definition at line 161 of file WNonBinDendroGeode.h.

Referenced by findClickedCluster(), and getClickedCluster().

◆ m_displayColors

const std::vector< WColor >& WNonBinDendroGeode::m_displayColors
private

stores a the current colors each node should be displayed, given the current selection

Definition at line 138 of file WNonBinDendroGeode.h.

Referenced by layout().

◆ m_hozLine

float WNonBinDendroGeode::m_hozLine
private

determines if a horizontal line will be drawn to indicate aprtition level

Definition at line 159 of file WNonBinDendroGeode.h.

Referenced by create().

◆ m_lineArray

osg::DrawElementsUInt* WNonBinDendroGeode::m_lineArray
private

line array

Definition at line 144 of file WNonBinDendroGeode.h.

Referenced by create(), and layout().

◆ m_lineColors

osg::ref_ptr< osg::Vec4Array > WNonBinDendroGeode::m_lineColors
private

stores a the colors of each line that should be drawn

Definition at line 140 of file WNonBinDendroGeode.h.

Referenced by create(), and layout().

◆ m_rootCluster

size_t WNonBinDendroGeode::m_rootCluster
private

top cluster to draw the tree from

Definition at line 136 of file WNonBinDendroGeode.h.

Referenced by create(), and getClickedCluster().

◆ m_tree

const WHtree WNonBinDendroGeode::m_tree
private

the tree to work on

Definition at line 134 of file WNonBinDendroGeode.h.

Referenced by create(), findClickedCluster(), getClickedCluster(), and layout().

◆ m_triangleLeaves

bool WNonBinDendroGeode::m_triangleLeaves
private

option to join leaves with straight lines, giving a triangle appearance to the bottom level

Definition at line 157 of file WNonBinDendroGeode.h.

Referenced by layout().

◆ m_useHLevel

bool WNonBinDendroGeode::m_useHLevel
private

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

Definition at line 156 of file WNonBinDendroGeode.h.

Referenced by create(), findClickedCluster(), and layout().

◆ m_vertexArray

osg::Vec3Array* WNonBinDendroGeode::m_vertexArray
private

vertex array

Definition at line 142 of file WNonBinDendroGeode.h.

Referenced by create(), and layout().

◆ m_xClicked

float WNonBinDendroGeode::m_xClicked
private

stores the click x position for use in the node selection recursive function

Definition at line 153 of file WNonBinDendroGeode.h.

Referenced by findClickedCluster(), and getClickedCluster().

◆ m_xOff

float WNonBinDendroGeode::m_xOff
private

x offset for dendrogram drawing in the screen

Definition at line 148 of file WNonBinDendroGeode.h.

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

◆ m_xSize

float WNonBinDendroGeode::m_xSize
private

x size in pixel of the final dendrogram

Definition at line 146 of file WNonBinDendroGeode.h.

Referenced by create(), and inDendrogramArea().

◆ m_xUnit

float WNonBinDendroGeode::m_xUnit
private

helper variable for x position in the node selection recursive function

Definition at line 150 of file WNonBinDendroGeode.h.

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

◆ m_yClicked

float WNonBinDendroGeode::m_yClicked
private

stores the click y position for use in the node selection recursive function

Definition at line 154 of file WNonBinDendroGeode.h.

Referenced by findClickedCluster(), and getClickedCluster().

◆ m_yOff

float WNonBinDendroGeode::m_yOff
private

y offset for dendrogram drawing in the screen

Definition at line 149 of file WNonBinDendroGeode.h.

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

◆ m_ySize

float WNonBinDendroGeode::m_ySize
private

y size in pixel of the final dendrogram

Definition at line 147 of file WNonBinDendroGeode.h.

Referenced by create(), and inDendrogramArea().

◆ m_yUnit

float WNonBinDendroGeode::m_yUnit
private

helper variable for y position in the node selection recursive function

Definition at line 151 of file WNonBinDendroGeode.h.

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


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