VTK
vtkChartXY.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkChartXY.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 
32 #ifndef __vtkChartXY_h
33 #define __vtkChartXY_h
34 
35 #include "vtkChart.h"
36 #include "vtkSmartPointer.h" // For SP ivars
37 #include "vtkVector.h" // For vtkVector2f in struct
38 
39 class vtkPlot;
40 class vtkAxis;
41 class vtkPlotGrid;
42 class vtkChartLegend;
43 class vtkTooltipItem;
44 class vtkChartXYPrivate; // Private class to keep my STL vector in...
45 
47 {
48 public:
49  vtkTypeMacro(vtkChartXY, vtkChart);
50  virtual void PrintSelf(ostream &os, vtkIndent indent);
51 
53  static vtkChartXY *New();
54 
58  virtual void Update();
59 
62  virtual bool Paint(vtkContext2D *painter);
63 
65  virtual vtkPlot * AddPlot(int type);
66 
68  virtual vtkIdType AddPlot(vtkPlot* plot);
69 
72  virtual bool RemovePlot(vtkIdType index);
73 
75  virtual void ClearPlots();
76 
79  virtual vtkPlot* GetPlot(vtkIdType index);
80 
82  virtual vtkIdType GetNumberOfPlots();
83 
85  int GetPlotCorner(vtkPlot *plot);
86 
88  void SetPlotCorner(vtkPlot *plot, int corner);
89 
93  virtual vtkAxis* GetAxis(int axisIndex);
94 
96  virtual void SetShowLegend(bool visible);
97 
99  virtual vtkChartLegend* GetLegend();
100 
102  virtual vtkTooltipItem* GetTooltip();
103 
105  virtual vtkIdType GetNumberOfAxes();
106 
110  virtual void RecalculateBounds();
111 
113 
114  vtkSetMacro(DrawAxesAtOrigin, bool);
115  vtkGetMacro(DrawAxesAtOrigin, bool);
116  vtkBooleanMacro(DrawAxesAtOrigin, bool);
118 
120 
122  vtkSetMacro(AutoAxes, bool);
123  vtkGetMacro(AutoAxes, bool);
124  vtkBooleanMacro(AutoAxes, bool);
126 
128 
129  vtkSetMacro(HiddenAxisBorder, int);
130  vtkGetMacro(HiddenAxisBorder, int);
132 
134 
137  vtkSetMacro(ForceAxesToBounds, bool);
138  vtkGetMacro(ForceAxesToBounds, bool);
139  vtkBooleanMacro(ForceAxesToBounds, bool);
141 
143 
149  vtkSetMacro(BarWidthFraction, float);
150  vtkGetMacro(BarWidthFraction, float);
152 
154 
155  virtual void SetTooltipInfo(const vtkContextMouseEvent &,
156  const vtkVector2f &,
157  vtkIdType, vtkPlot*,
158  vtkIdType segmentIndex = -1);
160 
161 //BTX
163  virtual bool Hit(const vtkContextMouseEvent &mouse);
164 
166  virtual bool MouseEnterEvent(const vtkContextMouseEvent &mouse);
167 
169  virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse);
170 
172  virtual bool MouseLeaveEvent(const vtkContextMouseEvent &mouse);
173 
175  virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse);
176 
178  virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse);
179 
181 
183  virtual bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta);
184 //ETX
186 
187 //BTX
188 protected:
189  vtkChartXY();
190  ~vtkChartXY();
191 
193  void RecalculatePlotTransforms();
194 
197  void RecalculatePlotBounds();
198 
202  virtual bool UpdateLayout(vtkContext2D* painter);
203 
207  virtual int GetLegendBorder(vtkContext2D* painter, int axisPosition);
208 
211  virtual void SetLegendPosition(const vtkRectf& rect);
212 
215 
219 
222 
225 
227  bool DrawBox;
228 
231 
236 
238  bool AutoAxes;
239 
242 
246 
250 
255 
256 private:
257  vtkChartXY(const vtkChartXY &); // Not implemented.
258  void operator=(const vtkChartXY &); // Not implemented.
259 
260  vtkChartXYPrivate *ChartPrivate; // Private class where I hide my STL containers
261 
264  void CalculateBarPlots();
265 
267 
270  bool LocatePointInPlots(const vtkContextMouseEvent &mouse,
271  int invokeEvent = -1);
273 
275  bool RemovePlotFromCorners(vtkPlot *plot);
276 
277  void ZoomInAxes(vtkAxis *x, vtkAxis *y, float *orign, float *max);
278 
279 //ETX
280 };
281 
283 
287 {
291  int Index;
292 };
294 
295 #endif //__vtkChartXY_h