VTK  9.7.1
vtkChartPie.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3 
15 #ifndef vtkChartPie_h
16 #define vtkChartPie_h
17 
18 #include "vtkChart.h"
19 #include "vtkChartsCoreModule.h" // For export macro
20 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
21 
22 VTK_ABI_NAMESPACE_BEGIN
23 class vtkChartLegend;
24 class vtkTooltipItem;
25 class vtkChartPiePrivate;
26 class vtkPlotPie;
27 
28 class VTKCHARTSCORE_EXPORT VTK_MARSHALAUTO vtkChartPie : public vtkChart
29 {
30 public:
31  vtkTypeMacro(vtkChartPie, vtkChart);
32  void PrintSelf(ostream& os, vtkIndent indent) override;
33 
37  static vtkChartPie* New();
38 
44  void Update() override;
45 
49  bool Paint(vtkContext2D* painter) override;
50 
51  using vtkChart::AddPlot;
55  vtkPlot* AddPlot(int type) override;
56 
61  virtual void SetPlot(vtkPlotPie* plot);
62 
66  vtkPlot* GetPlot(vtkIdType index) override;
67 
71  vtkIdType GetNumberOfPlots() override;
72 
76  void SetShowLegend(bool visible) override;
77 
82  vtkChartLegend* GetLegend() override;
83 
87  void SetScene(vtkContextScene* scene) override;
88 
92  bool Hit(const vtkContextMouseEvent& mouse) override;
93 
97  bool MouseEnterEvent(const vtkContextMouseEvent& mouse) override;
98 
102  bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
103 
107  bool MouseLeaveEvent(const vtkContextMouseEvent& mouse) override;
108 
112  bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
113 
117  bool MouseButtonReleaseEvent(const vtkContextMouseEvent& mouse) override;
118 
122  bool MouseWheelEvent(const vtkContextMouseEvent& mouse, int delta) override;
123 
124 protected:
125  vtkChartPie();
126  ~vtkChartPie() override;
127 
131  void RecalculatePlotTransforms();
132 
137 
142 
147 
148 private:
149  vtkChartPie(const vtkChartPie&) = delete;
150  void operator=(const vtkChartPie&) = delete;
151 
155  bool LocatePointInPlots(const vtkContextMouseEvent& mouse);
156 
160  vtkChartPiePrivate* Private;
161 };
162 
163 VTK_ABI_NAMESPACE_END
164 #endif // vtkChartPie_h
bool PlotTransformValid
Does the plot area transform need to be recalculated?
Definition: vtkChartPie.h:146
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:136
int vtkIdType
Definition: vtkType.h:363
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:49
Factory class for drawing 2D charts.
Definition: vtkChart.h:41
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:28
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:43
virtual bool MouseEnterEvent(const vtkContextMouseEvent &mouse)
Mouse enter event.
Factory class for drawing pie charts.
Definition: vtkChartPie.h:28
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.
#define VTK_MARSHALAUTO
takes care of drawing 2D axes
vtkTooltipItem * Tooltip
The tooltip item for the chart - can be used to display extra information.
Definition: vtkChartPie.h:141
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
Class for drawing a Pie diagram.
Definition: vtkPlotPie.h:29
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.