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 "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 00079 //BTX 00081 00083 virtual vtkStdString GetTooltipLabel(const vtkVector2f &plotPos, 00084 vtkIdType seriesIndex, 00085 vtkIdType segmentIndex); 00087 00089 00092 virtual vtkIdType GetNearestPoint(const vtkVector2f& point, 00093 const vtkVector2f& tolerance, 00094 vtkVector2f* location); 00096 00098 00099 virtual bool SelectPoints(const vtkVector2f& min, const vtkVector2f& max); 00100 //ETX 00102 00104 00105 virtual void SetColor(unsigned char r, unsigned char g, unsigned char b, 00106 unsigned char a); 00107 virtual void SetColor(double r, double g, double b); 00108 virtual void GetColor(double rgb[3]); 00109 void GetColor(unsigned char rgb[3]); 00111 00113 virtual void SetWidth(float width); 00114 00116 virtual float GetWidth(); 00117 00119 00121 vtkGetObjectMacro(Pen, vtkPen); 00123 00125 00127 vtkGetObjectMacro(Brush, vtkBrush); 00129 00131 virtual void SetLabel(const vtkStdString &label); 00132 00134 virtual vtkStdString GetLabel(); 00135 00138 virtual void SetLabels(vtkStringArray *labels); 00139 00143 virtual vtkStringArray *GetLabels(); 00144 00146 virtual int GetNumberOfLabels(); 00147 00149 vtkStdString GetLabel(vtkIdType index); 00150 00155 void SetIndexedLabels(vtkStringArray *labels); 00156 00158 virtual vtkStringArray *GetIndexedLabels(); 00159 00161 00162 vtkGetObjectMacro(Data, vtkContextMapper2D); 00164 00166 00169 vtkGetMacro(UseIndexForXSeries, bool); 00171 00173 00176 vtkSetMacro(UseIndexForXSeries, bool); 00178 00180 00182 virtual void SetInput(vtkTable *table); 00183 virtual void SetInput(vtkTable *table, const vtkStdString &xColumn, 00184 const vtkStdString &yColumn); 00185 void SetInput(vtkTable *table, vtkIdType xColumn, vtkIdType yColumn); 00187 00189 virtual vtkTable* GetInput(); 00190 00194 virtual void SetInputArray(int index, const vtkStdString &name); 00195 00196 virtual void SetSelection(vtkIdTypeArray *id); 00197 vtkGetObjectMacro(Selection, vtkIdTypeArray); 00198 00200 00201 vtkGetObjectMacro(XAxis, vtkAxis); 00202 virtual void SetXAxis(vtkAxis* axis); 00204 00206 00207 vtkGetObjectMacro(YAxis, vtkAxis); 00208 virtual void SetYAxis(vtkAxis* axis); 00210 00212 00213 virtual void GetBounds(double bounds[4]) 00214 { bounds[0] = bounds[1] = bounds[2] = bounds[3] = 0.0; } 00216 00217 //BTX 00219 00221 virtual void SetProperty(const vtkStdString &property, const vtkVariant &var); 00222 virtual vtkVariant GetProperty(const vtkStdString &property); 00223 //ETX 00225 00226 //BTX 00227 protected: 00228 vtkPlot(); 00229 ~vtkPlot(); 00230 00232 vtkStdString GetNumber(double position, vtkAxis *axis); 00233 00235 vtkPen* Pen; 00236 00238 vtkBrush* Brush; 00239 00241 vtkSmartPointer<vtkStringArray> Labels; 00242 00244 vtkSmartPointer<vtkStringArray> AutoLabels; 00245 00247 vtkSmartPointer<vtkStringArray> IndexedLabels; 00248 00252 bool UseIndexForXSeries; 00253 00256 vtkContextMapper2D *Data; 00257 00259 vtkIdTypeArray *Selection; 00260 00262 vtkAxis* XAxis; 00263 00265 vtkAxis* YAxis; 00266 00269 vtkStdString TooltipLabelFormat; 00270 00273 vtkStdString TooltipDefaultLabelFormat; 00274 00275 private: 00276 vtkPlot(const vtkPlot &); // Not implemented. 00277 void operator=(const vtkPlot &); // Not implemented. 00278 00279 //ETX 00280 }; 00281 00282 #endif //__vtkPlot_h