OpenWalnut
1.5.0dev
|
Class creates a dendrogram from a hierarchical clustering, and allows to click and select specific nodes. More...
#include <WNonBinDendroGeode.h>
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... | |
Class creates a dendrogram from a hierarchical clustering, and allows to click and select specific nodes.
Definition at line 66 of file WNonBinDendroGeode.h.
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.
tree | tree object to work on |
displayColors | vector of cluster selection colors |
cluster | root cluster for the dendrogram |
xSize | number of pixel to scale the tree on along the x axis |
ySize | number of pixel to scale the tree on along the y axis |
xOffset | translation alogn the x axis |
yOffset | translation alogn the y axis |
useHLevel | if true the height of a node is determined by the hierarchical level of the cluster |
triangleLeaves | if set leaves will be joined by a straight line to the parent node |
hozLine | if != 0 a horizontal cuttting line will be drawn across the tree |
Definition at line 58 of file WNonBinDendroGeode.cpp.
References create().
WNonBinDendroGeode::~WNonBinDendroGeode | ( | ) |
destructor
Definition at line 68 of file WNonBinDendroGeode.cpp.
|
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().
|
private |
recurse function that follows the layout to determine the cluster from pixel coordinates
cluster | cluster to check against coordinates |
leftLimit | left boundary of cluster |
rightLimit | right 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().
size_t WNonBinDendroGeode::getClickedCluster | ( | int | xClick, |
int | yClick | ||
) |
calculate which cluster was clicked from given pixel coordinates
xClick | the x coordinate |
yClick | the y coordinate |
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().
bool WNonBinDendroGeode::inDendrogramArea | ( | int | xClick, |
int | yClick | ||
) | const |
calculates if the given position is within the view area of the dendrogram
xClick | the x coordinate |
yClick | the y coordinate |
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().
|
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
cluster | the current node cluster to work on |
leftLimit | left border of the current subcluster |
rightLimit | right 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().
|
private |
ID of the clicked cluster.
Definition at line 161 of file WNonBinDendroGeode.h.
Referenced by findClickedCluster(), and getClickedCluster().
|
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().
|
private |
determines if a horizontal line will be drawn to indicate aprtition level
Definition at line 159 of file WNonBinDendroGeode.h.
Referenced by create().
|
private |
line array
Definition at line 144 of file WNonBinDendroGeode.h.
|
private |
stores a the colors of each line that should be drawn
Definition at line 140 of file WNonBinDendroGeode.h.
|
private |
top cluster to draw the tree from
Definition at line 136 of file WNonBinDendroGeode.h.
Referenced by create(), and getClickedCluster().
|
private |
the tree to work on
Definition at line 134 of file WNonBinDendroGeode.h.
Referenced by create(), findClickedCluster(), getClickedCluster(), and layout().
|
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().
|
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().
|
private |
vertex array
Definition at line 142 of file WNonBinDendroGeode.h.
|
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().
|
private |
x offset for dendrogram drawing in the screen
Definition at line 148 of file WNonBinDendroGeode.h.
Referenced by create(), getClickedCluster(), and inDendrogramArea().
|
private |
x size in pixel of the final dendrogram
Definition at line 146 of file WNonBinDendroGeode.h.
Referenced by create(), and inDendrogramArea().
|
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().
|
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().
|
private |
y offset for dendrogram drawing in the screen
Definition at line 149 of file WNonBinDendroGeode.h.
Referenced by create(), getClickedCluster(), and inDendrogramArea().
|
private |
y size in pixel of the final dendrogram
Definition at line 147 of file WNonBinDendroGeode.h.
Referenced by create(), and inDendrogramArea().
|
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().