VTK
dox/Rendering/vtkScalarsToColorsPainter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkScalarsToColorsPainter.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00027 #ifndef __vtkScalarsToColorsPainter_h
00028 #define __vtkScalarsToColorsPainter_h
00029 
00030 #include "vtkPainter.h"
00031 #include "vtkSmartPointer.h" // needed for vtkSmartPointer.
00032 class vtkDataArray;
00033 class vtkImageData;
00034 class vtkInformationDoubleVectorKey;
00035 class vtkInformationIntegerKey;
00036 class vtkInformationObjectBaseKey;
00037 class vtkInformationStringKey;
00038 class vtkDataSet;
00039 class vtkScalarsToColors;
00040 
00041 class VTK_RENDERING_EXPORT vtkScalarsToColorsPainter : public vtkPainter
00042 {
00043 public:
00044   static vtkScalarsToColorsPainter* New();
00045   vtkTypeMacro(vtkScalarsToColorsPainter, vtkPainter);
00046   void PrintSelf(ostream& os, vtkIndent indent);
00047 
00054   static vtkInformationIntegerKey* USE_LOOKUP_TABLE_SCALAR_RANGE();
00055 
00059   static vtkInformationDoubleVectorKey* SCALAR_RANGE();
00060 
00063   static vtkInformationIntegerKey* SCALAR_MODE();
00064 
00070   static vtkInformationIntegerKey* COLOR_MODE();
00071   
00075   static vtkInformationIntegerKey* INTERPOLATE_SCALARS_BEFORE_MAPPING();
00076   
00078 
00079   static vtkInformationObjectBaseKey* LOOKUP_TABLE();
00080   void SetLookupTable(vtkScalarsToColors *lut);
00081   vtkScalarsToColors *GetLookupTable();
00083   
00086   virtual void CreateDefaultLookupTable();
00087   
00090   static vtkInformationIntegerKey* SCALAR_VISIBILITY();
00091 
00093 
00094   static vtkInformationIntegerKey* ARRAY_ACCESS_MODE();
00095   static vtkInformationIntegerKey* ARRAY_ID();
00096   static vtkInformationStringKey* ARRAY_NAME();
00097   static vtkInformationIntegerKey* ARRAY_COMPONENT();
00099   
00101   static vtkInformationIntegerKey* SCALAR_MATERIAL_MODE();
00102 
00110   virtual int GetPremultiplyColorsWithAlpha(vtkActor* actor);
00111 
00114   virtual vtkDataObject *GetOutput();
00115 
00119   virtual vtkIdType GetTextureSizeLimit();
00120 
00121 //BTX
00122 protected:
00123   vtkScalarsToColorsPainter();
00124   virtual ~vtkScalarsToColorsPainter(); 
00125  
00127   virtual vtkDataObject* NewClone(vtkDataObject* data);
00128 
00130 
00133   void MapScalarsToTexture(vtkDataSet* output,
00134     vtkDataArray* scalars, vtkDataSet* input);
00136 
00138   virtual void PrepareForRendering(vtkRenderer* renderer, vtkActor* actor);
00139 
00141 
00143   virtual void MapScalars(vtkDataSet* output,
00144     double alpha, int multiply_with_alpha,
00145     vtkDataSet* input);
00147 
00150   virtual void ProcessInformation(vtkInformation*);
00151 
00153   virtual void ReportReferences(vtkGarbageCollector *collector);
00154 
00161   int CanUseTextureMapForColoring(vtkDataObject* input);
00162 
00163 
00165   void UpdateColorTextureMap(double alpha, int multiply_with_alpha);
00166 
00167   // Methods to set the ivars. These are purposefully protected.
00168   // The only means of affecting these should be using the vtkInformation
00169   // object.
00170   vtkSetMacro(UseLookupTableScalarRange,int);
00171   vtkSetVector2Macro(ScalarRange,double);
00172   vtkSetMacro(ScalarMode, int);
00173   vtkSetMacro(ColorMode, int);
00174   vtkSetMacro(InterpolateScalarsBeforeMapping,int);
00175   vtkSetMacro(ScalarVisibility,int);
00176   vtkSetMacro(ScalarMaterialMode,int);
00177   vtkSetMacro(ArrayAccessMode, int);
00178   vtkSetMacro(ArrayId, int);
00179   vtkSetStringMacro(ArrayName);
00180   vtkSetMacro(ArrayComponent, int);
00181 
00182   vtkDataObject* OutputData;
00183 
00184   int ArrayAccessMode;
00185   int ArrayComponent;
00186   int ArrayId;
00187   char* ArrayName;
00188   
00189   vtkScalarsToColors *LookupTable;
00190   // Lookup table provided via the scalars. This gets preference over the one
00191   // set on the mapper by the user.
00192   vtkSmartPointer<vtkScalarsToColors> ScalarsLookupTable;
00193   vtkSmartPointer<vtkImageData> ColorTextureMap;
00194   int ColorMode;
00195   int InterpolateScalarsBeforeMapping;
00196   int ScalarMode;
00197   int ScalarMaterialMode;
00198   double LastUsedAlpha; // Essential to ensure alpha changes work correctly 
00199                         // for composite datasets.
00200   int LastUsedMultiplyWithAlpha;
00201   double ScalarRange[2];
00202   int ScalarVisibility;
00203   int UseLookupTableScalarRange;
00204 
00205   vtkTimeStamp OutputUpdateTime;
00206 
00207   // This is set when MapScalars decides to use vertex colors for atleast on
00208   // dataset in the current pass.
00209   int UsingScalarColoring;
00210   
00211 private:
00212   vtkScalarsToColorsPainter(const vtkScalarsToColorsPainter&); // Not implemented.
00213   void operator=(const vtkScalarsToColorsPainter&); // Not implemented.
00214 //ETX
00215 };
00216 
00217 #endif
00218