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 =========================================================================*/
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 
38 class vtkDendrogramItem;
39 class vtkLookupTable;
40 class vtkStringArray;
41 class vtkTree;
42 
43 class VTKVIEWSINFOVIS_EXPORT vtkTanglegramItem : public vtkContextItem
44 {
45 public:
46  static vtkTanglegramItem *New();
48  void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE;
49 
53  virtual void SetTree1(vtkTree *tree);
54 
58  virtual void SetTree2(vtkTree *tree);
59 
61 
70  vtkTable * GetTable();
71  void SetTable(vtkTable *table);
73 
75 
78  vtkGetStringMacro(Tree1Label);
79  vtkSetStringMacro(Tree1Label);
81 
83 
86  vtkGetStringMacro(Tree2Label);
87  vtkSetStringMacro(Tree2Label);
89 
94  void SetOrientation(int orientation);
95 
99  int GetOrientation();
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 
135  float GetTreeLineWidth();
136  void SetTreeLineWidth(float width);
138 
142  bool Hit(const vtkContextMouseEvent &mouse) VTK_OVERRIDE;
143 
148  bool MouseDoubleClickEvent(const vtkContextMouseEvent &event) VTK_OVERRIDE;
149 
150 protected:
152  ~vtkTanglegramItem() VTK_OVERRIDE;
153 
157  void RefreshBuffers(vtkContext2D *painter);
158 
162  void PositionTree2();
163 
167  void PaintCorrespondenceLines(vtkContext2D *painter);
168 
172  void PaintTreeLabels(vtkContext2D *painter);
173 
178  void ReorderTree();
179 
185  void ReorderTreeAtVertex(vtkIdType parent, vtkTree *tree);
186 
193  double GetPositionScoreForVertex(vtkIdType vertex, vtkTree *tree);
194 
199  void GenerateLookupTable();
200 
204  bool Paint(vtkContext2D *painter) VTK_OVERRIDE;
205 
206 private:
207  vtkSmartPointer<vtkDendrogramItem> Dendrogram1;
208  vtkSmartPointer<vtkDendrogramItem> Dendrogram2;
209  vtkSmartPointer<vtkLookupTable> LookupTable;
210  vtkSmartPointer<vtkTable> Table;
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&) VTK_DELETE_FUNCTION;
229  void operator=(const vtkTanglegramItem&) VTK_DELETE_FUNCTION;
230 
231 };
232 
233 #endif
Display two related trees.
A 2D graphics item for rendering a tree as a dendrogram.
base class for items that are part of a vtkContextScene.
map scalar values into colors via a lookup table
a vtkAbstractArray subclass for strings
Hold a reference to a vtkObjectBase instance.
int vtkIdType
Definition: vtkType.h:345
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:52
data structure to represent mouse events.
a simple class to control print indentation
Definition: vtkIndent.h:33
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:62
virtual bool Hit(const vtkContextMouseEvent &mouse)
Return true if the supplied x, y coordinate is inside the item.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
A rooted tree data structure.
Definition: vtkTree.h:54
virtual bool MouseDoubleClickEvent(const vtkContextMouseEvent &mouse)
Mouse button double click event.