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
bool DrawAxesAtOrigin
Definition: vtkChartXY.h:235
#define VTK_CHARTS_EXPORT
Wrapper around vtkstd::string to keep symbols short.
Definition: vtkStdString.h:45
virtual void SetShowLegend(bool visible)
virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse)
virtual vtkIdType GetNumberOfAxes()
bool ForceAxesToBounds
Definition: vtkChartXY.h:254
virtual void RecalculateBounds()
virtual void PrintSelf(ostream &os, vtkIndent indent)
int vtkIdType
Definition: vtkType.h:255
int HiddenAxisBorder
Definition: vtkChartXY.h:241
vtkRectf MouseBox
Definition: vtkChartXY.h:224
vtkStdString SeriesName
Definition: vtkChartXY.h:288
virtual void ClearPlots()
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:54
Factory class for drawing 2D charts.
Definition: vtkChart.h:46
virtual bool RemovePlot(vtkIdType index)
virtual bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta)
takes care of drawing 2D axes
Definition: vtkAxis.h:44
data structure to represent mouse events.
vtkVector2i ScreenPosition
Definition: vtkChartXY.h:290
virtual vtkChartLegend * GetLegend()
a simple class to control print indentation
Definition: vtkIndent.h:37
bool DrawBox
Definition: vtkChartXY.h:227
virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse)
virtual vtkIdType GetNumberOfPlots()
Abstract class for 2D plots.
Definition: vtkPlot.h:50
vtkVector2f Position
Definition: vtkChartXY.h:289
vtkSmartPointer< vtkChartLegend > Legend
Definition: vtkChartXY.h:214
virtual bool MouseEnterEvent(const vtkContextMouseEvent &mouse)
Factory class for drawing XY charts.
Definition: vtkChartXY.h:46
draw the chart legend
virtual bool Paint(vtkContext2D *painter)=0
virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse)
takes care of drawing the plot grid
Definition: vtkPlotGrid.h:36
virtual bool Hit(const vtkContextMouseEvent &mouse)
virtual vtkPlot * GetPlot(vtkIdType index)
bool LayoutChanged
Definition: vtkChartXY.h:249
takes care of drawing 2D axes
bool AutoAxes
Definition: vtkChartXY.h:238
static vtkObject * New()
vtkSmartPointer< vtkTooltipItem > Tooltip
Definition: vtkChartXY.h:218
float BarWidthFraction
Definition: vtkChartXY.h:245
virtual void Update()
virtual bool MouseLeaveEvent(const vtkContextMouseEvent &mouse)
virtual vtkPlot * AddPlot(int type)
virtual vtkAxis * GetAxis(int axisIndex)
bool DrawNearestPoint
Definition: vtkChartXY.h:230
bool PlotTransformValid
Definition: vtkChartXY.h:221