VTK  9.5.20250718
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 "vtkNew.h" // For vtkNew
49#include "vtkRenderingAnnotationModule.h" // For export macro
50#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
51
52VTK_ABI_NAMESPACE_BEGIN
54class vtkAxisActor2D;
55class vtkDataObject;
56class vtkPolyData;
58class vtkTextMapper;
59class vtkTextProperty;
62class vtkPieChartActorConnection;
63class vtkPieceLabelArray;
64
65class VTKRENDERINGANNOTATION_EXPORT VTK_MARSHALAUTO vtkPieChartActor : public vtkActor2D
66{
67public:
69
73 void PrintSelf(ostream& os, vtkIndent indent) override;
75
80
82
88 virtual void SetInputData(vtkDataObject*);
89 virtual void SetInputConnection(vtkAlgorithmOutput*);
91
96 virtual vtkDataObject* GetInput();
97
99
102 vtkSetMacro(TitleVisibility, vtkTypeBool);
103 vtkGetMacro(TitleVisibility, vtkTypeBool);
104 vtkBooleanMacro(TitleVisibility, vtkTypeBool);
106
108
111 vtkSetStringMacro(Title);
112 vtkGetStringMacro(Title);
114
116
120 virtual void SetTitleTextProperty(vtkTextProperty* p);
121 vtkGetObjectMacro(TitleTextProperty, vtkTextProperty);
123
125
128 vtkSetMacro(LabelVisibility, vtkTypeBool);
129 vtkGetMacro(LabelVisibility, vtkTypeBool);
130 vtkBooleanMacro(LabelVisibility, vtkTypeBool);
132
134
138 virtual void SetLabelTextProperty(vtkTextProperty* p);
139 vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
141
143
147 void SetPieceColor(int i, double r, double g, double b);
148 void SetPieceColor(int i, const double color[3])
149 {
150 this->SetPieceColor(i, color[0], color[1], color[2]);
151 }
152 double* GetPieceColor(int i);
154
156
160 void SetPieceLabel(int i, const char*);
161 const char* GetPieceLabel(int i);
164
166
171 vtkSetMacro(LegendVisibility, vtkTypeBool);
172 vtkGetMacro(LegendVisibility, vtkTypeBool);
173 vtkBooleanMacro(LegendVisibility, vtkTypeBool);
175
177
181 vtkGetObjectMacro(LegendActor, vtkLegendBoxActor);
183
185
192
197
204
205protected:
208
209private:
210 vtkPieChartActorConnection* ConnectionHolder;
211
212 vtkIdType ArrayNumber;
213 vtkIdType ComponentNumber;
214 vtkTypeBool TitleVisibility; // Should I see the title?
215 char* Title; // The title string
216 vtkTextProperty* TitleTextProperty;
217 vtkTypeBool LabelVisibility;
218 vtkTextProperty* LabelTextProperty;
219 vtkPieceLabelArray* Labels;
220 vtkTypeBool LegendVisibility;
221 vtkNew<vtkLegendBoxActor> LegendActor;
222 vtkGlyphSource2D* GlyphSource;
223
224 // Local variables needed to plot
225 vtkIdType N; // The number of values
226 double Total; // The total of all values in the data array
227 double* Fractions; // The fraction of the pie
228
229 vtkTextMapper** PieceMappers; // a label for each radial spoke
230 vtkActor2D** PieceActors;
231
232 vtkTextMapper* TitleMapper;
233 vtkActor2D* TitleActor;
234
235 vtkPolyData* WebData; // The web of the spider plot
236 vtkPolyDataMapper2D* WebMapper;
237 vtkActor2D* WebActor;
238
239 vtkPolyData* PlotData; // The lines drawn within the axes
240 vtkPolyDataMapper2D* PlotMapper;
241 vtkActor2D* PlotActor;
242
243 vtkTimeStamp BuildTime;
244
245 double Center[3];
246 double Radius;
247
248 int LastPosition[2];
249 int LastPosition2[2];
250 double P1[3];
251 double P2[3];
252
253 void Initialize();
254 int PlaceAxes(vtkViewport* viewport, const int* size);
255 int BuildPlot(vtkViewport*);
256
257 vtkPieChartActor(const vtkPieChartActor&) = delete;
258 void operator=(const vtkPieChartActor&) = delete;
259};
260
261VTK_ABI_NAMESPACE_END
262#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
Allocate and hold a VTK object.
Definition vtkNew.h:167
create a pie chart from an array
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.
static vtkPieChartActor * New()
Instantiate this class.
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.
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
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_MARSHALSETTER(property)
#define VTK_MARSHALGETTER(property)
#define VTK_MARSHALAUTO