VTK  9.7.1
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 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
25 
26 VTK_ABI_NAMESPACE_BEGIN
27 class vtkActor2D;
28 class vtkMapArrayValues;
29 class vtkCamera;
30 class vtkFollower;
31 class vtkGraph;
32 class vtkGlyph3D;
33 class vtkGraphToPolyData;
34 class vtkIconGlyphFilter;
35 class vtkCellCenters;
36 class vtkPolyData;
37 class vtkPolyDataMapper;
39 class vtkLookupTable;
41 class vtkTexture;
42 class vtkTexturedActor2D;
44 
45 class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkGraphMapper : public vtkMapper
46 {
47 public:
48  static vtkGraphMapper* New();
49  vtkTypeMacro(vtkGraphMapper, vtkMapper);
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51  void Render(vtkRenderer* ren, vtkActor* act) override;
52 
54 
57  void SetVertexColorArrayName(const char* name);
58  const char* GetVertexColorArrayName();
60 
62 
65  void SetColorVertices(bool vis);
66  bool GetColorVertices();
67  void ColorVerticesOn();
68  void ColorVerticesOff();
70 
72 
78  void SetScaledGlyphs(bool arg);
79  vtkGetMacro(ScaledGlyphs, bool);
80  vtkBooleanMacro(ScaledGlyphs, bool);
82 
84 
87  vtkSetStringMacro(ScalingArrayName);
88  vtkGetStringMacro(ScalingArrayName);
90 
92 
95  void SetEdgeVisibility(bool vis);
96  bool GetEdgeVisibility();
97  vtkBooleanMacro(EdgeVisibility, bool);
99 
101 
104  void SetEdgeColorArrayName(const char* name);
105  const char* GetEdgeColorArrayName();
107 
109 
112  void SetColorEdges(bool vis);
113  bool GetColorEdges();
114  void ColorEdgesOn();
115  void ColorEdgesOff();
117 
119 
122  vtkSetStringMacro(EnabledEdgesArrayName);
123  vtkGetStringMacro(EnabledEdgesArrayName);
125 
127 
130  vtkSetMacro(EnableEdgesByArray, vtkTypeBool);
131  vtkGetMacro(EnableEdgesByArray, vtkTypeBool);
132  vtkBooleanMacro(EnableEdgesByArray, vtkTypeBool);
134 
136 
139  vtkSetStringMacro(EnabledVerticesArrayName);
140  vtkGetStringMacro(EnabledVerticesArrayName);
142 
144 
147  vtkSetMacro(EnableVerticesByArray, vtkTypeBool);
148  vtkGetMacro(EnableVerticesByArray, vtkTypeBool);
149  vtkBooleanMacro(EnableVerticesByArray, vtkTypeBool);
151 
153 
156  void SetIconArrayName(const char* name);
157  const char* GetIconArrayName();
159 
165  void AddIconType(const char* type, int index);
166 
170  void ClearIconTypes();
171 
173 
176  void SetIconSize(int* size) VTK_SIZEHINT(2);
177  int* GetIconSize() VTK_SIZEHINT(2);
179 
184  void SetIconAlignment(int alignment);
185 
187 
190  vtkTexture* GetIconTexture();
191  void SetIconTexture(vtkTexture* texture);
193 
195 
198  void SetIconVisibility(bool vis);
199  bool GetIconVisibility();
200  vtkBooleanMacro(IconVisibility, bool);
202 
204 
207  vtkGetMacro(VertexPointSize, float);
208  void SetVertexPointSize(float size);
210 
212 
215  vtkGetMacro(EdgeLineWidth, float);
216  void SetEdgeLineWidth(float width);
218 
224  void ReleaseGraphicsResources(vtkWindow*) override;
225 
229  vtkMTimeType GetMTime() override;
230 
232 
235  void SetInputData(vtkGraph* input);
236  vtkGraph* GetInput();
238 
243  double* GetBounds() VTK_SIZEHINT(6) override;
244  void GetBounds(double* bounds) override { Superclass::GetBounds(bounds); }
245 
247 
250  vtkGetObjectMacro(EdgeLookupTable, vtkLookupTable);
251  vtkGetObjectMacro(VertexLookupTable, vtkLookupTable);
253 
254 protected:
255  vtkGraphMapper();
256  ~vtkGraphMapper() override;
257 
259 
262  vtkGetStringMacro(VertexColorArrayNameInternal);
263  vtkSetStringMacro(VertexColorArrayNameInternal);
264  vtkGetStringMacro(EdgeColorArrayNameInternal);
265  vtkSetStringMacro(EdgeColorArrayNameInternal);
269 
274 
275  vtkGetStringMacro(IconArrayNameInternal);
276  vtkSetStringMacro(IconArrayNameInternal);
277  char* IconArrayNameInternal;
278 
281 
287 
292 
297 
298  // Color maps
301 
302  void ReportReferences(vtkGarbageCollector*) override;
303 
304  // see algorithm for more info
305  int FillInputPortInformation(int port, vtkInformation* info) override;
306 
307 private:
308  vtkGraphMapper(const vtkGraphMapper&) = delete;
309  void operator=(const vtkGraphMapper&) = delete;
310 
311  // Helper function
312  vtkPolyData* CreateCircle(bool filled);
313 
314  float VertexPointSize;
315  float EdgeLineWidth;
316  bool ScaledGlyphs;
317  char* ScalingArrayName;
318 };
319 
320 VTK_ABI_NAMESPACE_END
321 #endif
char * EdgeColorArrayNameInternal
Used to store the vertex and edge color array names.
map vtkGraph and derived classes to graphics primitives
void GetBounds(T a, double bds[6])
char * EnabledVerticesArrayName
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:41
actor that draws 2D data with texture support
char * IconArrayNameInternal
Map values in an input array to different values in an output array of (possibly) different type...
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:318
Filter that generates a polydata consisting of quads with texture coordinates referring to a set of i...
vtkTypeBool EnableEdgesByArray
vtkSmartPointer< vtkPolyDataMapper > OutlineMapper
void ReportReferences(vtkGarbageCollector *) override
a actor that draws 2D data
Definition: vtkActor2D.h:35
map scalar values into colors via a lookup table
abstract specification for renderers
Definition: vtkRenderer.h:63
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
vtkSmartPointer< vtkGlyph3D > CircleOutlineGlyph
vtkSmartPointer< vtkIconGlyphFilter > IconGlyph
vtkSmartPointer< vtkActor > OutlineActor
generate points at center of cells
Detect and break reference loops.
vtkSmartPointer< vtkTransformCoordinateSystems > IconTransform
int vtkTypeBool
Definition: vtkABI.h:64
convert a vtkGraph to vtkPolyData
Base class for graph data types.
Definition: vtkGraph.h:282
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
Make a vtkPolyData with a vertex on each point.
a simple class to control print indentation
Definition: vtkIndent.h:28
a virtual camera for 3D rendering
Definition: vtkCamera.h:41
vtkLookupTable * VertexLookupTable
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:102
vtkSmartPointer< vtkPolyDataMapper > VertexMapper
vtkSmartPointer< vtkGlyph3D > CircleGlyph
handles properties associated with a texture map
Definition: vtkTexture.h:58
virtual double * GetBounds()=0
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax, zmin,zmax).
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkLookupTable * EdgeLookupTable
vtkSmartPointer< vtkActor > EdgeActor
#define VTK_SIZEHINT(...)
transform points into different coordinate systems
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:77
map vtkPolyData to graphics primitives
a subclass of actor that always faces the camera
Definition: vtkFollower.h:33
vtkSmartPointer< vtkTexturedActor2D > IconActor
vtkSmartPointer< vtkActor > VertexActor
char * EnabledEdgesArrayName
vtkSmartPointer< vtkGraphToPolyData > GraphToPoly
static vtkAlgorithm * New()
#define VTK_MARSHALAUTO
vtkSmartPointer< vtkMapArrayValues > IconTypeToIndex
vtkSmartPointer< vtkVertexGlyphFilter > VertexGlyph
vtkSmartPointer< vtkPolyDataMapper2D > IconMapper
vtkSmartPointer< vtkPolyDataMapper > EdgeMapper
virtual void Render(vtkRenderer *ren, vtkActor *a)=0
Method initiates the mapping process.
char * VertexColorArrayNameInternal
Used to store the vertex and edge color array names.
draw vtkPolyData onto the image plane
vtkTypeBool EnableVerticesByArray