VTK  9.1.0
vtkTanglegramItem.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkTanglegramItem.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
29#ifndef vtkTanglegramItem_h
30#define vtkTanglegramItem_h
31
32#include "vtkViewsInfovisModule.h" // For export macro
33
34#include "vtkContextItem.h"
35#include "vtkSmartPointer.h" // For SmartPointer ivars
36#include "vtkTable.h" // For get/set
37
39class vtkLookupTable;
40class vtkStringArray;
41class vtkTree;
42
43class VTKVIEWSINFOVIS_EXPORT vtkTanglegramItem : public vtkContextItem
44{
45public:
48 void PrintSelf(ostream& os, vtkIndent indent) override;
49
53 virtual void SetTree1(vtkTree* tree);
54
58 virtual void SetTree2(vtkTree* tree);
59
61
71 void SetTable(vtkTable* table);
73
75
78 vtkGetStringMacro(Tree1Label);
79 vtkSetStringMacro(Tree1Label);
81
83
86 vtkGetStringMacro(Tree2Label);
87 vtkSetStringMacro(Tree2Label);
89
95
100
102
108 vtkGetMacro(MinimumVisibleFontSize, int);
109 vtkSetMacro(MinimumVisibleFontSize, int);
111
113
119 vtkGetMacro(LabelSizeDifference, int);
120 vtkSetMacro(LabelSizeDifference, int);
122
124
127 vtkGetMacro(CorrespondenceLineWidth, float);
128 vtkSetMacro(CorrespondenceLineWidth, float);
130
132
136 void SetTreeLineWidth(float width);
138
142 bool Hit(const vtkContextMouseEvent& mouse) override;
143
148 bool MouseDoubleClickEvent(const vtkContextMouseEvent& event) override;
149
150protected:
153
158
163
168
173
179
186
194
200
204 bool Paint(vtkContext2D* painter) override;
205
206private:
211 vtkStringArray* Tree1Names;
212 vtkStringArray* Tree2Names;
213 vtkStringArray* SourceNames;
214 double Tree1Bounds[4];
215 double Tree2Bounds[4];
216 double Spacing;
217 double LabelWidth1;
218 double LabelWidth2;
219 bool PositionSet;
220 bool TreeReordered;
221 char* Tree1Label;
222 char* Tree2Label;
223 int Orientation;
224 int MinimumVisibleFontSize;
225 int LabelSizeDifference;
226 float CorrespondenceLineWidth;
227
228 vtkTanglegramItem(const vtkTanglegramItem&) = delete;
229 void operator=(const vtkTanglegramItem&) = delete;
230};
231
232#endif
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:73
base class for items that are part of a vtkContextScene.
data structure to represent mouse events.
A 2D graphics item for rendering a tree as a dendrogram.
a simple class to control print indentation
Definition: vtkIndent.h:113
map scalar values into colors via a lookup table
a vtkAbstractArray subclass for strings
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:172
Display two related trees.
void RefreshBuffers(vtkContext2D *painter)
Update the bounds of our two dendrograms.
void ReorderTree()
Reorder the children of tree #2 to minimize the amount of crossings in our tanglegram.
bool MouseDoubleClickEvent(const vtkContextMouseEvent &event) override
Propagate any double click onto the dendrograms to check if any subtrees should be collapsed or expan...
void SetTable(vtkTable *table)
Get/Set the table that describes the correspondences between the two trees.
int GetOrientation()
Get the current orientation.
bool Hit(const vtkContextMouseEvent &mouse) override
Returns true if the transform is interactive, false otherwise.
void PaintTreeLabels(vtkContext2D *painter)
Draw the labels of our two dendrograms.
void ReorderTreeAtVertex(vtkIdType parent, vtkTree *tree)
Helper function used by ReorderTree.
void PositionTree2()
Calculate and set an appropriate position for our second dendrogram.
void SetTreeLineWidth(float width)
Get/Set how wide the edges of the trees should be.
static vtkTanglegramItem * New()
~vtkTanglegramItem() override
void GenerateLookupTable()
Initialize the lookup table used to color the lines between the two dendrograms.
void PaintCorrespondenceLines(vtkContext2D *painter)
Draw the lines between the corresponding vertices of our two dendrograms.
float GetTreeLineWidth()
Get/Set how wide the edges of the trees should be.
bool Paint(vtkContext2D *painter) override
Paints the tree & associated table as a heatmap.
double GetPositionScoreForVertex(vtkIdType vertex, vtkTree *tree)
Helper function used by ReorderTreeAtVertex.
virtual void SetTree1(vtkTree *tree)
Set the first tree.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetOrientation(int orientation)
Set which way the tanglegram should face within the visualization.
vtkTable * GetTable()
Get/Set the table that describes the correspondences between the two trees.
virtual void SetTree2(vtkTree *tree)
Set the second tree.
A rooted tree data structure.
Definition: vtkTree.h:164
@ orientation
Definition: vtkX3D.h:268
int vtkIdType
Definition: vtkType.h:332