VTK
vtkChart.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkChart.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
29 #ifndef __vtkChart_h
30 #define __vtkChart_h
31 
32 #include "vtkContextItem.h"
33 #include "vtkRect.h" // For vtkRectf
34 #include "vtkStdString.h" // For vtkStdString ivars
35 
36 class vtkTransform2D;
37 class vtkContextScene;
38 class vtkPlot;
39 class vtkAxis;
40 class vtkTextProperty;
41 class vtkChartLegend;
42 
43 class vtkInteractorStyle;
44 class vtkAnnotationLink;
45 
47 {
48 public:
49  vtkTypeMacro(vtkChart, vtkContextItem);
50  virtual void PrintSelf(ostream &os, vtkIndent indent);
51 
52 //BTX
54 
55  enum {
58  BAR,
59  STACKED};
61 
63 
64  enum {
65  PAN = 0,
68  NOTIFY
69  };
70 //ETX
72 
75  virtual bool Paint(vtkContext2D *painter) = 0;
76 
78  virtual vtkPlot* AddPlot(int type);
79 
82  virtual vtkIdType AddPlot(vtkPlot* plot);
83 
86  virtual bool RemovePlot(vtkIdType index);
87 
91  virtual bool RemovePlotInstance(vtkPlot* plot);
92 
94  virtual void ClearPlots();
95 
98  virtual vtkPlot* GetPlot(vtkIdType index);
99 
101  virtual vtkIdType GetNumberOfPlots();
102 
106  virtual vtkAxis* GetAxis(int axisIndex);
107 
109  virtual vtkIdType GetNumberOfAxes();
110 
114  virtual void RecalculateBounds();
115 
117  virtual void SetAnnotationLink(vtkAnnotationLink *link);
118 
120 
121  vtkGetObjectMacro(AnnotationLink, vtkAnnotationLink);
123 
125 
126  vtkSetVector2Macro(Geometry, int);
127  vtkGetVector2Macro(Geometry, int);
129 
131 
132  vtkSetVector2Macro(Point1, int);
133  vtkGetVector2Macro(Point1, int);
135 
137 
138  vtkSetVector2Macro(Point2, int);
139  vtkGetVector2Macro(Point2, int);
141 
143 
144  virtual void SetShowLegend(bool visible);
145  virtual bool GetShowLegend();
147 
150  virtual vtkChartLegend * GetLegend();
151 
153 
154  virtual void SetTitle(const vtkStdString &title);
155  virtual vtkStdString GetTitle();
157 
159 
161  vtkGetObjectMacro(TitleProperties, vtkTextProperty);
163 
165 
166  void SetBottomBorder(int border);
167  void SetTopBorder(int border);
168  void SetLeftBorder(int border);
169  void SetRightBorder(int border);
171 
173  void SetBorders(int left, int bottom, int right, int top);
174 
178  void SetSize(const vtkRectf &rect);
179 
181  vtkRectf GetSize();
182 
184 
186  vtkSetMacro(AutoSize, bool);
187  vtkGetMacro(AutoSize, bool);
189 
191 
196  vtkSetMacro(RenderEmpty, bool);
197  vtkGetMacro(RenderEmpty, bool);
199 
207  virtual void SetActionToButton(int action, int button);
208 
212  virtual int GetActionToButton(int action);
213 
217  virtual void SetClickActionToButton(int action, int button);
218 
222  virtual int GetClickActionToButton(int action);
223 
224 protected:
225  vtkChart();
226  ~vtkChart();
227 
229 
233  bool CalculatePlotTransform(vtkAxis *x, vtkAxis *y,
234  vtkTransform2D *transform);
236 
239 
241  int Geometry[2];
242 
244  int Point1[2];
245 
247  int Point2[2];
248 
251 
254 
257 
259  bool AutoSize;
261 
263 
265  {
266  public:
267  MouseActions();
268  short& Pan() { return Data[0]; }
269  short& Zoom() { return Data[1]; }
270  short& Select() { return Data[2]; }
271  short& operator[](int index) { return Data[index]; }
272  short Data[3];
273  };
275  {
276  public:
278  short& Notify() { return Data[0]; }
279  short& Select() { return Data[1]; }
280  short& operator[](int index) { return Data[index]; }
281  short Data[2];
282  };
284 
287 
288 private:
289  vtkChart(const vtkChart &); // Not implemented.
290  void operator=(const vtkChart &); // Not implemented.
291 };
292 
293 #endif //__vtkChart_h