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 -------------------------------------------------------------------------*/
30 #ifndef vtkGraphMapper_h
31 #define vtkGraphMapper_h
32 
33 #include "vtkRenderingCoreModule.h" // For export macro
34 #include "vtkMapper.h"
35 
36 #include "vtkSmartPointer.h" // Required for smart pointer internal ivars.
37 
38 class vtkActor2D;
39 class vtkMapArrayValues;
40 class vtkCamera;
41 class vtkFollower;
42 class vtkGraph;
43 class vtkGlyph3D;
44 class vtkGraphToPolyData;
45 class vtkIconGlyphFilter;
46 class vtkCellCenters;
47 class vtkPolyData;
48 class vtkPolyDataMapper;
50 class vtkLookupTable;
52 class vtkTexture;
53 class vtkTexturedActor2D;
55 
56 class VTKRENDERINGCORE_EXPORT vtkGraphMapper : public vtkMapper
57 {
58 public:
59  static vtkGraphMapper *New();
60  vtkTypeMacro(vtkGraphMapper, vtkMapper);
61  void PrintSelf(ostream& os, vtkIndent indent) override;
62  void Render(vtkRenderer *ren, vtkActor *act) override;
63 
65 
68  void SetVertexColorArrayName(const char* name);
69  const char* GetVertexColorArrayName();
71 
73 
76  void SetColorVertices(bool vis);
77  bool GetColorVertices();
78  void ColorVerticesOn();
79  void ColorVerticesOff();
81 
83 
89  void SetScaledGlyphs(bool arg);
90  vtkGetMacro(ScaledGlyphs, bool);
91  vtkBooleanMacro(ScaledGlyphs, bool);
93 
95 
98  vtkSetStringMacro(ScalingArrayName);
99  vtkGetStringMacro(ScalingArrayName);
101 
103 
106  void SetEdgeVisibility(bool vis);
107  bool GetEdgeVisibility();
108  vtkBooleanMacro(EdgeVisibility, bool);
110 
112 
115  void SetEdgeColorArrayName(const char* name);
116  const char* GetEdgeColorArrayName();
118 
120 
123  void SetColorEdges(bool vis);
124  bool GetColorEdges();
125  void ColorEdgesOn();
126  void ColorEdgesOff();
128 
130 
133  vtkSetStringMacro(EnabledEdgesArrayName);
134  vtkGetStringMacro(EnabledEdgesArrayName);
136 
138 
141  vtkSetMacro(EnableEdgesByArray, vtkTypeBool);
142  vtkGetMacro(EnableEdgesByArray, vtkTypeBool);
143  vtkBooleanMacro(EnableEdgesByArray, vtkTypeBool);
145 
147 
150  vtkSetStringMacro(EnabledVerticesArrayName);
151  vtkGetStringMacro(EnabledVerticesArrayName);
153 
155 
158  vtkSetMacro(EnableVerticesByArray, vtkTypeBool);
159  vtkGetMacro(EnableVerticesByArray, vtkTypeBool);
160  vtkBooleanMacro(EnableVerticesByArray, vtkTypeBool);
162 
164 
167  void SetIconArrayName(const char* name);
168  const char* GetIconArrayName();
170 
176  void AddIconType(const char *type, int index);
177 
181  void ClearIconTypes();
182 
184 
187  void SetIconSize(int *size);
188  int *GetIconSize();
190 
195  void SetIconAlignment(int alignment);
196 
198 
201  vtkTexture *GetIconTexture();
202  void SetIconTexture(vtkTexture *texture);
204 
206 
209  void SetIconVisibility(bool vis);
210  bool GetIconVisibility();
211  vtkBooleanMacro(IconVisibility, bool);
213 
215 
218  vtkGetMacro(VertexPointSize,float);
219  void SetVertexPointSize(float size);
221 
223 
226  vtkGetMacro(EdgeLineWidth,float);
227  void SetEdgeLineWidth(float width);
229 
235  void ReleaseGraphicsResources(vtkWindow *) override;
236 
240  vtkMTimeType GetMTime() override;
241 
243 
246  void SetInputData(vtkGraph *input);
247  vtkGraph *GetInput();
249 
254  double *GetBounds() VTK_SIZEHINT(6) override;
255  void GetBounds(double* bounds) override
256  { Superclass::GetBounds(bounds); }
257 
259 
262  vtkGetObjectMacro(EdgeLookupTable, vtkLookupTable);
263  vtkGetObjectMacro(VertexLookupTable, vtkLookupTable);
265 
266 protected:
267  vtkGraphMapper();
268  ~vtkGraphMapper() override;
269 
271 
274  vtkGetStringMacro(VertexColorArrayNameInternal);
275  vtkSetStringMacro(VertexColorArrayNameInternal);
276  vtkGetStringMacro(EdgeColorArrayNameInternal);
277  vtkSetStringMacro(EdgeColorArrayNameInternal);
281 
286 
287  vtkGetStringMacro(IconArrayNameInternal);
288  vtkSetStringMacro(IconArrayNameInternal);
289  char* IconArrayNameInternal;
290 
293 
299 
304 
309 
310  // Color maps
313 
314  void ReportReferences(vtkGarbageCollector*) override;
315 
316  // see algorithm for more info
317  int FillInputPortInformation(int port, vtkInformation* info) override;
318 
319 private:
320  vtkGraphMapper(const vtkGraphMapper&) = delete;
321  void operator=(const vtkGraphMapper&) = delete;
322 
323  // Helper function
324  vtkPolyData* CreateCircle(bool filled);
325 
326  float VertexPointSize;
327  float EdgeLineWidth;
328  bool ScaledGlyphs;
329  char* ScalingArrayName;
330 };
331 
332 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:36
vtkGraphToPolyData
convert a vtkGraph to vtkPolyData
Definition: vtkGraphToPolyData.h:41
vtkGraphMapper::EnableEdgesByArray
vtkTypeBool EnableEdgesByArray
Definition: vtkGraphMapper.h:284
vtkMapper::GetMTime
vtkMTimeType GetMTime() override
Overload standard modified time function.
vtkFollower
a subclass of actor that always faces the camera
Definition: vtkFollower.h:40
vtkGraphMapper::OutlineActor
vtkSmartPointer< vtkActor > OutlineActor
Definition: vtkGraphMapper.h:307
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:45
vtkGraphMapper::VertexGlyph
vtkSmartPointer< vtkVertexGlyphFilter > VertexGlyph
Definition: vtkGraphMapper.h:295
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:311
vtkTexturedActor2D
actor that draws 2D data with texture support
Definition: vtkTexturedActor2D.h:38
vtkX3D::type
Definition: vtkX3D.h:516
vtkGraphMapper::IconActor
vtkSmartPointer< vtkTexturedActor2D > IconActor
Definition: vtkGraphMapper.h:308
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:298
vtkSmartPointer< vtkGlyph3D >
vtkGraphMapper::EnableVerticesByArray
vtkTypeBool EnableVerticesByArray
Definition: vtkGraphMapper.h:285
vtkGraphMapper::IconArrayNameInternal
char * IconArrayNameInternal
Definition: vtkGraphMapper.h:288
vtkGraphMapper::EdgeColorArrayNameInternal
char * EdgeColorArrayNameInternal
Definition: vtkGraphMapper.h:279
vtkIconGlyphFilter
Filter that generates a polydata consisting of quads with texture coordinates referring to a set of i...
Definition: vtkIconGlyphFilter.h:59
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkGraphMapper::EdgeMapper
vtkSmartPointer< vtkPolyDataMapper > EdgeMapper
Definition: vtkGraphMapper.h:300
vtkMapper.h
vtkGraphMapper::CircleGlyph
vtkSmartPointer< vtkGlyph3D > CircleGlyph
Definition: vtkGraphMapper.h:291
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:65
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:42
vtkGraphMapper::CircleOutlineGlyph
vtkSmartPointer< vtkGlyph3D > CircleOutlineGlyph
Definition: vtkGraphMapper.h:292
vtkGraphMapper
map vtkGraph and derived classes to graphics primitives
Definition: vtkGraphMapper.h:56
vtkMapper
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:80
vtkTransformCoordinateSystems
transform points into different coordinate systems
Definition: vtkTransformCoordinateSystems.h:35
vtkGraphMapper::IconGlyph
vtkSmartPointer< vtkIconGlyphFilter > IconGlyph
Definition: vtkGraphMapper.h:296
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkGraphMapper::GraphToPoly
vtkSmartPointer< vtkGraphToPolyData > GraphToPoly
Definition: vtkGraphMapper.h:294
vtkGraphMapper::VertexActor
vtkSmartPointer< vtkActor > VertexActor
Definition: vtkGraphMapper.h:306
vtkCamera
a virtual camera for 3D rendering
Definition: vtkCamera.h:44
vtkSmartPointer.h
vtkX3D::size
Definition: vtkX3D.h:253
vtkGraphMapper::IconMapper
vtkSmartPointer< vtkPolyDataMapper2D > IconMapper
Definition: vtkGraphMapper.h:303
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:108
vtkGarbageCollector
Detect and break reference loops.
Definition: vtkGarbageCollector.h:96
vtkGraphMapper::OutlineMapper
vtkSmartPointer< vtkPolyDataMapper > OutlineMapper
Definition: vtkGraphMapper.h:302
vtkGlyph3D
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:105
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:80
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:68
vtkX3D::info
Definition: vtkX3D.h:376
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkGraphMapper::EnabledVerticesArrayName
char * EnabledVerticesArrayName
Definition: vtkGraphMapper.h:283
vtkAlgorithm::ReportReferences
void ReportReferences(vtkGarbageCollector *) override
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:39
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:57
vtkGraphMapper::IconTypeToIndex
vtkSmartPointer< vtkMapArrayValues > IconTypeToIndex
Definition: vtkGraphMapper.h:297
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
vtkGraphMapper::VertexLookupTable
vtkLookupTable * VertexLookupTable
Definition: vtkGraphMapper.h:312
vtkGraphMapper::VertexColorArrayNameInternal
char * VertexColorArrayNameInternal
Definition: vtkGraphMapper.h:277
vtkGraph
Base class for graph data types.
Definition: vtkGraph.h:281
vtkCellCenters
generate points at center of cells
Definition: vtkCellCenters.h:41
vtkX3D::filled
Definition: vtkX3D.h:349
vtkGraphMapper::VertexMapper
vtkSmartPointer< vtkPolyDataMapper > VertexMapper
Definition: vtkGraphMapper.h:301
vtkX3D::index
Definition: vtkX3D.h:246
vtkVertexGlyphFilter
Make a vtkPolyData with a vertex on each point.
Definition: vtkVertexGlyphFilter.h:40
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkGraphMapper::EdgeActor
vtkSmartPointer< vtkActor > EdgeActor
Definition: vtkGraphMapper.h:305
vtkGraphMapper::EnabledEdgesArrayName
char * EnabledEdgesArrayName
Definition: vtkGraphMapper.h:282
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302