VTK
dox/Charts/vtkPlotBar.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkPlotBar.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 
00027 #ifndef __vtkPlotBar_h
00028 #define __vtkPlotBar_h
00029 
00030 #include "vtkPlot.h"
00031 #include "vtkSmartPointer.h" // Needed to hold ColorSeries
00032 
00033 class vtkContext2D;
00034 class vtkTable;
00035 class vtkPoints2D;
00036 class vtkStdString;
00037 class vtkColorSeries;
00038 
00039 class vtkPlotBarPrivate;
00040 
00041 class VTK_CHARTS_EXPORT vtkPlotBar : public vtkPlot
00042 {
00043 public:
00044   vtkTypeMacro(vtkPlotBar, vtkPlot);
00045   virtual void PrintSelf(ostream &os, vtkIndent indent);
00046 
00048 
00049   enum {
00050     VERTICAL = 0,
00051     HORIZONTAL
00052   };
00054 
00056   static vtkPlotBar *New();
00057 
00060   virtual bool Paint(vtkContext2D *painter);
00061 
00063 
00068   virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf& rect,
00069                            int legendIndex);
00071 
00073 
00074   virtual void SetColor(unsigned char r, unsigned char g, unsigned char b,
00075                         unsigned char a);
00076   virtual void SetColor(double r,  double g, double b);
00077   virtual void GetColor(double rgb[3]);
00079 
00081 
00082   vtkSetMacro(Width, float);
00084 
00086 
00087   vtkGetMacro(Width, float);
00089 
00091 
00094   vtkSetMacro(Offset, float);
00095   vtkGetMacro(Offset, float);
00097 
00099 
00101   virtual void SetOrientation(int orientation);
00102   vtkGetMacro(Orientation, int);
00104 
00106   virtual void GetBounds(double bounds[4]);
00107 
00109   virtual void SetInputArray(int index, const vtkStdString &name);
00110 
00112   void SetColorSeries(vtkColorSeries *colorSeries);
00113 
00115   vtkColorSeries *GetColorSeries();
00116 
00118   virtual vtkStringArray *GetLabels();
00119 
00121   virtual void SetGroupName(const vtkStdString& name);
00122 
00124   virtual vtkStdString GetGroupName();
00125 
00127 
00129   virtual vtkStdString GetTooltipLabel(const vtkVector2f &plotPos,
00130                                        vtkIdType seriesIndex,
00131                                        vtkIdType segmentIndex);
00133 
00135   virtual bool SelectPoints(const vtkVector2f& min, const vtkVector2f& max);
00136 
00137 //BTX
00139 
00142   virtual vtkIdType GetNearestPoint(const vtkVector2f& point,
00143                                     const vtkVector2f& tolerance,
00144                                     vtkVector2f* location);
00146 
00148 
00153   virtual vtkIdType GetNearestPoint(const vtkVector2f& point,
00154                                     const vtkVector2f&,
00155                                     vtkVector2f* location,
00156                                     vtkIdType* segmentIndex);
00158 
00159 protected:
00160   vtkPlotBar();
00161   ~vtkPlotBar();
00162 
00164   bool UpdateTableCache(vtkTable *table);
00165 
00167   vtkPoints2D *Points;
00168 
00169   float Width;
00170   float Offset;
00171 
00172   int Orientation;
00173 
00175   vtkTimeStamp BuildTime;
00176 
00178   vtkSmartPointer<vtkColorSeries> ColorSeries;
00179 
00180 private:
00181   vtkPlotBar(const vtkPlotBar &); // Not implemented.
00182   void operator=(const vtkPlotBar &); // Not implemented.
00183 
00184   vtkPlotBarPrivate *Private;
00185 
00186 //ETX
00187 };
00188 
00189 #endif //__vtkPlotBar_h