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 
182  virtual bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta);
183 
185 
186  virtual bool KeyPressEvent(const vtkContextKeyEvent &key);
187 //ETX
189 
190 //BTX
191 protected:
192  vtkChartXY();
193  ~vtkChartXY();
194 
196  void RecalculatePlotTransforms();
197 
200  void RecalculatePlotBounds();
201 
205  virtual bool UpdateLayout(vtkContext2D* painter);
206 
210  virtual int GetLegendBorder(vtkContext2D* painter, int axisPosition);
211 
214  virtual void SetLegendPosition(const vtkRectf& rect);
215 
218 
222 
225 
228 
230  bool DrawBox;
231 
234 
239 
241  bool AutoAxes;
242 
245 
249 
253 
258 
259 private:
260  vtkChartXY(const vtkChartXY &); // Not implemented.
261  void operator=(const vtkChartXY &); // Not implemented.
262 
263  vtkChartXYPrivate *ChartPrivate; // Private class where I hide my STL containers
264 
267  void CalculateBarPlots();
268 
270 
273  bool LocatePointInPlots(const vtkContextMouseEvent &mouse,
274  int invokeEvent = -1);
276 
278  bool RemovePlotFromCorners(vtkPlot *plot);
279 
280  void ZoomInAxes(vtkAxis *x, vtkAxis *y, float *orign, float *max);
281 
282 //ETX
283 };
284 
286 
290 {
294  int Index;
295 };
297 
298 #endif //__vtkChartXY_h