VTK  9.7.1
vtkTanglegramItem.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
20 #ifndef vtkTanglegramItem_h
21 #define vtkTanglegramItem_h
22 
23 #include "vtkViewsInfovisModule.h" // For export macro
24 
25 #include "vtkContextItem.h"
26 #include "vtkSmartPointer.h" // For SmartPointer ivars
27 #include "vtkTable.h" // For get/set
28 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
29 
30 VTK_ABI_NAMESPACE_BEGIN
31 class vtkDendrogramItem;
32 class vtkLookupTable;
33 class vtkStringArray;
34 class vtkTree;
35 
36 class VTKVIEWSINFOVIS_EXPORT VTK_MARSHALAUTO vtkTanglegramItem : public vtkContextItem
37 {
38 public:
39  static vtkTanglegramItem* New();
41  void PrintSelf(ostream& os, vtkIndent indent) override;
42 
44 
47  virtual void SetTree1(vtkTree* tree);
48  vtkTree* GetTree1();
50 
52 
55  virtual void SetTree2(vtkTree* tree);
56  vtkTree* GetTree2();
58 
60 
69  vtkTable* GetTable();
70  void SetTable(vtkTable* table);
72 
74 
77  vtkGetStringMacro(Tree1Label);
78  vtkSetStringMacro(Tree1Label);
80 
82 
85  vtkGetStringMacro(Tree2Label);
86  vtkSetStringMacro(Tree2Label);
88 
93  void SetOrientation(int orientation);
94 
98  int GetOrientation();
99 
101 
107  vtkGetMacro(MinimumVisibleFontSize, int);
108  vtkSetMacro(MinimumVisibleFontSize, int);
110 
112 
118  vtkGetMacro(LabelSizeDifference, int);
119  vtkSetMacro(LabelSizeDifference, int);
121 
123 
126  vtkGetMacro(CorrespondenceLineWidth, float);
127  vtkSetMacro(CorrespondenceLineWidth, float);
129 
131 
134  float GetTreeLineWidth();
135  void SetTreeLineWidth(float width);
137 
141  bool Hit(const vtkContextMouseEvent& mouse) override;
142 
147  bool MouseDoubleClickEvent(const vtkContextMouseEvent& event) override;
148 
149 protected:
151  ~vtkTanglegramItem() override;
152 
156  void RefreshBuffers(vtkContext2D* painter);
157 
161  void PositionTree2();
162 
166  void PaintCorrespondenceLines(vtkContext2D* painter);
167 
171  void PaintTreeLabels(vtkContext2D* painter);
172 
177  void ReorderTree();
178 
184  void ReorderTreeAtVertex(vtkIdType parent, vtkTree* tree);
185 
192  double GetPositionScoreForVertex(vtkIdType vertex, vtkTree* tree);
193 
198  void GenerateLookupTable();
199 
203  bool Paint(vtkContext2D* painter) override;
204 
205 private:
210  vtkStringArray* Tree1Names;
211  vtkStringArray* Tree2Names;
212  vtkStringArray* SourceNames;
213  double Tree1Bounds[4];
214  double Tree2Bounds[4];
215  double Spacing;
216  double LabelWidth1;
217  double LabelWidth2;
218  bool PositionSet;
219  bool TreeReordered;
220  char* Tree1Label;
221  char* Tree2Label;
222  int Orientation;
223  int MinimumVisibleFontSize;
224  int LabelSizeDifference;
225  float CorrespondenceLineWidth;
226 
227  vtkTanglegramItem(const vtkTanglegramItem&) = delete;
228  void operator=(const vtkTanglegramItem&) = delete;
229 };
230 
231 VTK_ABI_NAMESPACE_END
232 #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.
virtual bool Paint(vtkContext2D *painter)
Paint event for the item, called whenever the item needs to be drawn.
map scalar values into colors via a lookup table
a vtkAbstractArray subclass for strings
int vtkIdType
Definition: vtkType.h:363
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:49
data structure to represent mouse events.
a simple class to control print indentation
Definition: vtkIndent.h:28
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:59
virtual bool Hit(const vtkContextMouseEvent &mouse)
Return true if the supplied x, y coordinate is inside the item.
#define VTK_MARSHALAUTO
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:46
virtual bool MouseDoubleClickEvent(const vtkContextMouseEvent &mouse)
Mouse button double click event.