VTK  9.5.2
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 "vtkRenderingAnnotationModule.h" // For export macro
30#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
31
32VTK_ABI_NAMESPACE_BEGIN
34class vtkAxisActor2D;
35class vtkDataObject;
36class vtkPolyData;
38class vtkTextMapper;
39class vtkTextProperty;
42class vtkPieChartActorConnection;
43class vtkPieceLabelArray;
44
45class VTKRENDERINGANNOTATION_EXPORT VTK_MARSHALAUTO vtkPieChartActor : public vtkActor2D
46{
47public:
49
53 void PrintSelf(ostream& os, vtkIndent indent) override;
55
60
62
70
75
77
80 vtkSetMacro(TitleVisibility, vtkTypeBool);
81 vtkGetMacro(TitleVisibility, vtkTypeBool);
82 vtkBooleanMacro(TitleVisibility, vtkTypeBool);
84
86
89 vtkSetStringMacro(Title);
90 vtkGetStringMacro(Title);
92
94
99 vtkGetObjectMacro(TitleTextProperty, vtkTextProperty);
101
103
106 vtkSetMacro(LabelVisibility, vtkTypeBool);
107 vtkGetMacro(LabelVisibility, vtkTypeBool);
108 vtkBooleanMacro(LabelVisibility, vtkTypeBool);
110
112
117 vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
119
121
125 void SetPieceColor(int i, double r, double g, double b);
126 void SetPieceColor(int i, const double color[3])
127 {
128 this->SetPieceColor(i, color[0], color[1], color[2]);
129 }
130 double* GetPieceColor(int i);
132
134
138 void SetPieceLabel(int i, const char*);
139 const char* GetPieceLabel(int i);
141
143
148 vtkSetMacro(LegendVisibility, vtkTypeBool);
149 vtkGetMacro(LegendVisibility, vtkTypeBool);
150 vtkBooleanMacro(LegendVisibility, vtkTypeBool);
152
154
158 vtkGetObjectMacro(LegendActor, vtkLegendBoxActor);
160
162
169
174
181
182protected:
185
186private:
187 vtkPieChartActorConnection* ConnectionHolder;
188
189 vtkIdType ArrayNumber;
190 vtkIdType ComponentNumber;
191 vtkTypeBool TitleVisibility; // Should I see the title?
192 char* Title; // The title string
193 vtkTextProperty* TitleTextProperty;
194 vtkTypeBool LabelVisibility;
195 vtkTextProperty* LabelTextProperty;
196 vtkPieceLabelArray* Labels;
197 vtkTypeBool LegendVisibility;
198 vtkLegendBoxActor* LegendActor;
199 vtkGlyphSource2D* GlyphSource;
200
201 // Local variables needed to plot
202 vtkIdType N; // The number of values
203 double Total; // The total of all values in the data array
204 double* Fractions; // The fraction of the pie
205
206 vtkTextMapper** PieceMappers; // a label for each radial spoke
207 vtkActor2D** PieceActors;
208
209 vtkTextMapper* TitleMapper;
210 vtkActor2D* TitleActor;
211
212 vtkPolyData* WebData; // The web of the spider plot
213 vtkPolyDataMapper2D* WebMapper;
214 vtkActor2D* WebActor;
215
216 vtkPolyData* PlotData; // The lines drawn within the axes
217 vtkPolyDataMapper2D* PlotMapper;
218 vtkActor2D* PlotActor;
219
220 vtkTimeStamp BuildTime;
221
222 double Center[3];
223 double Radius;
224
225 int LastPosition[2];
226 int LastPosition2[2];
227 double P1[3];
228 double P2[3];
229
230 void Initialize();
231 int PlaceAxes(vtkViewport* viewport, const int* size);
232 int BuildPlot(vtkViewport*);
233
234 vtkPieChartActor(const vtkPieChartActor&) = delete;
235 void operator=(const vtkPieChartActor&) = delete;
236};
237
238VTK_ABI_NAMESPACE_END
239#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
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: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:26
int vtkTypeBool
Definition vtkABI.h:64
virtual void Initialize()
int vtkIdType
Definition vtkType.h:332
#define VTK_MARSHALAUTO