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) VTK_OVERRIDE;
49 
58  static vtkInformationIntegerKey* USE_LOOKUP_TABLE_SCALAR_RANGE();
59 
65  static vtkInformationDoubleVectorKey* SCALAR_RANGE();
66 
71  static vtkInformationIntegerKey* SCALAR_MODE();
72 
80  static vtkInformationIntegerKey* COLOR_MODE();
81 
88  static vtkInformationIntegerKey* INTERPOLATE_SCALARS_BEFORE_MAPPING();
89 
91 
94  static vtkInformationObjectBaseKey* LOOKUP_TABLE();
95  void SetLookupTable(vtkScalarsToColors *lut);
96  vtkScalarsToColors *GetLookupTable();
98 
103  virtual void CreateDefaultLookupTable();
104 
108  static vtkInformationIntegerKey* SCALAR_VISIBILITY();
109 
111 
114  static vtkInformationIntegerKey* ARRAY_ACCESS_MODE();
115  static vtkInformationIntegerKey* ARRAY_ID();
116  static vtkInformationStringKey* ARRAY_NAME();
117  static vtkInformationIntegerKey* ARRAY_COMPONENT();
118  static vtkInformationIntegerKey* FIELD_DATA_TUPLE_ID();
120 
124  static vtkInformationIntegerKey* SCALAR_MATERIAL_MODE();
125 
138  virtual int GetPremultiplyColorsWithAlpha(vtkActor* actor);
139 
143  vtkDataObject *GetOutput() VTK_OVERRIDE;
144 
150  virtual vtkIdType GetTextureSizeLimit();
151 
152 protected:
154  ~vtkScalarsToColorsPainter() VTK_OVERRIDE;
155 
159  virtual vtkDataObject* NewClone(vtkDataObject* data);
160 
166  void MapScalarsToTexture(vtkDataSet* output,
167  vtkDataArray* scalars, vtkDataSet* input);
168 
172  void PrepareForRendering(vtkRenderer* renderer, vtkActor* actor) VTK_OVERRIDE;
173 
179  virtual void MapScalars(vtkDataSet* output,
180  double alpha, int multiply_with_alpha,
181  vtkDataSet* input);
182 
187  void ProcessInformation(vtkInformation*) VTK_OVERRIDE;
188 
192  void ReportReferences(vtkGarbageCollector *collector) VTK_OVERRIDE;
193 
202  int CanUseTextureMapForColoring(vtkDataObject* input);
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 
226  vtkDataObject* OutputData;
227 
228  int ArrayAccessMode;
229  int ArrayComponent;
230  int ArrayId;
231  char* ArrayName;
232  vtkIdType FieldDataTupleId;
233 
234  vtkScalarsToColors *LookupTable;
235  // Lookup table provided via the scalars. This gets preference over the one
236  // set on the mapper by the user.
237  vtkSmartPointer<vtkScalarsToColors> ScalarsLookupTable;
238  vtkSmartPointer<vtkImageData> ColorTextureMap;
239  int ColorMode;
240  int InterpolateScalarsBeforeMapping;
241  int ScalarMode;
242  int ScalarMaterialMode;
243  double LastUsedAlpha; // Essential to ensure alpha changes work correctly
244  // for composite datasets.
245  int LastUsedMultiplyWithAlpha;
246  double ScalarRange[2];
247  int ScalarVisibility;
248  int UseLookupTableScalarRange;
249 
250  vtkTimeStamp OutputUpdateTime;
251 
252  // This is set when MapScalars decides to use vertex colors for atleast on
253  // dataset in the current pass.
254  int UsingScalarColoring;
255 
256 private:
257  vtkScalarsToColorsPainter(const vtkScalarsToColorsPainter&) VTK_DELETE_FUNCTION;
258  void operator=(const vtkScalarsToColorsPainter&) VTK_DELETE_FUNCTION;
259 
260 };
261 
262 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
record modification and/or execution time
Definition: vtkTimeStamp.h:35
virtual vtkDataObject * GetOutput()
Get the output data object from this painter.
Definition: vtkPainter.h:174
abstract specification for renderers
Definition: vtkRenderer.h:63
Hold a reference to a vtkObjectBase instance.
int vtkIdType
Definition: vtkType.h:345
Key for string values in vtkInformation.
Detect and break reference loops.
Superclass for mapping scalar values to colors.
Key for double vector values.
a simple class to control print indentation
Definition: vtkIndent.h:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
Key for integer values in vtkInformation.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
Key for vtkObjectBase values.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
painter that converts scalars to colors.
Abstract class for drawing poly data.
Definition: vtkPainter.h:61
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
general representation of visualization data
Definition: vtkDataObject.h:64
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.