VTK
dox/Charts/Core/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 "vtkChartsCoreModule.h" // For export macro
00031 #include "vtkPlot.h"
00032 #include "vtkSmartPointer.h" // Needed to hold ColorSeries
00033 
00034 class vtkContext2D;
00035 class vtkTable;
00036 class vtkPoints2D;
00037 class vtkStdString;
00038 class vtkColorSeries;
00039 
00040 class vtkPlotBarPrivate;
00041 
00042 class VTKCHARTSCORE_EXPORT vtkPlotBar : public vtkPlot
00043 {
00044 public:
00045   vtkTypeMacro(vtkPlotBar, vtkPlot);
00046   virtual void PrintSelf(ostream &os, vtkIndent indent);
00047 
00049 
00050   enum {
00051     VERTICAL = 0,
00052     HORIZONTAL
00053   };
00055 
00057   static vtkPlotBar *New();
00058 
00061   virtual bool Paint(vtkContext2D *painter);
00062 
00064 
00069   virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf& rect,
00070                            int legendIndex);
00072 
00074 
00075   virtual void SetColor(unsigned char r, unsigned char g, unsigned char b,
00076                         unsigned char a);
00077   virtual void SetColor(double r,  double g, double b);
00078   virtual void GetColor(double rgb[3]);
00080 
00082 
00083   vtkSetMacro(Width, float);
00085 
00087 
00088   vtkGetMacro(Width, float);
00090 
00092 
00095   vtkSetMacro(Offset, float);
00096   vtkGetMacro(Offset, float);
00098 
00100 
00102   virtual void SetOrientation(int orientation);
00103   vtkGetMacro(Orientation, int);
00105 
00107   virtual void GetBounds(double bounds[4], bool unscaled);
00108 
00110   virtual void GetBounds(double bounds[4]);
00111 
00113   virtual void GetUnscaledInputBounds(double bounds[4]);
00114 
00116   virtual void SetInputArray(int index, const vtkStdString &name);
00117 
00119   void SetColorSeries(vtkColorSeries *colorSeries);
00120 
00122   vtkColorSeries *GetColorSeries();
00123 
00125   virtual vtkStringArray *GetLabels();
00126 
00128   virtual void SetGroupName(const vtkStdString& name);
00129 
00131   virtual vtkStdString GetGroupName();
00132 
00134 
00136   virtual vtkStdString GetTooltipLabel(const vtkVector2f &plotPos,
00137                                        vtkIdType seriesIndex,
00138                                        vtkIdType segmentIndex);
00140 
00142   virtual bool SelectPoints(const vtkVector2f& min, const vtkVector2f& max);
00143 
00144 //BTX
00146 
00149   virtual vtkIdType GetNearestPoint(const vtkVector2f& point,
00150                                     const vtkVector2f& tolerance,
00151                                     vtkVector2f* location);
00153 
00155 
00160   virtual vtkIdType GetNearestPoint(const vtkVector2f& point,
00161                                     const vtkVector2f&,
00162                                     vtkVector2f* location,
00163                                     vtkIdType* segmentIndex);
00165 
00166 protected:
00167   vtkPlotBar();
00168   ~vtkPlotBar();
00169 
00171   bool UpdateTableCache(vtkTable *table);
00172 
00174   vtkPoints2D *Points;
00175 
00176   float Width;
00177   float Offset;
00178 
00179   int Orientation;
00180 
00182   vtkTimeStamp BuildTime;
00183 
00185   vtkSmartPointer<vtkColorSeries> ColorSeries;
00186 
00187 private:
00188   vtkPlotBar(const vtkPlotBar &); // Not implemented.
00189   void operator=(const vtkPlotBar &); // Not implemented.
00190 
00191   vtkPlotBarPrivate *Private;
00192 
00193 //ETX
00194 };
00195 
00196 #endif //__vtkPlotBar_h