VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkChart.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 00029 #ifndef __vtkChart_h 00030 #define __vtkChart_h 00031 00032 #include "vtkContextItem.h" 00033 #include "vtkRect.h" // For vtkRectf 00034 #include "vtkStdString.h" // For vtkStdString ivars 00035 00036 class vtkTransform2D; 00037 class vtkContextScene; 00038 class vtkPlot; 00039 class vtkAxis; 00040 class vtkTextProperty; 00041 class vtkChartLegend; 00042 00043 class vtkInteractorStyle; 00044 class vtkAnnotationLink; 00045 00046 class VTK_CHARTS_EXPORT vtkChart : public vtkContextItem 00047 { 00048 public: 00049 vtkTypeMacro(vtkChart, vtkContextItem); 00050 virtual void PrintSelf(ostream &os, vtkIndent indent); 00051 00052 //BTX 00054 00055 enum { 00056 LINE, 00057 POINTS, 00058 BAR, 00059 STACKED}; 00061 00063 00064 enum { 00065 PAN = 0, 00066 ZOOM, 00067 SELECT, 00068 NOTIFY 00069 }; 00070 //ETX 00072 00075 virtual bool Paint(vtkContext2D *painter) = 0; 00076 00078 virtual vtkPlot* AddPlot(int type); 00079 00082 virtual vtkIdType AddPlot(vtkPlot* plot); 00083 00086 virtual bool RemovePlot(vtkIdType index); 00087 00091 virtual bool RemovePlotInstance(vtkPlot* plot); 00092 00094 virtual void ClearPlots(); 00095 00098 virtual vtkPlot* GetPlot(vtkIdType index); 00099 00101 virtual vtkIdType GetNumberOfPlots(); 00102 00106 virtual vtkAxis* GetAxis(int axisIndex); 00107 00109 virtual vtkIdType GetNumberOfAxes(); 00110 00114 virtual void RecalculateBounds(); 00115 00117 virtual void SetAnnotationLink(vtkAnnotationLink *link); 00118 00120 00121 vtkGetObjectMacro(AnnotationLink, vtkAnnotationLink); 00123 00125 00126 vtkSetVector2Macro(Geometry, int); 00127 vtkGetVector2Macro(Geometry, int); 00129 00131 00132 vtkSetVector2Macro(Point1, int); 00133 vtkGetVector2Macro(Point1, int); 00135 00137 00138 vtkSetVector2Macro(Point2, int); 00139 vtkGetVector2Macro(Point2, int); 00141 00143 00144 virtual void SetShowLegend(bool visible); 00145 virtual bool GetShowLegend(); 00147 00150 virtual vtkChartLegend * GetLegend(); 00151 00153 00154 virtual void SetTitle(const vtkStdString &title); 00155 virtual vtkStdString GetTitle(); 00157 00159 00161 vtkGetObjectMacro(TitleProperties, vtkTextProperty); 00163 00165 00166 void SetBottomBorder(int border); 00167 void SetTopBorder(int border); 00168 void SetLeftBorder(int border); 00169 void SetRightBorder(int border); 00171 00173 void SetBorders(int left, int bottom, int right, int top); 00174 00178 void SetSize(const vtkRectf &rect); 00179 00181 vtkRectf GetSize(); 00182 00184 00186 vtkSetMacro(AutoSize, bool); 00187 vtkGetMacro(AutoSize, bool); 00189 00191 00196 vtkSetMacro(RenderEmpty, bool); 00197 vtkGetMacro(RenderEmpty, bool); 00199 00207 virtual void SetActionToButton(int action, int button); 00208 00212 virtual int GetActionToButton(int action); 00213 00217 virtual void SetClickActionToButton(int action, int button); 00218 00222 virtual int GetClickActionToButton(int action); 00223 00224 protected: 00225 vtkChart(); 00226 ~vtkChart(); 00227 00229 00233 bool CalculatePlotTransform(vtkAxis *x, vtkAxis *y, 00234 vtkTransform2D *transform); 00236 00238 vtkAnnotationLink *AnnotationLink; 00239 00241 int Geometry[2]; 00242 00244 int Point1[2]; 00245 00247 int Point2[2]; 00248 00250 bool ShowLegend; 00251 00253 vtkStdString Title; 00254 00256 vtkTextProperty* TitleProperties; 00257 00258 vtkRectf Size; 00259 bool AutoSize; 00260 bool RenderEmpty; 00261 00263 00264 class MouseActions 00265 { 00266 public: 00267 MouseActions(); 00268 short& Pan() { return Data[0]; } 00269 short& Zoom() { return Data[1]; } 00270 short& Select() { return Data[2]; } 00271 short& operator[](int index) { return Data[index]; } 00272 short Data[3]; 00273 }; 00274 class MouseClickActions 00275 { 00276 public: 00277 MouseClickActions(); 00278 short& Notify() { return Data[0]; } 00279 short& Select() { return Data[1]; } 00280 short& operator[](int index) { return Data[index]; } 00281 short Data[2]; 00282 }; 00284 00285 MouseActions Actions; 00286 MouseClickActions ActionsClick; 00287 00288 private: 00289 vtkChart(const vtkChart &); // Not implemented. 00290 void operator=(const vtkChart &); // Not implemented. 00291 }; 00292 00293 #endif //__vtkChart_h