VTK
vtkChartPie.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkChartPie.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 vtkChartPie_h
28 #define vtkChartPie_h
29 
30 #include "vtkChartsCoreModule.h" // For export macro
31 #include "vtkChart.h"
32 
33 class vtkChartLegend;
34 class vtkTooltipItem;
35 class vtkChartPiePrivate;
36 
37 class VTKCHARTSCORE_EXPORT vtkChartPie : public vtkChart
38 {
39 public:
40  vtkTypeMacro(vtkChartPie, vtkChart);
41  void PrintSelf(ostream &os, vtkIndent indent) override;
42 
46  static vtkChartPie *New();
47 
53  void Update() override;
54 
58  bool Paint(vtkContext2D *painter) override;
59 
63  vtkPlot * AddPlot(int type) override;
64 
68  vtkIdType AddPlot(vtkPlot* plot) override
69  { return Superclass::AddPlot(plot); }
70 
74  vtkPlot* GetPlot(vtkIdType index) override;
75 
79  vtkIdType GetNumberOfPlots() override;
80 
84  void SetShowLegend(bool visible) override;
85 
90  vtkChartLegend * GetLegend() override;
91 
95  void SetScene(vtkContextScene *scene) override;
96 
100  bool Hit(const vtkContextMouseEvent &mouse) override;
101 
105  bool MouseEnterEvent(const vtkContextMouseEvent &mouse) override;
106 
110  bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override;
111 
115  bool MouseLeaveEvent(const vtkContextMouseEvent &mouse) override;
116 
120  bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override;
121 
125  bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse) override;
126 
130  bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta) override;
131 
132 protected:
133  vtkChartPie();
134  ~vtkChartPie() override;
135 
139  void RecalculatePlotTransforms();
140 
145 
150 
155 
156 private:
157  vtkChartPie(const vtkChartPie &) = delete;
158  void operator=(const vtkChartPie &) = delete;
159 
163  bool LocatePointInPlots(const vtkContextMouseEvent &mouse);
164 
168  vtkChartPiePrivate *Private;
169 
170 };
171 
172 #endif //vtkChartPie_h
bool PlotTransformValid
Does the plot area transform need to be recalculated?
Definition: vtkChartPie.h:154
virtual void SetShowLegend(bool visible)
Set/get whether the chart should draw a legend.
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...
bool Paint(vtkContext2D *painter) override=0
Paint event for the chart, called whenever the chart needs to be drawn.
vtkChartLegend * Legend
The legend for the chart.
Definition: vtkChartPie.h:144
int vtkIdType
Definition: vtkType.h:347
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:58
Factory class for drawing 2D charts.
Definition: vtkChart.h:50
virtual void SetScene(vtkContextScene *scene)
Set the vtkContextScene for the item, always set for an item in a scene.
virtual bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta)
Mouse wheel event, positive delta indicates forward movement of the wheel.
Provides a 2D scene for vtkContextItem objects.
data structure to represent mouse events.
virtual vtkChartLegend * GetLegend()
Get the legend for the chart, if available.
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse)
Mouse button release event.
virtual vtkIdType GetNumberOfPlots()
Get the number of plots the chart contains.
Abstract class for 2D plots.
Definition: vtkPlot.h:52
virtual bool MouseEnterEvent(const vtkContextMouseEvent &mouse)
Mouse enter event.
Factory class for drawing pie charts.
Definition: vtkChartPie.h:37
draw the chart legend
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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
vtkTooltipItem * Tooltip
The tooltip item for the chart - can be used to display extra information.
Definition: vtkChartPie.h:149
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
vtkIdType AddPlot(vtkPlot *plot) override
Add a plot to the chart.
Definition: vtkChartPie.h:68
virtual void Update()
Perform any updates to the item that may be necessary before rendering.
virtual bool MouseLeaveEvent(const vtkContextMouseEvent &mouse)
Mouse leave event.
virtual vtkPlot * AddPlot(int type)
Add a plot to the chart, defaults to using the name of the y column.