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  void PrintSelf(ostream &os, vtkIndent indent) override;
44 
48  static vtkChartBox* New();
49 
55  void Update() override;
56 
60  bool Paint(vtkContext2D *painter) override;
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  vtkPlot* GetPlot(vtkIdType index) override;
104 
108  vtkIdType GetNumberOfPlots() override;
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  bool Hit(const vtkContextMouseEvent &mouse) override;
135 
139  bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override;
140 
144  bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override;
145 
149  bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse) override;
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() override;
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 &) = delete;
230  void operator=(const vtkChartBox &) = delete;
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:40
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
bool Paint(vtkContext2D *painter) override=0
Paint event for the chart, called whenever the chart needs to be drawn.
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
int vtkIdType
Definition: vtkType.h:347
bool GeometryValid
Definition: vtkChartBox.h:181
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:58
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:408
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
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTimeStamp BuildTime
The point cache is marked dirty until it has been initialized.
Definition: vtkChartBox.h:204
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