VTK
|
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 virtual void SetLabel(const vtkStdString &label); 00149 00151 virtual vtkStdString GetLabel(); 00152 00155 virtual void SetLabels(vtkStringArray *labels); 00156 00160 virtual vtkStringArray *GetLabels(); 00161 00163 virtual int GetNumberOfLabels(); 00164 00166 vtkStdString GetLabel(vtkIdType index); 00167 00172 void SetIndexedLabels(vtkStringArray *labels); 00173 00175 virtual vtkStringArray *GetIndexedLabels(); 00176 00178 vtkContextMapper2D* GetData(); 00179 00181 00184 vtkGetMacro(UseIndexForXSeries, bool); 00186 00188 00191 vtkSetMacro(UseIndexForXSeries, bool); 00193 00195 00197 virtual void SetInputData(vtkTable *table); 00198 virtual void SetInputData(vtkTable *table, const vtkStdString &xColumn, 00199 const vtkStdString &yColumn); 00200 void SetInputData(vtkTable *table, vtkIdType xColumn, vtkIdType yColumn); 00202 00204 virtual vtkTable* GetInput(); 00205 00209 virtual void SetInputArray(int index, const vtkStdString &name); 00210 00211 virtual void SetSelection(vtkIdTypeArray *id); 00212 vtkGetObjectMacro(Selection, vtkIdTypeArray); 00213 00215 00216 vtkGetObjectMacro(XAxis, vtkAxis); 00217 virtual void SetXAxis(vtkAxis* axis); 00219 00221 00222 vtkGetObjectMacro(YAxis, vtkAxis); 00223 virtual void SetYAxis(vtkAxis* axis); 00225 00227 00232 void SetShiftScale(const vtkRectd &scaling); 00233 vtkRectd GetShiftScale(); 00235 00237 00239 virtual void GetBounds(double bounds[4]) 00240 { bounds[0] = bounds[1] = bounds[2] = bounds[3] = 0.0; } 00242 00244 00258 virtual void GetUnscaledInputBounds(double bounds[4]) 00259 { 00260 // Implemented here by calling GetBounds() to support plot 00261 // subclasses that do no log-scaling or plot orientation. 00262 return this->GetBounds(bounds); 00263 } 00265 00266 //BTX 00268 00270 virtual void SetProperty(const vtkStdString &property, const vtkVariant &var); 00271 virtual vtkVariant GetProperty(const vtkStdString &property); 00272 //ETX 00274 00275 //BTX 00276 protected: 00277 vtkPlot(); 00278 ~vtkPlot(); 00279 00281 vtkStdString GetNumber(double position, vtkAxis *axis); 00282 00284 vtkSmartPointer<vtkPen> Pen; 00285 00287 vtkSmartPointer<vtkBrush> Brush; 00288 00290 vtkSmartPointer<vtkStringArray> Labels; 00291 00293 vtkSmartPointer<vtkStringArray> AutoLabels; 00294 00296 vtkSmartPointer<vtkStringArray> IndexedLabels; 00297 00301 bool UseIndexForXSeries; 00302 00305 vtkSmartPointer<vtkContextMapper2D> Data; 00306 00308 vtkIdTypeArray *Selection; 00309 00311 vtkAxis* XAxis; 00312 00314 vtkAxis* YAxis; 00315 00318 vtkStdString TooltipLabelFormat; 00319 00322 vtkStdString TooltipDefaultLabelFormat; 00323 00324 int TooltipNotation; 00325 int TooltipPrecision; 00326 00328 vtkRectd ShiftScale; 00329 00330 private: 00331 vtkPlot(const vtkPlot &); // Not implemented. 00332 void operator=(const vtkPlot &); // Not implemented. 00333 00334 //ETX 00335 }; 00336 00337 #endif //__vtkPlot_h