VTK
vtkChartBox.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkChartBox.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 
27 #ifndef vtkChartBox_h
28 #define vtkChartBox_h
29 
30 #include "vtkChartsCoreModule.h" // For export macro
31 #include "vtkChart.h"
32 
33 class vtkIdTypeArray;
34 class vtkPlotBox;
35 class vtkStdString;
36 class vtkStringArray;
37 class vtkTooltipItem;
38 
39 class VTKCHARTSCORE_EXPORT vtkChartBox : public vtkChart
40 {
41 public:
42  vtkTypeMacro(vtkChartBox, vtkChart);
43  virtual void PrintSelf(ostream &os, vtkIndent indent);
44 
48  static vtkChartBox* New();
49 
55  virtual void Update();
56 
60  virtual bool Paint(vtkContext2D *painter);
61 
63 
66  void SetColumnVisibility(const vtkStdString& name, bool visible);
67  void SetColumnVisibility(vtkIdType column, bool visible);
69 
74  void SetColumnVisibilityAll(bool visible);
75 
77 
80  bool GetColumnVisibility(const vtkStdString& name);
81  bool GetColumnVisibility(vtkIdType column);
83 
87  vtkIdType GetColumnId(const vtkStdString& name);
88 
90 
93  vtkGetObjectMacro(VisibleColumns, vtkStringArray);
95 
96  // Index of the selected column in the visible columns list.
97  vtkGetMacro(SelectedColumn, int);
98  vtkSetMacro(SelectedColumn, int);
99 
103  virtual vtkPlot* GetPlot(vtkIdType index);
104 
108  virtual vtkIdType GetNumberOfPlots();
109 
113  virtual vtkAxis* GetYAxis();
114 
118  virtual float GetXPosition(int index);
119 
123  virtual vtkIdType GetNumberOfVisibleColumns();
124 
129  virtual void SetPlot(vtkPlotBox *plot);
130 
134  virtual bool Hit(const vtkContextMouseEvent &mouse);
135 
139  virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse);
140 
144  virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse);
145 
149  virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse);
150 
154  virtual void SetTooltip(vtkTooltipItem *tooltip);
155 
159  virtual vtkTooltipItem* GetTooltip();
160 
164  virtual void SetTooltipInfo(const vtkContextMouseEvent &,
165  const vtkVector2d &,
166  vtkIdType, vtkPlot*,
167  vtkIdType segmentIndex = -1);
168 
169 protected:
170  vtkChartBox();
171  ~vtkChartBox();
172 
174 
177  class Private;
178  Private *Storage;
180 
182 
187 
192 
194 
200 
205 
210 
211  void ResetSelection();
212  void UpdateGeometry(vtkContext2D*);
213  void CalculatePlotTransform();
214  void SwapAxes(int a1, int a2);
215 
221  bool LocatePointInPlots(const vtkContextMouseEvent &mouse,
222  int invokeEvent = -1);
223 
224  int LocatePointInPlot(const vtkVector2f &position,
225  const vtkVector2f &tolerance, vtkVector2f &plotPos,
226  vtkPlot *plot, vtkIdType &segmentIndex);
227 
228 private:
229  vtkChartBox(const vtkChartBox &) VTK_DELETE_FUNCTION;
230  void operator=(const vtkChartBox &) VTK_DELETE_FUNCTION;
231 
232 };
233 
235 
241 {
245  int Index;
246 };
248 
249 #endif //vtkChartBox_h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:47
Small struct used by InvokeEvent to send some information about the point that was clicked on...
Definition: vtkChartBox.h:240
vtkIdTypeArray * Selection
Selected indices for the table the plot is rendering.
Definition: vtkChartBox.h:186
vtkStringArray * VisibleColumns
A list of the visible columns in the chart.
Definition: vtkChartBox.h:191
virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse)
Mouse button down event Return true if the item holds the event, false if the event can be propagated...
vtkStdString SeriesName
Definition: vtkChartBox.h:242
vtkVector2f Position
Definition: vtkChartBox.h:243
record modification and/or execution time
Definition: vtkTimeStamp.h:35
a vtkAbstractArray subclass for strings
bool CalculatePlotTransform(vtkAxis *x, vtkAxis *y, vtkTransform2D *transform)
Given the x and y vtkAxis, and a transform, calculate the transform that the points in a chart would ...
dynamic, self-adjusting array of vtkIdType
virtual void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
int vtkIdType
Definition: vtkType.h:287
bool GeometryValid
Definition: vtkChartBox.h:181
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:57
Factory class for drawing 2D charts.
Definition: vtkChart.h:50
takes care of drawing 2D axes
Definition: vtkAxis.h:71
int SelectedColumn
Index of the selected column in the visible columns list.
Definition: vtkChartBox.h:197
data structure to represent mouse events.
a simple class to control print indentation
Definition: vtkIndent.h:39
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:327
virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse)
Mouse button release event.
virtual vtkIdType GetNumberOfPlots()
Get the number of plots the chart contains.
float SelectedColumnDelta
Index of the selected column in the visible columns list.
Definition: vtkChartBox.h:198
Abstract class for 2D plots.
Definition: vtkPlot.h:52
Class for drawing box plots.
Definition: vtkPlotBox.h:41
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
vtkTimeStamp BuildTime
The point cache is marked dirty until it has been initialized.
Definition: vtkChartBox.h:204
virtual bool Paint(vtkContext2D *painter)=0
Paint event for the chart, called whenever the chart needs to be drawn.
virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse)
Mouse move event.
virtual bool Hit(const vtkContextMouseEvent &mouse)
Return true if the supplied x, y coordinate is inside the item.
virtual vtkPlot * GetPlot(vtkIdType index)
Get the plot at the specified index, returns null if the index is invalid.
takes care of drawing 2D axes
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
vtkVector2i ScreenPosition
Definition: vtkChartBox.h:244
vtkSmartPointer< vtkTooltipItem > Tooltip
The tooltip item for the chart - can be used to display extra information.
Definition: vtkChartBox.h:209
virtual void Update()
Perform any updates to the item that may be necessary before rendering.
Factory class for drawing box plot charts.
Definition: vtkChartBox.h:39
Private * Storage
Definition: vtkChartBox.h:177