VTK  9.1.0
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-------------------------------------------------------------------------*/
35#ifndef vtkRenderedGraphRepresentation_h
36#define vtkRenderedGraphRepresentation_h
37
39#include "vtkSmartPointer.h" // for SP ivars
40#include "vtkViewsInfovisModule.h" // For export macro
41
42class vtkActor;
43class vtkApplyColors;
44class vtkApplyIcons;
45class vtkEdgeCenters;
46class vtkEdgeLayout;
48class vtkGraphLayout;
54class vtkInformation;
56class vtkLookupTable;
59class vtkPolyData;
63class vtkRenderView;
66class vtkTextProperty;
69class vtkVertexDegree;
70class vtkView;
71class vtkViewTheme;
72
73class VTKVIEWSINFOVIS_EXPORT vtkRenderedGraphRepresentation : public vtkRenderedRepresentation
74{
75public:
78 void PrintSelf(ostream& os, vtkIndent indent) override;
79
80 // ------------------------------------------------------------------------
81 // Vertex labels
82
83 virtual void SetVertexLabelArrayName(const char* name);
84 virtual const char* GetVertexLabelArrayName();
85 virtual void SetVertexLabelPriorityArrayName(const char* name);
86 virtual const char* GetVertexLabelPriorityArrayName();
87 virtual void SetVertexLabelVisibility(bool b);
89 vtkBooleanMacro(VertexLabelVisibility, bool);
92 vtkSetStringMacro(VertexHoverArrayName);
93 vtkGetStringMacro(VertexHoverArrayName);
95
98 vtkSetMacro(HideVertexLabelsOnInteraction, bool);
99 vtkGetMacro(HideVertexLabelsOnInteraction, bool);
100 vtkBooleanMacro(HideVertexLabelsOnInteraction, bool);
102
103 // ------------------------------------------------------------------------
104 // Edge labels
105
106 virtual void SetEdgeLabelArrayName(const char* name);
107 virtual const char* GetEdgeLabelArrayName();
108 virtual void SetEdgeLabelPriorityArrayName(const char* name);
109 virtual const char* GetEdgeLabelPriorityArrayName();
110 virtual void SetEdgeLabelVisibility(bool b);
112 vtkBooleanMacro(EdgeLabelVisibility, bool);
115 vtkSetStringMacro(EdgeHoverArrayName);
116 vtkGetStringMacro(EdgeHoverArrayName);
118
121 vtkSetMacro(HideEdgeLabelsOnInteraction, bool);
122 vtkGetMacro(HideEdgeLabelsOnInteraction, bool);
123 vtkBooleanMacro(HideEdgeLabelsOnInteraction, bool);
125
126 // ------------------------------------------------------------------------
127 // Vertex icons
128
129 virtual void SetVertexIconArrayName(const char* name);
130 virtual const char* GetVertexIconArrayName();
131 virtual void SetVertexIconPriorityArrayName(const char* name);
132 virtual const char* GetVertexIconPriorityArrayName();
133 virtual void SetVertexIconVisibility(bool b);
135 vtkBooleanMacro(VertexIconVisibility, bool);
136 virtual void AddVertexIconType(const char* name, int type);
137 virtual void ClearVertexIconTypes();
138 virtual void SetUseVertexIconTypeMap(bool b);
140 vtkBooleanMacro(UseVertexIconTypeMap, bool);
141 virtual void SetVertexIconAlignment(int align);
143 virtual void SetVertexSelectedIcon(int icon);
145 virtual void SetVertexDefaultIcon(int icon);
146 virtual int GetVertexDefaultIcon();
147
149
161 virtual void SetVertexIconSelectionModeToSelectedIcon() { this->SetVertexIconSelectionMode(0); }
162 virtual void SetVertexIconSelectionModeToSelectedOffset() { this->SetVertexIconSelectionMode(1); }
163 virtual void SetVertexIconSelectionModeToAnnotationIcon() { this->SetVertexIconSelectionMode(2); }
165 {
166 this->SetVertexIconSelectionMode(3);
167 }
169
170 // ------------------------------------------------------------------------
171 // Edge icons
172
173 virtual void SetEdgeIconArrayName(const char* name);
174 virtual const char* GetEdgeIconArrayName();
175 virtual void SetEdgeIconPriorityArrayName(const char* name);
176 virtual const char* GetEdgeIconPriorityArrayName();
177 virtual void SetEdgeIconVisibility(bool b);
178 virtual bool GetEdgeIconVisibility();
179 vtkBooleanMacro(EdgeIconVisibility, bool);
180 virtual void AddEdgeIconType(const char* name, int type);
181 virtual void ClearEdgeIconTypes();
182 virtual void SetUseEdgeIconTypeMap(bool b);
183 virtual bool GetUseEdgeIconTypeMap();
184 vtkBooleanMacro(UseEdgeIconTypeMap, bool);
185 virtual void SetEdgeIconAlignment(int align);
186 virtual int GetEdgeIconAlignment();
187
188 // ------------------------------------------------------------------------
189 // Vertex colors
190
191 virtual void SetColorVerticesByArray(bool b);
193 vtkBooleanMacro(ColorVerticesByArray, bool);
194 virtual void SetVertexColorArrayName(const char* name);
195 virtual const char* GetVertexColorArrayName();
196
197 // ------------------------------------------------------------------------
198 // Edge colors
199
200 virtual void SetColorEdgesByArray(bool b);
201 virtual bool GetColorEdgesByArray();
202 vtkBooleanMacro(ColorEdgesByArray, bool);
203 virtual void SetEdgeColorArrayName(const char* name);
204 virtual const char* GetEdgeColorArrayName();
205
206 // ------------------------------------------------------------------------
207 // Enabled vertices
208
209 virtual void SetEnableVerticesByArray(bool b);
211 vtkBooleanMacro(EnableVerticesByArray, bool);
212 virtual void SetEnabledVerticesArrayName(const char* name);
213 virtual const char* GetEnabledVerticesArrayName();
214
215 // ------------------------------------------------------------------------
216 // Enabled edges
217
218 virtual void SetEnableEdgesByArray(bool b);
219 virtual bool GetEnableEdgesByArray();
220 vtkBooleanMacro(EnableEdgesByArray, bool);
221 virtual void SetEnabledEdgesArrayName(const char* name);
222 virtual const char* GetEnabledEdgesArrayName();
223
224 virtual void SetEdgeVisibility(bool b);
225 virtual bool GetEdgeVisibility();
226 vtkBooleanMacro(EdgeVisibility, bool);
227
228 void SetEdgeSelection(bool b);
230
231 // ------------------------------------------------------------------------
232 // Vertex layout strategy
233
235
241
243
246 virtual void SetLayoutStrategy(const char* name);
247 vtkGetStringMacro(LayoutStrategyName);
249
253 void SetLayoutStrategyToRandom() { this->SetLayoutStrategy("Random"); }
254 void SetLayoutStrategyToForceDirected() { this->SetLayoutStrategy("Force Directed"); }
255 void SetLayoutStrategyToSimple2D() { this->SetLayoutStrategy("Simple 2D"); }
256 void SetLayoutStrategyToClustering2D() { this->SetLayoutStrategy("Clustering 2D"); }
257 void SetLayoutStrategyToCommunity2D() { this->SetLayoutStrategy("Community 2D"); }
258 void SetLayoutStrategyToFast2D() { this->SetLayoutStrategy("Fast 2D"); }
259 void SetLayoutStrategyToPassThrough() { this->SetLayoutStrategy("Pass Through"); }
260 void SetLayoutStrategyToCircular() { this->SetLayoutStrategy("Circular"); }
261 void SetLayoutStrategyToTree() { this->SetLayoutStrategy("Tree"); }
262 void SetLayoutStrategyToCosmicTree() { this->SetLayoutStrategy("Cosmic Tree"); }
263 void SetLayoutStrategyToCone() { this->SetLayoutStrategy("Cone"); }
264 void SetLayoutStrategyToSpanTree() { this->SetLayoutStrategy("Span Tree"); }
265
271 const char* xarr, const char* yarr = nullptr, const char* zarr = nullptr);
272
284 bool radial, double angle = 90, double leafSpacing = 0.9, double logSpacing = 1.0);
285
296 virtual void SetLayoutStrategyToCosmicTree(const char* nodeSizeArrayName,
297 bool sizeLeafNodesOnly = true, int layoutDepth = 0, vtkIdType layoutRoot = -1);
298
299 // ------------------------------------------------------------------------
300 // Edge layout strategy
301
303
308 void SetEdgeLayoutStrategyToArcParallel() { this->SetEdgeLayoutStrategy("Arc Parallel"); }
309 void SetEdgeLayoutStrategyToPassThrough() { this->SetEdgeLayoutStrategy("Pass Through"); }
311
316 virtual void SetEdgeLayoutStrategyToGeo(double explodeFactor = 0.2);
317
319
322 virtual void SetEdgeLayoutStrategy(const char* name);
323 vtkGetStringMacro(EdgeLayoutStrategyName);
325
326 // ------------------------------------------------------------------------
327 // Miscellaneous
328
332 void ApplyViewTheme(vtkViewTheme* theme) override;
333
335
338 virtual void SetGlyphType(int type);
339 virtual int GetGlyphType();
341
343
346 virtual void SetScaling(bool b);
347 virtual bool GetScaling();
348 vtkBooleanMacro(Scaling, bool);
350
352
355 virtual void SetScalingArrayName(const char* name);
356 virtual const char* GetScalingArrayName();
358
360
363 virtual void SetVertexScalarBarVisibility(bool b);
365 virtual void SetEdgeScalarBarVisibility(bool b);
368
370
376
380 virtual bool IsLayoutComplete();
381
385 virtual void UpdateLayout();
386
390 void ComputeSelectedGraphBounds(double bounds[6]);
391
392protected:
395
397
400 bool AddToView(vtkView* view) override;
401 bool RemoveFromView(vtkView* view) override;
403
404 void PrepareForRendering(vtkRenderView* view) override;
405
407
409
414 vtkInformationVector* outputVector) override;
415
417
449
452
453 vtkSetStringMacro(VertexColorArrayNameInternal);
454 vtkGetStringMacro(VertexColorArrayNameInternal);
456
457 vtkSetStringMacro(EdgeColorArrayNameInternal);
458 vtkGetStringMacro(EdgeColorArrayNameInternal);
460
461 vtkSetStringMacro(ScalingArrayNameInternal);
462 vtkGetStringMacro(ScalingArrayNameInternal);
464
465 vtkSetStringMacro(LayoutStrategyName);
467 vtkSetStringMacro(EdgeLayoutStrategyName);
471
473
474private:
476 void operator=(const vtkRenderedGraphRepresentation&) = delete;
477};
478
479#endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:55
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:39
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:43
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:95
Removes the rows/edges/vertices of input data flagged by ann.
A view containing a renderer.
Definition: vtkRenderView.h:68
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 const char * GetEdgeLabelArrayName()
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 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 const char * GetVertexColorArrayName()
virtual void SetScaling(bool b)
Set whether to scale vertex glyphs.
static vtkRenderedGraphRepresentation * New()
virtual void SetColorEdgesByArray(bool b)
virtual bool GetColorEdgesByArray()
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)
void ApplyViewTheme(vtkViewTheme *theme) override
Apply a theme to this representation.
virtual const char * GetVertexIconPriorityArrayName()
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 vtkScalarBarWidget * GetEdgeScalarBar()
Obtain the scalar bar widget used to draw a legend for the vertices/edges.
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 bool GetEdgeLabelVisibility()
vtkSmartPointer< vtkScalarBarWidget > EdgeScalarBar
Internal filter classes.
virtual int GetGlyphType()
Set the graph vertex glyph type.
virtual vtkEdgeLayoutStrategy * GetEdgeLayoutStrategy()
Set/get the graph layout strategy.
vtkSmartPointer< vtkGraphToPoints > VertexIconPoints
Internal filter classes.
virtual bool GetEnableEdgesByArray()
vtkSmartPointer< vtkPointSetToLabelHierarchy > EdgeLabelHierarchy
Internal filter classes.
virtual bool GetEdgeIconVisibility()
virtual const char * GetEdgeLabelPriorityArrayName()
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 vtkScalarBarWidget * GetVertexScalarBar()
Obtain the scalar bar widget used to draw a legend for the vertices/edges.
virtual void AddEdgeIconType(const char *name, int type)
virtual void SetVertexDefaultIcon(int icon)
virtual void AddVertexIconType(const char *name, int type)
vtkSmartPointer< vtkPolyData > EmptyPolyData
Internal filter classes.
vtkSmartPointer< vtkPolyDataMapper2D > VertexIconMapper
Internal filter classes.
virtual const char * GetVertexLabelPriorityArrayName()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSmartPointer< vtkEdgeCenters > EdgeCenters
Internal filter classes.
vtkSelection * ConvertSelection(vtkView *view, vtkSelection *sel) override
Convert the selection to a type appropriate for sharing with other representations through vtkAnnotat...
virtual void UpdateLayout()
Performs another iteration on the graph layout.
vtkSmartPointer< vtkPointSetToLabelHierarchy > VertexLabelHierarchy
Internal filter classes.
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 void SetVertexIconSelectionModeToIgnoreSelection()
Set the mode to one of.
virtual bool IsLayoutComplete()
Whether the current graph layout is complete.
virtual vtkTextProperty * GetVertexLabelTextProperty()
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 * GetEdgeIconPriorityArrayName()
virtual const char * GetEdgeIconArrayName()
virtual const char * GetEnabledVerticesArrayName()
virtual void SetVertexIconSelectionModeToSelectedOffset()
Set the mode to one of.
virtual void SetEdgeColorArrayName(const char *name)
virtual void SetColorVerticesByArray(bool b)
virtual vtkGraphLayoutStrategy * GetLayoutStrategy()
Set/get the graph layout strategy.
virtual const char * GetVertexIconArrayName()
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.
virtual vtkTextProperty * GetEdgeLabelTextProperty()
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.
virtual const char * GetEdgeColorArrayName()
vtkSmartPointer< vtkGraphToPoints > GraphToPoints
Internal filter classes.
virtual void SetUseEdgeIconTypeMap(bool b)
virtual void SetVertexIconPriorityArrayName(const char *name)
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
virtual const char * GetEnabledEdgesArrayName()
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 const char * GetScalingArrayName()
Set the glyph scaling array name.
virtual const char * GetVertexLabelArrayName()
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:63
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:52
The superclass for all views.
Definition: vtkView.h:55
@ mode
Definition: vtkX3D.h:253
@ type
Definition: vtkX3D.h:522
@ name
Definition: vtkX3D.h:225
@ string
Definition: vtkX3D.h:496
int vtkIdType
Definition: vtkType.h:332