VTK
vtkMapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMapper.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 =========================================================================*/
60 #ifndef vtkMapper_h
61 #define vtkMapper_h
62 
63 #include "vtkRenderingCoreModule.h" // For export macro
64 #include "vtkAbstractMapper3D.h"
65 #include "vtkSystemIncludes.h" // For VTK_COLOR_MODE_DEFAULT and _MAP_SCALARS
66 #include "vtkSmartPointer.h" // needed for vtkSmartPointer.
67 
68 #define VTK_RESOLVE_OFF 0
69 #define VTK_RESOLVE_POLYGON_OFFSET 1
70 #define VTK_RESOLVE_SHIFT_ZBUFFER 2
71 
72 #define VTK_GET_ARRAY_BY_ID 0
73 #define VTK_GET_ARRAY_BY_NAME 1
74 
75 #define VTK_MATERIALMODE_DEFAULT 0
76 #define VTK_MATERIALMODE_AMBIENT 1
77 #define VTK_MATERIALMODE_DIFFUSE 2
78 #define VTK_MATERIALMODE_AMBIENT_AND_DIFFUSE 3
79 
80 class vtkWindow;
81 class vtkRenderer;
82 class vtkActor;
83 class vtkDataSet;
84 class vtkFloatArray;
85 class vtkImageData;
86 class vtkScalarsToColors;
88 
90 {
91 public:
93  void PrintSelf(ostream& os, vtkIndent indent);
94 
97 
100  unsigned long GetMTime();
101 
104  virtual void Render(vtkRenderer *ren, vtkActor *a) = 0;
105 
110 
112 
116 
119  virtual void CreateDefaultLookupTable();
120 
122 
124  vtkSetMacro(ScalarVisibility, int);
125  vtkGetMacro(ScalarVisibility, int);
126  vtkBooleanMacro(ScalarVisibility, int);
128 
130 
134  vtkSetMacro(Static, int);
135  vtkGetMacro(Static, int);
136  vtkBooleanMacro(Static, int);
138 
140 
149  vtkSetMacro(ColorMode, int);
150  vtkGetMacro(ColorMode, int);
152  { this->SetColorMode(VTK_COLOR_MODE_DEFAULT); }
154  { this->SetColorMode(VTK_COLOR_MODE_MAP_SCALARS); }
156  { this->SetColorMode(VTK_COLOR_MODE_DIRECT_SCALARS); }
158 
160  const char *GetColorModeAsString();
161 
163 
166  vtkSetMacro(InterpolateScalarsBeforeMapping, int);
167  vtkGetMacro(InterpolateScalarsBeforeMapping, int);
168  vtkBooleanMacro(InterpolateScalarsBeforeMapping, int);
170 
172 
178  vtkSetMacro(UseLookupTableScalarRange, int);
179  vtkGetMacro(UseLookupTableScalarRange, int);
180  vtkBooleanMacro(UseLookupTableScalarRange, int);
182 
184 
187  vtkSetVector2Macro(ScalarRange, double);
188  vtkGetVectorMacro(ScalarRange, double, 2);
190 
192 
197  vtkSetMacro(ImmediateModeRendering, int);
198  vtkGetMacro(ImmediateModeRendering, int);
199  vtkBooleanMacro(ImmediateModeRendering, int);
201 
203 
215 
216  //BTX
218 
225  vtkGetMacro(ForceCompileOnly, int);
227  //ETX
229 
241  // When ScalarMode is set to use Field Data (ScalarModeToFieldData),
242  // you must call SelectColorArray to choose the field data array to
243  // be used to color cells. In this mode, the default behavior is to
244  // treat the field data tuples as being associated with cells. If
245  // the poly data contains triangle strips, the array is expected to
246  // contain the cell data for each mini-cell formed by any triangle
247  // strips in the poly data as opposed to treating them as a single
248  // tuple that applies to the entire strip. This mode can also be
249  // used to color the entire poly data by a single color obtained by
250  // mapping the tuple at a given index in the field data array
251  // through the color map. Use SetFieldDataTupleId() to specify
252  // the tuple index.
253  vtkSetMacro(ScalarMode, int);
254  vtkGetMacro(ScalarMode, int);
256  { this->SetScalarMode(VTK_SCALAR_MODE_DEFAULT); }
258  { this->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_DATA); }
260  { this->SetScalarMode(VTK_SCALAR_MODE_USE_CELL_DATA); }
262  { this->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_FIELD_DATA); }
264  { this->SetScalarMode(VTK_SCALAR_MODE_USE_CELL_FIELD_DATA); }
266  { this->SetScalarMode(VTK_SCALAR_MODE_USE_FIELD_DATA); }
267 
269 
272  void SelectColorArray(int arrayNum);
273  void SelectColorArray(const char* arrayName);
275 
276 
277  // When ScalarMode is set to UseFieldData, set the index of the
278  // tuple by which to color the entire data set. By default, the
279  // index is -1, which means to treat the field data array selected
280  // with SelectColorArray as having a scalar value for each cell.
281  // Indices of 0 or higher mean to use the tuple at the given index
282  // for coloring the entire data set.
283  vtkSetMacro(FieldDataTupleId, vtkIdType);
284  vtkGetMacro(FieldDataTupleId, vtkIdType);
285 
287 
289  void ColorByArrayComponent(int arrayNum, int component);
290  void ColorByArrayComponent(const char* arrayName, int component);
292 
294 
295  char* GetArrayName() { return this->ArrayName; }
296  int GetArrayId() { return this->ArrayId; }
297  int GetArrayAccessMode() { return this->ArrayAccessMode; }
298  int GetArrayComponent() { return this->ArrayComponent; }
300 
302  const char *GetScalarModeAsString();
303 
305 
319  { SetResolveCoincidentTopology(VTK_RESOLVE_OFF) ;}
321  { SetResolveCoincidentTopology(VTK_RESOLVE_POLYGON_OFFSET); }
323  { SetResolveCoincidentTopology(VTK_RESOLVE_SHIFT_ZBUFFER); }
325 
327 
331  double factor, double units);
333  double& factor, double& units);
335 
337 
345 
347 
352 
354 
356  virtual double *GetBounds();
357  virtual void GetBounds(double bounds[6])
358  { this->vtkAbstractMapper3D::GetBounds(bounds); }
360 
362 
365  void SetRenderTime(double time) {this->RenderTime = time;}
366  vtkGetMacro(RenderTime, double);
368 
369  //BTX
371 
374  //ETX
376 
378 
383  { return this->GetInput(); }
385 
387 
394  double alpha);
396 
398 
399  vtkSetMacro(ScalarMaterialMode,int);
400  vtkGetMacro(ScalarMaterialMode,int);
402  { this->SetScalarMaterialMode(VTK_MATERIALMODE_DEFAULT); }
404  { this->SetScalarMaterialMode(VTK_MATERIALMODE_AMBIENT); }
406  { this->SetScalarMaterialMode(VTK_MATERIALMODE_DIFFUSE); }
408  { this->SetScalarMaterialMode(VTK_MATERIALMODE_AMBIENT_AND_DIFFUSE); }
410 
413 
415 
422  virtual bool GetIsOpaque()
423  { return true; }
425 
427 
431  virtual bool GetSupportsSelection()
432  { return false; }
434 
442 
443 protected:
446 
448 
449  // Use texture coordinates for coloring.
451  // Coordinate for each point.
453  // 1D ColorMap used for the texture image.
456 
460  double ScalarRange[2];
466 
467  double RenderTime;
468 
469  // for coloring by a component of a field data array
470  int ArrayId;
471  char ArrayName[256];
474 
475  // If coloring by field data, which tuple to use to color the entire
476  // data set. If -1, treat array values as cell data.
478 
479  int Static;
480 
482 
483 private:
484  vtkMapper(const vtkMapper&); // Not implemented.
485  void operator=(const vtkMapper&); // Not implemented.
486 };
487 
488 #endif
vtkMapper::SetResolveCoincidentTopologyToOff
static void SetResolveCoincidentTopologyToOff()
Definition: vtkMapper.h:318
vtkMapper::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
Definition: vtkMapper.h:109
VTK_SCALAR_MODE_DEFAULT
#define VTK_SCALAR_MODE_DEFAULT
Definition: vtkAbstractMapper.h:33
vtkMapper::SetScalarModeToUsePointData
void SetScalarModeToUsePointData()
Definition: vtkMapper.h:257
vtkMapper::UseLookupTableScalarRange
int UseLookupTableScalarRange
Definition: vtkMapper.h:461
VTK_SCALAR_MODE_USE_CELL_FIELD_DATA
#define VTK_SCALAR_MODE_USE_CELL_FIELD_DATA
Definition: vtkAbstractMapper.h:37
vtkMapper::ColorByArrayComponent
void ColorByArrayComponent(const char *arrayName, int component)
VTK_SCALAR_MODE_USE_POINT_DATA
#define VTK_SCALAR_MODE_USE_POINT_DATA
Definition: vtkAbstractMapper.h:34
VTK_COLOR_MODE_MAP_SCALARS
#define VTK_COLOR_MODE_MAP_SCALARS
Definition: vtkSystemIncludes.h:99
vtkMapper::GetScalarMaterialModeAsString
const char * GetScalarMaterialModeAsString()
vtkMapper::GetColorModeAsString
const char * GetColorModeAsString()
vtkMapper::Static
int Static
Definition: vtkMapper.h:479
vtkSetVector2Macro
#define vtkSetVector2Macro(name, type)
Definition: vtkSetGet.h:254
vtkMapper::SetResolveCoincidentTopologyToShiftZBuffer
static void SetResolveCoincidentTopologyToShiftZBuffer()
Definition: vtkMapper.h:322
vtkMapper::SetResolveCoincidentTopology
static void SetResolveCoincidentTopology(int val)
vtkMapper::MapScalars
virtual vtkUnsignedCharArray * MapScalars(vtkDataSet *input, double alpha)
vtkX3D::component
@ component
Definition: vtkX3D.h:175
vtkMapper::SetColorModeToDefault
void SetColorModeToDefault()
Definition: vtkMapper.h:151
VTK_SCALAR_MODE_USE_POINT_FIELD_DATA
#define VTK_SCALAR_MODE_USE_POINT_FIELD_DATA
Definition: vtkAbstractMapper.h:36
vtkAbstractMapper3D::GetBounds
virtual double * GetBounds()=0
vtkgl::m
const GLfloat * m
Definition: vtkgl.h:18169
vtkMapper::GetScalarModeAsString
const char * GetScalarModeAsString()
vtkMapper::GetMTime
unsigned long GetMTime()
vtkMapper::SetGlobalImmediateModeRendering
static void SetGlobalImmediateModeRendering(int val)
vtkIdType
int vtkIdType
Definition: vtkType.h:275
vtkMapper::ArrayId
int ArrayId
Definition: vtkMapper.h:470
VTK_RESOLVE_POLYGON_OFFSET
#define VTK_RESOLVE_POLYGON_OFFSET
Definition: vtkMapper.h:69
vtkMapper::SetLookupTable
void SetLookupTable(vtkScalarsToColors *lut)
vtkFloatArray
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:49
vtkMapper::GetResolveCoincidentTopology
static int GetResolveCoincidentTopology()
VTK_MATERIALMODE_DIFFUSE
#define VTK_MATERIALMODE_DIFFUSE
Definition: vtkMapper.h:77
vtkMapper::GetLookupTable
vtkScalarsToColors * GetLookupTable()
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:49
vtkMapper::ColorByArrayComponent
void ColorByArrayComponent(int arrayNum, int component)
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkMapper::ShallowCopy
void ShallowCopy(vtkAbstractMapper *m)
vtkMapper::GlobalImmediateModeRenderingOn
static void GlobalImmediateModeRenderingOn()
Definition: vtkMapper.h:209
vtkMapper::SetResolveCoincidentTopologyPolygonOffsetFaces
static void SetResolveCoincidentTopologyPolygonOffsetFaces(int faces)
vtkMapper::ColorTextureMap
vtkImageData * ColorTextureMap
Definition: vtkMapper.h:454
vtkMapper::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters
static void GetResolveCoincidentTopologyPolygonOffsetParameters(double &factor, double &units)
vtkMapper::MapScalars
virtual vtkUnsignedCharArray * MapScalars(double alpha)
vtkMapper::CanUseTextureMapForColoring
virtual int CanUseTextureMapForColoring(vtkDataObject *input)
vtkX3D::time
@ time
Definition: vtkX3D.h:497
vtkgl::input
GLenum GLenum GLenum input
Definition: vtkgl.h:15941
vtkMapper::SetRenderTime
void SetRenderTime(double time)
Definition: vtkMapper.h:365
vtkMapper::SetScalarMaterialModeToAmbientAndDiffuse
void SetScalarMaterialModeToAmbientAndDiffuse()
Definition: vtkMapper.h:407
vtkMapper::GetArrayId
int GetArrayId()
Definition: vtkMapper.h:296
vtkGetVectorMacro
#define vtkGetVectorMacro(name, type, count)
Definition: vtkSetGet.h:424
vtkMapper::GetArrayAccessMode
int GetArrayAccessMode()
Definition: vtkMapper.h:297
vtkMapper::SelectColorArray
void SelectColorArray(int arrayNum)
vtkMapper::Colors
vtkUnsignedCharArray * Colors
Definition: vtkMapper.h:447
vtkAbstractMapper3D.h
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkMapper::SetScalarMaterialModeToAmbient
void SetScalarMaterialModeToAmbient()
Definition: vtkMapper.h:403
vtkMapper::SetScalarModeToDefault
void SetScalarModeToDefault()
Definition: vtkMapper.h:255
vtkMapper::SetScalarMaterialModeToDefault
void SetScalarMaterialModeToDefault()
Definition: vtkMapper.h:401
vtkgl::val
GLuint GLfloat * val
Definition: vtkgl.h:13789
vtkMapper::SetScalarModeToUseCellData
void SetScalarModeToUseCellData()
Definition: vtkMapper.h:259
vtkMapper::GetArrayComponent
int GetArrayComponent()
Definition: vtkMapper.h:298
vtkMapper::Render
virtual void Render(vtkRenderer *ren, vtkActor *a)=0
VTK_SCALAR_MODE_USE_CELL_DATA
#define VTK_SCALAR_MODE_USE_CELL_DATA
Definition: vtkAbstractMapper.h:35
vtkMapper::ImmediateModeRendering
int ImmediateModeRendering
Definition: vtkMapper.h:462
vtkgl::value
GLsizei const GLfloat * value
Definition: vtkgl.h:12021
vtkMapper::SetScalarMaterialModeToDiffuse
void SetScalarMaterialModeToDiffuse()
Definition: vtkMapper.h:405
vtkMapper::BuildTime
vtkTimeStamp BuildTime
Definition: vtkMapper.h:459
vtkMapper::ArrayAccessMode
int ArrayAccessMode
Definition: vtkMapper.h:473
vtkMapper
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:90
vtkMapper::ScalarVisibility
int ScalarVisibility
Definition: vtkMapper.h:458
VTK_RESOLVE_OFF
#define VTK_RESOLVE_OFF
Definition: vtkMapper.h:68
VTK_SCALAR_MODE_USE_FIELD_DATA
#define VTK_SCALAR_MODE_USE_FIELD_DATA
Definition: vtkAbstractMapper.h:38
vtkMapper::FieldDataTupleId
vtkIdType FieldDataTupleId
Definition: vtkMapper.h:477
vtkMapper::ColorCoordinates
vtkFloatArray * ColorCoordinates
Definition: vtkMapper.h:452
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkRenderingCoreModule.h
vtkMapper::InterpolateScalarsBeforeMapping
int InterpolateScalarsBeforeMapping
Definition: vtkMapper.h:450
vtkMapper::CreateDefaultLookupTable
virtual void CreateDefaultLookupTable()
vtkSmartPointer.h
vtkMapper::GlobalImmediateModeRenderingOff
static void GlobalImmediateModeRenderingOff()
Definition: vtkMapper.h:211
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkMapper::RenderTime
double RenderTime
Definition: vtkMapper.h:467
vtkMapper::ScalarMaterialMode
int ScalarMaterialMode
Definition: vtkMapper.h:465
vtkScalarsToColors
Superclass for mapping scalar values to colors.
Definition: vtkScalarsToColors.h:63
vtkMapper::SetScalarModeToUseFieldData
void SetScalarModeToUseFieldData()
Definition: vtkMapper.h:265
vtkMapper::GetInput
vtkDataSet * GetInput()
vtkgl::a
GLboolean GLboolean GLboolean GLboolean a
Definition: vtkgl.h:12312
vtkMapper::GetInputAsDataSet
vtkDataSet * GetInputAsDataSet()
Definition: vtkMapper.h:382
vtkMapper::vtkMapper
vtkMapper()
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkAbstractArray
Abstract superclass for all arrays.
Definition: vtkAbstractArray.h:65
vtkMapper::ColorMode
int ColorMode
Definition: vtkMapper.h:463
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
vtkMapper::GetSupportsSelection
virtual bool GetSupportsSelection()
Definition: vtkMapper.h:431
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkMapper::SetColorModeToDirectScalars
void SetColorModeToDirectScalars()
Definition: vtkMapper.h:155
VTK_COLOR_MODE_DEFAULT
#define VTK_COLOR_MODE_DEFAULT
Definition: vtkSystemIncludes.h:98
vtkgl::alpha
GLclampf GLclampf GLclampf alpha
Definition: vtkgl.h:11313
vtkMapper::MapScalarsToTexture
void MapScalarsToTexture(vtkAbstractArray *scalars, double alpha)
vtkAbstractMapper3D
abstract class specifies interface to map 3D data
Definition: vtkAbstractMapper3D.h:42
vtkMapper::SetColorModeToMapScalars
void SetColorModeToMapScalars()
Definition: vtkMapper.h:153
VTK_MATERIALMODE_DEFAULT
#define VTK_MATERIALMODE_DEFAULT
Definition: vtkMapper.h:75
vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters
static void SetResolveCoincidentTopologyPolygonOffsetParameters(double factor, double units)
vtkMapper::SetResolveCoincidentTopologyZShift
static void SetResolveCoincidentTopologyZShift(double val)
vtkMapper::GetIsOpaque
virtual bool GetIsOpaque()
Definition: vtkMapper.h:422
vtkMapper::GetResolveCoincidentTopologyZShift
static double GetResolveCoincidentTopologyZShift()
vtkMapper::SetResolveCoincidentTopologyToPolygonOffset
static void SetResolveCoincidentTopologyToPolygonOffset()
Definition: vtkMapper.h:320
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:64
VTK_RESOLVE_SHIFT_ZBUFFER
#define VTK_RESOLVE_SHIFT_ZBUFFER
Definition: vtkMapper.h:70
vtkMapper::LookupTable
vtkScalarsToColors * LookupTable
Definition: vtkMapper.h:457
VTK_COLOR_MODE_DIRECT_SCALARS
#define VTK_COLOR_MODE_DIRECT_SCALARS
Definition: vtkSystemIncludes.h:100
VTK_MATERIALMODE_AMBIENT_AND_DIFFUSE
#define VTK_MATERIALMODE_AMBIENT_AND_DIFFUSE
Definition: vtkMapper.h:78
vtkMapper::SetResolveCoincidentTopologyToDefault
static void SetResolveCoincidentTopologyToDefault()
vtkMapper::SelectColorArray
void SelectColorArray(const char *arrayName)
vtkMapper::GetBounds
virtual void GetBounds(double bounds[6])
Definition: vtkMapper.h:357
vtkMapper::GetResolveCoincidentTopologyPolygonOffsetFaces
static int GetResolveCoincidentTopologyPolygonOffsetFaces()
VTKRENDERINGCORE_EXPORT
#define VTKRENDERINGCORE_EXPORT
Definition: vtkRenderingCoreModule.h:15
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:65
VTK_MATERIALMODE_AMBIENT
#define VTK_MATERIALMODE_AMBIENT
Definition: vtkMapper.h:76
vtkMapper::GetBounds
virtual double * GetBounds()
vtkMapper::ForceCompileOnly
int ForceCompileOnly
Definition: vtkMapper.h:481
vtkMapper::GetGlobalImmediateModeRendering
static int GetGlobalImmediateModeRendering()
vtkMapper::SetScalarModeToUsePointFieldData
void SetScalarModeToUsePointFieldData()
Definition: vtkMapper.h:261
vtkMapper::ArrayComponent
int ArrayComponent
Definition: vtkMapper.h:472
vtkSystemIncludes.h
vtkAbstractMapper
abstract class specifies interface to map data
Definition: vtkAbstractMapper.h:52
vtkMapper::SetForceCompileOnly
void SetForceCompileOnly(int value)
vtkMapper::~vtkMapper
~vtkMapper()
vtkMapper::ScalarMode
int ScalarMode
Definition: vtkMapper.h:464
vtkMapper::SetScalarModeToUseCellFieldData
void SetScalarModeToUseCellFieldData()
Definition: vtkMapper.h:263
vtkMapper::GetArrayName
char * GetArrayName()
Definition: vtkMapper.h:295