VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkScalarsToColorsPainter.h,v $ 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 vtkTypeRevisionMacro(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 00116 //BTX 00117 protected: 00118 vtkScalarsToColorsPainter(); 00119 virtual ~vtkScalarsToColorsPainter(); 00120 00122 vtkDataObject* NewClone(vtkDataObject* data); 00123 00125 00128 void MapScalarsToTexture(vtkDataSet* output, 00129 vtkDataArray* scalars, vtkDataSet* input); 00131 00133 virtual void PrepareForRendering(vtkRenderer* renderer, vtkActor* actor); 00134 00136 00138 virtual void MapScalars(vtkDataSet* output, 00139 double alpha, int multiply_with_alpha, 00140 vtkDataSet* input); 00142 00145 virtual void ProcessInformation(vtkInformation*); 00146 00148 virtual void ReportReferences(vtkGarbageCollector *collector); 00149 00156 int CanUseTextureMapForColoring(vtkDataObject* input); 00157 00158 00160 void UpdateColorTextureMap(double alpha, int multiply_with_alpha); 00161 00162 // Methods to set the ivars. These are purposefully protected. 00163 // The only means of affecting these should be using teh vtkInformation 00164 // object. 00165 vtkSetMacro(UseLookupTableScalarRange,int); 00166 vtkSetVector2Macro(ScalarRange,double); 00167 vtkSetMacro(ScalarMode, int); 00168 vtkSetMacro(ColorMode, int); 00169 vtkSetMacro(InterpolateScalarsBeforeMapping,int); 00170 vtkSetMacro(ScalarVisibility,int); 00171 vtkSetMacro(ScalarMaterialMode,int); 00172 vtkSetMacro(ArrayAccessMode, int); 00173 vtkSetMacro(ArrayId, int); 00174 vtkSetStringMacro(ArrayName); 00175 vtkSetMacro(ArrayComponent, int); 00176 00177 vtkDataObject* OutputData; 00178 00179 int ArrayAccessMode; 00180 int ArrayComponent; 00181 int ArrayId; 00182 char* ArrayName; 00183 00184 vtkScalarsToColors *LookupTable; 00185 // Lookup table provided via the scalars. This gets preference over the one 00186 // set on the mapper by the user. 00187 vtkSmartPointer<vtkScalarsToColors> ScalarsLookupTable; 00188 vtkSmartPointer<vtkImageData> ColorTextureMap; 00189 int ColorMode; 00190 int InterpolateScalarsBeforeMapping; 00191 int ScalarMode; 00192 int ScalarMaterialMode; 00193 double LastUsedAlpha; // Essential to ensure alpha changes work correctly 00194 // for composite datasets. 00195 double ScalarRange[2]; 00196 int ScalarVisibility; 00197 int UseLookupTableScalarRange; 00198 00199 vtkTimeStamp OutputUpdateTime; 00200 00201 // This is set when MapScalars decides to use vertex colors for atleast on 00202 // dataset in the current pass. 00203 int UsingScalarColoring; 00204 00205 private: 00206 vtkScalarsToColorsPainter(const vtkScalarsToColorsPainter&); // Not implemented. 00207 void operator=(const vtkScalarsToColorsPainter&); // Not implemented. 00208 //ETX 00209 }; 00210 00211 #endif 00212