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 -------------------------------------------------------------------------*/
31 #ifndef vtkRenderedGraphRepresentation_h
32 #define vtkRenderedGraphRepresentation_h
33 
34 #include "vtkViewsInfovisModule.h" // For export macro
36 #include "vtkSmartPointer.h" // for SP ivars
37 
38 class vtkActor;
39 class vtkApplyColors;
40 class vtkApplyIcons;
41 class vtkEdgeCenters;
42 class vtkEdgeLayout;
44 class vtkGraphLayout;
46 class vtkGraphToGlyphs;
47 class vtkGraphToPoints;
48 class vtkGraphToPolyData;
49 class vtkIconGlyphFilter;
50 class vtkInformation;
52 class vtkLookupTable;
55 class vtkPolyData;
56 class vtkPolyDataMapper;
59 class vtkRenderView;
60 class vtkScalarBarWidget;
61 class vtkScalarsToColors;
62 class vtkTextProperty;
63 class vtkTexturedActor2D;
65 class vtkVertexDegree;
66 class vtkView;
67 class vtkViewTheme;
68 
70 {
71 public:
74  void PrintSelf(ostream& os, vtkIndent indent);
75 
76  // ------------------------------------------------------------------------
77  // Vertex labels
78 
79  virtual void SetVertexLabelArrayName(const char* name);
80  virtual const char* GetVertexLabelArrayName();
81  virtual void SetVertexLabelPriorityArrayName(const char* name);
82  virtual const char* GetVertexLabelPriorityArrayName();
83  virtual void SetVertexLabelVisibility(bool b);
84  virtual bool GetVertexLabelVisibility();
85  vtkBooleanMacro(VertexLabelVisibility, bool);
86  virtual void SetVertexLabelTextProperty(vtkTextProperty* p);
87  virtual vtkTextProperty* GetVertexLabelTextProperty();
88  vtkSetStringMacro(VertexHoverArrayName);
89  vtkGetStringMacro(VertexHoverArrayName);
91 
93  vtkSetMacro(HideVertexLabelsOnInteraction, bool)
94  vtkGetMacro(HideVertexLabelsOnInteraction, bool)
95  vtkBooleanMacro(HideVertexLabelsOnInteraction, bool)
97 
98  // ------------------------------------------------------------------------
99  // Edge labels
100 
101  virtual void SetEdgeLabelArrayName(const char* name);
102  virtual const char* GetEdgeLabelArrayName();
103  virtual void SetEdgeLabelPriorityArrayName(const char* name);
104  virtual const char* GetEdgeLabelPriorityArrayName();
105  virtual void SetEdgeLabelVisibility(bool b);
106  virtual bool GetEdgeLabelVisibility();
107  vtkBooleanMacro(EdgeLabelVisibility, bool);
108  virtual void SetEdgeLabelTextProperty(vtkTextProperty* p);
109  virtual vtkTextProperty* GetEdgeLabelTextProperty();
110  vtkSetStringMacro(EdgeHoverArrayName);
111  vtkGetStringMacro(EdgeHoverArrayName);
113 
115  vtkSetMacro(HideEdgeLabelsOnInteraction, bool)
116  vtkGetMacro(HideEdgeLabelsOnInteraction, bool)
117  vtkBooleanMacro(HideEdgeLabelsOnInteraction, bool)
119 
120  // ------------------------------------------------------------------------
121  // Vertex icons
122 
123  virtual void SetVertexIconArrayName(const char* name);
124  virtual const char* GetVertexIconArrayName();
125  virtual void SetVertexIconPriorityArrayName(const char* name);
126  virtual const char* GetVertexIconPriorityArrayName();
127  virtual void SetVertexIconVisibility(bool b);
128  virtual bool GetVertexIconVisibility();
129  vtkBooleanMacro(VertexIconVisibility, bool);
130  virtual void AddVertexIconType(const char* name, int type);
131  virtual void ClearVertexIconTypes();
132  virtual void SetUseVertexIconTypeMap(bool b);
133  virtual bool GetUseVertexIconTypeMap();
134  vtkBooleanMacro(UseVertexIconTypeMap, bool);
135  virtual void SetVertexIconAlignment(int align);
136  virtual int GetVertexIconAlignment();
137  virtual void SetVertexSelectedIcon(int icon);
138  virtual int GetVertexSelectedIcon();
139  virtual void SetVertexDefaultIcon(int icon);
140  virtual int GetVertexDefaultIcon();
141 
143 
148  virtual void SetVertexIconSelectionMode(int mode);
149  virtual int GetVertexIconSelectionMode();
150  virtual void SetVertexIconSelectionModeToSelectedIcon()
151  { this->SetVertexIconSelectionMode(0); }
153  { this->SetVertexIconSelectionMode(1); }
155  { this->SetVertexIconSelectionMode(2); }
157  { this->SetVertexIconSelectionMode(3); }
159 
160  // ------------------------------------------------------------------------
161  // Edge icons
162 
163  virtual void SetEdgeIconArrayName(const char* name);
164  virtual const char* GetEdgeIconArrayName();
165  virtual void SetEdgeIconPriorityArrayName(const char* name);
166  virtual const char* GetEdgeIconPriorityArrayName();
167  virtual void SetEdgeIconVisibility(bool b);
168  virtual bool GetEdgeIconVisibility();
169  vtkBooleanMacro(EdgeIconVisibility, bool);
170  virtual void AddEdgeIconType(const char* name, int type);
171  virtual void ClearEdgeIconTypes();
172  virtual void SetUseEdgeIconTypeMap(bool b);
173  virtual bool GetUseEdgeIconTypeMap();
174  vtkBooleanMacro(UseEdgeIconTypeMap, bool);
175  virtual void SetEdgeIconAlignment(int align);
176  virtual int GetEdgeIconAlignment();
177 
178  // ------------------------------------------------------------------------
179  // Vertex colors
180 
181  virtual void SetColorVerticesByArray(bool b);
182  virtual bool GetColorVerticesByArray();
183  vtkBooleanMacro(ColorVerticesByArray, bool);
184  virtual void SetVertexColorArrayName(const char* name);
185  virtual const char* GetVertexColorArrayName();
186 
187  // ------------------------------------------------------------------------
188  // Edge colors
189 
190  virtual void SetColorEdgesByArray(bool b);
191  virtual bool GetColorEdgesByArray();
192  vtkBooleanMacro(ColorEdgesByArray, bool);
193  virtual void SetEdgeColorArrayName(const char* name);
194  virtual const char* GetEdgeColorArrayName();
195 
196  // ------------------------------------------------------------------------
197  // Enabled vertices
198 
199  virtual void SetEnableVerticesByArray(bool b);
200  virtual bool GetEnableVerticesByArray();
201  vtkBooleanMacro(EnableVerticesByArray, bool);
202  virtual void SetEnabledVerticesArrayName(const char* name);
203  virtual const char* GetEnabledVerticesArrayName();
204 
205  // ------------------------------------------------------------------------
206  // Enabled edges
207 
208  virtual void SetEnableEdgesByArray(bool b);
209  virtual bool GetEnableEdgesByArray();
210  vtkBooleanMacro(EnableEdgesByArray, bool);
211  virtual void SetEnabledEdgesArrayName(const char* name);
212  virtual const char* GetEnabledEdgesArrayName();
213 
214  virtual void SetEdgeVisibility(bool b);
215  virtual bool GetEdgeVisibility();
216  vtkBooleanMacro(EdgeVisibility, bool);
217 
218  void SetEdgeSelection(bool b);
219  bool GetEdgeSelection();
220 
221  // ------------------------------------------------------------------------
222  // Vertex layout strategy
223 
225 
226  virtual void SetLayoutStrategy(vtkGraphLayoutStrategy* strategy);
227  virtual vtkGraphLayoutStrategy* GetLayoutStrategy();
229 
231 
232  virtual void SetLayoutStrategy(const char* name);
233  vtkGetStringMacro(LayoutStrategyName);
235 
237 
239  { this->SetLayoutStrategy("Random"); }
241  { this->SetLayoutStrategy("Force Directed"); }
243  { this->SetLayoutStrategy("Simple 2D"); }
245  { this->SetLayoutStrategy("Clustering 2D"); }
247  { this->SetLayoutStrategy("Community 2D"); }
249  { this->SetLayoutStrategy("Fast 2D"); }
251  { this->SetLayoutStrategy("Pass Through"); }
253  { this->SetLayoutStrategy("Circular"); }
255  { this->SetLayoutStrategy("Tree"); }
257  { this->SetLayoutStrategy("Cosmic Tree"); }
259  { this->SetLayoutStrategy("Cone"); }
261  { this->SetLayoutStrategy("Span Tree"); }
263 
265 
267  virtual void SetLayoutStrategyToAssignCoordinates(
268  const char* xarr, const char* yarr = 0, const char* zarr = 0);
270 
272 
281  virtual void SetLayoutStrategyToTree(
282  bool radial,
283  double angle = 90,
284  double leafSpacing = 0.9,
285  double logSpacing = 1.0);
287 
289 
298  virtual void SetLayoutStrategyToCosmicTree(
299  const char* nodeSizeArrayName,
300  bool sizeLeafNodesOnly = true,
301  int layoutDepth = 0,
302  vtkIdType layoutRoot = -1);
304 
305  // ------------------------------------------------------------------------
306  // Edge layout strategy
307 
309 
310  virtual void SetEdgeLayoutStrategy(vtkEdgeLayoutStrategy* strategy);
311  virtual vtkEdgeLayoutStrategy* GetEdgeLayoutStrategy();
313  { this->SetEdgeLayoutStrategy("Arc Parallel"); }
315  { this->SetEdgeLayoutStrategy("Pass Through"); }
317 
320  virtual void SetEdgeLayoutStrategyToGeo(double explodeFactor = 0.2);
321 
323 
324  virtual void SetEdgeLayoutStrategy(const char* name);
325  vtkGetStringMacro(EdgeLayoutStrategyName);
327 
328  // ------------------------------------------------------------------------
329  // Miscellaneous
330 
332  virtual void ApplyViewTheme(vtkViewTheme* theme);
333 
335 
336  virtual void SetGlyphType(int type);
337  virtual int GetGlyphType();
339 
341 
342  virtual void SetScaling(bool b);
343  virtual bool GetScaling();
344  vtkBooleanMacro(Scaling, bool);
346 
348 
349  virtual void SetScalingArrayName(const char* name);
350  virtual const char* GetScalingArrayName();
352 
354 
355  virtual void SetVertexScalarBarVisibility(bool b);
356  virtual bool GetVertexScalarBarVisibility();
357  virtual void SetEdgeScalarBarVisibility(bool b);
358  virtual bool GetEdgeScalarBarVisibility();
360 
362 
364  virtual vtkScalarBarWidget* GetVertexScalarBar();
365  virtual vtkScalarBarWidget* GetEdgeScalarBar();
367 
369  virtual bool IsLayoutComplete();
370 
372  virtual void UpdateLayout();
373 
375  void ComputeSelectedGraphBounds( double bounds[6] );
376 
377 protected:
380 
382 
383  virtual bool AddToView(vtkView* view);
384  virtual bool RemoveFromView(vtkView* view);
386 
387  virtual void PrepareForRendering(vtkRenderView* view);
388 
389  virtual vtkSelection* ConvertSelection(vtkView* view, vtkSelection* sel);
390 
392 
394 
395  virtual int RequestData(
396  vtkInformation* request,
397  vtkInformationVector** inputVector,
398  vtkInformationVector* outputVector);
400 
401  //BTX
403 
432  //ETX
434 
437 
438  vtkSetStringMacro(VertexColorArrayNameInternal);
439  vtkGetStringMacro(VertexColorArrayNameInternal);
441 
442  vtkSetStringMacro(EdgeColorArrayNameInternal);
443  vtkGetStringMacro(EdgeColorArrayNameInternal);
445 
446  vtkSetStringMacro(ScalingArrayNameInternal);
447  vtkGetStringMacro(ScalingArrayNameInternal);
449 
450  vtkSetStringMacro(LayoutStrategyName);
451  char* LayoutStrategyName;
452  vtkSetStringMacro(EdgeLayoutStrategyName);
456 
458 
459 private:
461  void operator=(const vtkRenderedGraphRepresentation&); // Not implemented
462 };
463 
464 #endif
465 
virtual void ApplyViewTheme(vtkViewTheme *vtkNotUsed(theme))
vtkSmartPointer< vtkPolyDataMapper > OutlineMapper
vtkSmartPointer< vtkGraphToPoints > VertexIconPoints
virtual vtkSelection * ConvertSelection(vtkView *view, vtkSelection *selection)
vtkSmartPointer< vtkGraphToPolyData > GraphToPoly
vtkSmartPointer< vtkScalarBarWidget > VertexScalarBar
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:50
actor that draws 2D data with texture support
vtkSmartPointer< vtkApplyIcons > ApplyVertexIcons
vtkSmartPointer< vtkPointSetToLabelHierarchy > VertexLabelHierarchy
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
void PrintSelf(ostream &os, vtkIndent indent)
map scalar values into colors via a lookup table
vtkSmartPointer< vtkIconGlyphFilter > VertexIconGlyph
A node in a selection tree. Used to store selection results.
Definition: vtkSelection.h:44
Adds an attribute array with the degree of each vertex.
vtkSmartPointer< vtkScalarBarWidget > EdgeScalarBar
int vtkIdType
Definition: vtkType.h:275
virtual bool AddToView(vtkView *vtkNotUsed(view))
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:83
vtkSmartPointer< vtkApplyColors > ApplyColors
static vtkRenderedRepresentation * New()
abstract superclass for all graph layout strategies
vtkSmartPointer< vtkPolyDataMapper > EdgeMapper
vtkSmartPointer< vtkVertexDegree > VertexDegree
convert a vtkGraph to vtkPolyData
Superclass for mapping scalar values to colors.
vtkSmartPointer< vtkEdgeLayout > EdgeLayout
generate points at center of edges
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:47
vtkSmartPointer< vtkTexturedActor2D > VertexIconActor
vtkSmartPointer< vtkTransformCoordinateSystems > VertexIconTransform
The superclass for all views.
Definition: vtkView.h:62
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkSmartPointer< vtkPointSetToLabelHierarchy > EdgeLabelHierarchy
vtkSmartPointer< vtkGraphLayout > Layout
virtual bool RemoveFromView(vtkView *vtkNotUsed(view))
layout a graph in 2 or 3 dimensions
virtual void PrepareForRendering(vtkRenderView *view)
vtkSmartPointer< vtkPolyData > EmptyPolyData
Perturbs vertices that are coincident.
represent text properties.
transform points into different coordinate systems
build a label hierarchy for a graph or point set.
vtkSmartPointer< vtkRemoveHiddenData > RemoveHiddenGraph
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
map vtkPolyData to graphics primitives
vtkSmartPointer< vtkGraphToPoints > GraphToPoints
A view containing a renderer.
Definition: vtkRenderView.h:63
abstract superclass for all edge layout strategies
vtkSmartPointer< vtkEdgeCenters > EdgeCenters
layout graph edges
Definition: vtkEdgeLayout.h:40
convert a vtkGraph a set of points.
Store zero or more vtkInformation instances.
apply colors to a data set.
vtkSmartPointer< vtkPolyDataMapper > VertexMapper
vtkSmartPointer< vtkGraphToGlyphs > OutlineGlyph
vtkSmartPointer< vtkPolyDataMapper2D > VertexIconMapper
create glyphs for graph vertices
virtual vtkUnicodeString GetHoverTextInternal(vtkSelection *)
apply icons to a data set.
Definition: vtkApplyIcons.h:69
vtkSmartPointer< vtkPerturbCoincidentVertices > Coincident
draw vtkPolyData onto the image plane
#define VTKVIEWSINFOVIS_EXPORT
String class that stores Unicode text.
2D widget for manipulating a scalar bar
Removes the rows/edges/vertices of input data flagged by ann.