VTK
dox/Charts/vtkColorLegend.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkColorLegend.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 =========================================================================*/
00015 
00023 #ifndef __vtkColorLegend_h
00024 #define __vtkColorLegend_h
00025 
00026 #include "vtkChartLegend.h"
00027 #include "vtkSmartPointer.h" // For SP ivars
00028 #include "vtkVector.h"       // For vtkRectf
00029 
00030 class vtkAxis;
00031 class vtkImageData;
00032 class vtkScalarsToColors;
00033 class vtkCallbackCommand;
00034 
00035 class VTK_CHARTS_EXPORT vtkColorLegend: public vtkChartLegend
00036 {
00037 public:
00038   vtkTypeMacro(vtkColorLegend, vtkChartLegend);
00039   virtual void PrintSelf(ostream &os, vtkIndent indent);
00040   static vtkColorLegend* New();
00041 
00044   virtual void GetBounds(double bounds[4]);
00045 
00049   virtual void Update();
00050 
00054   virtual bool Paint(vtkContext2D *painter);
00055 
00056   virtual void SetTransferFunction(vtkScalarsToColors* transfer);
00057   virtual vtkScalarsToColors * GetTransferFunction();
00058 
00059   virtual void SetPosition(const vtkRectf& pos);
00060   virtual vtkRectf GetPosition();
00061 
00067   vtkRectf GetBoundingRect(vtkContext2D* painter);
00068 
00069 protected:
00070   vtkColorLegend();
00071   virtual ~vtkColorLegend();
00072 
00076   virtual void ComputeTexture();
00077 
00079 
00081   virtual void ScalarsToColorsModified(vtkObject* caller, unsigned long eid,
00082                                        void* calldata);
00083   static void OnScalarsToColorsModified(vtkObject* caller, unsigned long eid,
00084                                         void *clientdata, void* calldata);
00086 
00087   vtkScalarsToColors*                 TransferFunction;
00088   vtkSmartPointer<vtkImageData>       ImageData;
00089   vtkSmartPointer<vtkAxis>            Axis;
00090   vtkSmartPointer<vtkCallbackCommand> Callback;
00091   bool                                Interpolate;
00092   vtkRectf                            Position;
00093 
00094 private:
00095   vtkColorLegend(const vtkColorLegend &); // Not implemented.
00096   void operator=(const vtkColorLegend &);   // Not implemented.
00097 };
00098 
00099 #endif