VTK
dox/Rendering/Core/vtkDiscretizableColorTransferFunction.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkDiscretizableColorTransferFunction.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 =========================================================================*/
00042 #ifndef __vtkDiscretizableColorTransferFunction_h
00043 #define __vtkDiscretizableColorTransferFunction_h
00044 
00045 #include "vtkRenderingCoreModule.h" // For export macro
00046 #include "vtkColorTransferFunction.h"
00047 #include "vtkSmartPointer.h" // for vtkSmartPointer
00048 
00049 class vtkLookupTable;
00050 class vtkColorTransferFunction;
00051 class vtkPiecewiseFunction;
00052 
00053 class VTKRENDERINGCORE_EXPORT vtkDiscretizableColorTransferFunction : public vtkColorTransferFunction
00054 {
00055 public:
00056   static vtkDiscretizableColorTransferFunction* New();
00057   vtkTypeMacro(vtkDiscretizableColorTransferFunction, vtkColorTransferFunction);
00058   void PrintSelf(ostream& os, vtkIndent indent);
00059 
00060   int IsOpaque();
00061 
00066   virtual void Build();
00067 
00069 
00073   vtkSetMacro(Discretize, int);
00074   vtkGetMacro(Discretize, int);
00075   vtkBooleanMacro(Discretize, int);
00077 
00079 
00081   virtual void SetUseLogScale(int useLogScale);
00082   vtkGetMacro(UseLogScale, int);
00084 
00086 
00089   void SetNumberOfValues(vtkIdType number);
00090   vtkGetMacro(NumberOfValues, vtkIdType);
00092 
00095   virtual unsigned char *MapValue(double v);
00096 
00099   virtual void GetColor(double v, double rgb[3]);
00100 
00102   virtual double GetOpacity(double v);
00103 
00105 
00116   virtual vtkUnsignedCharArray *MapScalars(vtkDataArray *scalars, int colorMode,
00117                                    int component);
00119 
00121   double* GetRGBPoints();
00122 
00127   virtual void SetAlpha(double alpha);
00128 
00129 
00131 
00134   virtual void SetNanColor(double r, double g, double b);
00135   virtual void SetNanColor(double rgb[3]) {
00136     this->SetNanColor(rgb[0], rgb[1], rgb[2]);
00137   }
00139 
00140 
00142 
00144   virtual int UsingLogScale()
00145     { return this->UseLogScale; }
00147 
00149   virtual vtkIdType GetNumberOfAvailableColors();
00150 
00152 
00153   virtual void SetScalarOpacityFunction(vtkPiecewiseFunction *function);
00154   virtual vtkPiecewiseFunction* GetScalarOpacityFunction() const;
00156 
00158 
00159   vtkSetMacro(EnableOpacityMapping, bool)
00160   vtkGetMacro(EnableOpacityMapping, bool)
00161   vtkBooleanMacro(EnableOpacityMapping, bool)
00163 
00164 protected:
00165   vtkDiscretizableColorTransferFunction();
00166   ~vtkDiscretizableColorTransferFunction();
00167 
00169   void ScalarOpacityFunctionModified();
00170 
00171   int Discretize;
00172   int UseLogScale;
00173 
00174   vtkIdType NumberOfValues;
00175   vtkLookupTable* LookupTable;
00176 
00177   vtkTimeStamp BuildTime;
00178 
00179   bool EnableOpacityMapping;
00180   vtkSmartPointer<vtkPiecewiseFunction> ScalarOpacityFunction;
00181   unsigned long ScalarOpacityFunctionObserverId;
00182 
00183 private:
00184   vtkDiscretizableColorTransferFunction(const vtkDiscretizableColorTransferFunction&); // Not implemented.
00185   void operator=(const vtkDiscretizableColorTransferFunction&); // Not implemented.
00186 
00187   // Pointer used by GetRGBPoints().
00188   double* Data;
00189 };
00190 
00191 #endif
00192