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=========================================================================*/
53#ifndef vtkPieChartActor_h
54#define vtkPieChartActor_h
55
56#include "vtkActor2D.h"
57#include "vtkRenderingAnnotationModule.h" // For export macro
58
60class vtkAxisActor2D;
61class vtkDataObject;
62class vtkPolyData;
64class vtkTextMapper;
65class vtkTextProperty;
68class vtkPieChartActorConnection;
69class vtkPieceLabelArray;
70
71class VTKRENDERINGANNOTATION_EXPORT vtkPieChartActor : public vtkActor2D
72{
73public:
75
79 void PrintSelf(ostream& os, vtkIndent indent) override;
81
86
88
96
101
103
106 vtkSetMacro(TitleVisibility, vtkTypeBool);
107 vtkGetMacro(TitleVisibility, vtkTypeBool);
108 vtkBooleanMacro(TitleVisibility, vtkTypeBool);
110
112
115 vtkSetStringMacro(Title);
116 vtkGetStringMacro(Title);
118
120
125 vtkGetObjectMacro(TitleTextProperty, vtkTextProperty);
127
129
132 vtkSetMacro(LabelVisibility, vtkTypeBool);
133 vtkGetMacro(LabelVisibility, vtkTypeBool);
134 vtkBooleanMacro(LabelVisibility, vtkTypeBool);
136
138
143 vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
145
147
151 void SetPieceColor(int i, double r, double g, double b);
152 void SetPieceColor(int i, const double color[3])
153 {
154 this->SetPieceColor(i, color[0], color[1], color[2]);
155 }
156 double* GetPieceColor(int i);
158
160
164 void SetPieceLabel(const int i, const char*);
165 const char* GetPieceLabel(int i);
167
169
174 vtkSetMacro(LegendVisibility, vtkTypeBool);
175 vtkGetMacro(LegendVisibility, vtkTypeBool);
176 vtkBooleanMacro(LegendVisibility, vtkTypeBool);
178
180
184 vtkGetObjectMacro(LegendActor, vtkLegendBoxActor);
186
188
195
200
207
208protected:
211
212private:
213 vtkPieChartActorConnection* ConnectionHolder;
214
215 vtkIdType ArrayNumber;
216 vtkIdType ComponentNumber;
217 vtkTypeBool TitleVisibility; // Should I see the title?
218 char* Title; // The title string
219 vtkTextProperty* TitleTextProperty;
220 vtkTypeBool LabelVisibility;
221 vtkTextProperty* LabelTextProperty;
222 vtkPieceLabelArray* Labels;
223 vtkTypeBool LegendVisibility;
224 vtkLegendBoxActor* LegendActor;
225 vtkGlyphSource2D* GlyphSource;
226
227 // Local variables needed to plot
228 vtkIdType N; // The number of values
229 double Total; // The total of all values in the data array
230 double* Fractions; // The fraction of the pie
231
232 vtkTextMapper** PieceMappers; // a label for each radial spoke
233 vtkActor2D** PieceActors;
234
235 vtkTextMapper* TitleMapper;
236 vtkActor2D* TitleActor;
237
238 vtkPolyData* WebData; // The web of the spider plot
239 vtkPolyDataMapper2D* WebMapper;
240 vtkActor2D* WebActor;
241
242 vtkPolyData* PlotData; // The lines drawn within the axes
243 vtkPolyDataMapper2D* PlotMapper;
244 vtkActor2D* PlotActor;
245
246 vtkTimeStamp BuildTime;
247
248 double Center[3];
249 double Radius;
250
251 int LastPosition[2];
252 int LastPosition2[2];
253 double P1[3];
254 double P2[3];
255
256 void Initialize();
257 int PlaceAxes(vtkViewport* viewport, const int* size);
258 int BuildPlot(vtkViewport*);
259
260private:
261 vtkPieChartActor(const vtkPieChartActor&) = delete;
262 void operator=(const vtkPieChartActor&) = delete;
263};
264
265#endif
a actor that draws 2D data
Definition: vtkActor2D.h:149
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:113
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:195
2D text annotation
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:52
abstract specification for Viewports
Definition: vtkViewport.h:47
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
@ color
Definition: vtkX3D.h:227
@ size
Definition: vtkX3D.h:259
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:332