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 00041 class vtkVariant; 00042 class vtkTable; 00043 class vtkIdTypeArray; 00044 class vtkContextMapper2D; 00045 class vtkPen; 00046 class vtkBrush; 00047 class vtkAxis; 00048 class vtkVector2f; 00049 class vtkRectf; 00050 class vtkStringArray; 00051 00052 class VTKCHARTSCORE_EXPORT vtkPlot : public vtkContextItem 00053 { 00054 public: 00055 vtkTypeMacro(vtkPlot, vtkContextItem); 00056 virtual void PrintSelf(ostream &os, vtkIndent indent); 00057 00059 00064 virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf& rect, 00065 int legendIndex); 00067 00069 00077 virtual void SetTooltipLabelFormat(const vtkStdString &label); 00078 virtual vtkStdString GetTooltipLabelFormat(); 00080 00082 00083 virtual void SetTooltipNotation(int notation); 00084 virtual int GetTooltipNotation(); 00086 00088 00089 virtual void SetTooltipPrecision(int precision); 00090 virtual int GetTooltipPrecision(); 00092 00093 //BTX 00095 00097 virtual vtkStdString GetTooltipLabel(const vtkVector2f &plotPos, 00098 vtkIdType seriesIndex, 00099 vtkIdType segmentIndex); 00101 00103 00106 virtual vtkIdType GetNearestPoint(const vtkVector2f& point, 00107 const vtkVector2f& tolerance, 00108 vtkVector2f* location); 00110 00112 virtual bool SelectPoints(const vtkVector2f& min, const vtkVector2f& max); 00113 00115 00116 virtual bool SelectPointsInPolygon(const vtkContextPolygon &polygon); 00117 //ETX 00119 00121 00122 virtual void SetColor(unsigned char r, unsigned char g, unsigned char b, 00123 unsigned char a); 00124 virtual void SetColor(double r, double g, double b); 00125 virtual void GetColor(double rgb[3]); 00126 void GetColor(unsigned char rgb[3]); 00128 00130 virtual void SetWidth(float width); 00131 00133 virtual float GetWidth(); 00134 00136 00138 void SetPen(vtkPen *pen); 00139 vtkPen* GetPen(); 00141 00143 00144 void SetBrush(vtkBrush *brush); 00145 vtkBrush* GetBrush(); 00147 00149 virtual void SetLabel(const vtkStdString &label); 00150 00152 virtual vtkStdString GetLabel(); 00153 00156 virtual void SetLabels(vtkStringArray *labels); 00157 00161 virtual vtkStringArray *GetLabels(); 00162 00164 virtual int GetNumberOfLabels(); 00165 00167 vtkStdString GetLabel(vtkIdType index); 00168 00173 void SetIndexedLabels(vtkStringArray *labels); 00174 00176 virtual vtkStringArray *GetIndexedLabels(); 00177 00179 vtkContextMapper2D* GetData(); 00180 00182 00185 vtkGetMacro(UseIndexForXSeries, bool); 00187 00189 00192 vtkSetMacro(UseIndexForXSeries, bool); 00194 00196 00198 virtual void SetInputData(vtkTable *table); 00199 virtual void SetInputData(vtkTable *table, const vtkStdString &xColumn, 00200 const vtkStdString &yColumn); 00201 void SetInputData(vtkTable *table, vtkIdType xColumn, vtkIdType yColumn); 00203 00205 virtual vtkTable* GetInput(); 00206 00210 virtual void SetInputArray(int index, const vtkStdString &name); 00211 00212 virtual void SetSelection(vtkIdTypeArray *id); 00213 vtkGetObjectMacro(Selection, vtkIdTypeArray); 00214 00216 00217 vtkGetObjectMacro(XAxis, vtkAxis); 00218 virtual void SetXAxis(vtkAxis* axis); 00220 00222 00223 vtkGetObjectMacro(YAxis, vtkAxis); 00224 virtual void SetYAxis(vtkAxis* axis); 00226 00228 00230 virtual void GetBounds(double bounds[4]) 00231 { bounds[0] = bounds[1] = bounds[2] = bounds[3] = 0.0; } 00233 00235 00249 virtual void GetUnscaledInputBounds(double bounds[4]) 00250 { 00251 // Implemented here by calling GetBounds() to support plot 00252 // subclasses that do no log-scaling or plot orientation. 00253 return this->GetBounds(bounds); 00254 } 00256 00257 //BTX 00259 00261 virtual void SetProperty(const vtkStdString &property, const vtkVariant &var); 00262 virtual vtkVariant GetProperty(const vtkStdString &property); 00263 //ETX 00265 00266 //BTX 00267 protected: 00268 vtkPlot(); 00269 ~vtkPlot(); 00270 00272 vtkStdString GetNumber(double position, vtkAxis *axis); 00273 00275 vtkSmartPointer<vtkPen> Pen; 00276 00278 vtkSmartPointer<vtkBrush> Brush; 00279 00281 vtkSmartPointer<vtkStringArray> Labels; 00282 00284 vtkSmartPointer<vtkStringArray> AutoLabels; 00285 00287 vtkSmartPointer<vtkStringArray> IndexedLabels; 00288 00292 bool UseIndexForXSeries; 00293 00296 vtkSmartPointer<vtkContextMapper2D> Data; 00297 00299 vtkIdTypeArray *Selection; 00300 00302 vtkAxis* XAxis; 00303 00305 vtkAxis* YAxis; 00306 00309 vtkStdString TooltipLabelFormat; 00310 00313 vtkStdString TooltipDefaultLabelFormat; 00314 00315 int TooltipNotation; 00316 int TooltipPrecision; 00317 00318 private: 00319 vtkPlot(const vtkPlot &); // Not implemented. 00320 void operator=(const vtkPlot &); // Not implemented. 00321 00322 //ETX 00323 }; 00324 00325 #endif //__vtkPlot_h