VTK  9.3.20240420
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
82#ifndef vtkRenderedGraphRepresentation_h
83#define vtkRenderedGraphRepresentation_h
84
86#include "vtkSmartPointer.h" // for SP ivars
87#include "vtkViewsInfovisModule.h" // For export macro
88
89VTK_ABI_NAMESPACE_BEGIN
90class vtkActor;
91class vtkApplyColors;
92class vtkApplyIcons;
93class vtkEdgeCenters;
94class vtkEdgeLayout;
96class vtkGraphLayout;
102class vtkInformation;
104class vtkLookupTable;
107class vtkPolyData;
111class vtkRenderView;
114class vtkTextProperty;
117class vtkVertexDegree;
118class vtkView;
119class vtkViewTheme;
120
122{
123public:
126 void PrintSelf(ostream& os, vtkIndent indent) override;
127
128 // ------------------------------------------------------------------------
129 // Vertex labels
130
131 virtual void SetVertexLabelArrayName(const char* name);
132 virtual const char* GetVertexLabelArrayName();
133 virtual void SetVertexLabelPriorityArrayName(const char* name);
134 virtual const char* GetVertexLabelPriorityArrayName();
135 virtual void SetVertexLabelVisibility(bool b);
137 vtkBooleanMacro(VertexLabelVisibility, bool);
140 vtkSetStringMacro(VertexHoverArrayName);
141 vtkGetStringMacro(VertexHoverArrayName);
143
146 vtkSetMacro(HideVertexLabelsOnInteraction, bool);
147 vtkGetMacro(HideVertexLabelsOnInteraction, bool);
148 vtkBooleanMacro(HideVertexLabelsOnInteraction, bool);
150
151 // ------------------------------------------------------------------------
152 // Edge labels
153
154 virtual void SetEdgeLabelArrayName(const char* name);
155 virtual const char* GetEdgeLabelArrayName();
156 virtual void SetEdgeLabelPriorityArrayName(const char* name);
157 virtual const char* GetEdgeLabelPriorityArrayName();
158 virtual void SetEdgeLabelVisibility(bool b);
160 vtkBooleanMacro(EdgeLabelVisibility, bool);
163 vtkSetStringMacro(EdgeHoverArrayName);
164 vtkGetStringMacro(EdgeHoverArrayName);
166
169 vtkSetMacro(HideEdgeLabelsOnInteraction, bool);
170 vtkGetMacro(HideEdgeLabelsOnInteraction, bool);
171 vtkBooleanMacro(HideEdgeLabelsOnInteraction, bool);
173
174 // ------------------------------------------------------------------------
175 // Vertex icons
176
177 virtual void SetVertexIconArrayName(const char* name);
178 virtual const char* GetVertexIconArrayName();
179 virtual void SetVertexIconPriorityArrayName(const char* name);
180 virtual const char* GetVertexIconPriorityArrayName();
181 virtual void SetVertexIconVisibility(bool b);
183 vtkBooleanMacro(VertexIconVisibility, bool);
184 virtual void AddVertexIconType(const char* name, int type);
185 virtual void ClearVertexIconTypes();
186 virtual void SetUseVertexIconTypeMap(bool b);
188 vtkBooleanMacro(UseVertexIconTypeMap, bool);
189 virtual void SetVertexIconAlignment(int align);
191 virtual void SetVertexSelectedIcon(int icon);
193 virtual void SetVertexDefaultIcon(int icon);
194 virtual int GetVertexDefaultIcon();
195
197
207 virtual void SetVertexIconSelectionMode(int mode);
209 virtual void SetVertexIconSelectionModeToSelectedIcon() { this->SetVertexIconSelectionMode(0); }
210 virtual void SetVertexIconSelectionModeToSelectedOffset() { this->SetVertexIconSelectionMode(1); }
211 virtual void SetVertexIconSelectionModeToAnnotationIcon() { this->SetVertexIconSelectionMode(2); }
213 {
214 this->SetVertexIconSelectionMode(3);
215 }
217
218 // ------------------------------------------------------------------------
219 // Edge icons
220
221 virtual void SetEdgeIconArrayName(const char* name);
222 virtual const char* GetEdgeIconArrayName();
223 virtual void SetEdgeIconPriorityArrayName(const char* name);
224 virtual const char* GetEdgeIconPriorityArrayName();
225 virtual void SetEdgeIconVisibility(bool b);
226 virtual bool GetEdgeIconVisibility();
227 vtkBooleanMacro(EdgeIconVisibility, bool);
228 virtual void AddEdgeIconType(const char* name, int type);
229 virtual void ClearEdgeIconTypes();
230 virtual void SetUseEdgeIconTypeMap(bool b);
231 virtual bool GetUseEdgeIconTypeMap();
232 vtkBooleanMacro(UseEdgeIconTypeMap, bool);
233 virtual void SetEdgeIconAlignment(int align);
234 virtual int GetEdgeIconAlignment();
235
236 // ------------------------------------------------------------------------
237 // Vertex colors
238
239 virtual void SetColorVerticesByArray(bool b);
241 vtkBooleanMacro(ColorVerticesByArray, bool);
242 virtual void SetVertexColorArrayName(const char* name);
243 virtual const char* GetVertexColorArrayName();
244
245 // ------------------------------------------------------------------------
246 // Edge colors
247
248 virtual void SetColorEdgesByArray(bool b);
249 virtual bool GetColorEdgesByArray();
250 vtkBooleanMacro(ColorEdgesByArray, bool);
251 virtual void SetEdgeColorArrayName(const char* name);
252 virtual const char* GetEdgeColorArrayName();
253
254 // ------------------------------------------------------------------------
255 // Enabled vertices
256
257 virtual void SetEnableVerticesByArray(bool b);
259 vtkBooleanMacro(EnableVerticesByArray, bool);
260 virtual void SetEnabledVerticesArrayName(const char* name);
261 virtual const char* GetEnabledVerticesArrayName();
262
263 // ------------------------------------------------------------------------
264 // Enabled edges
265
266 virtual void SetEnableEdgesByArray(bool b);
267 virtual bool GetEnableEdgesByArray();
268 vtkBooleanMacro(EnableEdgesByArray, bool);
269 virtual void SetEnabledEdgesArrayName(const char* name);
270 virtual const char* GetEnabledEdgesArrayName();
271
272 virtual void SetEdgeVisibility(bool b);
273 virtual bool GetEdgeVisibility();
274 vtkBooleanMacro(EdgeVisibility, bool);
275
276 void SetEdgeSelection(bool b);
278
279 // ------------------------------------------------------------------------
280 // Vertex layout strategy
281
283
289
291
294 virtual void SetLayoutStrategy(const char* name);
295 vtkGetStringMacro(LayoutStrategyName);
297
301 void SetLayoutStrategyToRandom() { this->SetLayoutStrategy("Random"); }
302 void SetLayoutStrategyToForceDirected() { this->SetLayoutStrategy("Force Directed"); }
303 void SetLayoutStrategyToSimple2D() { this->SetLayoutStrategy("Simple 2D"); }
304 void SetLayoutStrategyToClustering2D() { this->SetLayoutStrategy("Clustering 2D"); }
305 void SetLayoutStrategyToCommunity2D() { this->SetLayoutStrategy("Community 2D"); }
306 void SetLayoutStrategyToFast2D() { this->SetLayoutStrategy("Fast 2D"); }
307 void SetLayoutStrategyToPassThrough() { this->SetLayoutStrategy("Pass Through"); }
308 void SetLayoutStrategyToCircular() { this->SetLayoutStrategy("Circular"); }
309 void SetLayoutStrategyToTree() { this->SetLayoutStrategy("Tree"); }
310 void SetLayoutStrategyToCosmicTree() { this->SetLayoutStrategy("Cosmic Tree"); }
311 void SetLayoutStrategyToCone() { this->SetLayoutStrategy("Cone"); }
312 void SetLayoutStrategyToSpanTree() { this->SetLayoutStrategy("Span Tree"); }
313
319 const char* xarr, const char* yarr = nullptr, const char* zarr = nullptr);
320
332 bool radial, double angle = 90, double leafSpacing = 0.9, double logSpacing = 1.0);
333
344 virtual void SetLayoutStrategyToCosmicTree(const char* nodeSizeArrayName,
345 bool sizeLeafNodesOnly = true, int layoutDepth = 0, vtkIdType layoutRoot = -1);
346
347 // ------------------------------------------------------------------------
348 // Edge layout strategy
349
351
356 void SetEdgeLayoutStrategyToArcParallel() { this->SetEdgeLayoutStrategy("Arc Parallel"); }
357 void SetEdgeLayoutStrategyToPassThrough() { this->SetEdgeLayoutStrategy("Pass Through"); }
359
364 virtual void SetEdgeLayoutStrategyToGeo(double explodeFactor = 0.2);
365
367
370 virtual void SetEdgeLayoutStrategy(const char* name);
371 vtkGetStringMacro(EdgeLayoutStrategyName);
373
374 // ------------------------------------------------------------------------
375 // Miscellaneous
376
380 void ApplyViewTheme(vtkViewTheme* theme) override;
381
383
386 virtual void SetGlyphType(int type);
387 virtual int GetGlyphType();
389
391
394 virtual void SetScaling(bool b);
395 virtual bool GetScaling();
396 vtkBooleanMacro(Scaling, bool);
398
400
403 virtual void SetScalingArrayName(const char* name);
404 virtual const char* GetScalingArrayName();
406
408
411 virtual void SetVertexScalarBarVisibility(bool b);
413 virtual void SetEdgeScalarBarVisibility(bool b);
416
418
424
428 virtual bool IsLayoutComplete();
429
433 virtual void UpdateLayout();
434
438 void ComputeSelectedGraphBounds(double bounds[6]);
439
440protected:
443
445
448 bool AddToView(vtkView* view) override;
449 bool RemoveFromView(vtkView* view) override;
451
452 void PrepareForRendering(vtkRenderView* view) override;
453
455
456 std::string GetHoverStringInternal(vtkSelection* sel) override;
457
462 vtkInformationVector* outputVector) override;
463
465
497
500
501 vtkSetStringMacro(VertexColorArrayNameInternal);
502 vtkGetStringMacro(VertexColorArrayNameInternal);
504
505 vtkSetStringMacro(EdgeColorArrayNameInternal);
506 vtkGetStringMacro(EdgeColorArrayNameInternal);
508
509 vtkSetStringMacro(ScalingArrayNameInternal);
510 vtkGetStringMacro(ScalingArrayNameInternal);
512
513 vtkSetStringMacro(LayoutStrategyName);
515 vtkSetStringMacro(EdgeLayoutStrategyName);
519
521
522private:
524 void operator=(const vtkRenderedGraphRepresentation&) = delete;
525};
526
527VTK_ABI_NAMESPACE_END
528#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
apply colors to a data set.
apply icons to a data set.
generate points at center of edges
abstract superclass for all edge layout strategies
layout graph edges
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:108
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
Removes the rows/edges/vertices of input data flagged by ann.
A view containing a renderer.
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.
Hold a reference to a vtkObjectBase instance.
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.
The superclass for all views.
Definition vtkView.h:49
int vtkIdType
Definition vtkType.h:315