VTK  9.1.0
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=========================================================================*/
43#ifndef vtkPieChartActor_h
44#define vtkPieChartActor_h
45
46#include "vtkActor2D.h"
47#include "vtkRenderingAnnotationModule.h" // For export macro
48
50class vtkAxisActor2D;
51class vtkDataObject;
52class vtkPolyData;
54class vtkTextMapper;
55class vtkTextProperty;
58class vtkPieChartActorConnection;
59class vtkPieceLabelArray;
60
61class VTKRENDERINGANNOTATION_EXPORT vtkPieChartActor : public vtkActor2D
62{
63public:
65
69 void PrintSelf(ostream& os, vtkIndent indent) override;
71
76
78
86
91
93
96 vtkSetMacro(TitleVisibility, vtkTypeBool);
97 vtkGetMacro(TitleVisibility, vtkTypeBool);
98 vtkBooleanMacro(TitleVisibility, vtkTypeBool);
100
102
105 vtkSetStringMacro(Title);
106 vtkGetStringMacro(Title);
108
110
115 vtkGetObjectMacro(TitleTextProperty, vtkTextProperty);
117
119
122 vtkSetMacro(LabelVisibility, vtkTypeBool);
123 vtkGetMacro(LabelVisibility, vtkTypeBool);
124 vtkBooleanMacro(LabelVisibility, vtkTypeBool);
126
128
133 vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
135
137
141 void SetPieceColor(int i, double r, double g, double b);
142 void SetPieceColor(int i, const double color[3])
143 {
144 this->SetPieceColor(i, color[0], color[1], color[2]);
145 }
146 double* GetPieceColor(int i);
148
150
154 void SetPieceLabel(const int i, const char*);
155 const char* GetPieceLabel(int i);
157
159
164 vtkSetMacro(LegendVisibility, vtkTypeBool);
165 vtkGetMacro(LegendVisibility, vtkTypeBool);
166 vtkBooleanMacro(LegendVisibility, vtkTypeBool);
168
170
174 vtkGetObjectMacro(LegendActor, vtkLegendBoxActor);
176
178
185
190
197
198protected:
201
202private:
203 vtkPieChartActorConnection* ConnectionHolder;
204
205 vtkIdType ArrayNumber;
206 vtkIdType ComponentNumber;
207 vtkTypeBool TitleVisibility; // Should I see the title?
208 char* Title; // The title string
209 vtkTextProperty* TitleTextProperty;
210 vtkTypeBool LabelVisibility;
211 vtkTextProperty* LabelTextProperty;
212 vtkPieceLabelArray* Labels;
213 vtkTypeBool LegendVisibility;
214 vtkLegendBoxActor* LegendActor;
215 vtkGlyphSource2D* GlyphSource;
216
217 // Local variables needed to plot
218 vtkIdType N; // The number of values
219 double Total; // The total of all values in the data array
220 double* Fractions; // The fraction of the pie
221
222 vtkTextMapper** PieceMappers; // a label for each radial spoke
223 vtkActor2D** PieceActors;
224
225 vtkTextMapper* TitleMapper;
226 vtkActor2D* TitleActor;
227
228 vtkPolyData* WebData; // The web of the spider plot
229 vtkPolyDataMapper2D* WebMapper;
230 vtkActor2D* WebActor;
231
232 vtkPolyData* PlotData; // The lines drawn within the axes
233 vtkPolyDataMapper2D* PlotMapper;
234 vtkActor2D* PlotActor;
235
236 vtkTimeStamp BuildTime;
237
238 double Center[3];
239 double Radius;
240
241 int LastPosition[2];
242 int LastPosition2[2];
243 double P1[3];
244 double P2[3];
245
246 void Initialize();
247 int PlaceAxes(vtkViewport* viewport, const int* size);
248 int BuildPlot(vtkViewport*);
249
250private:
251 vtkPieChartActor(const vtkPieChartActor&) = delete;
252 void operator=(const vtkPieChartActor&) = delete;
253};
254
255#endif
a actor that draws 2D data
Definition: vtkActor2D.h:49
Proxy object to connect input/output ports.
Create an axis with tick marks and labels.
general representation of visualization data
Definition: vtkDataObject.h:69
create 2D glyphs represented by vtkPolyData
a simple class to control print indentation
Definition: vtkIndent.h:43
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 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:95
2D text annotation
Definition: vtkTextMapper.h:57
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:42
abstract specification for Viewports
Definition: vtkViewport.h:56
window superclass for vtkRenderWindow
Definition: vtkWindow.h:45
@ color
Definition: vtkX3D.h:227
@ size
Definition: vtkX3D.h:259
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:332