VTK: Rendering/Annotation/vtkPieChartActor.h Source File

| VTK 9.3.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
34 #ifndef vtkPieChartActor_h
35 #define vtkPieChartActor_h
36
37 #include "vtkActor2D.h"
38 #include "vtkRenderingAnnotationModule.h" // For export macro
39
40 VTK_ABI_NAMESPACE_BEGIN
41 class vtkAlgorithmOutput;
42 class vtkAxisActor2D;
43 class vtkDataObject;
44 class vtkPolyData;
45 class vtkPolyDataMapper2D;
46 class vtkTextMapper;
47 class vtkTextProperty;
48 class vtkLegendBoxActor;
49 class vtkGlyphSource2D;
50 class vtkPieChartActorConnection;
51 class vtkPieceLabelArray;
52
53 class VTKRENDERINGANNOTATION_EXPORT vtkPieChartActor : public vtkActor2D
54 {
55 public:
57
60 vtkTypeMacro(vtkPieChartActor, vtkActor2D);
61 void PrintSelf(ostream& os, vtkIndent indent) override;
63
67 static vtkPieChartActor* New();
68
70
75 virtual void SetInputData(vtkDataObject*);
76 virtual void SetInputConnection(vtkAlgorithmOutput*);
78
82 virtual vtkDataObject* GetInput();
83
85
88 vtkSetMacro(TitleVisibility, vtkTypeBool);
89 vtkGetMacro(TitleVisibility, vtkTypeBool);
90 vtkBooleanMacro(TitleVisibility, vtkTypeBool);
92
94
97 vtkSetStringMacro(Title);
98 vtkGetStringMacro(Title);
100
102
106 virtual void SetTitleTextProperty(vtkTextProperty* p);
107 vtkGetObjectMacro(TitleTextProperty, vtkTextProperty);
109
111
114 vtkSetMacro(LabelVisibility, vtkTypeBool);
115 vtkGetMacro(LabelVisibility, vtkTypeBool);
116 vtkBooleanMacro(LabelVisibility, vtkTypeBool);
118
120
124 virtual void SetLabelTextProperty(vtkTextProperty* p);
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
173 int RenderOverlay(vtkViewport*) override;
174 int RenderOpaqueGeometry(vtkViewport*) override;
175 int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
177
181 vtkTypeBool HasTranslucentPolygonalGeometry() override;
182
188 void ReleaseGraphicsResources(vtkWindow*) override;
189
190 protected:
191 vtkPieChartActor();
192 ~vtkPieChartActor() override;
193
194 private:
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
246 VTK_ABI_NAMESPACE_END
247 #endif
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:44
vtkAlgorithmOutput
Proxy object to connect input/output ports.
Definition: vtkAlgorithmOutput.h:41
vtkAxisActor2D
Create an axis with tick marks and labels.
Definition: vtkAxisActor2D.h:64
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:64
vtkGlyphSource2D
create 2D glyphs represented by vtkPolyData
Definition: vtkGlyphSource2D.h:63
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkLegendBoxActor
draw symbols with text
Definition: vtkLegendBoxActor.h:60
vtkPieChartActor
create a pie chart from an array
Definition: vtkPieChartActor.h:54
vtkPieChartActor::SetInputConnection
virtual void SetInputConnection(vtkAlgorithmOutput *)
Set the input to the pie chart actor.
vtkPieChartActor::New
static vtkPieChartActor * New()
Instantiate this class.
vtkPieChartActor::HasTranslucentPolygonalGeometry
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
vtkPieChartActor::RenderOpaqueGeometry
int RenderOpaqueGeometry(vtkViewport *) override
Draw the pie plot.
vtkPieChartActor::GetInput
virtual vtkDataObject * GetInput()
Get the input data object to this actor.
vtkPieChartActor::SetLabelTextProperty
virtual void SetLabelTextProperty(vtkTextProperty *p)
Set/Get the labels text property.
vtkPieChartActor::SetTitleTextProperty
virtual void SetTitleTextProperty(vtkTextProperty *p)
Set/Get the title text property.
vtkPieChartActor::SetPieceColor
void SetPieceColor(int i, const double color[3])
Specify colors for each piece of pie.
Definition: vtkPieChartActor.h:134
vtkPieChartActor::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Draw the pie plot.
Definition: vtkPieChartActor.h:175
vtkPieChartActor::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
vtkPieChartActor::GetPieceColor
double * GetPieceColor(int i)
Specify colors for each piece of pie.
vtkPieChartActor::~vtkPieChartActor
~vtkPieChartActor() override
vtkPieChartActor::RenderOverlay
int RenderOverlay(vtkViewport *) override
Draw the pie plot.
vtkPieChartActor::GetPieceLabel
const char * GetPieceLabel(int i)
Specify the names for each piece of pie.
vtkPieChartActor::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for type information and printing.
vtkPieChartActor::vtkPieChartActor
vtkPieChartActor()
vtkPieChartActor::SetInputData
virtual void SetInputData(vtkDataObject *)
Set the input to the pie chart actor.
vtkPieChartActor::SetPieceColor
void SetPieceColor(int i, double r, double g, double b)
Specify colors for each piece of pie.
vtkPieChartActor::SetPieceLabel
void SetPieceLabel(int i, const char *)
Specify the names for each piece of pie.
vtkPolyDataMapper2D
draw vtkPolyData onto the image plane
Definition: vtkPolyDataMapper2D.h:49
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:89
vtkTextMapper
2D text annotation
Definition: vtkTextMapper.h:49
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:35
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:34
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:54
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkX3D::color
@ color
Definition: vtkX3D.h:221
vtkX3D::size
@ size
Definition: vtkX3D.h:253
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:64
vtkActor2D.h
vtkIdType
int vtkIdType
Definition: vtkType.h:315