VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Rendering/OpenGL/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 "vtkRenderingOpenGLModule.h" // For export macro
00031 #include "vtkPainter.h"
00032 #include "vtkSmartPointer.h" // needed for vtkSmartPointer.
00033 class vtkDataArray;
00034 class vtkImageData;
00035 class vtkInformationDoubleVectorKey;
00036 class vtkInformationIntegerKey;
00037 class vtkInformationObjectBaseKey;
00038 class vtkInformationStringKey;
00039 class vtkDataSet;
00040 class vtkScalarsToColors;
00041 
00042 class VTKRENDERINGOPENGL_EXPORT vtkScalarsToColorsPainter : public vtkPainter
00043 {
00044 public:
00045   static vtkScalarsToColorsPainter* New();
00046   vtkTypeMacro(vtkScalarsToColorsPainter, vtkPainter);
00047   void PrintSelf(ostream& os, vtkIndent indent);
00048 
00055   static vtkInformationIntegerKey* USE_LOOKUP_TABLE_SCALAR_RANGE();
00056 
00060   static vtkInformationDoubleVectorKey* SCALAR_RANGE();
00061 
00064   static vtkInformationIntegerKey* SCALAR_MODE();
00065 
00071   static vtkInformationIntegerKey* COLOR_MODE();
00072 
00076   static vtkInformationIntegerKey* INTERPOLATE_SCALARS_BEFORE_MAPPING();
00077 
00079 
00080   static vtkInformationObjectBaseKey* LOOKUP_TABLE();
00081   void SetLookupTable(vtkScalarsToColors *lut);
00082   vtkScalarsToColors *GetLookupTable();
00084 
00087   virtual void CreateDefaultLookupTable();
00088 
00091   static vtkInformationIntegerKey* SCALAR_VISIBILITY();
00092 
00094 
00095   static vtkInformationIntegerKey* ARRAY_ACCESS_MODE();
00096   static vtkInformationIntegerKey* ARRAY_ID();
00097   static vtkInformationStringKey*  ARRAY_NAME();
00098   static vtkInformationIntegerKey* ARRAY_COMPONENT();
00099   static vtkInformationIntegerKey* FIELD_DATA_TUPLE_ID();
00101 
00103   static vtkInformationIntegerKey* SCALAR_MATERIAL_MODE();
00104 
00112   virtual int GetPremultiplyColorsWithAlpha(vtkActor* actor);
00113 
00116   virtual vtkDataObject *GetOutput();
00117 
00121   virtual vtkIdType GetTextureSizeLimit();
00122 
00123 //BTX
00124 protected:
00125   vtkScalarsToColorsPainter();
00126   virtual ~vtkScalarsToColorsPainter();
00127 
00129   virtual vtkDataObject* NewClone(vtkDataObject* data);
00130 
00132 
00135   void MapScalarsToTexture(vtkDataSet* output,
00136     vtkDataArray* scalars, vtkDataSet* input);
00138 
00140   virtual void PrepareForRendering(vtkRenderer* renderer, vtkActor* actor);
00141 
00143 
00145   virtual void MapScalars(vtkDataSet* output,
00146     double alpha, int multiply_with_alpha,
00147     vtkDataSet* input);
00149 
00152   virtual void ProcessInformation(vtkInformation*);
00153 
00155   virtual void ReportReferences(vtkGarbageCollector *collector);
00156 
00163   int CanUseTextureMapForColoring(vtkDataObject* input);
00164 
00165 
00167   void UpdateColorTextureMap(double alpha, int multiply_with_alpha);
00168 
00169   // Methods to set the ivars. These are purposefully protected.
00170   // The only means of affecting these should be using the vtkInformation
00171   // object.
00172   vtkSetMacro(UseLookupTableScalarRange, int);
00173   vtkSetVector2Macro(ScalarRange, double);
00174   vtkSetMacro(ScalarMode, int);
00175   vtkSetMacro(ColorMode, int);
00176   vtkSetMacro(InterpolateScalarsBeforeMapping, int);
00177   vtkSetMacro(ScalarVisibility, int);
00178   vtkSetMacro(ScalarMaterialMode, int);
00179   vtkSetMacro(ArrayAccessMode, int);
00180   vtkSetMacro(ArrayComponent, int);
00181   vtkSetMacro(ArrayId, int);
00182   vtkSetStringMacro(ArrayName);
00183   vtkSetMacro(FieldDataTupleId, vtkIdType);
00184 
00185   vtkDataObject* OutputData;
00186 
00187   int ArrayAccessMode;
00188   int ArrayComponent;
00189   int ArrayId;
00190   char* ArrayName;
00191   vtkIdType FieldDataTupleId;
00192 
00193   vtkScalarsToColors *LookupTable;
00194   // Lookup table provided via the scalars. This gets preference over the one
00195   // set on the mapper by the user.
00196   vtkSmartPointer<vtkScalarsToColors> ScalarsLookupTable;
00197   vtkSmartPointer<vtkImageData> ColorTextureMap;
00198   int ColorMode;
00199   int InterpolateScalarsBeforeMapping;
00200   int ScalarMode;
00201   int ScalarMaterialMode;
00202   double LastUsedAlpha; // Essential to ensure alpha changes work correctly
00203                         // for composite datasets.
00204   int LastUsedMultiplyWithAlpha;
00205   double ScalarRange[2];
00206   int ScalarVisibility;
00207   int UseLookupTableScalarRange;
00208 
00209   vtkTimeStamp OutputUpdateTime;
00210 
00211   // This is set when MapScalars decides to use vertex colors for atleast on
00212   // dataset in the current pass.
00213   int UsingScalarColoring;
00214 
00215 private:
00216   vtkScalarsToColorsPainter(const vtkScalarsToColorsPainter&); // Not implemented.
00217   void operator=(const vtkScalarsToColorsPainter&); // Not implemented.
00218 //ETX
00219 };
00220 
00221 #endif