VTK  9.3.0
vtkPieChartActor.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
34#ifndef vtkPieChartActor_h
35#define vtkPieChartActor_h
36
37#include "vtkActor2D.h"
38#include "vtkRenderingAnnotationModule.h" // For export macro
39
40VTK_ABI_NAMESPACE_BEGIN
42class vtkAxisActor2D;
43class vtkDataObject;
44class vtkPolyData;
46class vtkTextMapper;
47class vtkTextProperty;
50class vtkPieChartActorConnection;
51class vtkPieceLabelArray;
52
53class VTKRENDERINGANNOTATION_EXPORT vtkPieChartActor : public vtkActor2D
54{
55public:
57
61 void PrintSelf(ostream& os, vtkIndent indent) override;
63
68
70
78
83
85
88 vtkSetMacro(TitleVisibility, vtkTypeBool);
89 vtkGetMacro(TitleVisibility, vtkTypeBool);
90 vtkBooleanMacro(TitleVisibility, vtkTypeBool);
92
94
97 vtkSetStringMacro(Title);
98 vtkGetStringMacro(Title);
100
102
107 vtkGetObjectMacro(TitleTextProperty, vtkTextProperty);
109
111
114 vtkSetMacro(LabelVisibility, vtkTypeBool);
115 vtkGetMacro(LabelVisibility, vtkTypeBool);
116 vtkBooleanMacro(LabelVisibility, vtkTypeBool);
118
120
125 vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
127
129
133 void SetPieceColor(int i, double r, double g, double b);
134 void SetPieceColor(int i, const double color[3])
135 {
136 this->SetPieceColor(i, color[0], color[1], color[2]);
137 }
138 double* GetPieceColor(int i);
140
142
146 void SetPieceLabel(int i, const char*);
147 const char* GetPieceLabel(int i);
149
151
156 vtkSetMacro(LegendVisibility, vtkTypeBool);
157 vtkGetMacro(LegendVisibility, vtkTypeBool);
158 vtkBooleanMacro(LegendVisibility, vtkTypeBool);
160
162
166 vtkGetObjectMacro(LegendActor, vtkLegendBoxActor);
168
170
177
182
189
190protected:
193
194private:
195 vtkPieChartActorConnection* ConnectionHolder;
196
197 vtkIdType ArrayNumber;
198 vtkIdType ComponentNumber;
199 vtkTypeBool TitleVisibility; // Should I see the title?
200 char* Title; // The title string
201 vtkTextProperty* TitleTextProperty;
202 vtkTypeBool LabelVisibility;
203 vtkTextProperty* LabelTextProperty;
204 vtkPieceLabelArray* Labels;
205 vtkTypeBool LegendVisibility;
206 vtkLegendBoxActor* LegendActor;
207 vtkGlyphSource2D* GlyphSource;
208
209 // Local variables needed to plot
210 vtkIdType N; // The number of values
211 double Total; // The total of all values in the data array
212 double* Fractions; // The fraction of the pie
213
214 vtkTextMapper** PieceMappers; // a label for each radial spoke
215 vtkActor2D** PieceActors;
216
217 vtkTextMapper* TitleMapper;
218 vtkActor2D* TitleActor;
219
220 vtkPolyData* WebData; // The web of the spider plot
221 vtkPolyDataMapper2D* WebMapper;
222 vtkActor2D* WebActor;
223
224 vtkPolyData* PlotData; // The lines drawn within the axes
225 vtkPolyDataMapper2D* PlotMapper;
226 vtkActor2D* PlotActor;
227
228 vtkTimeStamp BuildTime;
229
230 double Center[3];
231 double Radius;
232
233 int LastPosition[2];
234 int LastPosition2[2];
235 double P1[3];
236 double P2[3];
237
238 void Initialize();
239 int PlaceAxes(vtkViewport* viewport, const int* size);
240 int BuildPlot(vtkViewport*);
241
242 vtkPieChartActor(const vtkPieChartActor&) = delete;
243 void operator=(const vtkPieChartActor&) = delete;
244};
245
246VTK_ABI_NAMESPACE_END
247#endif
a actor that draws 2D data
Definition vtkActor2D.h:44
Proxy object to connect input/output ports.
Create an axis with tick marks and labels.
general representation of visualization data
create 2D glyphs represented by vtkPolyData
a simple class to control print indentation
Definition vtkIndent.h:38
draw symbols with text
create a pie chart from an array
virtual void SetInputConnection(vtkAlgorithmOutput *)
Set the input to the pie chart actor.
const char * GetPieceLabel(int i)
Specify the names for each piece of pie.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
int RenderOpaqueGeometry(vtkViewport *) override
Draw the pie plot.
virtual void SetLabelTextProperty(vtkTextProperty *p)
Set/Get the labels text property.
static vtkPieChartActor * New()
Instantiate this class.
virtual void SetTitleTextProperty(vtkTextProperty *p)
Set/Get the title text property.
virtual vtkDataObject * GetInput()
Get the input data object to this actor.
double * GetPieceColor(int i)
Specify colors for each piece of pie.
void SetPieceColor(int i, const double color[3])
Specify colors for each piece of pie.
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Draw the pie plot.
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
~vtkPieChartActor() override
int RenderOverlay(vtkViewport *) override
Draw the pie plot.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for type information and printing.
virtual void SetInputData(vtkDataObject *)
Set the input to the pie chart actor.
void SetPieceColor(int i, double r, double g, double b)
Specify colors for each piece of pie.
void SetPieceLabel(int i, const char *)
Specify the names for each piece of pie.
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:89
2D text annotation
represent text properties.
record modification and/or execution time
abstract specification for Viewports
Definition vtkViewport.h:54
window superclass for vtkRenderWindow
Definition vtkWindow.h:34
int vtkTypeBool
Definition vtkABI.h:64
int vtkIdType
Definition vtkType.h:315