VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 "vtkChartsCoreModule.h" // For export macro
36 #include "vtkChart.h"
37 #include "vtkSmartPointer.h" // For SP ivars
38 #include "vtkVector.h" // For vtkVector2f in struct
39 #include "vtkContextPolygon.h" // For vtkContextPolygon
40 
41 class vtkPlot;
42 class vtkAxis;
43 class vtkPlotGrid;
44 class vtkChartLegend;
45 class vtkTooltipItem;
46 class vtkChartXYPrivate; // Private class to keep my STL vector in...
47 
49 {
50 public:
52  virtual void PrintSelf(ostream &os, vtkIndent indent);
53 
55  static vtkChartXY *New();
56 
60  virtual void Update();
61 
64  virtual bool Paint(vtkContext2D *painter);
65 
67  virtual vtkPlot * AddPlot(int type);
68 
70  virtual vtkIdType AddPlot(vtkPlot* plot);
71 
74  virtual bool RemovePlot(vtkIdType index);
75 
77  virtual void ClearPlots();
78 
81  virtual vtkPlot* GetPlot(vtkIdType index);
82 
84  virtual vtkIdType GetNumberOfPlots();
85 
87  int GetPlotCorner(vtkPlot *plot);
88 
90  void SetPlotCorner(vtkPlot *plot, int corner);
91 
95  virtual vtkAxis* GetAxis(int axisIndex);
96 
98  virtual void SetShowLegend(bool visible);
99 
101  virtual vtkChartLegend* GetLegend();
102 
104  virtual void SetTooltip(vtkTooltipItem *tooltip);
105 
107  virtual vtkTooltipItem* GetTooltip();
108 
110  virtual vtkIdType GetNumberOfAxes();
111 
115  virtual void RecalculateBounds();
116 
122  virtual void SetSelectionMethod(int method);
123 
125 
126  vtkSetMacro(DrawAxesAtOrigin, bool);
127  vtkGetMacro(DrawAxesAtOrigin, bool);
128  vtkBooleanMacro(DrawAxesAtOrigin, bool);
130 
132 
134  vtkSetMacro(AutoAxes, bool);
135  vtkGetMacro(AutoAxes, bool);
136  vtkBooleanMacro(AutoAxes, bool);
138 
140 
141  vtkSetMacro(HiddenAxisBorder, int);
142  vtkGetMacro(HiddenAxisBorder, int);
144 
146 
149  vtkSetMacro(ForceAxesToBounds, bool);
150  vtkGetMacro(ForceAxesToBounds, bool);
151  vtkBooleanMacro(ForceAxesToBounds, bool);
153 
155 
161  vtkSetMacro(BarWidthFraction, float);
162  vtkGetMacro(BarWidthFraction, float);
164 
166 
167  virtual void SetTooltipInfo(const vtkContextMouseEvent &,
168  const vtkVector2d &,
169  vtkIdType, vtkPlot*,
170  vtkIdType segmentIndex = -1);
172 
173 //BTX
175  virtual bool Hit(const vtkContextMouseEvent &mouse);
176 
178  virtual bool MouseEnterEvent(const vtkContextMouseEvent &mouse);
179 
181  virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse);
182 
184  virtual bool MouseLeaveEvent(const vtkContextMouseEvent &mouse);
185 
187  virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse);
188 
190  virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse);
191 
194  virtual bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta);
195 
197 
198  virtual bool KeyPressEvent(const vtkContextKeyEvent &key);
199 //ETX
201 
202 //BTX
203 protected:
204  vtkChartXY();
205  ~vtkChartXY();
206 
208  void RecalculatePlotTransforms();
209 
212  void RecalculatePlotBounds();
213 
217  virtual bool UpdateLayout(vtkContext2D* painter);
218 
222  virtual int GetLegendBorder(vtkContext2D* painter, int axisPosition);
223 
226  virtual void SetLegendPosition(const vtkRectf& rect);
227 
230 
234 
237 
240 
242  bool DrawBox;
243 
247 
250 
253 
258 
260  bool AutoAxes;
261 
264 
268 
272 
277 
278 private:
279  vtkChartXY(const vtkChartXY &); // Not implemented.
280  void operator=(const vtkChartXY &); // Not implemented.
281 
282  vtkChartXYPrivate *ChartPrivate; // Private class where I hide my STL containers
283 
286  void CalculateBarPlots();
287 
289 
292  bool LocatePointInPlots(const vtkContextMouseEvent &mouse,
293  int invokeEvent = -1);
295 
296  int LocatePointInPlot(const vtkVector2f &position,
297  const vtkVector2f &tolerance, vtkVector2f &plotPos,
298  vtkPlot *plot, vtkIdType &segmentIndex);
299 
301  bool RemovePlotFromCorners(vtkPlot *plot);
302 
303  void ZoomInAxes(vtkAxis *x, vtkAxis *y, float *orign, float *max);
304 
306 
307  void TransformBoxOrPolygon(bool polygonMode, vtkTransform2D *transform,
308  const vtkVector2f &mousePosition,
309  vtkVector2f &min, vtkVector2f &max,
310  vtkContextPolygon &polygon);
312 
313 //ETX
314 };
315 
317 
321 {
325  int Index;
326 };
328 
329 #endif //__vtkChartXY_h
bool DrawAxesAtOrigin
Definition: vtkChartXY.h:257
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:46
GLuint GLenum GLenum transform
Definition: vtkgl.h:16451
data structure to represent key events.
GLuint GLuint GLsizei GLenum type
Definition: vtkgl.h:11315
virtual void SetShowLegend(bool visible)
GLuint index
Definition: vtkgl.h:11983
virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse)
vtkContextPolygon SelectionPolygon
Definition: vtkChartXY.h:246
virtual vtkIdType GetNumberOfAxes()
bool ForceAxesToBounds
Definition: vtkChartXY.h:276
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
virtual void RecalculateBounds()
virtual void PrintSelf(ostream &os, vtkIndent indent)
int vtkIdType
Definition: vtkType.h:268
int HiddenAxisBorder
Definition: vtkChartXY.h:263
bool DrawSelectionPolygon
Definition: vtkChartXY.h:249
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
vtkRectf MouseBox
Definition: vtkChartXY.h:239
vtkStdString SeriesName
Definition: vtkChartXY.h:322
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
virtual void ClearPlots()
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:56
Factory class for drawing 2D charts.
Definition: vtkChart.h:49
virtual bool RemovePlot(vtkIdType index)
virtual bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta)
takes care of drawing 2D axes
Definition: vtkAxis.h:70
data structure to represent mouse events.
vtkVector2i ScreenPosition
Definition: vtkChartXY.h:324
virtual vtkChartLegend * GetLegend()
a simple class to control print indentation
Definition: vtkIndent.h:38
bool DrawBox
Definition: vtkChartXY.h:242
virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse)
virtual vtkIdType GetNumberOfPlots()
describes linear transformations via a 3x3 matrix
Abstract class for 2D plots.
Definition: vtkPlot.h:51
vtkVector2f Position
Definition: vtkChartXY.h:323
virtual bool KeyPressEvent(const vtkContextKeyEvent &key)
vtkSmartPointer< vtkChartLegend > Legend
Definition: vtkChartXY.h:229
virtual bool MouseEnterEvent(const vtkContextMouseEvent &mouse)
Factory class for drawing XY charts.
Definition: vtkChartXY.h:48
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:37
virtual bool Hit(const vtkContextMouseEvent &mouse)
virtual vtkPlot * GetPlot(vtkIdType index)
#define vtkBooleanMacro(name, type)
Definition: vtkSetGet.h:234
bool LayoutChanged
Definition: vtkChartXY.h:271
takes care of drawing 2D axes
bool AutoAxes
Definition: vtkChartXY.h:260
static vtkObject * New()
vtkSmartPointer< vtkTooltipItem > Tooltip
Definition: vtkChartXY.h:233
float BarWidthFraction
Definition: vtkChartXY.h:267
virtual void SetSelectionMethod(int method)
virtual void Update()
virtual bool MouseLeaveEvent(const vtkContextMouseEvent &mouse)
virtual vtkPlot * AddPlot(int type)
#define max(a, b)
#define VTKCHARTSCORE_EXPORT
virtual vtkAxis * GetAxis(int axisIndex)
bool DrawNearestPoint
Definition: vtkChartXY.h:252
#define vtkSetMacro(name, type)
Definition: vtkSetGet.h:69
bool PlotTransformValid
Definition: vtkChartXY.h:236