VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Charts/Core/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 "vtkChartsCoreModule.h" // For export macro
00036 #include "vtkContextItem.h"
00037 #include "vtkStdString.h"     // Needed to hold TooltipLabelFormat ivar
00038 #include "vtkSmartPointer.h"  // Needed to hold SP ivars
00039 #include "vtkContextPolygon.h" // For vtkContextPolygon
00040 #include "vtkRect.h"           // For vtkRectd ivar
00041 
00042 class vtkVariant;
00043 class vtkTable;
00044 class vtkIdTypeArray;
00045 class vtkContextMapper2D;
00046 class vtkPen;
00047 class vtkBrush;
00048 class vtkAxis;
00049 class vtkStringArray;
00050 
00051 class VTKCHARTSCORE_EXPORT vtkPlot : public vtkContextItem
00052 {
00053 public:
00054   vtkTypeMacro(vtkPlot, vtkContextItem);
00055   virtual void PrintSelf(ostream &os, vtkIndent indent);
00056 
00058 
00063   virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf& rect,
00064                            int legendIndex);
00066 
00068 
00076   virtual void SetTooltipLabelFormat(const vtkStdString &label);
00077   virtual vtkStdString GetTooltipLabelFormat();
00079 
00081 
00082   virtual void SetTooltipNotation(int notation);
00083   virtual int GetTooltipNotation();
00085 
00087 
00088   virtual void SetTooltipPrecision(int precision);
00089   virtual int GetTooltipPrecision();
00091 
00092 //BTX
00094 
00096   virtual vtkStdString GetTooltipLabel(const vtkVector2d &plotPos,
00097                                        vtkIdType seriesIndex,
00098                                        vtkIdType segmentIndex);
00100 
00102 
00105   virtual vtkIdType GetNearestPoint(const vtkVector2f& point,
00106                                     const vtkVector2f& tolerance,
00107                                     vtkVector2f* location);
00109 
00111   virtual bool SelectPoints(const vtkVector2f& min, const vtkVector2f& max);
00112 
00114 
00115   virtual bool SelectPointsInPolygon(const vtkContextPolygon &polygon);
00116 //ETX
00118 
00120 
00121   virtual void SetColor(unsigned char r, unsigned char g, unsigned char b,
00122                         unsigned char a);
00123   virtual void SetColor(double r,  double g, double b);
00124   virtual void GetColor(double rgb[3]);
00125   void GetColor(unsigned char rgb[3]);
00127 
00129   virtual void SetWidth(float width);
00130 
00132   virtual float GetWidth();
00133 
00135 
00137   void SetPen(vtkPen *pen);
00138   vtkPen* GetPen();
00140 
00142 
00143   void SetBrush(vtkBrush *brush);
00144   vtkBrush* GetBrush();
00146 
00148 
00150   void SetSelectionPen(vtkPen *pen);
00151   vtkPen* GetSelectionPen();
00153 
00155 
00157   void SetSelectionBrush(vtkBrush *brush);
00158   vtkBrush* GetSelectionBrush();
00160 
00162   virtual void SetLabel(const vtkStdString &label);
00163 
00165   virtual vtkStdString GetLabel();
00166 
00169   virtual void SetLabels(vtkStringArray *labels);
00170 
00174   virtual vtkStringArray *GetLabels();
00175 
00177   virtual int GetNumberOfLabels();
00178 
00180   vtkStdString GetLabel(vtkIdType index);
00181 
00186   void SetIndexedLabels(vtkStringArray *labels);
00187 
00189   virtual vtkStringArray *GetIndexedLabels();
00190 
00192   vtkContextMapper2D* GetData();
00193 
00195 
00198   vtkGetMacro(UseIndexForXSeries, bool);
00200 
00202 
00205   vtkSetMacro(UseIndexForXSeries, bool);
00207 
00209 
00211   virtual void SetInputData(vtkTable *table);
00212   virtual void SetInputData(vtkTable *table, const vtkStdString &xColumn,
00213                             const vtkStdString &yColumn);
00214   void SetInputData(vtkTable *table, vtkIdType xColumn, vtkIdType yColumn);
00216 
00218   virtual vtkTable* GetInput();
00219 
00223   virtual void SetInputArray(int index, const vtkStdString &name);
00224 
00225   virtual void SetSelection(vtkIdTypeArray *id);
00226   vtkGetObjectMacro(Selection, vtkIdTypeArray);
00227 
00229 
00230   vtkGetObjectMacro(XAxis, vtkAxis);
00231   virtual void SetXAxis(vtkAxis* axis);
00233 
00235 
00236   vtkGetObjectMacro(YAxis, vtkAxis);
00237   virtual void SetYAxis(vtkAxis* axis);
00239 
00241 
00246   void SetShiftScale(const vtkRectd &scaling);
00247   vtkRectd GetShiftScale();
00249 
00251 
00253   virtual void GetBounds(double bounds[4])
00254   { bounds[0] = bounds[1] = bounds[2] = bounds[3] = 0.0; }
00256 
00258 
00272   virtual void GetUnscaledInputBounds(double bounds[4])
00273     {
00274     // Implemented here by calling GetBounds() to support plot
00275     // subclasses that do no log-scaling or plot orientation.
00276     return this->GetBounds(bounds);
00277     }
00279 
00280 //BTX
00282 
00284   virtual void SetProperty(const vtkStdString &property, const vtkVariant &var);
00285   virtual vtkVariant GetProperty(const vtkStdString &property);
00286 //ETX
00288 
00289 //BTX
00290 protected:
00291   vtkPlot();
00292   ~vtkPlot();
00293 
00295   vtkStdString GetNumber(double position, vtkAxis *axis);
00296 
00298   vtkSmartPointer<vtkPen> Pen;
00299 
00301   vtkSmartPointer<vtkBrush> Brush;
00302 
00305   vtkSmartPointer<vtkPen> SelectionPen;
00306 
00309   vtkSmartPointer<vtkBrush> SelectionBrush;
00310 
00312   vtkSmartPointer<vtkStringArray> Labels;
00313 
00315   vtkSmartPointer<vtkStringArray> AutoLabels;
00316 
00318   vtkSmartPointer<vtkStringArray> IndexedLabels;
00319 
00323   bool UseIndexForXSeries;
00324 
00327   vtkSmartPointer<vtkContextMapper2D> Data;
00328 
00330   vtkIdTypeArray *Selection;
00331 
00333   vtkAxis* XAxis;
00334 
00336   vtkAxis* YAxis;
00337 
00340   vtkStdString TooltipLabelFormat;
00341 
00344   vtkStdString TooltipDefaultLabelFormat;
00345 
00346   int TooltipNotation;
00347   int TooltipPrecision;
00348 
00350   vtkRectd ShiftScale;
00351 
00352 private:
00353   vtkPlot(const vtkPlot &); // Not implemented.
00354   void operator=(const vtkPlot &); // Not implemented.
00355 
00356 //ETX
00357 };
00358 
00359 #endif //vtkPlot_h