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) 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 
133  virtual int GetPremultiplyColorsWithAlpha(vtkActor* actor);
134 
138  vtkDataObject *GetOutput() override;
139 
145  virtual vtkIdType GetTextureSizeLimit();
146 
147 protected:
149  ~vtkScalarsToColorsPainter() override;
150 
154  virtual vtkDataObject* NewClone(vtkDataObject* data);
155 
161  void MapScalarsToTexture(vtkDataSet* output,
162  vtkDataArray* scalars, vtkDataSet* input);
163 
167  void PrepareForRendering(vtkRenderer* renderer, vtkActor* actor) override;
168 
174  virtual void MapScalars(vtkDataSet* output,
175  double alpha, int multiply_with_alpha,
176  vtkDataSet* input);
177 
182  void ProcessInformation(vtkInformation*) override;
183 
187  void ReportReferences(vtkGarbageCollector *collector) override;
188 
197  int CanUseTextureMapForColoring(vtkDataObject* input);
198 
199 
203  void UpdateColorTextureMap(double alpha, int multiply_with_alpha);
204 
205  // Methods to set the ivars. These are purposefully protected.
206  // The only means of affecting these should be using the vtkInformation
207  // object.
208  vtkSetMacro(UseLookupTableScalarRange, int);
209  vtkSetVector2Macro(ScalarRange, double);
210  vtkSetMacro(ScalarMode, int);
211  vtkSetMacro(ColorMode, int);
212  vtkSetMacro(InterpolateScalarsBeforeMapping, int);
213  vtkSetMacro(ScalarVisibility, int);
214  vtkSetMacro(ArrayAccessMode, int);
215  vtkSetMacro(ArrayComponent, int);
216  vtkSetMacro(ArrayId, int);
217  vtkSetStringMacro(ArrayName);
218  vtkSetMacro(FieldDataTupleId, vtkIdType);
219 
221 
224  int ArrayId;
225  char* ArrayName;
227 
229  // Lookup table provided via the scalars. This gets preference over the one
230  // set on the mapper by the user.
236  double LastUsedAlpha; // Essential to ensure alpha changes work correctly
237  // for composite datasets.
239  double ScalarRange[2];
242 
244 
245  // This is set when MapScalars decides to use vertex colors for atleast on
246  // dataset in the current pass.
248 
249 private:
251  void operator=(const vtkScalarsToColorsPainter&) = delete;
252 
253 };
254 
255 #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
virtual void ProcessInformation(vtkInformation *)
Called before RenderInternal() if the Information has been changed since the last time this method wa...
Definition: vtkPainter.h:233
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
virtual void PrepareForRendering(vtkRenderer *, vtkActor *)
Some subclasses may need to do some preprocessing before the actual rendering can be done eg...
Definition: vtkPainter.h:210
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkSmartPointer< vtkImageData > ColorTextureMap
int vtkIdType
Definition: vtkType.h:345
Key for string values in vtkInformation.
Detect and break reference loops.
Superclass for mapping scalar values to colors.
void ReportReferences(vtkGarbageCollector *collector) override
Take part in garbage collection.
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
vtkSmartPointer< vtkScalarsToColors > ScalarsLookupTable
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.