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 =========================================================================*/
25 #ifndef vtkScalarsToColorsPainter_h
26 #define vtkScalarsToColorsPainter_h
27 
28 #include "vtkRenderingOpenGLModule.h" // For export macro
29 #include "vtkPainter.h"
30 #include "vtkSmartPointer.h" // needed for vtkSmartPointer.
31 class vtkDataArray;
32 class vtkImageData;
37 class vtkDataSet;
38 class vtkScalarsToColors;
39 
40 class VTKRENDERINGOPENGL_EXPORT vtkScalarsToColorsPainter : public vtkPainter
41 {
42 public:
45  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
46 
55  static vtkInformationIntegerKey* USE_LOOKUP_TABLE_SCALAR_RANGE();
56 
62  static vtkInformationDoubleVectorKey* SCALAR_RANGE();
63 
68  static vtkInformationIntegerKey* SCALAR_MODE();
69 
77  static vtkInformationIntegerKey* COLOR_MODE();
78 
85  static vtkInformationIntegerKey* INTERPOLATE_SCALARS_BEFORE_MAPPING();
86 
88 
91  static vtkInformationObjectBaseKey* LOOKUP_TABLE();
92  void SetLookupTable(vtkScalarsToColors *lut);
93  vtkScalarsToColors *GetLookupTable();
95 
100  virtual void CreateDefaultLookupTable();
101 
105  static vtkInformationIntegerKey* SCALAR_VISIBILITY();
106 
108 
111  static vtkInformationIntegerKey* ARRAY_ACCESS_MODE();
112  static vtkInformationIntegerKey* ARRAY_ID();
113  static vtkInformationStringKey* ARRAY_NAME();
114  static vtkInformationIntegerKey* ARRAY_COMPONENT();
115  static vtkInformationIntegerKey* FIELD_DATA_TUPLE_ID();
117 
121  static vtkInformationIntegerKey* SCALAR_MATERIAL_MODE();
122 
135  virtual int GetPremultiplyColorsWithAlpha(vtkActor* actor);
136 
140  vtkDataObject *GetOutput() VTK_OVERRIDE;
141 
147  virtual vtkIdType GetTextureSizeLimit();
148 
149 protected:
151  ~vtkScalarsToColorsPainter() VTK_OVERRIDE;
152 
156  virtual vtkDataObject* NewClone(vtkDataObject* data);
157 
163  void MapScalarsToTexture(vtkDataSet* output,
164  vtkDataArray* scalars, vtkDataSet* input);
165 
169  void PrepareForRendering(vtkRenderer* renderer, vtkActor* actor) VTK_OVERRIDE;
170 
176  virtual void MapScalars(vtkDataSet* output,
177  double alpha, int multiply_with_alpha,
178  vtkDataSet* input);
179 
184  void ProcessInformation(vtkInformation*) VTK_OVERRIDE;
185 
189  void ReportReferences(vtkGarbageCollector *collector) VTK_OVERRIDE;
190 
199  int CanUseTextureMapForColoring(vtkDataObject* input);
200 
201 
205  void UpdateColorTextureMap(double alpha, int multiply_with_alpha);
206 
207  // Methods to set the ivars. These are purposefully protected.
208  // The only means of affecting these should be using the vtkInformation
209  // object.
210  vtkSetMacro(UseLookupTableScalarRange, int);
211  vtkSetVector2Macro(ScalarRange, double);
212  vtkSetMacro(ScalarMode, int);
213  vtkSetMacro(ColorMode, int);
214  vtkSetMacro(InterpolateScalarsBeforeMapping, int);
215  vtkSetMacro(ScalarVisibility, int);
216  vtkSetMacro(ScalarMaterialMode, int);
217  vtkSetMacro(ArrayAccessMode, int);
218  vtkSetMacro(ArrayComponent, int);
219  vtkSetMacro(ArrayId, int);
220  vtkSetStringMacro(ArrayName);
221  vtkSetMacro(FieldDataTupleId, vtkIdType);
222 
223  vtkDataObject* OutputData;
224 
225  int ArrayAccessMode;
226  int ArrayComponent;
227  int ArrayId;
228  char* ArrayName;
229  vtkIdType FieldDataTupleId;
230 
231  vtkScalarsToColors *LookupTable;
232  // Lookup table provided via the scalars. This gets preference over the one
233  // set on the mapper by the user.
234  vtkSmartPointer<vtkScalarsToColors> ScalarsLookupTable;
235  vtkSmartPointer<vtkImageData> ColorTextureMap;
236  int ColorMode;
237  int InterpolateScalarsBeforeMapping;
238  int ScalarMode;
239  int ScalarMaterialMode;
240  double LastUsedAlpha; // Essential to ensure alpha changes work correctly
241  // for composite datasets.
242  int LastUsedMultiplyWithAlpha;
243  double ScalarRange[2];
244  int ScalarVisibility;
245  int UseLookupTableScalarRange;
246 
247  vtkTimeStamp OutputUpdateTime;
248 
249  // This is set when MapScalars decides to use vertex colors for atleast on
250  // dataset in the current pass.
251  int UsingScalarColoring;
252 
253 private:
254  vtkScalarsToColorsPainter(const vtkScalarsToColorsPainter&) VTK_DELETE_FUNCTION;
255  void operator=(const vtkScalarsToColorsPainter&) VTK_DELETE_FUNCTION;
256 
257 };
258 
259 #endif
represents an object (geometry &amp; properties) in a rendered scene
Definition: vtkActor.h:45
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
record modification and/or execution time
Definition: vtkTimeStamp.h:32
virtual vtkDataObject * GetOutput()
Get the output data object from this painter.
Definition: vtkPainter.h:174
abstract specification for renderers
Definition: vtkRenderer.h:57
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:33
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
Key for integer values in vtkInformation.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
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:58
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.