VTK
dox/Charts/vtkPlot.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkPlot.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 
00032 #ifndef __vtkPlot_h
00033 #define __vtkPlot_h
00034 
00035 #include "vtkContextItem.h"
00036 #include "vtkStdString.h"     // Needed to hold TooltipLabelFormat ivar
00037 #include "vtkSmartPointer.h"  // Needed to hold SP ivars
00038 
00039 class vtkVariant;
00040 class vtkTable;
00041 class vtkIdTypeArray;
00042 class vtkContextMapper2D;
00043 class vtkPen;
00044 class vtkBrush;
00045 class vtkAxis;
00046 class vtkVector2f;
00047 class vtkRectf;
00048 class vtkStringArray;
00049 
00050 class VTK_CHARTS_EXPORT vtkPlot : public vtkContextItem
00051 {
00052 public:
00053   vtkTypeMacro(vtkPlot, vtkContextItem);
00054   virtual void PrintSelf(ostream &os, vtkIndent indent);
00055 
00057 
00062   virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf& rect,
00063                            int legendIndex);
00065 
00067 
00075   virtual void SetTooltipLabelFormat(const vtkStdString &label);
00076   virtual vtkStdString GetTooltipLabelFormat();
00078 
00080 
00081   virtual void SetTooltipNotation(int notation);
00082   virtual int GetTooltipNotation();
00084 
00086 
00087   virtual void SetTooltipPrecision(int precision);
00088   virtual int GetTooltipPrecision();
00090 
00091 //BTX
00093 
00095   virtual vtkStdString GetTooltipLabel(const vtkVector2f &plotPos,
00096                                        vtkIdType seriesIndex,
00097                                        vtkIdType segmentIndex);
00099 
00101 
00104   virtual vtkIdType GetNearestPoint(const vtkVector2f& point,
00105                                     const vtkVector2f& tolerance,
00106                                     vtkVector2f* location);
00108 
00110 
00111   virtual bool SelectPoints(const vtkVector2f& min, const vtkVector2f& max);
00112 //ETX
00114 
00116 
00117   virtual void SetColor(unsigned char r, unsigned char g, unsigned char b,
00118                         unsigned char a);
00119   virtual void SetColor(double r,  double g, double b);
00120   virtual void GetColor(double rgb[3]);
00121   void GetColor(unsigned char rgb[3]);
00123 
00125   virtual void SetWidth(float width);
00126 
00128   virtual float GetWidth();
00129 
00131 
00133   void SetPen(vtkPen *pen);
00134   vtkPen* GetPen();
00136 
00138 
00139   void SetBrush(vtkBrush *brush);
00140   vtkBrush* GetBrush();
00142 
00144   virtual void SetLabel(const vtkStdString &label);
00145 
00147   virtual vtkStdString GetLabel();
00148 
00151   virtual void SetLabels(vtkStringArray *labels);
00152 
00156   virtual vtkStringArray *GetLabels();
00157 
00159   virtual int GetNumberOfLabels();
00160 
00162   vtkStdString GetLabel(vtkIdType index);
00163 
00168   void SetIndexedLabels(vtkStringArray *labels);
00169 
00171   virtual vtkStringArray *GetIndexedLabels();
00172 
00174   vtkContextMapper2D* GetData();
00175 
00177 
00180   vtkGetMacro(UseIndexForXSeries, bool);
00182 
00184 
00187   vtkSetMacro(UseIndexForXSeries, bool);
00189 
00191 
00193   virtual void SetInput(vtkTable *table);
00194   virtual void SetInput(vtkTable *table, const vtkStdString &xColumn,
00195                         const vtkStdString &yColumn);
00196   void SetInput(vtkTable *table, vtkIdType xColumn, vtkIdType yColumn);
00198 
00200   virtual vtkTable* GetInput();
00201 
00205   virtual void SetInputArray(int index, const vtkStdString &name);
00206 
00207   virtual void SetSelection(vtkIdTypeArray *id);
00208   vtkGetObjectMacro(Selection, vtkIdTypeArray);
00209 
00211 
00212   vtkGetObjectMacro(XAxis, vtkAxis);
00213   virtual void SetXAxis(vtkAxis* axis);
00215 
00217 
00218   vtkGetObjectMacro(YAxis, vtkAxis);
00219   virtual void SetYAxis(vtkAxis* axis);
00221 
00223 
00224   virtual void GetBounds(double bounds[4])
00225   { bounds[0] = bounds[1] = bounds[2] = bounds[3] = 0.0; }
00227 
00228 //BTX
00230 
00232   virtual void SetProperty(const vtkStdString &property, const vtkVariant &var);
00233   virtual vtkVariant GetProperty(const vtkStdString &property);
00234 //ETX
00236 
00237 //BTX
00238 protected:
00239   vtkPlot();
00240   ~vtkPlot();
00241 
00243   vtkStdString GetNumber(double position, vtkAxis *axis);
00244 
00246   vtkSmartPointer<vtkPen> Pen;
00247 
00249   vtkSmartPointer<vtkBrush> Brush;
00250 
00252   vtkSmartPointer<vtkStringArray> Labels;
00253 
00255   vtkSmartPointer<vtkStringArray> AutoLabels;
00256 
00258   vtkSmartPointer<vtkStringArray> IndexedLabels;
00259 
00263   bool UseIndexForXSeries;
00264 
00267   vtkSmartPointer<vtkContextMapper2D> Data;
00268 
00270   vtkIdTypeArray *Selection;
00271 
00273   vtkAxis* XAxis;
00274 
00276   vtkAxis* YAxis;
00277 
00280   vtkStdString TooltipLabelFormat;
00281 
00284   vtkStdString TooltipDefaultLabelFormat;
00285 
00286   int TooltipNotation;
00287   int TooltipPrecision;
00288 
00289 private:
00290   vtkPlot(const vtkPlot &); // Not implemented.
00291   void operator=(const vtkPlot &); // Not implemented.
00292 
00293 //ETX
00294 };
00295 
00296 #endif //__vtkPlot_h