VTK
vtkRenderedGraphRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkRenderedGraphRepresentation.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 =========================================================================*/
15 /*-------------------------------------------------------------------------
16  Copyright 2008 Sandia Corporation.
17  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18  the U.S. Government retains certain rights in this software.
19 -------------------------------------------------------------------------*/
26 #ifndef vtkRenderedGraphRepresentation_h
27 #define vtkRenderedGraphRepresentation_h
28 
29 #include "vtkViewsInfovisModule.h" // For export macro
31 #include "vtkSmartPointer.h" // for SP ivars
32 
33 class vtkActor;
34 class vtkApplyColors;
35 class vtkApplyIcons;
36 class vtkEdgeCenters;
37 class vtkEdgeLayout;
39 class vtkGraphLayout;
41 class vtkGraphToGlyphs;
42 class vtkGraphToPoints;
43 class vtkGraphToPolyData;
44 class vtkIconGlyphFilter;
45 class vtkInformation;
47 class vtkLookupTable;
50 class vtkPolyData;
51 class vtkPolyDataMapper;
54 class vtkRenderView;
55 class vtkScalarBarWidget;
56 class vtkScalarsToColors;
57 class vtkTextProperty;
58 class vtkTexturedActor2D;
60 class vtkVertexDegree;
61 class vtkView;
62 class vtkViewTheme;
63 
64 class VTKVIEWSINFOVIS_EXPORT vtkRenderedGraphRepresentation : public vtkRenderedRepresentation
65 {
66 public:
69  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
70 
71  // ------------------------------------------------------------------------
72  // Vertex labels
73 
74  virtual void SetVertexLabelArrayName(const char* name);
75  virtual const char* GetVertexLabelArrayName();
76  virtual void SetVertexLabelPriorityArrayName(const char* name);
77  virtual const char* GetVertexLabelPriorityArrayName();
78  virtual void SetVertexLabelVisibility(bool b);
79  virtual bool GetVertexLabelVisibility();
80  vtkBooleanMacro(VertexLabelVisibility, bool);
81  virtual void SetVertexLabelTextProperty(vtkTextProperty* p);
82  virtual vtkTextProperty* GetVertexLabelTextProperty();
83  vtkSetStringMacro(VertexHoverArrayName);
84  vtkGetStringMacro(VertexHoverArrayName);
86 
89  vtkSetMacro(HideVertexLabelsOnInteraction, bool)
90  vtkGetMacro(HideVertexLabelsOnInteraction, bool)
91  vtkBooleanMacro(HideVertexLabelsOnInteraction, bool)
93 
94  // ------------------------------------------------------------------------
95  // Edge labels
96 
97  virtual void SetEdgeLabelArrayName(const char* name);
98  virtual const char* GetEdgeLabelArrayName();
99  virtual void SetEdgeLabelPriorityArrayName(const char* name);
100  virtual const char* GetEdgeLabelPriorityArrayName();
101  virtual void SetEdgeLabelVisibility(bool b);
102  virtual bool GetEdgeLabelVisibility();
103  vtkBooleanMacro(EdgeLabelVisibility, bool);
104  virtual void SetEdgeLabelTextProperty(vtkTextProperty* p);
105  virtual vtkTextProperty* GetEdgeLabelTextProperty();
106  vtkSetStringMacro(EdgeHoverArrayName);
107  vtkGetStringMacro(EdgeHoverArrayName);
109 
112  vtkSetMacro(HideEdgeLabelsOnInteraction, bool)
113  vtkGetMacro(HideEdgeLabelsOnInteraction, bool)
114  vtkBooleanMacro(HideEdgeLabelsOnInteraction, bool)
116 
117  // ------------------------------------------------------------------------
118  // Vertex icons
119 
120  virtual void SetVertexIconArrayName(const char* name);
121  virtual const char* GetVertexIconArrayName();
122  virtual void SetVertexIconPriorityArrayName(const char* name);
123  virtual const char* GetVertexIconPriorityArrayName();
124  virtual void SetVertexIconVisibility(bool b);
125  virtual bool GetVertexIconVisibility();
126  vtkBooleanMacro(VertexIconVisibility, bool);
127  virtual void AddVertexIconType(const char* name, int type);
128  virtual void ClearVertexIconTypes();
129  virtual void SetUseVertexIconTypeMap(bool b);
130  virtual bool GetUseVertexIconTypeMap();
131  vtkBooleanMacro(UseVertexIconTypeMap, bool);
132  virtual void SetVertexIconAlignment(int align);
133  virtual int GetVertexIconAlignment();
134  virtual void SetVertexSelectedIcon(int icon);
135  virtual int GetVertexSelectedIcon();
136  virtual void SetVertexDefaultIcon(int icon);
137  virtual int GetVertexDefaultIcon();
138 
140 
150  virtual void SetVertexIconSelectionMode(int mode);
151  virtual int GetVertexIconSelectionMode();
153  { this->SetVertexIconSelectionMode(0); }
155  { this->SetVertexIconSelectionMode(1); }
157  { this->SetVertexIconSelectionMode(2); }
159  { this->SetVertexIconSelectionMode(3); }
161 
162  // ------------------------------------------------------------------------
163  // Edge icons
164 
165  virtual void SetEdgeIconArrayName(const char* name);
166  virtual const char* GetEdgeIconArrayName();
167  virtual void SetEdgeIconPriorityArrayName(const char* name);
168  virtual const char* GetEdgeIconPriorityArrayName();
169  virtual void SetEdgeIconVisibility(bool b);
170  virtual bool GetEdgeIconVisibility();
171  vtkBooleanMacro(EdgeIconVisibility, bool);
172  virtual void AddEdgeIconType(const char* name, int type);
173  virtual void ClearEdgeIconTypes();
174  virtual void SetUseEdgeIconTypeMap(bool b);
175  virtual bool GetUseEdgeIconTypeMap();
176  vtkBooleanMacro(UseEdgeIconTypeMap, bool);
177  virtual void SetEdgeIconAlignment(int align);
178  virtual int GetEdgeIconAlignment();
179 
180  // ------------------------------------------------------------------------
181  // Vertex colors
182 
183  virtual void SetColorVerticesByArray(bool b);
184  virtual bool GetColorVerticesByArray();
185  vtkBooleanMacro(ColorVerticesByArray, bool);
186  virtual void SetVertexColorArrayName(const char* name);
187  virtual const char* GetVertexColorArrayName();
188 
189  // ------------------------------------------------------------------------
190  // Edge colors
191 
192  virtual void SetColorEdgesByArray(bool b);
193  virtual bool GetColorEdgesByArray();
194  vtkBooleanMacro(ColorEdgesByArray, bool);
195  virtual void SetEdgeColorArrayName(const char* name);
196  virtual const char* GetEdgeColorArrayName();
197 
198  // ------------------------------------------------------------------------
199  // Enabled vertices
200 
201  virtual void SetEnableVerticesByArray(bool b);
202  virtual bool GetEnableVerticesByArray();
203  vtkBooleanMacro(EnableVerticesByArray, bool);
204  virtual void SetEnabledVerticesArrayName(const char* name);
205  virtual const char* GetEnabledVerticesArrayName();
206 
207  // ------------------------------------------------------------------------
208  // Enabled edges
209 
210  virtual void SetEnableEdgesByArray(bool b);
211  virtual bool GetEnableEdgesByArray();
212  vtkBooleanMacro(EnableEdgesByArray, bool);
213  virtual void SetEnabledEdgesArrayName(const char* name);
214  virtual const char* GetEnabledEdgesArrayName();
215 
216  virtual void SetEdgeVisibility(bool b);
217  virtual bool GetEdgeVisibility();
218  vtkBooleanMacro(EdgeVisibility, bool);
219 
220  void SetEdgeSelection(bool b);
221  bool GetEdgeSelection();
222 
223  // ------------------------------------------------------------------------
224  // Vertex layout strategy
225 
227 
230  virtual void SetLayoutStrategy(vtkGraphLayoutStrategy* strategy);
231  virtual vtkGraphLayoutStrategy* GetLayoutStrategy();
233 
235 
238  virtual void SetLayoutStrategy(const char* name);
239  vtkGetStringMacro(LayoutStrategyName);
241 
246  { this->SetLayoutStrategy("Random"); }
248  { this->SetLayoutStrategy("Force Directed"); }
250  { this->SetLayoutStrategy("Simple 2D"); }
252  { this->SetLayoutStrategy("Clustering 2D"); }
254  { this->SetLayoutStrategy("Community 2D"); }
256  { this->SetLayoutStrategy("Fast 2D"); }
258  { this->SetLayoutStrategy("Pass Through"); }
260  { this->SetLayoutStrategy("Circular"); }
262  { this->SetLayoutStrategy("Tree"); }
264  { this->SetLayoutStrategy("Cosmic Tree"); }
266  { this->SetLayoutStrategy("Cone"); }
268  { this->SetLayoutStrategy("Span Tree"); }
269 
274  virtual void SetLayoutStrategyToAssignCoordinates(
275  const char* xarr, const char* yarr = 0, const char* zarr = 0);
276 
287  virtual void SetLayoutStrategyToTree(
288  bool radial,
289  double angle = 90,
290  double leafSpacing = 0.9,
291  double logSpacing = 1.0);
292 
303  virtual void SetLayoutStrategyToCosmicTree(
304  const char* nodeSizeArrayName,
305  bool sizeLeafNodesOnly = true,
306  int layoutDepth = 0,
307  vtkIdType layoutRoot = -1);
308 
309  // ------------------------------------------------------------------------
310  // Edge layout strategy
311 
313 
316  virtual void SetEdgeLayoutStrategy(vtkEdgeLayoutStrategy* strategy);
317  virtual vtkEdgeLayoutStrategy* GetEdgeLayoutStrategy();
319  { this->SetEdgeLayoutStrategy("Arc Parallel"); }
321  { this->SetEdgeLayoutStrategy("Pass Through"); }
323 
328  virtual void SetEdgeLayoutStrategyToGeo(double explodeFactor = 0.2);
329 
331 
334  virtual void SetEdgeLayoutStrategy(const char* name);
335  vtkGetStringMacro(EdgeLayoutStrategyName);
337 
338  // ------------------------------------------------------------------------
339  // Miscellaneous
340 
344  void ApplyViewTheme(vtkViewTheme* theme) VTK_OVERRIDE;
345 
347 
350  virtual void SetGlyphType(int type);
351  virtual int GetGlyphType();
353 
355 
358  virtual void SetScaling(bool b);
359  virtual bool GetScaling();
360  vtkBooleanMacro(Scaling, bool);
362 
364 
367  virtual void SetScalingArrayName(const char* name);
368  virtual const char* GetScalingArrayName();
370 
372 
375  virtual void SetVertexScalarBarVisibility(bool b);
376  virtual bool GetVertexScalarBarVisibility();
377  virtual void SetEdgeScalarBarVisibility(bool b);
378  virtual bool GetEdgeScalarBarVisibility();
380 
382 
385  virtual vtkScalarBarWidget* GetVertexScalarBar();
386  virtual vtkScalarBarWidget* GetEdgeScalarBar();
388 
392  virtual bool IsLayoutComplete();
393 
397  virtual void UpdateLayout();
398 
402  void ComputeSelectedGraphBounds( double bounds[6] );
403 
404 protected:
406  ~vtkRenderedGraphRepresentation() VTK_OVERRIDE;
407 
409 
412  bool AddToView(vtkView* view) VTK_OVERRIDE;
413  bool RemoveFromView(vtkView* view) VTK_OVERRIDE;
415 
416  void PrepareForRendering(vtkRenderView* view) VTK_OVERRIDE;
417 
418  vtkSelection* ConvertSelection(vtkView* view, vtkSelection* sel) VTK_OVERRIDE;
419 
421 
425  int RequestData(
426  vtkInformation* request,
427  vtkInformationVector** inputVector,
428  vtkInformationVector* outputVector) VTK_OVERRIDE;
429 
431 
463 
466 
467  vtkSetStringMacro(VertexColorArrayNameInternal);
468  vtkGetStringMacro(VertexColorArrayNameInternal);
470 
471  vtkSetStringMacro(EdgeColorArrayNameInternal);
472  vtkGetStringMacro(EdgeColorArrayNameInternal);
474 
475  vtkSetStringMacro(ScalingArrayNameInternal);
476  vtkGetStringMacro(ScalingArrayNameInternal);
478 
479  vtkSetStringMacro(LayoutStrategyName);
480  char* LayoutStrategyName;
481  vtkSetStringMacro(EdgeLayoutStrategyName);
485 
487 
488 private:
490  void operator=(const vtkRenderedGraphRepresentation&) VTK_DELETE_FUNCTION;
491 };
492 
493 #endif
494 
virtual void ApplyViewTheme(vtkViewTheme *vtkNotUsed(theme))
Apply a theme to this representation.
vtkSmartPointer< vtkPolyDataMapper > OutlineMapper
Internal filter classes.
vtkSmartPointer< vtkGraphToPoints > VertexIconPoints
Internal filter classes.
virtual void SetVertexIconSelectionModeToIgnoreSelection()
Set the mode to one of.
virtual vtkSelection * ConvertSelection(vtkView *view, vtkSelection *selection)
Convert the selection to a type appropriate for sharing with other representations through vtkAnnotat...
virtual void SetVertexIconSelectionModeToSelectedIcon()
Set the mode to one of.
vtkSmartPointer< vtkGraphToPolyData > GraphToPoly
Internal filter classes.
vtkSmartPointer< vtkScalarBarWidget > VertexScalarBar
Internal filter classes.
void SetEdgeLayoutStrategyToPassThrough()
Set/get the graph layout strategy.
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
actor that draws 2D data with texture support
vtkSmartPointer< vtkApplyIcons > ApplyVertexIcons
Internal filter classes.
vtkSmartPointer< vtkPointSetToLabelHierarchy > VertexLabelHierarchy
Internal filter classes.
Store vtkAlgorithm input/output information.
Filter that generates a polydata consisting of quads with texture coordinates referring to a set of i...
vtkSmartPointer< vtkGraphToGlyphs > VertexGlyph
Internal filter classes.
vtkSmartPointer< vtkActor > VertexActor
Internal filter classes.
map scalar values into colors via a lookup table
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Subclasses should override this to connect inputs to the internal pipeline as necessary.
vtkSmartPointer< vtkIconGlyphFilter > VertexIconGlyph
Internal filter classes.
A node in a selection tree.
Definition: vtkSelection.h:37
Adds an attribute array with the degree of each vertex.
vtkSmartPointer< vtkScalarBarWidget > EdgeScalarBar
Internal filter classes.
int vtkIdType
Definition: vtkType.h:345
virtual bool AddToView(vtkView *vtkNotUsed(view))
Adds the representation to the view.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
vtkSmartPointer< vtkApplyColors > ApplyColors
Internal filter classes.
static vtkRenderedRepresentation * New()
abstract superclass for all graph layout strategies
vtkSmartPointer< vtkPolyDataMapper > EdgeMapper
Internal filter classes.
vtkSmartPointer< vtkVertexDegree > VertexDegree
Internal filter classes.
convert a vtkGraph to vtkPolyData
Superclass for mapping scalar values to colors.
vtkSmartPointer< vtkEdgeLayout > EdgeLayout
Internal filter classes.
generate points at center of edges
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:42
vtkSmartPointer< vtkTexturedActor2D > VertexIconActor
Internal filter classes.
vtkSmartPointer< vtkTransformCoordinateSystems > VertexIconTransform
Internal filter classes.
The superclass for all views.
Definition: vtkView.h:54
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkSmartPointer< vtkPointSetToLabelHierarchy > EdgeLabelHierarchy
Internal filter classes.
vtkSmartPointer< vtkGraphLayout > Layout
Internal filter classes.
virtual bool RemoveFromView(vtkView *vtkNotUsed(view))
Removes the representation to the view.
layout a graph in 2 or 3 dimensions
virtual void PrepareForRendering(vtkRenderView *view)
The view will call this method before every render.
vtkSmartPointer< vtkPolyData > EmptyPolyData
Internal filter classes.
void SetLayoutStrategyToRandom()
Set predefined layout strategies.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
Perturbs vertices that are coincident.
represent text properties.
transform points into different coordinate systems
build a label hierarchy for a graph or point set.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
vtkSmartPointer< vtkRemoveHiddenData > RemoveHiddenGraph
Internal filter classes.
map vtkPolyData to graphics primitives
vtkSmartPointer< vtkActor > OutlineActor
Internal filter classes.
vtkSmartPointer< vtkActor > EdgeActor
Internal filter classes.
vtkSmartPointer< vtkGraphToPoints > GraphToPoints
Internal filter classes.
A view containing a renderer.
Definition: vtkRenderView.h:58
abstract superclass for all edge layout strategies
vtkSmartPointer< vtkEdgeCenters > EdgeCenters
Internal filter classes.
layout graph edges
Definition: vtkEdgeLayout.h:38
convert a vtkGraph a set of points.
Store zero or more vtkInformation instances.
apply colors to a data set.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSmartPointer< vtkPolyDataMapper > VertexMapper
Internal filter classes.
vtkSmartPointer< vtkGraphToGlyphs > OutlineGlyph
Internal filter classes.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
vtkSmartPointer< vtkPolyDataMapper2D > VertexIconMapper
Internal filter classes.
virtual void SetVertexIconSelectionModeToSelectedOffset()
Set the mode to one of.
create glyphs for graph vertices
virtual vtkUnicodeString GetHoverTextInternal(vtkSelection *)
Subclasses may override this method to generate the hover text.
virtual void SetVertexIconSelectionModeToAnnotationIcon()
Set the mode to one of.
apply icons to a data set.
Definition: vtkApplyIcons.h:70
vtkSmartPointer< vtkPerturbCoincidentVertices > Coincident
Internal filter classes.
draw vtkPolyData onto the image plane
String class that stores Unicode text.
2D widget for manipulating a scalar bar
Removes the rows/edges/vertices of input data flagged by ann.
void SetEdgeLayoutStrategyToArcParallel()
Set/get the graph layout strategy.