VTK  9.2.6
vtkPieChartActor.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkPieChartActor.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
36
37#ifndef vtkPieChartActor_h
38#define vtkPieChartActor_h
39
40#include "vtkActor2D.h"
41#include "vtkRenderingAnnotationModule.h" // For export macro
42
44class vtkAxisActor2D;
45class vtkDataObject;
46class vtkPolyData;
48class vtkTextMapper;
49class vtkTextProperty;
52class vtkPieChartActorConnection;
53class vtkPieceLabelArray;
54
55class VTKRENDERINGANNOTATION_EXPORT vtkPieChartActor : public vtkActor2D
56{
57public:
59
63 void PrintSelf(ostream& os, vtkIndent indent) override;
65
70
72
80
85
87
90 vtkSetMacro(TitleVisibility, vtkTypeBool);
91 vtkGetMacro(TitleVisibility, vtkTypeBool);
92 vtkBooleanMacro(TitleVisibility, vtkTypeBool);
94
96
99 vtkSetStringMacro(Title);
100 vtkGetStringMacro(Title);
102
104
109 vtkGetObjectMacro(TitleTextProperty, vtkTextProperty);
111
113
116 vtkSetMacro(LabelVisibility, vtkTypeBool);
117 vtkGetMacro(LabelVisibility, vtkTypeBool);
118 vtkBooleanMacro(LabelVisibility, vtkTypeBool);
120
122
127 vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
129
131
135 void SetPieceColor(int i, double r, double g, double b);
136 void SetPieceColor(int i, const double color[3])
137 {
138 this->SetPieceColor(i, color[0], color[1], color[2]);
139 }
140 double* GetPieceColor(int i);
142
144
148 void SetPieceLabel(const int i, const char*);
149 const char* GetPieceLabel(int i);
151
153
158 vtkSetMacro(LegendVisibility, vtkTypeBool);
159 vtkGetMacro(LegendVisibility, vtkTypeBool);
160 vtkBooleanMacro(LegendVisibility, vtkTypeBool);
162
164
168 vtkGetObjectMacro(LegendActor, vtkLegendBoxActor);
170
172
179
184
191
192protected:
195
196private:
197 vtkPieChartActorConnection* ConnectionHolder;
198
199 vtkIdType ArrayNumber;
200 vtkIdType ComponentNumber;
201 vtkTypeBool TitleVisibility; // Should I see the title?
202 char* Title; // The title string
203 vtkTextProperty* TitleTextProperty;
204 vtkTypeBool LabelVisibility;
205 vtkTextProperty* LabelTextProperty;
206 vtkPieceLabelArray* Labels;
207 vtkTypeBool LegendVisibility;
208 vtkLegendBoxActor* LegendActor;
209 vtkGlyphSource2D* GlyphSource;
210
211 // Local variables needed to plot
212 vtkIdType N; // The number of values
213 double Total; // The total of all values in the data array
214 double* Fractions; // The fraction of the pie
215
216 vtkTextMapper** PieceMappers; // a label for each radial spoke
217 vtkActor2D** PieceActors;
218
219 vtkTextMapper* TitleMapper;
220 vtkActor2D* TitleActor;
221
222 vtkPolyData* WebData; // The web of the spider plot
223 vtkPolyDataMapper2D* WebMapper;
224 vtkActor2D* WebActor;
225
226 vtkPolyData* PlotData; // The lines drawn within the axes
227 vtkPolyDataMapper2D* PlotMapper;
228 vtkActor2D* PlotActor;
229
230 vtkTimeStamp BuildTime;
231
232 double Center[3];
233 double Radius;
234
235 int LastPosition[2];
236 int LastPosition2[2];
237 double P1[3];
238 double P2[3];
239
240 void Initialize();
241 int PlaceAxes(vtkViewport* viewport, const int* size);
242 int BuildPlot(vtkViewport*);
243
244private:
245 vtkPieChartActor(const vtkPieChartActor&) = delete;
246 void operator=(const vtkPieChartActor&) = delete;
247};
248
249#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:40
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 SetPieceLabel(const int i, const char *)
Specify the names for each piece of pie.
void SetPieceColor(int i, double r, double g, double b)
Specify colors for each piece of pie.
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:91
2D text annotation
represent text properties.
record modification and/or execution time
abstract specification for Viewports
Definition vtkViewport.h:56
window superclass for vtkRenderWindow
Definition vtkWindow.h:39
int vtkTypeBool
Definition vtkABI.h:69
int vtkIdType
Definition vtkType.h:332