VTK  9.3.0
vtkRenderedGraphRepresentation.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
22 #ifndef vtkRenderedGraphRepresentation_h
23 #define vtkRenderedGraphRepresentation_h
24 
26 #include "vtkSmartPointer.h" // for SP ivars
27 #include "vtkViewsInfovisModule.h" // For export macro
28 
29 VTK_ABI_NAMESPACE_BEGIN
30 class vtkActor;
31 class vtkApplyColors;
32 class vtkApplyIcons;
33 class vtkEdgeCenters;
34 class vtkEdgeLayout;
36 class vtkGraphLayout;
38 class vtkGraphToGlyphs;
39 class vtkGraphToPoints;
40 class vtkGraphToPolyData;
41 class vtkIconGlyphFilter;
42 class vtkInformation;
44 class vtkLookupTable;
47 class vtkPolyData;
48 class vtkPolyDataMapper;
51 class vtkRenderView;
52 class vtkScalarBarWidget;
53 class vtkScalarsToColors;
54 class vtkTextProperty;
55 class vtkTexturedActor2D;
57 class vtkVertexDegree;
58 class vtkView;
59 class vtkViewTheme;
60 
61 class VTKVIEWSINFOVIS_EXPORT vtkRenderedGraphRepresentation : public vtkRenderedRepresentation
62 {
63 public:
66  void PrintSelf(ostream& os, vtkIndent indent) override;
67 
68  // ------------------------------------------------------------------------
69  // Vertex labels
70 
71  virtual void SetVertexLabelArrayName(const char* name);
72  virtual const char* GetVertexLabelArrayName();
73  virtual void SetVertexLabelPriorityArrayName(const char* name);
74  virtual const char* GetVertexLabelPriorityArrayName();
75  virtual void SetVertexLabelVisibility(bool b);
76  virtual bool GetVertexLabelVisibility();
77  vtkBooleanMacro(VertexLabelVisibility, bool);
80  vtkSetStringMacro(VertexHoverArrayName);
81  vtkGetStringMacro(VertexHoverArrayName);
83 
86  vtkSetMacro(HideVertexLabelsOnInteraction, bool);
87  vtkGetMacro(HideVertexLabelsOnInteraction, bool);
88  vtkBooleanMacro(HideVertexLabelsOnInteraction, bool);
90 
91  // ------------------------------------------------------------------------
92  // Edge labels
93 
94  virtual void SetEdgeLabelArrayName(const char* name);
95  virtual const char* GetEdgeLabelArrayName();
96  virtual void SetEdgeLabelPriorityArrayName(const char* name);
97  virtual const char* GetEdgeLabelPriorityArrayName();
98  virtual void SetEdgeLabelVisibility(bool b);
99  virtual bool GetEdgeLabelVisibility();
100  vtkBooleanMacro(EdgeLabelVisibility, bool);
103  vtkSetStringMacro(EdgeHoverArrayName);
104  vtkGetStringMacro(EdgeHoverArrayName);
106 
109  vtkSetMacro(HideEdgeLabelsOnInteraction, bool);
110  vtkGetMacro(HideEdgeLabelsOnInteraction, bool);
111  vtkBooleanMacro(HideEdgeLabelsOnInteraction, bool);
113 
114  // ------------------------------------------------------------------------
115  // Vertex icons
116 
117  virtual void SetVertexIconArrayName(const char* name);
118  virtual const char* GetVertexIconArrayName();
119  virtual void SetVertexIconPriorityArrayName(const char* name);
120  virtual const char* GetVertexIconPriorityArrayName();
121  virtual void SetVertexIconVisibility(bool b);
122  virtual bool GetVertexIconVisibility();
123  vtkBooleanMacro(VertexIconVisibility, bool);
124  virtual void AddVertexIconType(const char* name, int type);
125  virtual void ClearVertexIconTypes();
126  virtual void SetUseVertexIconTypeMap(bool b);
127  virtual bool GetUseVertexIconTypeMap();
128  vtkBooleanMacro(UseVertexIconTypeMap, bool);
129  virtual void SetVertexIconAlignment(int align);
130  virtual int GetVertexIconAlignment();
131  virtual void SetVertexSelectedIcon(int icon);
132  virtual int GetVertexSelectedIcon();
133  virtual void SetVertexDefaultIcon(int icon);
134  virtual int GetVertexDefaultIcon();
135 
137 
147  virtual void SetVertexIconSelectionMode(int mode);
149  virtual void SetVertexIconSelectionModeToSelectedIcon() { this->SetVertexIconSelectionMode(0); }
150  virtual void SetVertexIconSelectionModeToSelectedOffset() { this->SetVertexIconSelectionMode(1); }
151  virtual void SetVertexIconSelectionModeToAnnotationIcon() { this->SetVertexIconSelectionMode(2); }
153  {
154  this->SetVertexIconSelectionMode(3);
155  }
157 
158  // ------------------------------------------------------------------------
159  // Edge icons
160 
161  virtual void SetEdgeIconArrayName(const char* name);
162  virtual const char* GetEdgeIconArrayName();
163  virtual void SetEdgeIconPriorityArrayName(const char* name);
164  virtual const char* GetEdgeIconPriorityArrayName();
165  virtual void SetEdgeIconVisibility(bool b);
166  virtual bool GetEdgeIconVisibility();
167  vtkBooleanMacro(EdgeIconVisibility, bool);
168  virtual void AddEdgeIconType(const char* name, int type);
169  virtual void ClearEdgeIconTypes();
170  virtual void SetUseEdgeIconTypeMap(bool b);
171  virtual bool GetUseEdgeIconTypeMap();
172  vtkBooleanMacro(UseEdgeIconTypeMap, bool);
173  virtual void SetEdgeIconAlignment(int align);
174  virtual int GetEdgeIconAlignment();
175 
176  // ------------------------------------------------------------------------
177  // Vertex colors
178 
179  virtual void SetColorVerticesByArray(bool b);
180  virtual bool GetColorVerticesByArray();
181  vtkBooleanMacro(ColorVerticesByArray, bool);
182  virtual void SetVertexColorArrayName(const char* name);
183  virtual const char* GetVertexColorArrayName();
184 
185  // ------------------------------------------------------------------------
186  // Edge colors
187 
188  virtual void SetColorEdgesByArray(bool b);
189  virtual bool GetColorEdgesByArray();
190  vtkBooleanMacro(ColorEdgesByArray, bool);
191  virtual void SetEdgeColorArrayName(const char* name);
192  virtual const char* GetEdgeColorArrayName();
193 
194  // ------------------------------------------------------------------------
195  // Enabled vertices
196 
197  virtual void SetEnableVerticesByArray(bool b);
198  virtual bool GetEnableVerticesByArray();
199  vtkBooleanMacro(EnableVerticesByArray, bool);
200  virtual void SetEnabledVerticesArrayName(const char* name);
201  virtual const char* GetEnabledVerticesArrayName();
202 
203  // ------------------------------------------------------------------------
204  // Enabled edges
205 
206  virtual void SetEnableEdgesByArray(bool b);
207  virtual bool GetEnableEdgesByArray();
208  vtkBooleanMacro(EnableEdgesByArray, bool);
209  virtual void SetEnabledEdgesArrayName(const char* name);
210  virtual const char* GetEnabledEdgesArrayName();
211 
212  virtual void SetEdgeVisibility(bool b);
213  virtual bool GetEdgeVisibility();
214  vtkBooleanMacro(EdgeVisibility, bool);
215 
216  void SetEdgeSelection(bool b);
218 
219  // ------------------------------------------------------------------------
220  // Vertex layout strategy
221 
223 
226  virtual void SetLayoutStrategy(vtkGraphLayoutStrategy* strategy);
229 
231 
234  virtual void SetLayoutStrategy(const char* name);
235  vtkGetStringMacro(LayoutStrategyName);
237 
241  void SetLayoutStrategyToRandom() { this->SetLayoutStrategy("Random"); }
242  void SetLayoutStrategyToForceDirected() { this->SetLayoutStrategy("Force Directed"); }
243  void SetLayoutStrategyToSimple2D() { this->SetLayoutStrategy("Simple 2D"); }
244  void SetLayoutStrategyToClustering2D() { this->SetLayoutStrategy("Clustering 2D"); }
245  void SetLayoutStrategyToCommunity2D() { this->SetLayoutStrategy("Community 2D"); }
246  void SetLayoutStrategyToFast2D() { this->SetLayoutStrategy("Fast 2D"); }
247  void SetLayoutStrategyToPassThrough() { this->SetLayoutStrategy("Pass Through"); }
248  void SetLayoutStrategyToCircular() { this->SetLayoutStrategy("Circular"); }
249  void SetLayoutStrategyToTree() { this->SetLayoutStrategy("Tree"); }
250  void SetLayoutStrategyToCosmicTree() { this->SetLayoutStrategy("Cosmic Tree"); }
251  void SetLayoutStrategyToCone() { this->SetLayoutStrategy("Cone"); }
252  void SetLayoutStrategyToSpanTree() { this->SetLayoutStrategy("Span Tree"); }
253 
259  const char* xarr, const char* yarr = nullptr, const char* zarr = nullptr);
260 
272  bool radial, double angle = 90, double leafSpacing = 0.9, double logSpacing = 1.0);
273 
284  virtual void SetLayoutStrategyToCosmicTree(const char* nodeSizeArrayName,
285  bool sizeLeafNodesOnly = true, int layoutDepth = 0, vtkIdType layoutRoot = -1);
286 
287  // ------------------------------------------------------------------------
288  // Edge layout strategy
289 
291 
296  void SetEdgeLayoutStrategyToArcParallel() { this->SetEdgeLayoutStrategy("Arc Parallel"); }
297  void SetEdgeLayoutStrategyToPassThrough() { this->SetEdgeLayoutStrategy("Pass Through"); }
299 
304  virtual void SetEdgeLayoutStrategyToGeo(double explodeFactor = 0.2);
305 
307 
310  virtual void SetEdgeLayoutStrategy(const char* name);
311  vtkGetStringMacro(EdgeLayoutStrategyName);
313 
314  // ------------------------------------------------------------------------
315  // Miscellaneous
316 
320  void ApplyViewTheme(vtkViewTheme* theme) override;
321 
323 
326  virtual void SetGlyphType(int type);
327  virtual int GetGlyphType();
329 
331 
334  virtual void SetScaling(bool b);
335  virtual bool GetScaling();
336  vtkBooleanMacro(Scaling, bool);
338 
340 
343  virtual void SetScalingArrayName(const char* name);
344  virtual const char* GetScalingArrayName();
346 
348 
351  virtual void SetVertexScalarBarVisibility(bool b);
353  virtual void SetEdgeScalarBarVisibility(bool b);
356 
358 
364 
368  virtual bool IsLayoutComplete();
369 
373  virtual void UpdateLayout();
374 
378  void ComputeSelectedGraphBounds(double bounds[6]);
379 
380 protected:
383 
385 
388  bool AddToView(vtkView* view) override;
389  bool RemoveFromView(vtkView* view) override;
391 
392  void PrepareForRendering(vtkRenderView* view) override;
393 
395 
397 
401  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
402  vtkInformationVector* outputVector) override;
403 
405 
437 
440 
441  vtkSetStringMacro(VertexColorArrayNameInternal);
442  vtkGetStringMacro(VertexColorArrayNameInternal);
444 
445  vtkSetStringMacro(EdgeColorArrayNameInternal);
446  vtkGetStringMacro(EdgeColorArrayNameInternal);
448 
449  vtkSetStringMacro(ScalingArrayNameInternal);
450  vtkGetStringMacro(ScalingArrayNameInternal);
452 
453  vtkSetStringMacro(LayoutStrategyName);
455  vtkSetStringMacro(EdgeLayoutStrategyName);
459 
461 
462 private:
464  void operator=(const vtkRenderedGraphRepresentation&) = delete;
465 };
466 
467 VTK_ABI_NAMESPACE_END
468 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:50
apply colors to a data set.
apply icons to a data set.
Definition: vtkApplyIcons.h:56
generate points at center of edges
abstract superclass for all edge layout strategies
layout graph edges
Definition: vtkEdgeLayout.h:28
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:38
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:89
Removes the rows/edges/vertices of input data flagged by ann.
A view containing a renderer.
Definition: vtkRenderView.h:59
bool AddToView(vtkView *view) override
Called by the view to add/remove this representation.
virtual void SetEdgeIconVisibility(bool b)
virtual void SetEnabledEdgesArrayName(const char *name)
virtual void SetEdgeLayoutStrategy(vtkEdgeLayoutStrategy *strategy)
Set/get the graph layout strategy.
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()
virtual bool GetScaling()
Set whether to scale vertex glyphs.
virtual void ClearVertexIconTypes()
vtkSmartPointer< vtkActor > OutlineActor
Internal filter classes.
void PrepareForRendering(vtkRenderView *view) override
The view will call this method before every render.
vtkSmartPointer< vtkApplyColors > ApplyColors
Internal filter classes.
virtual void SetScaling(bool b)
Set whether to scale vertex glyphs.
virtual void SetColorEdgesByArray(bool b)
virtual bool GetColorEdgesByArray()
virtual const char * GetVertexColorArrayName()
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.
vtkSmartPointer< vtkActor > VertexActor
Internal filter classes.
virtual void SetVertexLabelTextProperty(vtkTextProperty *p)
virtual vtkTextProperty * GetEdgeLabelTextProperty()
void ApplyViewTheme(vtkViewTheme *theme) override
Apply a theme to this representation.
vtkSmartPointer< vtkTexturedActor2D > VertexIconActor
Internal filter classes.
virtual int GetVertexIconSelectionMode()
Set the mode to one of.
vtkSmartPointer< vtkTransformCoordinateSystems > VertexIconTransform
Internal filter classes.
virtual bool GetColorVerticesByArray()
virtual void SetEnableEdgesByArray(bool b)
virtual void SetVertexLabelArrayName(const char *name)
virtual void SetEdgeVisibility(bool b)
std::string GetHoverStringInternal(vtkSelection *sel) override
Subclasses may override this method to generate the hover text.
vtkSmartPointer< vtkGraphLayout > Layout
Internal filter classes.
virtual const char * GetEdgeIconPriorityArrayName()
virtual bool GetEdgeLabelVisibility()
virtual const char * GetEnabledEdgesArrayName()
vtkSmartPointer< vtkScalarBarWidget > EdgeScalarBar
Internal filter classes.
virtual int GetGlyphType()
Set the graph vertex glyph type.
vtkSmartPointer< vtkGraphToPoints > VertexIconPoints
Internal filter classes.
virtual bool GetEnableEdgesByArray()
vtkSmartPointer< vtkPointSetToLabelHierarchy > EdgeLabelHierarchy
Internal filter classes.
virtual bool GetEdgeIconVisibility()
virtual void SetVertexIconSelectionMode(int mode)
Set the mode to one of.
virtual bool GetEnableVerticesByArray()
virtual int GetVertexIconAlignment()
vtkSmartPointer< vtkApplyIcons > ApplyVertexIcons
Internal filter classes.
virtual void SetEnabledVerticesArrayName(const char *name)
virtual void AddEdgeIconType(const char *name, int type)
virtual void SetVertexDefaultIcon(int icon)
virtual vtkTextProperty * GetVertexLabelTextProperty()
virtual void AddVertexIconType(const char *name, int type)
vtkSmartPointer< vtkPolyData > EmptyPolyData
Internal filter classes.
vtkSmartPointer< vtkPolyDataMapper2D > VertexIconMapper
Internal filter classes.
virtual const char * GetEdgeIconArrayName()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual const char * GetEnabledVerticesArrayName()
vtkSmartPointer< vtkEdgeCenters > EdgeCenters
Internal filter classes.
virtual void UpdateLayout()
Performs another iteration on the graph layout.
vtkSmartPointer< vtkPointSetToLabelHierarchy > VertexLabelHierarchy
Internal filter classes.
virtual const char * GetEdgeLabelPriorityArrayName()
virtual vtkScalarBarWidget * GetVertexScalarBar()
Obtain the scalar bar widget used to draw a legend for the vertices/edges.
virtual void SetVertexIconSelectionModeToAnnotationIcon()
Set the mode to one of.
virtual void SetEdgeLabelTextProperty(vtkTextProperty *p)
virtual void SetScalingArrayName(const char *name)
Set the glyph scaling array name.
void SetEdgeLayoutStrategyToPassThrough()
Set/get the graph layout strategy.
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 const char * GetVertexIconArrayName()
virtual void SetVertexIconSelectionModeToIgnoreSelection()
Set the mode to one of.
virtual bool IsLayoutComplete()
Whether the current graph layout is complete.
virtual const char * GetScalingArrayName()
Set the glyph scaling array name.
virtual void SetEdgeIconAlignment(int align)
virtual void SetVertexIconVisibility(bool b)
virtual void SetVertexSelectedIcon(int icon)
vtkSmartPointer< vtkEdgeLayout > EdgeLayout
Internal filter classes.
bool RemoveFromView(vtkView *view) override
Called by the view to add/remove this representation.
virtual void SetEdgeIconArrayName(const char *name)
virtual const char * GetVertexIconPriorityArrayName()
static vtkRenderedGraphRepresentation * New()
virtual void SetVertexIconSelectionModeToSelectedOffset()
Set the mode to one of.
virtual void SetEdgeColorArrayName(const char *name)
virtual void SetColorVerticesByArray(bool b)
virtual const char * GetVertexLabelPriorityArrayName()
virtual vtkScalarBarWidget * GetEdgeScalarBar()
Obtain the scalar bar widget used to draw a legend for the vertices/edges.
vtkSmartPointer< vtkRemoveHiddenData > RemoveHiddenGraph
Internal filter classes.
virtual void SetUseVertexIconTypeMap(bool b)
virtual void SetVertexIconAlignment(int align)
virtual bool GetVertexLabelVisibility()
vtkSmartPointer< vtkPolyDataMapper > VertexMapper
Internal filter classes.
vtkSmartPointer< vtkGraphToGlyphs > VertexGlyph
Internal filter classes.
virtual bool GetUseVertexIconTypeMap()
vtkSmartPointer< vtkPolyDataMapper > EdgeMapper
Internal filter classes.
virtual void SetEdgeLayoutStrategyToGeo(double explodeFactor=0.2)
Set the edge layout strategy to a geospatial arced strategy appropriate for vtkGeoView.
vtkSmartPointer< vtkPerturbCoincidentVertices > Coincident
Internal filter classes.
virtual void SetVertexColorArrayName(const char *name)
virtual void SetEdgeLabelPriorityArrayName(const char *name)
virtual bool GetUseEdgeIconTypeMap()
virtual void SetEdgeIconPriorityArrayName(const char *name)
virtual void SetVertexIconSelectionModeToSelectedIcon()
Set the mode to one of.
virtual void SetVertexLabelVisibility(bool b)
virtual void SetEnableVerticesByArray(bool b)
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Connect inputs to internal pipeline.
vtkSmartPointer< vtkGraphToPoints > GraphToPoints
Internal filter classes.
virtual void SetUseEdgeIconTypeMap(bool b)
vtkSelection * ConvertSelection(vtkView *view, vtkSelection *sel) override
Convert the selection to a type appropriate for sharing with other representations through vtkAnnotat...
virtual const char * GetEdgeLabelArrayName()
virtual vtkGraphLayoutStrategy * GetLayoutStrategy()
Set/get the graph layout strategy.
virtual void SetVertexIconPriorityArrayName(const char *name)
virtual const char * GetEdgeColorArrayName()
virtual void SetGlyphType(int type)
Set the graph vertex glyph type.
virtual void SetVertexLabelPriorityArrayName(const char *name)
virtual void SetEdgeLabelArrayName(const char *name)
vtkSmartPointer< vtkActor > EdgeActor
Internal filter classes.
vtkSmartPointer< vtkScalarBarWidget > VertexScalarBar
Internal filter classes.
void SetEdgeLayoutStrategyToArcParallel()
Set/get the graph layout strategy.
~vtkRenderedGraphRepresentation() override
vtkSmartPointer< vtkGraphToGlyphs > OutlineGlyph
Internal filter classes.
virtual void SetLayoutStrategyToAssignCoordinates(const char *xarr, const char *yarr=nullptr, const char *zarr=nullptr)
Set the layout strategy to use coordinates from arrays.
vtkSmartPointer< vtkPolyDataMapper > OutlineMapper
Internal filter classes.
virtual void SetVertexIconArrayName(const char *name)
vtkSmartPointer< vtkVertexDegree > VertexDegree
Internal filter classes.
vtkSmartPointer< vtkGraphToPolyData > GraphToPoly
Internal filter classes.
virtual void SetEdgeScalarBarVisibility(bool b)
Vertex/edge scalar bar visibility.
virtual bool GetEdgeScalarBarVisibility()
Vertex/edge scalar bar visibility.
vtkSmartPointer< vtkIconGlyphFilter > VertexIconGlyph
Internal filter classes.
virtual vtkEdgeLayoutStrategy * GetEdgeLayoutStrategy()
Set/get the graph layout strategy.
void ComputeSelectedGraphBounds(double bounds[6])
Compute the bounding box of the selected subgraph.
virtual bool GetVertexScalarBarVisibility()
Vertex/edge scalar bar visibility.
virtual void SetEdgeLabelVisibility(bool b)
virtual bool GetVertexIconVisibility()
2D widget for manipulating a scalar bar
Superclass for mapping scalar values to colors.
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:59
represent text properties.
actor that draws 2D data with texture support
transform points into different coordinate systems
Adds an attribute array with the degree of each vertex.
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:43
The superclass for all views.
Definition: vtkView.h:49
@ mode
Definition: vtkX3D.h:247
@ type
Definition: vtkX3D.h:516
@ name
Definition: vtkX3D.h:219
@ string
Definition: vtkX3D.h:490
int vtkIdType
Definition: vtkType.h:315