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 -------------------------------------------------------------------------*/
32 #ifndef vtkRenderedGraphRepresentation_h
33 #define vtkRenderedGraphRepresentation_h
34 
35 #include "vtkViewsInfovisModule.h" // For export macro
37 #include "vtkSmartPointer.h" // for SP ivars
38 
39 class vtkActor;
40 class vtkApplyColors;
41 class vtkApplyIcons;
42 class vtkEdgeCenters;
43 class vtkEdgeLayout;
45 class vtkGraphLayout;
47 class vtkGraphToGlyphs;
48 class vtkGraphToPoints;
49 class vtkGraphToPolyData;
50 class vtkIconGlyphFilter;
51 class vtkInformation;
53 class vtkLookupTable;
56 class vtkPolyData;
57 class vtkPolyDataMapper;
60 class vtkRenderView;
61 class vtkScalarBarWidget;
62 class vtkScalarsToColors;
63 class vtkTextProperty;
64 class vtkTexturedActor2D;
66 class vtkVertexDegree;
67 class vtkView;
68 class vtkViewTheme;
69 
70 class VTKVIEWSINFOVIS_EXPORT vtkRenderedGraphRepresentation : public vtkRenderedRepresentation
71 {
72 public:
75  void PrintSelf(ostream& os, vtkIndent indent);
76 
77  // ------------------------------------------------------------------------
78  // Vertex labels
79 
80  virtual void SetVertexLabelArrayName(const char* name);
81  virtual const char* GetVertexLabelArrayName();
82  virtual void SetVertexLabelPriorityArrayName(const char* name);
83  virtual const char* GetVertexLabelPriorityArrayName();
84  virtual void SetVertexLabelVisibility(bool b);
85  virtual bool GetVertexLabelVisibility();
86  vtkBooleanMacro(VertexLabelVisibility, bool);
89  vtkSetStringMacro(VertexHoverArrayName);
90  vtkGetStringMacro(VertexHoverArrayName);
92 
95  vtkSetMacro(HideVertexLabelsOnInteraction, bool)
96  vtkGetMacro(HideVertexLabelsOnInteraction, bool)
97  vtkBooleanMacro(HideVertexLabelsOnInteraction, bool)
99 
100  // ------------------------------------------------------------------------
101  // Edge labels
102 
103  virtual void SetEdgeLabelArrayName(const char* name);
104  virtual const char* GetEdgeLabelArrayName();
105  virtual void SetEdgeLabelPriorityArrayName(const char* name);
106  virtual const char* GetEdgeLabelPriorityArrayName();
107  virtual void SetEdgeLabelVisibility(bool b);
108  virtual bool GetEdgeLabelVisibility();
109  vtkBooleanMacro(EdgeLabelVisibility, bool);
110  virtual void SetEdgeLabelTextProperty(vtkTextProperty* p);
111  virtual vtkTextProperty* GetEdgeLabelTextProperty();
112  vtkSetStringMacro(EdgeHoverArrayName);
113  vtkGetStringMacro(EdgeHoverArrayName);
115 
118  vtkSetMacro(HideEdgeLabelsOnInteraction, bool)
119  vtkGetMacro(HideEdgeLabelsOnInteraction, bool)
120  vtkBooleanMacro(HideEdgeLabelsOnInteraction, bool)
122 
123  // ------------------------------------------------------------------------
124  // Vertex icons
125 
126  virtual void SetVertexIconArrayName(const char* name);
127  virtual const char* GetVertexIconArrayName();
128  virtual void SetVertexIconPriorityArrayName(const char* name);
129  virtual const char* GetVertexIconPriorityArrayName();
130  virtual void SetVertexIconVisibility(bool b);
131  virtual bool GetVertexIconVisibility();
132  vtkBooleanMacro(VertexIconVisibility, bool);
133  virtual void AddVertexIconType(const char* name, int type);
134  virtual void ClearVertexIconTypes();
135  virtual void SetUseVertexIconTypeMap(bool b);
136  virtual bool GetUseVertexIconTypeMap();
137  vtkBooleanMacro(UseVertexIconTypeMap, bool);
138  virtual void SetVertexIconAlignment(int align);
139  virtual int GetVertexIconAlignment();
140  virtual void SetVertexSelectedIcon(int icon);
141  virtual int GetVertexSelectedIcon();
142  virtual void SetVertexDefaultIcon(int icon);
143  virtual int GetVertexDefaultIcon();
144 
146 
156  virtual void SetVertexIconSelectionMode(int mode);
157  virtual int GetVertexIconSelectionMode();
158  virtual void SetVertexIconSelectionModeToSelectedIcon()
159  { this->SetVertexIconSelectionMode(0); }
161  { this->SetVertexIconSelectionMode(1); }
163  { this->SetVertexIconSelectionMode(2); }
165  { this->SetVertexIconSelectionMode(3); }
167 
168  // ------------------------------------------------------------------------
169  // Edge icons
170 
171  virtual void SetEdgeIconArrayName(const char* name);
172  virtual const char* GetEdgeIconArrayName();
173  virtual void SetEdgeIconPriorityArrayName(const char* name);
174  virtual const char* GetEdgeIconPriorityArrayName();
175  virtual void SetEdgeIconVisibility(bool b);
176  virtual bool GetEdgeIconVisibility();
177  vtkBooleanMacro(EdgeIconVisibility, bool);
178  virtual void AddEdgeIconType(const char* name, int type);
179  virtual void ClearEdgeIconTypes();
180  virtual void SetUseEdgeIconTypeMap(bool b);
181  virtual bool GetUseEdgeIconTypeMap();
182  vtkBooleanMacro(UseEdgeIconTypeMap, bool);
183  virtual void SetEdgeIconAlignment(int align);
184  virtual int GetEdgeIconAlignment();
185 
186  // ------------------------------------------------------------------------
187  // Vertex colors
188 
189  virtual void SetColorVerticesByArray(bool b);
190  virtual bool GetColorVerticesByArray();
191  vtkBooleanMacro(ColorVerticesByArray, bool);
192  virtual void SetVertexColorArrayName(const char* name);
193  virtual const char* GetVertexColorArrayName();
194 
195  // ------------------------------------------------------------------------
196  // Edge colors
197 
198  virtual void SetColorEdgesByArray(bool b);
199  virtual bool GetColorEdgesByArray();
200  vtkBooleanMacro(ColorEdgesByArray, bool);
201  virtual void SetEdgeColorArrayName(const char* name);
202  virtual const char* GetEdgeColorArrayName();
203 
204  // ------------------------------------------------------------------------
205  // Enabled vertices
206 
207  virtual void SetEnableVerticesByArray(bool b);
208  virtual bool GetEnableVerticesByArray();
209  vtkBooleanMacro(EnableVerticesByArray, bool);
210  virtual void SetEnabledVerticesArrayName(const char* name);
211  virtual const char* GetEnabledVerticesArrayName();
212 
213  // ------------------------------------------------------------------------
214  // Enabled edges
215 
216  virtual void SetEnableEdgesByArray(bool b);
217  virtual bool GetEnableEdgesByArray();
218  vtkBooleanMacro(EnableEdgesByArray, bool);
219  virtual void SetEnabledEdgesArrayName(const char* name);
220  virtual const char* GetEnabledEdgesArrayName();
221 
222  virtual void SetEdgeVisibility(bool b);
223  virtual bool GetEdgeVisibility();
224  vtkBooleanMacro(EdgeVisibility, bool);
225 
226  void SetEdgeSelection(bool b);
228 
229  // ------------------------------------------------------------------------
230  // Vertex layout strategy
231 
233 
236  virtual void SetLayoutStrategy(vtkGraphLayoutStrategy* strategy);
239 
241 
244  virtual void SetLayoutStrategy(const char* name);
245  vtkGetStringMacro(LayoutStrategyName);
247 
252  { this->SetLayoutStrategy("Random"); }
254  { this->SetLayoutStrategy("Force Directed"); }
256  { this->SetLayoutStrategy("Simple 2D"); }
258  { this->SetLayoutStrategy("Clustering 2D"); }
260  { this->SetLayoutStrategy("Community 2D"); }
262  { this->SetLayoutStrategy("Fast 2D"); }
264  { this->SetLayoutStrategy("Pass Through"); }
266  { this->SetLayoutStrategy("Circular"); }
268  { this->SetLayoutStrategy("Tree"); }
270  { this->SetLayoutStrategy("Cosmic Tree"); }
272  { this->SetLayoutStrategy("Cone"); }
274  { this->SetLayoutStrategy("Span Tree"); }
275 
281  const char* xarr, const char* yarr = 0, const char* zarr = 0);
282 
294  bool radial,
295  double angle = 90,
296  double leafSpacing = 0.9,
297  double logSpacing = 1.0);
298 
310  const char* nodeSizeArrayName,
311  bool sizeLeafNodesOnly = true,
312  int layoutDepth = 0,
313  vtkIdType layoutRoot = -1);
314 
315  // ------------------------------------------------------------------------
316  // Edge layout strategy
317 
319 
325  { this->SetEdgeLayoutStrategy("Arc Parallel"); }
327  { this->SetEdgeLayoutStrategy("Pass Through"); }
329 
334  virtual void SetEdgeLayoutStrategyToGeo(double explodeFactor = 0.2);
335 
337 
340  virtual void SetEdgeLayoutStrategy(const char* name);
341  vtkGetStringMacro(EdgeLayoutStrategyName);
343 
344  // ------------------------------------------------------------------------
345  // Miscellaneous
346 
350  virtual void ApplyViewTheme(vtkViewTheme* theme);
351 
353 
356  virtual void SetGlyphType(int type);
357  virtual int GetGlyphType();
359 
361 
364  virtual void SetScaling(bool b);
365  virtual bool GetScaling();
366  vtkBooleanMacro(Scaling, bool);
368 
370 
373  virtual void SetScalingArrayName(const char* name);
374  virtual const char* GetScalingArrayName();
376 
378 
381  virtual void SetVertexScalarBarVisibility(bool b);
383  virtual void SetEdgeScalarBarVisibility(bool b);
386 
388 
394 
398  virtual bool IsLayoutComplete();
399 
403  virtual void UpdateLayout();
404 
408  void ComputeSelectedGraphBounds( double bounds[6] );
409 
410 protected:
413 
415 
418  virtual bool AddToView(vtkView* view);
419  virtual bool RemoveFromView(vtkView* view);
421 
422  virtual void PrepareForRendering(vtkRenderView* view);
423 
425 
427 
431  virtual int RequestData(
432  vtkInformation* request,
433  vtkInformationVector** inputVector,
434  vtkInformationVector* outputVector);
435 
437 
469 
472 
473  vtkSetStringMacro(VertexColorArrayNameInternal);
474  vtkGetStringMacro(VertexColorArrayNameInternal);
476 
477  vtkSetStringMacro(EdgeColorArrayNameInternal);
478  vtkGetStringMacro(EdgeColorArrayNameInternal);
480 
481  vtkSetStringMacro(ScalingArrayNameInternal);
482  vtkGetStringMacro(ScalingArrayNameInternal);
484 
485  vtkSetStringMacro(LayoutStrategyName);
487  vtkSetStringMacro(EdgeLayoutStrategyName);
491 
493 
494 private:
496  void operator=(const vtkRenderedGraphRepresentation&) VTK_DELETE_FUNCTION;
497 };
498 
499 #endif
500 
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:52
apply colors to a data set.
apply icons to a data set.
Definition: vtkApplyIcons.h:71
generate points at center of edges
abstract superclass for all edge layout strategies
layout graph edges
Definition: vtkEdgeLayout.h:42
abstract superclass for all graph layout strategies
layout a graph in 2 or 3 dimensions
create glyphs for graph vertices
convert a vtkGraph a set of points.
convert a vtkGraph to vtkPolyData
Filter that generates a polydata consisting of quads with texture coordinates referring to a set of i...
a simple class to control print indentation
Definition: vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
map scalar values into colors via a lookup table
Perturbs vertices that are coincident.
build a label hierarchy for a graph or point set.
draw vtkPolyData onto the image plane
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
Removes the rows/edges/vertices of input data flagged by ann.
A view containing a renderer.
Definition: vtkRenderView.h:62
virtual void SetEdgeIconVisibility(bool b)
virtual void SetEnabledEdgesArrayName(const char *name)
virtual void SetEdgeLayoutStrategy(vtkEdgeLayoutStrategy *strategy)
Set/get the graph layout strategy.
virtual bool RemoveFromView(vtkView *view)
virtual void SetLayoutStrategyToTree(bool radial, double angle=90, double leafSpacing=0.9, double logSpacing=1.0)
Set the layout strategy to a tree layout.
virtual const char * GetVertexLabelArrayName()
vtkSmartPointer< vtkApplyColors > ApplyColors
Internal filter classes.
virtual void SetScaling(bool b)
Set whether to scale vertex glyphs.
virtual void SetColorEdgesByArray(bool b)
virtual void ApplyViewTheme(vtkViewTheme *theme)
Apply a theme to this representation.
virtual bool GetColorEdgesByArray()
virtual const char * GetVertexColorArrayName()
virtual void SetLayoutStrategyToAssignCoordinates(const char *xarr, const char *yarr=0, const char *zarr=0)
Set the layout strategy to use coordinates from arrays.
virtual void SetLayoutStrategyToCosmicTree(const char *nodeSizeArrayName, bool sizeLeafNodesOnly=true, int layoutDepth=0, vtkIdType layoutRoot=-1)
Set the layout strategy to a cosmic tree layout.
virtual void SetLayoutStrategy(const char *name)
Get/set the layout strategy by name.
virtual void SetEdgeLayoutStrategy(const char *name)
Set the edge layout strategy by name.
virtual void SetVertexLabelTextProperty(vtkTextProperty *p)
vtkSmartPointer< vtkTexturedActor2D > VertexIconActor
vtkSmartPointer< vtkTransformCoordinateSystems > VertexIconTransform
virtual bool GetColorVerticesByArray()
virtual void SetEnableEdgesByArray(bool b)
virtual void SetVertexLabelArrayName(const char *name)
virtual vtkSelection * ConvertSelection(vtkView *view, vtkSelection *sel)
Convert the selection to a type appropriate for sharing with other representations through vtkAnnotat...
virtual void SetEdgeVisibility(bool b)
vtkSmartPointer< vtkGraphLayout > Layout
virtual const char * GetEdgeIconPriorityArrayName()
virtual const char * GetEnabledEdgesArrayName()
vtkSmartPointer< vtkScalarBarWidget > EdgeScalarBar
vtkSmartPointer< vtkGraphToPoints > VertexIconPoints
virtual bool GetEnableEdgesByArray()
vtkSmartPointer< vtkPointSetToLabelHierarchy > EdgeLabelHierarchy
virtual bool GetEdgeIconVisibility()
virtual vtkUnicodeString GetHoverTextInternal(vtkSelection *sel)
Subclasses may override this method to generate the hover text.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Connect inputs to internal pipeline.
virtual bool GetEnableVerticesByArray()
vtkSmartPointer< vtkApplyIcons > ApplyVertexIcons
virtual void SetEnabledVerticesArrayName(const char *name)
virtual void AddEdgeIconType(const char *name, int type)
virtual vtkTextProperty * GetVertexLabelTextProperty()
vtkSmartPointer< vtkPolyData > EmptyPolyData
vtkSmartPointer< vtkPolyDataMapper2D > VertexIconMapper
virtual const char * GetEdgeIconArrayName()
virtual void PrepareForRendering(vtkRenderView *view)
The view will call this method before every render.
virtual const char * GetEnabledVerticesArrayName()
vtkSmartPointer< vtkEdgeCenters > EdgeCenters
virtual void UpdateLayout()
Performs another iteration on the graph layout.
vtkSmartPointer< vtkPointSetToLabelHierarchy > VertexLabelHierarchy
virtual vtkScalarBarWidget * GetVertexScalarBar()
Obtain the scalar bar widget used to draw a legend for the vertices/edges.
virtual void SetScalingArrayName(const char *name)
Set the glyph scaling array name.
virtual void SetVertexScalarBarVisibility(bool b)
Vertex/edge scalar bar visibility.
void SetLayoutStrategyToRandom()
Set predefined layout strategies.
virtual void SetLayoutStrategy(vtkGraphLayoutStrategy *strategy)
Set/get the graph layout strategy.
virtual bool IsLayoutComplete()
Whether the current graph layout is complete.
virtual const char * GetScalingArrayName()
virtual void SetEdgeIconAlignment(int align)
vtkSmartPointer< vtkEdgeLayout > EdgeLayout
virtual void SetEdgeIconArrayName(const char *name)
static vtkRenderedGraphRepresentation * New()
virtual void SetEdgeColorArrayName(const char *name)
virtual void SetColorVerticesByArray(bool b)
virtual const char * GetVertexLabelPriorityArrayName()
virtual vtkScalarBarWidget * GetEdgeScalarBar()
vtkSmartPointer< vtkRemoveHiddenData > RemoveHiddenGraph
virtual bool GetVertexLabelVisibility()
vtkSmartPointer< vtkPolyDataMapper > VertexMapper
vtkSmartPointer< vtkGraphToGlyphs > VertexGlyph
vtkSmartPointer< vtkPolyDataMapper > EdgeMapper
virtual void SetEdgeLayoutStrategyToGeo(double explodeFactor=0.2)
Set the edge layout strategy to a geospatial arced strategy appropriate for vtkGeoView.
vtkSmartPointer< vtkPerturbCoincidentVertices > Coincident
virtual void SetVertexColorArrayName(const char *name)
virtual bool GetUseEdgeIconTypeMap()
virtual void SetEdgeIconPriorityArrayName(const char *name)
virtual void SetVertexLabelVisibility(bool b)
virtual void SetEnableVerticesByArray(bool b)
vtkSmartPointer< vtkGraphToPoints > GraphToPoints
virtual void SetUseEdgeIconTypeMap(bool b)
virtual vtkGraphLayoutStrategy * GetLayoutStrategy()
virtual const char * GetEdgeColorArrayName()
virtual void SetGlyphType(int type)
Set the graph vertex glyph type.
virtual void SetVertexLabelPriorityArrayName(const char *name)
vtkSmartPointer< vtkScalarBarWidget > VertexScalarBar
virtual bool AddToView(vtkView *view)
Called by the view to add/remove this representation.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkSmartPointer< vtkGraphToGlyphs > OutlineGlyph
vtkSmartPointer< vtkPolyDataMapper > OutlineMapper
vtkSmartPointer< vtkVertexDegree > VertexDegree
vtkSmartPointer< vtkGraphToPolyData > GraphToPoly
virtual void SetEdgeScalarBarVisibility(bool b)
virtual bool GetEdgeScalarBarVisibility()
vtkSmartPointer< vtkIconGlyphFilter > VertexIconGlyph
virtual vtkEdgeLayoutStrategy * GetEdgeLayoutStrategy()
void ComputeSelectedGraphBounds(double bounds[6])
Compute the bounding box of the selected subgraph.
virtual bool GetVertexScalarBarVisibility()
2D widget for manipulating a scalar bar
Superclass for mapping scalar values to colors.
A node in a selection tree.
Definition: vtkSelection.h:44
represent text properties.
actor that draws 2D data with texture support
transform points into different coordinate systems
String class that stores Unicode text.
Adds an attribute array with the degree of each vertex.
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:49
The superclass for all views.
Definition: vtkView.h:61
@ mode
Definition: vtkX3D.h:247
@ type
Definition: vtkX3D.h:516
@ name
Definition: vtkX3D.h:219
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
int vtkIdType
Definition: vtkType.h:287