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 
24 #ifndef vtkChartBox_h
25 #define vtkChartBox_h
26 
27 #include "vtkChartsCoreModule.h" // For export macro
28 #include "vtkChart.h"
29 
30 class vtkIdTypeArray;
31 class vtkPlotBox;
32 class vtkStdString;
33 class vtkStringArray;
34 class vtkTooltipItem;
35 
36 class VTKCHARTSCORE_EXPORT vtkChartBox : public vtkChart
37 {
38 public:
39  vtkTypeMacro(vtkChartBox, vtkChart);
40  void PrintSelf(ostream &os, vtkIndent indent) override;
41 
45  static vtkChartBox* New();
46 
52  void Update() override;
53 
57  bool Paint(vtkContext2D *painter) override;
58 
60 
63  void SetColumnVisibility(const vtkStdString& name, bool visible);
64  void SetColumnVisibility(vtkIdType column, bool visible);
66 
71  void SetColumnVisibilityAll(bool visible);
72 
74 
77  bool GetColumnVisibility(const vtkStdString& name);
78  bool GetColumnVisibility(vtkIdType column);
80 
84  vtkIdType GetColumnId(const vtkStdString& name);
85 
87 
90  vtkGetObjectMacro(VisibleColumns, vtkStringArray);
92 
93  // Index of the selected column in the visible columns list.
94  vtkGetMacro(SelectedColumn, int);
95  vtkSetMacro(SelectedColumn, int);
96 
100  vtkPlot* GetPlot(vtkIdType index) override;
101 
105  vtkIdType GetNumberOfPlots() override;
106 
110  virtual vtkAxis* GetYAxis();
111 
115  virtual float GetXPosition(int index);
116 
120  virtual vtkIdType GetNumberOfVisibleColumns();
121 
126  virtual void SetPlot(vtkPlotBox *plot);
127 
131  bool Hit(const vtkContextMouseEvent &mouse) override;
132 
136  bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override;
137 
141  bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override;
142 
146  bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse) override;
147 
151  virtual void SetTooltip(vtkTooltipItem *tooltip);
152 
156  virtual vtkTooltipItem* GetTooltip();
157 
161  virtual void SetTooltipInfo(const vtkContextMouseEvent &,
162  const vtkVector2d &,
163  vtkIdType, vtkPlot*,
164  vtkIdType segmentIndex = -1);
165 
166 protected:
167  vtkChartBox();
168  ~vtkChartBox() override;
169 
171 
174  class Private;
175  Private *Storage;
177 
179 
184 
189 
191 
197 
202 
207 
208  void ResetSelection();
209  void UpdateGeometry(vtkContext2D*);
210  void CalculatePlotTransform();
211  void SwapAxes(int a1, int a2);
212 
218  bool LocatePointInPlots(const vtkContextMouseEvent &mouse,
219  int invokeEvent = -1);
220 
221  int LocatePointInPlot(const vtkVector2f &position,
222  const vtkVector2f &tolerance, vtkVector2f &plotPos,
223  vtkPlot *plot, vtkIdType &segmentIndex);
224 
225 private:
226  vtkChartBox(const vtkChartBox &) = delete;
227  void operator=(const vtkChartBox &) = delete;
228 
229 };
230 
232 
238 {
242  int Index;
243 };
245 
246 #endif //vtkChartBox_h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:34
Small struct used by InvokeEvent to send some information about the point that was clicked on...
Definition: vtkChartBox.h:237
vtkIdTypeArray * Selection
Selected indices for the table the plot is rendering.
Definition: vtkChartBox.h:183
vtkStringArray * VisibleColumns
A list of the visible columns in the chart.
Definition: vtkChartBox.h:188
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:239
vtkVector2f Position
Definition: vtkChartBox.h:240
record modification and/or execution time
Definition: vtkTimeStamp.h:32
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:345
bool GeometryValid
Definition: vtkChartBox.h:178
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:52
Factory class for drawing 2D charts.
Definition: vtkChart.h:44
takes care of drawing 2D axes
Definition: vtkAxis.h:68
int SelectedColumn
Index of the selected column in the visible columns list.
Definition: vtkChartBox.h:194
data structure to represent mouse events.
a simple class to control print indentation
Definition: vtkIndent.h:33
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:405
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:195
Abstract class for 2D plots.
Definition: vtkPlot.h:46
Class for drawing box plots.
Definition: vtkPlotBox.h:38
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:201
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:241
vtkSmartPointer< vtkTooltipItem > Tooltip
The tooltip item for the chart - can be used to display extra information.
Definition: vtkChartBox.h:206
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:36
Private * Storage
Definition: vtkChartBox.h:174