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 
24 #ifndef vtkChartPie_h
25 #define vtkChartPie_h
26 
27 #include "vtkChartsCoreModule.h" // For export macro
28 #include "vtkChart.h"
29 
30 class vtkChartLegend;
31 class vtkTooltipItem;
32 class vtkChartPiePrivate;
33 
34 class VTKCHARTSCORE_EXPORT vtkChartPie : public vtkChart
35 {
36 public:
37  vtkTypeMacro(vtkChartPie, vtkChart);
38  void PrintSelf(ostream &os, vtkIndent indent) override;
39 
43  static vtkChartPie *New();
44 
50  void Update() override;
51 
55  bool Paint(vtkContext2D *painter) override;
56 
60  vtkPlot * AddPlot(int type) override;
61 
65  vtkIdType AddPlot(vtkPlot* plot) override
66  { return Superclass::AddPlot(plot); }
67 
71  vtkPlot* GetPlot(vtkIdType index) override;
72 
76  vtkIdType GetNumberOfPlots() override;
77 
81  void SetShowLegend(bool visible) override;
82 
87  vtkChartLegend * GetLegend() override;
88 
92  void SetScene(vtkContextScene *scene) override;
93 
97  bool Hit(const vtkContextMouseEvent &mouse) override;
98 
102  bool MouseEnterEvent(const vtkContextMouseEvent &mouse) override;
103 
107  bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override;
108 
112  bool MouseLeaveEvent(const vtkContextMouseEvent &mouse) override;
113 
117  bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override;
118 
122  bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse) override;
123 
127  bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta) override;
128 
129 protected:
130  vtkChartPie();
131  ~vtkChartPie() override;
132 
136  void RecalculatePlotTransforms();
137 
142 
147 
152 
153 private:
154  vtkChartPie(const vtkChartPie &) = delete;
155  void operator=(const vtkChartPie &) = delete;
156 
160  bool LocatePointInPlots(const vtkContextMouseEvent &mouse);
161 
165  vtkChartPiePrivate *Private;
166 
167 };
168 
169 #endif //vtkChartPie_h
bool PlotTransformValid
Does the plot area transform need to be recalculated?
Definition: vtkChartPie.h:151
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:141
int vtkIdType
Definition: vtkType.h:347
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:52
Factory class for drawing 2D charts.
Definition: vtkChart.h:44
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:33
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:46
virtual bool MouseEnterEvent(const vtkContextMouseEvent &mouse)
Mouse enter event.
Factory class for drawing pie charts.
Definition: vtkChartPie.h:34
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:146
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:65
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.