VTK
vtkGraphMapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGraphMapper.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 -------------------------------------------------------------------------*/
33 #ifndef vtkGraphMapper_h
34 #define vtkGraphMapper_h
35 
36 #include "vtkRenderingCoreModule.h" // For export macro
37 #include "vtkMapper.h"
38 
39 #include "vtkSmartPointer.h" // Required for smart pointer internal ivars.
40 
41 class vtkActor2D;
42 class vtkMapArrayValues;
43 class vtkCamera;
44 class vtkFollower;
45 class vtkGraph;
46 class vtkGlyph3D;
47 class vtkGraphToPolyData;
48 class vtkIconGlyphFilter;
49 class vtkCellCenters;
50 class vtkPolyData;
51 class vtkPolyDataMapper;
53 class vtkLookupTable;
55 class vtkTexture;
56 class vtkTexturedActor2D;
58 
59 class VTKRENDERINGCORE_EXPORT vtkGraphMapper : public vtkMapper
60 {
61 public:
62  static vtkGraphMapper *New();
63  vtkTypeMacro(vtkGraphMapper, vtkMapper);
64  void PrintSelf(ostream& os, vtkIndent indent) override;
65  void Render(vtkRenderer *ren, vtkActor *act) override;
66 
68 
71  void SetVertexColorArrayName(const char* name);
72  const char* GetVertexColorArrayName();
74 
76 
79  void SetColorVertices(bool vis);
80  bool GetColorVertices();
81  void ColorVerticesOn();
82  void ColorVerticesOff();
84 
86 
92  void SetScaledGlyphs(bool arg);
93  vtkGetMacro(ScaledGlyphs, bool);
94  vtkBooleanMacro(ScaledGlyphs, bool);
96 
98 
101  vtkSetStringMacro(ScalingArrayName);
102  vtkGetStringMacro(ScalingArrayName);
104 
106 
109  void SetEdgeVisibility(bool vis);
110  bool GetEdgeVisibility();
111  vtkBooleanMacro(EdgeVisibility, bool);
113 
115 
118  void SetEdgeColorArrayName(const char* name);
119  const char* GetEdgeColorArrayName();
121 
123 
126  void SetColorEdges(bool vis);
127  bool GetColorEdges();
128  void ColorEdgesOn();
129  void ColorEdgesOff();
131 
133 
136  vtkSetStringMacro(EnabledEdgesArrayName);
137  vtkGetStringMacro(EnabledEdgesArrayName);
139 
141 
144  vtkSetMacro(EnableEdgesByArray, vtkTypeBool);
145  vtkGetMacro(EnableEdgesByArray, vtkTypeBool);
146  vtkBooleanMacro(EnableEdgesByArray, vtkTypeBool);
148 
150 
153  vtkSetStringMacro(EnabledVerticesArrayName);
154  vtkGetStringMacro(EnabledVerticesArrayName);
156 
158 
161  vtkSetMacro(EnableVerticesByArray, vtkTypeBool);
162  vtkGetMacro(EnableVerticesByArray, vtkTypeBool);
163  vtkBooleanMacro(EnableVerticesByArray, vtkTypeBool);
165 
167 
170  void SetIconArrayName(const char* name);
171  const char* GetIconArrayName();
173 
179  void AddIconType(const char *type, int index);
180 
184  void ClearIconTypes();
185 
187 
190  void SetIconSize(int *size);
191  int *GetIconSize();
193 
198  void SetIconAlignment(int alignment);
199 
201 
204  vtkTexture *GetIconTexture();
205  void SetIconTexture(vtkTexture *texture);
207 
209 
212  void SetIconVisibility(bool vis);
213  bool GetIconVisibility();
214  vtkBooleanMacro(IconVisibility, bool);
216 
218 
221  vtkGetMacro(VertexPointSize,float);
222  void SetVertexPointSize(float size);
224 
226 
229  vtkGetMacro(EdgeLineWidth,float);
230  void SetEdgeLineWidth(float width);
232 
238  void ReleaseGraphicsResources(vtkWindow *) override;
239 
243  vtkMTimeType GetMTime() override;
244 
246 
249  void SetInputData(vtkGraph *input);
250  vtkGraph *GetInput();
252 
257  double *GetBounds() VTK_SIZEHINT(6) override;
258  void GetBounds(double* bounds) override
259  { Superclass::GetBounds(bounds); }
260 
262 
265  vtkGetObjectMacro(EdgeLookupTable, vtkLookupTable);
266  vtkGetObjectMacro(VertexLookupTable, vtkLookupTable);
268 
269 protected:
270  vtkGraphMapper();
271  ~vtkGraphMapper() override;
272 
274 
277  vtkGetStringMacro(VertexColorArrayNameInternal);
278  vtkSetStringMacro(VertexColorArrayNameInternal);
279  vtkGetStringMacro(EdgeColorArrayNameInternal);
280  vtkSetStringMacro(EdgeColorArrayNameInternal);
284 
289 
290  vtkGetStringMacro(IconArrayNameInternal);
291  vtkSetStringMacro(IconArrayNameInternal);
292  char* IconArrayNameInternal;
293 
296 
302 
307 
312 
313  // Color maps
316 
317  void ReportReferences(vtkGarbageCollector*) override;
318 
319  // see algorithm for more info
320  int FillInputPortInformation(int port, vtkInformation* info) override;
321 
322 private:
323  vtkGraphMapper(const vtkGraphMapper&) = delete;
324  void operator=(const vtkGraphMapper&) = delete;
325 
326  // Helper function
327  vtkPolyData* CreateCircle(bool filled);
328 
329  float VertexPointSize;
330  float EdgeLineWidth;
331  bool ScaledGlyphs;
332  char* ScalingArrayName;
333 };
334 
335 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:42
vtkGraphToPolyData
convert a vtkGraph to vtkPolyData
Definition: vtkGraphToPolyData.h:47
vtkGraphMapper::EnableEdgesByArray
vtkTypeBool EnableEdgesByArray
Definition: vtkGraphMapper.h:287
vtkMapper::GetMTime
vtkMTimeType GetMTime() override
Overload standard modified time function.
vtkFollower
a subclass of actor that always faces the camera
Definition: vtkFollower.h:46
vtkGraphMapper::OutlineActor
vtkSmartPointer< vtkActor > OutlineActor
Definition: vtkGraphMapper.h:310
vtkMapper::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkPolyDataMapper2D
draw vtkPolyData onto the image plane
Definition: vtkPolyDataMapper2D.h:51
vtkGraphMapper::VertexGlyph
vtkSmartPointer< vtkVertexGlyphFilter > VertexGlyph
Definition: vtkGraphMapper.h:298
vtkAbstractMapper3D::GetBounds
virtual double * GetBounds()=0
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
vtkGraphMapper::EdgeLookupTable
vtkLookupTable * EdgeLookupTable
Definition: vtkGraphMapper.h:314
vtkTexturedActor2D
actor that draws 2D data with texture support
Definition: vtkTexturedActor2D.h:41
vtkX3D::type
Definition: vtkX3D.h:516
vtkGraphMapper::IconActor
vtkSmartPointer< vtkTexturedActor2D > IconActor
Definition: vtkGraphMapper.h:311
vtkAlgorithm::FillInputPortInformation
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
vtkGraphMapper::IconTransform
vtkSmartPointer< vtkTransformCoordinateSystems > IconTransform
Definition: vtkGraphMapper.h:301
vtkSmartPointer< vtkGlyph3D >
vtkGraphMapper::EnableVerticesByArray
vtkTypeBool EnableVerticesByArray
Definition: vtkGraphMapper.h:288
vtkGraphMapper::IconArrayNameInternal
char * IconArrayNameInternal
Definition: vtkGraphMapper.h:291
vtkGraphMapper::EdgeColorArrayNameInternal
char * EdgeColorArrayNameInternal
Definition: vtkGraphMapper.h:282
vtkIconGlyphFilter
Filter that generates a polydata consisting of quads with texture coordinates referring to a set of i...
Definition: vtkIconGlyphFilter.h:62
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkGraphMapper::EdgeMapper
vtkSmartPointer< vtkPolyDataMapper > EdgeMapper
Definition: vtkGraphMapper.h:303
vtkMapper.h
vtkGraphMapper::CircleGlyph
vtkSmartPointer< vtkGlyph3D > CircleGlyph
Definition: vtkGraphMapper.h:294
vtkX3D::port
Definition: vtkX3D.h:447
vtkMapper::Render
virtual void Render(vtkRenderer *ren, vtkActor *a)=0
Method initiates the mapping process.
vtkMapArrayValues
Map values in an input array to different values in an output array of (possibly) different type.
Definition: vtkMapArrayValues.h:48
vtkTexture
handles properties associated with a texture map
Definition: vtkTexture.h:71
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:42
vtkGraphMapper::CircleOutlineGlyph
vtkSmartPointer< vtkGlyph3D > CircleOutlineGlyph
Definition: vtkGraphMapper.h:295
vtkGraphMapper
map vtkGraph and derived classes to graphics primitives
Definition: vtkGraphMapper.h:59
vtkMapper
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:86
vtkTransformCoordinateSystems
transform points into different coordinate systems
Definition: vtkTransformCoordinateSystems.h:38
vtkGraphMapper::IconGlyph
vtkSmartPointer< vtkIconGlyphFilter > IconGlyph
Definition: vtkGraphMapper.h:299
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkGraphMapper::GraphToPoly
vtkSmartPointer< vtkGraphToPolyData > GraphToPoly
Definition: vtkGraphMapper.h:297
vtkGraphMapper::VertexActor
vtkSmartPointer< vtkActor > VertexActor
Definition: vtkGraphMapper.h:309
vtkCamera
a virtual camera for 3D rendering
Definition: vtkCamera.h:50
vtkSmartPointer.h
vtkX3D::size
Definition: vtkX3D.h:253
vtkGraphMapper::IconMapper
vtkSmartPointer< vtkPolyDataMapper2D > IconMapper
Definition: vtkGraphMapper.h:306
vtkMapper::GetInput
vtkDataSet * GetInput()
Get the input as a vtkDataSet.
vtkX3D::name
Definition: vtkX3D.h:219
vtkMapper::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this mapper.
Definition: vtkMapper.h:114
vtkGarbageCollector
Detect and break reference loops.
Definition: vtkGarbageCollector.h:99
vtkGraphMapper::OutlineMapper
vtkSmartPointer< vtkPolyDataMapper > OutlineMapper
Definition: vtkGraphMapper.h:305
vtkGlyph3D
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:111
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkMapper::GetBounds
double * GetBounds() override
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
vtkLookupTable
map scalar values into colors via a lookup table
Definition: vtkLookupTable.h:74
vtkX3D::info
Definition: vtkX3D.h:376
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkGraphMapper::EnabledVerticesArrayName
char * EnabledVerticesArrayName
Definition: vtkGraphMapper.h:286
vtkAlgorithm::ReportReferences
void ReportReferences(vtkGarbageCollector *) override
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:45
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkGraphMapper::IconTypeToIndex
vtkSmartPointer< vtkMapArrayValues > IconTypeToIndex
Definition: vtkGraphMapper.h:300
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkGraphMapper::VertexLookupTable
vtkLookupTable * VertexLookupTable
Definition: vtkGraphMapper.h:315
vtkGraphMapper::VertexColorArrayNameInternal
char * VertexColorArrayNameInternal
Definition: vtkGraphMapper.h:280
vtkGraph
Base class for graph data types.
Definition: vtkGraph.h:287
vtkCellCenters
generate points at center of cells
Definition: vtkCellCenters.h:47
vtkX3D::filled
Definition: vtkX3D.h:349
vtkGraphMapper::VertexMapper
vtkSmartPointer< vtkPolyDataMapper > VertexMapper
Definition: vtkGraphMapper.h:304
vtkX3D::index
Definition: vtkX3D.h:246
vtkVertexGlyphFilter
Make a vtkPolyData with a vertex on each point.
Definition: vtkVertexGlyphFilter.h:43
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkGraphMapper::EdgeActor
vtkSmartPointer< vtkActor > EdgeActor
Definition: vtkGraphMapper.h:308
vtkGraphMapper::EnabledEdgesArrayName
char * EnabledEdgesArrayName
Definition: vtkGraphMapper.h:285
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302