VTK
|
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 "vtkRenderingCoreModule.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 VTKRENDERINGCORE_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(); 00100 00102 static vtkInformationIntegerKey* SCALAR_MATERIAL_MODE(); 00103 00111 virtual int GetPremultiplyColorsWithAlpha(vtkActor* actor); 00112 00115 virtual vtkDataObject *GetOutput(); 00116 00120 virtual vtkIdType GetTextureSizeLimit(); 00121 00122 //BTX 00123 protected: 00124 vtkScalarsToColorsPainter(); 00125 virtual ~vtkScalarsToColorsPainter(); 00126 00128 virtual vtkDataObject* NewClone(vtkDataObject* data); 00129 00131 00134 void MapScalarsToTexture(vtkDataSet* output, 00135 vtkDataArray* scalars, vtkDataSet* input); 00137 00139 virtual void PrepareForRendering(vtkRenderer* renderer, vtkActor* actor); 00140 00142 00144 virtual void MapScalars(vtkDataSet* output, 00145 double alpha, int multiply_with_alpha, 00146 vtkDataSet* input); 00148 00151 virtual void ProcessInformation(vtkInformation*); 00152 00154 virtual void ReportReferences(vtkGarbageCollector *collector); 00155 00162 int CanUseTextureMapForColoring(vtkDataObject* input); 00163 00164 00166 void UpdateColorTextureMap(double alpha, int multiply_with_alpha); 00167 00168 // Methods to set the ivars. These are purposefully protected. 00169 // The only means of affecting these should be using the vtkInformation 00170 // object. 00171 vtkSetMacro(UseLookupTableScalarRange, int); 00172 vtkSetVector2Macro(ScalarRange, double); 00173 vtkSetMacro(ScalarMode, int); 00174 vtkSetMacro(ColorMode, int); 00175 vtkSetMacro(InterpolateScalarsBeforeMapping, int); 00176 vtkSetMacro(ScalarVisibility, int); 00177 vtkSetMacro(ScalarMaterialMode, int); 00178 vtkSetMacro(ArrayAccessMode, int); 00179 vtkSetMacro(ArrayComponent, int); 00180 vtkSetMacro(ArrayId, int); 00181 vtkSetStringMacro(ArrayName); 00182 00183 vtkDataObject* OutputData; 00184 00185 int ArrayAccessMode; 00186 int ArrayComponent; 00187 int ArrayId; 00188 char* ArrayName; 00189 00190 vtkScalarsToColors *LookupTable; 00191 // Lookup table provided via the scalars. This gets preference over the one 00192 // set on the mapper by the user. 00193 vtkSmartPointer<vtkScalarsToColors> ScalarsLookupTable; 00194 vtkSmartPointer<vtkImageData> ColorTextureMap; 00195 int ColorMode; 00196 int InterpolateScalarsBeforeMapping; 00197 int ScalarMode; 00198 int ScalarMaterialMode; 00199 double LastUsedAlpha; // Essential to ensure alpha changes work correctly 00200 // for composite datasets. 00201 int LastUsedMultiplyWithAlpha; 00202 double ScalarRange[2]; 00203 int ScalarVisibility; 00204 int UseLookupTableScalarRange; 00205 00206 vtkTimeStamp OutputUpdateTime; 00207 00208 // This is set when MapScalars decides to use vertex colors for atleast on 00209 // dataset in the current pass. 00210 int UsingScalarColoring; 00211 00212 private: 00213 vtkScalarsToColorsPainter(const vtkScalarsToColorsPainter&); // Not implemented. 00214 void operator=(const vtkScalarsToColorsPainter&); // Not implemented. 00215 //ETX 00216 }; 00217 00218 #endif