VTK
vtkScalarsToColorsPainter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkScalarsToColorsPainter.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 =========================================================================*/
28 #ifndef vtkScalarsToColorsPainter_h
29 #define vtkScalarsToColorsPainter_h
30 
31 #include "vtkRenderingOpenGLModule.h" // For export macro
32 #include "vtkPainter.h"
33 #include "vtkSmartPointer.h" // needed for vtkSmartPointer.
34 class vtkDataArray;
35 class vtkImageData;
40 class vtkDataSet;
41 class vtkScalarsToColors;
42 
43 class VTKRENDERINGOPENGL_EXPORT vtkScalarsToColorsPainter : public vtkPainter
44 {
45 public:
48  void PrintSelf(ostream& os, vtkIndent indent);
49 
59 
66 
72 
81 
89 
91 
98 
103  virtual void CreateDefaultLookupTable();
104 
109 
111 
120 
125 
139 
144 
151 
152 protected:
155 
160 
167  vtkDataArray* scalars, vtkDataSet* input);
168 
172  virtual void PrepareForRendering(vtkRenderer* renderer, vtkActor* actor);
173 
179  virtual void MapScalars(vtkDataSet* output,
180  double alpha, int multiply_with_alpha,
181  vtkDataSet* input);
182 
188 
192  void ReportReferences(vtkGarbageCollector *collector) VTK_OVERRIDE;
193 
203 
204 
208  void UpdateColorTextureMap(double alpha, int multiply_with_alpha);
209 
210  // Methods to set the ivars. These are purposefully protected.
211  // The only means of affecting these should be using the vtkInformation
212  // object.
213  vtkSetMacro(UseLookupTableScalarRange, int);
214  vtkSetVector2Macro(ScalarRange, double);
215  vtkSetMacro(ScalarMode, int);
216  vtkSetMacro(ColorMode, int);
217  vtkSetMacro(InterpolateScalarsBeforeMapping, int);
218  vtkSetMacro(ScalarVisibility, int);
219  vtkSetMacro(ScalarMaterialMode, int);
220  vtkSetMacro(ArrayAccessMode, int);
221  vtkSetMacro(ArrayComponent, int);
222  vtkSetMacro(ArrayId, int);
223  vtkSetStringMacro(ArrayName);
224  vtkSetMacro(FieldDataTupleId, vtkIdType);
225 
227 
230  int ArrayId;
231  char* ArrayName;
233 
235  // Lookup table provided via the scalars. This gets preference over the one
236  // set on the mapper by the user.
243  double LastUsedAlpha; // Essential to ensure alpha changes work correctly
244  // for composite datasets.
246  double ScalarRange[2];
249 
251 
252  // This is set when MapScalars decides to use vertex colors for atleast on
253  // dataset in the current pass.
255 
256 private:
257  vtkScalarsToColorsPainter(const vtkScalarsToColorsPainter&) VTK_DELETE_FUNCTION;
258  void operator=(const vtkScalarsToColorsPainter&) VTK_DELETE_FUNCTION;
259 
260 };
261 
262 #endif
vtkScalarsToColorsPainter::ColorMode
int ColorMode
Definition: vtkScalarsToColorsPainter.h:239
vtkScalarsToColorsPainter::CanUseTextureMapForColoring
int CanUseTextureMapForColoring(vtkDataObject *input)
Returns if we can use texture maps for scalar coloring.
vtkScalarsToColorsPainter::LOOKUP_TABLE
static vtkInformationObjectBaseKey * LOOKUP_TABLE()
Specify a lookup table for the mapper to use.
vtkInformationStringKey
Key for string values in vtkInformation.
Definition: vtkInformationStringKey.h:37
vtkScalarsToColorsPainter::ReportReferences
void ReportReferences(vtkGarbageCollector *collector) override
Take part in garbage collection.
vtkScalarsToColorsPainter::ARRAY_ACCESS_MODE
static vtkInformationIntegerKey * ARRAY_ACCESS_MODE()
Controls what data array is used to generate colors.
vtkScalarsToColorsPainter::SCALAR_RANGE
static vtkInformationDoubleVectorKey * SCALAR_RANGE()
Specify range in terms of scalar minimum and maximum (smin,smax).
vtkX3D::alpha
@ alpha
Definition: vtkX3D.h:250
vtkScalarsToColorsPainter::~vtkScalarsToColorsPainter
virtual ~vtkScalarsToColorsPainter()
vtkScalarsToColorsPainter::INTERPOLATE_SCALARS_BEFORE_MAPPING
static vtkInformationIntegerKey * INTERPOLATE_SCALARS_BEFORE_MAPPING()
By default, vertex color is used to map colors to a surface.
vtkScalarsToColorsPainter
painter that converts scalars to colors.
Definition: vtkScalarsToColorsPainter.h:44
vtkScalarsToColorsPainter::GetTextureSizeLimit
virtual vtkIdType GetTextureSizeLimit()
Return the texture size limit.
vtkIdType
int vtkIdType
Definition: vtkType.h:287
vtkScalarsToColorsPainter::UseLookupTableScalarRange
int UseLookupTableScalarRange
Definition: vtkScalarsToColorsPainter.h:248
vtkScalarsToColorsPainter::ColorTextureMap
vtkSmartPointer< vtkImageData > ColorTextureMap
Definition: vtkScalarsToColorsPainter.h:238
vtkX3D::data
@ data
Definition: vtkX3D.h:315
vtkScalarsToColorsPainter::ArrayComponent
int ArrayComponent
Definition: vtkScalarsToColorsPainter.h:229
vtkScalarsToColorsPainter::ScalarVisibility
int ScalarVisibility
Definition: vtkScalarsToColorsPainter.h:247
vtkScalarsToColorsPainter::MapScalars
virtual void MapScalars(vtkDataSet *output, double alpha, int multiply_with_alpha, vtkDataSet *input)
Generates the colors, if needed.
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:36
vtkSmartPointer< vtkScalarsToColors >
vtkScalarsToColorsPainter::ArrayAccessMode
int ArrayAccessMode
Definition: vtkScalarsToColorsPainter.h:228
vtkScalarsToColorsPainter::MapScalarsToTexture
void MapScalarsToTexture(vtkDataSet *output, vtkDataArray *scalars, vtkDataSet *input)
Create texture coordinates for the output assuming a texture for the lookuptable has already been cre...
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
vtkScalarsToColorsPainter::GetLookupTable
vtkScalarsToColors * GetLookupTable()
vtkScalarsToColorsPainter::COLOR_MODE
static vtkInformationIntegerKey * COLOR_MODE()
Control how the scalar data is mapped to colors.
vtkScalarsToColorsPainter::PrepareForRendering
virtual void PrepareForRendering(vtkRenderer *renderer, vtkActor *actor)
Called just before RenderInternal().
vtkScalarsToColorsPainter::ARRAY_NAME
static vtkInformationStringKey * ARRAY_NAME()
vtkScalarsToColorsPainter::New
static vtkScalarsToColorsPainter * New()
vtkScalarsToColorsPainter::GetPremultiplyColorsWithAlpha
virtual int GetPremultiplyColorsWithAlpha(vtkActor *actor)
For alpha blending, we sometime premultiply the colors with alpha and change the alpha blending funct...
vtkScalarsToColorsPainter::ArrayId
int ArrayId
Definition: vtkScalarsToColorsPainter.h:230
vtkScalarsToColorsPainter::ScalarMode
int ScalarMode
Definition: vtkScalarsToColorsPainter.h:241
vtkScalarsToColorsPainter::LookupTable
vtkScalarsToColors * LookupTable
Definition: vtkScalarsToColorsPainter.h:234
vtkScalarsToColorsPainter::NewClone
virtual vtkDataObject * NewClone(vtkDataObject *data)
Create a new shallow-copied clone for data with no scalars.
vtkScalarsToColorsPainter::FIELD_DATA_TUPLE_ID
static vtkInformationIntegerKey * FIELD_DATA_TUPLE_ID()
vtkScalarsToColorsPainter::vtkScalarsToColorsPainter
vtkScalarsToColorsPainter()
vtkScalarsToColorsPainter::ProcessInformation
virtual void ProcessInformation(vtkInformation *)
Called before RenderInternal() if the Information has been changed since the last time this method wa...
vtkInformationObjectBaseKey
Key for vtkObjectBase values.
Definition: vtkInformationObjectBaseKey.h:37
vtkInformationIntegerKey
Key for integer values in vtkInformation.
Definition: vtkInformationIntegerKey.h:35
vtkScalarsToColorsPainter::GetOutput
virtual vtkDataObject * GetOutput()
Subclasses need to override this to return the output of the pipeline.
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:52
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkPainter
Abstract class for drawing poly data.
Definition: vtkPainter.h:62
vtkSmartPointer.h
vtkScalarsToColorsPainter::USE_LOOKUP_TABLE_SCALAR_RANGE
static vtkInformationIntegerKey * USE_LOOKUP_TABLE_SCALAR_RANGE()
Control whether the mapper sets the lookuptable range based on its own ScalarRange,...
vtkScalarsToColorsPainter::FieldDataTupleId
vtkIdType FieldDataTupleId
Definition: vtkScalarsToColorsPainter.h:232
vtkScalarsToColorsPainter::CreateDefaultLookupTable
virtual void CreateDefaultLookupTable()
Create default lookup table.
vtkScalarsToColors
Superclass for mapping scalar values to colors.
Definition: vtkScalarsToColors.h:67
vtkPainter.h
vtkScalarsToColorsPainter::SCALAR_MODE
static vtkInformationIntegerKey * SCALAR_MODE()
Control how the painter works with scalar point data and cell attribute data.
vtkGarbageCollector
Detect and break reference loops.
Definition: vtkGarbageCollector.h:100
vtkScalarsToColorsPainter::ARRAY_COMPONENT
static vtkInformationIntegerKey * ARRAY_COMPONENT()
vtkScalarsToColorsPainter::LastUsedMultiplyWithAlpha
int LastUsedMultiplyWithAlpha
Definition: vtkScalarsToColorsPainter.h:245
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:87
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkScalarsToColorsPainter::SCALAR_MATERIAL_MODE
static vtkInformationIntegerKey * SCALAR_MATERIAL_MODE()
Set the light-model color mode.
vtkScalarsToColorsPainter::OutputUpdateTime
vtkTimeStamp OutputUpdateTime
Definition: vtkScalarsToColorsPainter.h:250
vtkInformationDoubleVectorKey
Key for double vector values.
Definition: vtkInformationDoubleVectorKey.h:35
vtkScalarsToColorsPainter::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkScalarsToColorsPainter::LastUsedAlpha
double LastUsedAlpha
Definition: vtkScalarsToColorsPainter.h:243
vtkScalarsToColorsPainter::ArrayName
char * ArrayName
Definition: vtkScalarsToColorsPainter.h:231
vtkScalarsToColorsPainter::UsingScalarColoring
int UsingScalarColoring
Definition: vtkScalarsToColorsPainter.h:254
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:64
vtkScalarsToColorsPainter::UpdateColorTextureMap
void UpdateColorTextureMap(double alpha, int multiply_with_alpha)
Should not be called if CanUseTextureMapForColoring() returns 0.
vtkScalarsToColorsPainter::InterpolateScalarsBeforeMapping
int InterpolateScalarsBeforeMapping
Definition: vtkScalarsToColorsPainter.h:240
vtkScalarsToColorsPainter::ScalarsLookupTable
vtkSmartPointer< vtkScalarsToColors > ScalarsLookupTable
Definition: vtkScalarsToColorsPainter.h:237
vtkScalarsToColorsPainter::OutputData
vtkDataObject * OutputData
Definition: vtkScalarsToColorsPainter.h:224
vtkScalarsToColorsPainter::SCALAR_VISIBILITY
static vtkInformationIntegerKey * SCALAR_VISIBILITY()
Turn on/off flag to control whether scalar data is used to color objects.
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:65
vtkScalarsToColorsPainter::ScalarMaterialMode
int ScalarMaterialMode
Definition: vtkScalarsToColorsPainter.h:242
vtkScalarsToColorsPainter::ARRAY_ID
static vtkInformationIntegerKey * ARRAY_ID()
vtkScalarsToColorsPainter::SetLookupTable
void SetLookupTable(vtkScalarsToColors *lut)