VTK
vtkTanglegramItem.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: TestDiagram.cxx
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 =========================================================================*/
32 #ifndef vtkTanglegramItem_h
33 #define vtkTanglegramItem_h
34 
35 #include "vtkViewsInfovisModule.h" // For export macro
36 
37 #include "vtkContextItem.h"
38 #include "vtkSmartPointer.h" // For SmartPointer ivars
39 #include "vtkTable.h" // For get/set
40 
41 class vtkDendrogramItem;
42 class vtkLookupTable;
43 class vtkStringArray;
44 class vtkTree;
45 
46 class VTKVIEWSINFOVIS_EXPORT vtkTanglegramItem : public vtkContextItem
47 {
48 public:
51  virtual void PrintSelf(ostream &os, vtkIndent indent);
52 
56  virtual void SetTree1(vtkTree *tree);
57 
61  virtual void SetTree2(vtkTree *tree);
62 
64 
74  void SetTable(vtkTable *table);
76 
78 
81  vtkGetStringMacro(Tree1Label);
82  vtkSetStringMacro(Tree1Label);
84 
86 
89  vtkGetStringMacro(Tree2Label);
90  vtkSetStringMacro(Tree2Label);
92 
98 
103 
105 
111  vtkGetMacro(MinimumVisibleFontSize, int);
112  vtkSetMacro(MinimumVisibleFontSize, int);
114 
116 
122  vtkGetMacro(LabelSizeDifference, int);
123  vtkSetMacro(LabelSizeDifference, int);
125 
127 
130  vtkGetMacro(CorrespondenceLineWidth, float);
131  vtkSetMacro(CorrespondenceLineWidth, float);
133 
135 
139  void SetTreeLineWidth(float width);
141 
145  virtual bool Hit(const vtkContextMouseEvent &mouse);
146 
151  virtual bool MouseDoubleClickEvent(const vtkContextMouseEvent &event);
152 
153 protected:
156 
160  void RefreshBuffers(vtkContext2D *painter);
161 
166 
171 
176 
181  void ReorderTree();
182 
188  void ReorderTreeAtVertex(vtkIdType parent, vtkTree *tree);
189 
197 
203 
207  virtual bool Paint(vtkContext2D *painter);
208 
209 private:
214  vtkStringArray *Tree1Names;
215  vtkStringArray *Tree2Names;
216  vtkStringArray *SourceNames;
217  double Tree1Bounds[4];
218  double Tree2Bounds[4];
219  double Spacing;
220  double LabelWidth1;
221  double LabelWidth2;
222  bool PositionSet;
223  bool TreeReordered;
224  char* Tree1Label;
225  char* Tree2Label;
226  int Orientation;
227  int MinimumVisibleFontSize;
228  int LabelSizeDifference;
229  float CorrespondenceLineWidth;
230 
231  vtkTanglegramItem(const vtkTanglegramItem&) VTK_DELETE_FUNCTION;
232  void operator=(const vtkTanglegramItem&) VTK_DELETE_FUNCTION;
233 
234 };
235 
236 #endif
vtkTanglegramItem::PaintTreeLabels
void PaintTreeLabels(vtkContext2D *painter)
Draw the labels of our two dendrograms.
vtkContextMouseEvent
data structure to represent mouse events.
Definition: vtkContextMouseEvent.h:41
vtkTanglegramItem
Display two related trees.
Definition: vtkTanglegramItem.h:47
vtkIdType
int vtkIdType
Definition: vtkType.h:287
vtkTanglegramItem::PaintCorrespondenceLines
void PaintCorrespondenceLines(vtkContext2D *painter)
Draw the lines between the corresponding vertices of our two dendrograms.
vtkTable
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:69
vtkTanglegramItem::SetOrientation
void SetOrientation(int orientation)
Set which way the tanglegram should face within the visualization.
vtkTanglegramItem::MouseDoubleClickEvent
virtual bool MouseDoubleClickEvent(const vtkContextMouseEvent &event)
Propagate any double click onto the dendrograms to check if any subtrees should be collapsed or expan...
vtkTanglegramItem::Hit
virtual bool Hit(const vtkContextMouseEvent &mouse)
Returns true if the transform is interactive, false otherwise.
vtkTanglegramItem::~vtkTanglegramItem
~vtkTanglegramItem()
vtkSmartPointer< vtkDendrogramItem >
vtkTanglegramItem::ReorderTreeAtVertex
void ReorderTreeAtVertex(vtkIdType parent, vtkTree *tree)
Helper function used by ReorderTree.
vtkTanglegramItem::GetOrientation
int GetOrientation()
Get the current orientation.
vtkTanglegramItem::RefreshBuffers
void RefreshBuffers(vtkContext2D *painter)
Update the bounds of our two dendrograms.
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:58
vtkContextItem.h
vtkTanglegramItem::GetTable
vtkTable * GetTable()
Get/Set the table that describes the correspondences between the two trees.
vtkTanglegramItem::New
static vtkTanglegramItem * New()
vtkTanglegramItem::SetTable
void SetTable(vtkTable *table)
vtkTree
A rooted tree data structure.
Definition: vtkTree.h:61
vtkTanglegramItem::GetPositionScoreForVertex
double GetPositionScoreForVertex(vtkIdType vertex, vtkTree *tree)
Helper function used by ReorderTreeAtVertex.
vtkTanglegramItem::SetTree1
virtual void SetTree1(vtkTree *tree)
Set the first tree.
vtkTanglegramItem::vtkTanglegramItem
vtkTanglegramItem()
vtkTanglegramItem::ReorderTree
void ReorderTree()
Reorder the children of tree #2 to minimize the amount of crossings in our tanglegram.
vtkTanglegramItem::PrintSelf
virtual void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkSmartPointer.h
vtkGetStringMacro
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
vtkTanglegramItem::PositionTree2
void PositionTree2()
Calculate and set an appropriate position for our second dendrogram.
vtkTanglegramItem::SetTreeLineWidth
void SetTreeLineWidth(float width)
vtkContextItem
base class for items that are part of a vtkContextScene.
Definition: vtkContextItem.h:35
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkLookupTable
map scalar values into colors via a lookup table
Definition: vtkLookupTable.h:75
vtkTanglegramItem::GenerateLookupTable
void GenerateLookupTable()
Initialize the lookup table used to color the lines between the two dendrograms.
vtkTanglegramItem::GetTreeLineWidth
float GetTreeLineWidth()
Get/Set how wide the edges of the trees should be.
vtkX3D::orientation
@ orientation
Definition: vtkX3D.h:262
vtkTanglegramItem::SetTree2
virtual void SetTree2(vtkTree *tree)
Set the second tree.
vtkDendrogramItem
A 2D graphics item for rendering a tree as a dendrogram.
Definition: vtkDendrogramItem.h:58
vtkTable.h
vtkStringArray
a vtkAbstractArray subclass for strings
Definition: vtkStringArray.h:43
vtkTanglegramItem::Paint
virtual bool Paint(vtkContext2D *painter)
Paints the tree & associated table as a heatmap.