VTK  9.3.20240328
vtkGraphMapper.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
17 #ifndef vtkGraphMapper_h
18 #define vtkGraphMapper_h
19 
20 #include "vtkMapper.h"
21 #include "vtkRenderingCoreModule.h" // For export macro
22 
23 #include "vtkSmartPointer.h" // Required for smart pointer internal ivars.
24 
25 VTK_ABI_NAMESPACE_BEGIN
26 class vtkActor2D;
27 class vtkMapArrayValues;
28 class vtkCamera;
29 class vtkFollower;
30 class vtkGraph;
31 class vtkGlyph3D;
32 class vtkGraphToPolyData;
33 class vtkIconGlyphFilter;
34 class vtkCellCenters;
35 class vtkPolyData;
36 class vtkPolyDataMapper;
38 class vtkLookupTable;
40 class vtkTexture;
41 class vtkTexturedActor2D;
43 
44 class VTKRENDERINGCORE_EXPORT vtkGraphMapper : public vtkMapper
45 {
46 public:
47  static vtkGraphMapper* New();
48  vtkTypeMacro(vtkGraphMapper, vtkMapper);
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50  void Render(vtkRenderer* ren, vtkActor* act) override;
51 
53 
56  void SetVertexColorArrayName(const char* name);
57  const char* GetVertexColorArrayName();
59 
61 
64  void SetColorVertices(bool vis);
69 
71 
77  void SetScaledGlyphs(bool arg);
78  vtkGetMacro(ScaledGlyphs, bool);
79  vtkBooleanMacro(ScaledGlyphs, bool);
81 
83 
86  vtkSetStringMacro(ScalingArrayName);
87  vtkGetStringMacro(ScalingArrayName);
89 
91 
94  void SetEdgeVisibility(bool vis);
96  vtkBooleanMacro(EdgeVisibility, bool);
98 
100 
103  void SetEdgeColorArrayName(const char* name);
104  const char* GetEdgeColorArrayName();
106 
108 
111  void SetColorEdges(bool vis);
113  void ColorEdgesOn();
116 
118 
121  vtkSetStringMacro(EnabledEdgesArrayName);
122  vtkGetStringMacro(EnabledEdgesArrayName);
124 
126 
129  vtkSetMacro(EnableEdgesByArray, vtkTypeBool);
130  vtkGetMacro(EnableEdgesByArray, vtkTypeBool);
131  vtkBooleanMacro(EnableEdgesByArray, vtkTypeBool);
133 
135 
138  vtkSetStringMacro(EnabledVerticesArrayName);
139  vtkGetStringMacro(EnabledVerticesArrayName);
141 
143 
146  vtkSetMacro(EnableVerticesByArray, vtkTypeBool);
147  vtkGetMacro(EnableVerticesByArray, vtkTypeBool);
148  vtkBooleanMacro(EnableVerticesByArray, vtkTypeBool);
150 
152 
155  void SetIconArrayName(const char* name);
156  const char* GetIconArrayName();
158 
164  void AddIconType(const char* type, int index);
165 
170 
172 
175  void SetIconSize(int* size);
176  int* GetIconSize();
178 
183  void SetIconAlignment(int alignment);
184 
186 
190  void SetIconTexture(vtkTexture* texture);
192 
194 
197  void SetIconVisibility(bool vis);
199  vtkBooleanMacro(IconVisibility, bool);
201 
203 
206  vtkGetMacro(VertexPointSize, float);
209 
211 
214  vtkGetMacro(EdgeLineWidth, float);
215  void SetEdgeLineWidth(float width);
217 
224 
228  vtkMTimeType GetMTime() override;
229 
231 
234  void SetInputData(vtkGraph* input);
237 
242  double* GetBounds() VTK_SIZEHINT(6) override;
243  void GetBounds(double* bounds) override { Superclass::GetBounds(bounds); }
244 
246 
249  vtkGetObjectMacro(EdgeLookupTable, vtkLookupTable);
250  vtkGetObjectMacro(VertexLookupTable, vtkLookupTable);
252 
253 protected:
255  ~vtkGraphMapper() override;
256 
258 
261  vtkGetStringMacro(VertexColorArrayNameInternal);
262  vtkSetStringMacro(VertexColorArrayNameInternal);
263  vtkGetStringMacro(EdgeColorArrayNameInternal);
264  vtkSetStringMacro(EdgeColorArrayNameInternal);
268 
273 
274  vtkGetStringMacro(IconArrayNameInternal);
275  vtkSetStringMacro(IconArrayNameInternal);
277 
280 
286 
291 
296 
297  // Color maps
300 
302 
303  // see algorithm for more info
305 
306 private:
307  vtkGraphMapper(const vtkGraphMapper&) = delete;
308  void operator=(const vtkGraphMapper&) = delete;
309 
310  // Helper function
311  vtkPolyData* CreateCircle(bool filled);
312 
313  float VertexPointSize;
314  float EdgeLineWidth;
315  bool ScaledGlyphs;
316  char* ScalingArrayName;
317 };
318 
319 VTK_ABI_NAMESPACE_END
320 #endif
virtual double * GetBounds()=0
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
a actor that draws 2D data
Definition: vtkActor2D.h:144
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:150
a virtual camera for 3D rendering
Definition: vtkCamera.h:150
generate points at center of cells
a subclass of actor that always faces the camera
Definition: vtkFollower.h:92
Detect and break reference loops.
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:211
map vtkGraph and derived classes to graphics primitives
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this mapper.
void ColorEdgesOn()
Whether to color edges.
~vtkGraphMapper() override
bool GetEdgeVisibility()
Whether to show edges or not.
vtkSmartPointer< vtkTexturedActor2D > IconActor
void SetColorEdges(bool vis)
Whether to color edges.
void SetVertexColorArrayName(const char *name)
The array to use for coloring vertices.
char * EnabledVerticesArrayName
vtkSmartPointer< vtkGraphToPolyData > GraphToPoly
vtkLookupTable * EdgeLookupTable
bool GetIconVisibility()
Whether to show icons.
void ClearIconTypes()
Clear all icon mappings.
vtkSmartPointer< vtkPolyDataMapper > EdgeMapper
const char * GetVertexColorArrayName()
The array to use for coloring vertices.
vtkSmartPointer< vtkPolyDataMapper > VertexMapper
int * GetIconSize()
Specify the Width and Height, in pixels, of an icon in the icon sheet.
void SetIconVisibility(bool vis)
Whether to show icons.
void AddIconType(const char *type, int index)
Associate the icon at index "index" in the vtkTexture to all vertices containing "type" as a value in...
void ColorVerticesOff()
Whether to color vertices.
bool GetColorVertices()
Whether to color vertices.
void SetColorVertices(bool vis)
Whether to color vertices.
vtkSmartPointer< vtkMapArrayValues > IconTypeToIndex
void ReportReferences(vtkGarbageCollector *) override
vtkSmartPointer< vtkIconGlyphFilter > IconGlyph
const char * GetIconArrayName()
The array to use for assigning icons.
char * EdgeColorArrayNameInternal
Used to store the vertex and edge color array names.
vtkSmartPointer< vtkPolyDataMapper > OutlineMapper
vtkSmartPointer< vtkVertexGlyphFilter > VertexGlyph
vtkSmartPointer< vtkTransformCoordinateSystems > IconTransform
void SetScaledGlyphs(bool arg)
Whether scaled glyphs are on or not.
vtkTypeBool EnableEdgesByArray
char * IconArrayNameInternal
void SetIconSize(int *size)
Specify the Width and Height, in pixels, of an icon in the icon sheet.
void SetInputData(vtkGraph *input)
Set the Input of this mapper.
static vtkGraphMapper * New()
void ColorVerticesOn()
Whether to color vertices.
vtkSmartPointer< vtkActor > EdgeActor
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkGraph * GetInput()
Set the Input of this mapper.
vtkLookupTable * VertexLookupTable
char * VertexColorArrayNameInternal
Used to store the vertex and edge color array names.
bool GetColorEdges()
Whether to color edges.
void SetIconAlignment(int alignment)
Specify where the icons should be placed in relation to the vertex.
char * EnabledEdgesArrayName
vtkSmartPointer< vtkPolyDataMapper2D > IconMapper
vtkSmartPointer< vtkGlyph3D > CircleGlyph
vtkSmartPointer< vtkActor > OutlineActor
void SetIconArrayName(const char *name)
The array to use for assigning icons.
vtkSmartPointer< vtkActor > VertexActor
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTypeBool EnableVerticesByArray
void ColorEdgesOff()
Whether to color edges.
void SetIconTexture(vtkTexture *texture)
The texture containing the icon sheet.
void SetEdgeVisibility(bool vis)
Whether to show edges or not.
vtkSmartPointer< vtkGlyph3D > CircleOutlineGlyph
void Render(vtkRenderer *ren, vtkActor *act) override
Method initiates the mapping process.
double * GetBounds() override
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
const char * GetEdgeColorArrayName()
The array to use for coloring edges.
void SetEdgeLineWidth(float width)
Get/Set the edge line width.
void SetEdgeColorArrayName(const char *name)
The array to use for coloring edges.
void SetVertexPointSize(float size)
Get/Set the vertex point size.
vtkTexture * GetIconTexture()
The texture containing the icon sheet.
vtkMTimeType GetMTime() override
Get the mtime also considering the lookup table.
convert a vtkGraph to vtkPolyData
Base class for graph data types.
Definition: vtkGraph.h:340
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 vtkAlgorithm input/output information.
map scalar values into colors via a lookup table
Map values in an input array to different values in an output array of (possibly) different type.
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:136
draw vtkPolyData onto the image plane
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:180
abstract specification for renderers
Definition: vtkRenderer.h:171
handles properties associated with a texture map
Definition: vtkTexture.h:167
actor that draws 2D data with texture support
transform points into different coordinate systems
Make a vtkPolyData with a vertex on each point.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:47
void GetBounds(T a, double bds[6])
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
@ type
Definition: vtkX3D.h:516
@ filled
Definition: vtkX3D.h:349
@ name
Definition: vtkX3D.h:219
@ size
Definition: vtkX3D.h:253
@ index
Definition: vtkX3D.h:246
int vtkTypeBool
Definition: vtkABI.h:64
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
#define VTK_SIZEHINT(...)