Loading [MathJax]/extensions/tex2jax.js
VTK  9.4.20250415
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
44#ifndef vtkPieChartActor_h
45#define vtkPieChartActor_h
46
47#include "vtkActor2D.h"
48#include "vtkRenderingAnnotationModule.h" // For export macro
49#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
50
51VTK_ABI_NAMESPACE_BEGIN
53class vtkAxisActor2D;
54class vtkDataObject;
55class vtkPolyData;
57class vtkTextMapper;
58class vtkTextProperty;
61class vtkPieChartActorConnection;
62class vtkPieceLabelArray;
63
64class VTKRENDERINGANNOTATION_EXPORT VTK_MARSHALAUTO vtkPieChartActor : public vtkActor2D
65{
66public:
68
72 void PrintSelf(ostream& os, vtkIndent indent) override;
74
79
81
89
94
96
99 vtkSetMacro(TitleVisibility, vtkTypeBool);
100 vtkGetMacro(TitleVisibility, vtkTypeBool);
101 vtkBooleanMacro(TitleVisibility, vtkTypeBool);
103
105
108 vtkSetStringMacro(Title);
109 vtkGetStringMacro(Title);
111
113
118 vtkGetObjectMacro(TitleTextProperty, vtkTextProperty);
120
122
125 vtkSetMacro(LabelVisibility, vtkTypeBool);
126 vtkGetMacro(LabelVisibility, vtkTypeBool);
127 vtkBooleanMacro(LabelVisibility, vtkTypeBool);
129
131
136 vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
138
140
144 void SetPieceColor(int i, double r, double g, double b);
145 void SetPieceColor(int i, const double color[3])
146 {
147 this->SetPieceColor(i, color[0], color[1], color[2]);
148 }
149 double* GetPieceColor(int i);
151
153
157 void SetPieceLabel(int i, const char*);
158 const char* GetPieceLabel(int i);
160
162
167 vtkSetMacro(LegendVisibility, vtkTypeBool);
168 vtkGetMacro(LegendVisibility, vtkTypeBool);
169 vtkBooleanMacro(LegendVisibility, vtkTypeBool);
171
173
177 vtkGetObjectMacro(LegendActor, vtkLegendBoxActor);
179
181
188
193
200
201protected:
204
205private:
206 vtkPieChartActorConnection* ConnectionHolder;
207
208 vtkIdType ArrayNumber;
209 vtkIdType ComponentNumber;
210 vtkTypeBool TitleVisibility; // Should I see the title?
211 char* Title; // The title string
212 vtkTextProperty* TitleTextProperty;
213 vtkTypeBool LabelVisibility;
214 vtkTextProperty* LabelTextProperty;
215 vtkPieceLabelArray* Labels;
216 vtkTypeBool LegendVisibility;
217 vtkLegendBoxActor* LegendActor;
218 vtkGlyphSource2D* GlyphSource;
219
220 // Local variables needed to plot
221 vtkIdType N; // The number of values
222 double Total; // The total of all values in the data array
223 double* Fractions; // The fraction of the pie
224
225 vtkTextMapper** PieceMappers; // a label for each radial spoke
226 vtkActor2D** PieceActors;
227
228 vtkTextMapper* TitleMapper;
229 vtkActor2D* TitleActor;
230
231 vtkPolyData* WebData; // The web of the spider plot
232 vtkPolyDataMapper2D* WebMapper;
233 vtkActor2D* WebActor;
234
235 vtkPolyData* PlotData; // The lines drawn within the axes
236 vtkPolyDataMapper2D* PlotMapper;
237 vtkActor2D* PlotActor;
238
239 vtkTimeStamp BuildTime;
240
241 double Center[3];
242 double Radius;
243
244 int LastPosition[2];
245 int LastPosition2[2];
246 double P1[3];
247 double P2[3];
248
249 void Initialize();
250 int PlaceAxes(vtkViewport* viewport, const int* size);
251 int BuildPlot(vtkViewport*);
252
253 vtkPieChartActor(const vtkPieChartActor&) = delete;
254 void operator=(const vtkPieChartActor&) = delete;
255};
256
257VTK_ABI_NAMESPACE_END
258#endif
a actor that draws 2D data
Definition vtkActor2D.h:145
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:108
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
2D text annotation
represent text properties.
record modification and/or execution time
abstract specification for Viewports
Definition vtkViewport.h:66
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
int vtkTypeBool
Definition vtkABI.h:64
int vtkIdType
Definition vtkType.h:332
#define VTK_MARSHALAUTO