VTK  9.6.1
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
24
25#ifndef vtkPieChartActor_h
26#define vtkPieChartActor_h
27
28#include "vtkActor2D.h"
29#include "vtkNew.h" // For vtkNew
30#include "vtkRenderingAnnotationModule.h" // For export macro
31#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
32
33VTK_ABI_NAMESPACE_BEGIN
35class vtkAxisActor2D;
36class vtkDataObject;
37class vtkPolyData;
39class vtkTextMapper;
40class vtkTextProperty;
43class vtkPieChartActorConnection;
44class vtkPieceLabelArray;
45
46class VTKRENDERINGANNOTATION_EXPORT VTK_MARSHALAUTO vtkPieChartActor : public vtkActor2D
47{
48public:
50
54 void PrintSelf(ostream& os, vtkIndent indent) override;
56
61
63
72
78
80
83 vtkSetMacro(TitleVisibility, vtkTypeBool);
84 vtkGetMacro(TitleVisibility, vtkTypeBool);
85 vtkBooleanMacro(TitleVisibility, vtkTypeBool);
87
89
92 vtkSetStringMacro(Title);
93 vtkGetStringMacro(Title);
95
97
102 vtkGetObjectMacro(TitleTextProperty, vtkTextProperty);
104
106
109 vtkSetMacro(LabelVisibility, vtkTypeBool);
110 vtkGetMacro(LabelVisibility, vtkTypeBool);
111 vtkBooleanMacro(LabelVisibility, vtkTypeBool);
113
115
120 vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
122
124
128 void SetPieceColor(int i, double r, double g, double b);
129 void SetPieceColor(int i, const double color[3])
130 {
131 this->SetPieceColor(i, color[0], color[1], color[2]);
132 }
133 double* GetPieceColor(int i);
135
137
141 void SetPieceLabel(int i, const char*);
142 const char* GetPieceLabel(int i);
145
147
152 vtkSetMacro(LegendVisibility, vtkTypeBool);
153 vtkGetMacro(LegendVisibility, vtkTypeBool);
154 vtkBooleanMacro(LegendVisibility, vtkTypeBool);
156
158
162 vtkGetObjectMacro(LegendActor, vtkLegendBoxActor);
164
166
173
178
185
186protected:
189
190private:
191 vtkPieChartActorConnection* ConnectionHolder;
192
193 vtkIdType ArrayNumber;
194 vtkIdType ComponentNumber;
195 vtkTypeBool TitleVisibility; // Should I see the title?
196 char* Title; // The title string
197 vtkTextProperty* TitleTextProperty;
198 vtkTypeBool LabelVisibility;
199 vtkTextProperty* LabelTextProperty;
200 vtkPieceLabelArray* Labels;
201 vtkTypeBool LegendVisibility;
202 vtkNew<vtkLegendBoxActor> LegendActor;
203 vtkGlyphSource2D* GlyphSource;
204
205 // Local variables needed to plot
206 vtkIdType N; // The number of values
207 double Total; // The total of all values in the data array
208 double* Fractions; // The fraction of the pie
209
210 vtkTextMapper** PieceMappers; // a label for each radial spoke
211 vtkActor2D** PieceActors;
212
213 vtkTextMapper* TitleMapper;
214 vtkActor2D* TitleActor;
215
216 vtkPolyData* WebData; // The web of the spider plot
217 vtkPolyDataMapper2D* WebMapper;
218 vtkActor2D* WebActor;
219
220 vtkPolyData* PlotData; // The lines drawn within the axes
221 vtkPolyDataMapper2D* PlotMapper;
222 vtkActor2D* PlotActor;
223
224 vtkTimeStamp BuildTime;
225
226 double Center[3];
227 double Radius;
228
229 int LastPosition[2];
230 int LastPosition2[2];
231 double P1[3];
232 double P2[3];
233
234 void Initialize();
235 int PlaceAxes(vtkViewport* viewport, const int* size);
236 int BuildPlot(vtkViewport*);
237
238 vtkPieChartActor(const vtkPieChartActor&) = delete;
239 void operator=(const vtkPieChartActor&) = delete;
240};
241
242VTK_ABI_NAMESPACE_END
243#endif
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:29
draw symbols with text
Allocate and hold a VTK object.
Definition vtkNew.h:58
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.
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.
int GetNumberOfPieceLabels()
Specify the names 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:72
2D text annotation
represent text properties.
record modification and/or execution time
abstract specification for Viewports
Definition vtkViewport.h:47
window superclass for vtkRenderWindow
Definition vtkWindow.h:29
int vtkTypeBool
Definition vtkABI.h:64
virtual void Initialize()
int vtkIdType
Definition vtkType.h:368
#define VTK_MARSHALSETTER(property)
#define VTK_MARSHALGETTER(property)
#define VTK_MARSHALAUTO