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=========================================================================*/
56#ifndef vtkPieChartActor_h
57#define vtkPieChartActor_h
58
59#include "vtkActor2D.h"
60#include "vtkRenderingAnnotationModule.h" // For export macro
61
63class vtkAxisActor2D;
64class vtkDataObject;
65class vtkPolyData;
67class vtkTextMapper;
68class vtkTextProperty;
71class vtkPieChartActorConnection;
72class vtkPieceLabelArray;
73
74class VTKRENDERINGANNOTATION_EXPORT vtkPieChartActor : public vtkActor2D
75{
76public:
78
82 void PrintSelf(ostream& os, vtkIndent indent) override;
84
89
91
99
104
106
109 vtkSetMacro(TitleVisibility, vtkTypeBool);
110 vtkGetMacro(TitleVisibility, vtkTypeBool);
111 vtkBooleanMacro(TitleVisibility, vtkTypeBool);
113
115
118 vtkSetStringMacro(Title);
119 vtkGetStringMacro(Title);
121
123
128 vtkGetObjectMacro(TitleTextProperty, vtkTextProperty);
130
132
135 vtkSetMacro(LabelVisibility, vtkTypeBool);
136 vtkGetMacro(LabelVisibility, vtkTypeBool);
137 vtkBooleanMacro(LabelVisibility, vtkTypeBool);
139
141
146 vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
148
150
154 void SetPieceColor(int i, double r, double g, double b);
155 void SetPieceColor(int i, const double color[3])
156 {
157 this->SetPieceColor(i, color[0], color[1], color[2]);
158 }
159 double* GetPieceColor(int i);
161
163
167 void SetPieceLabel(const int i, const char*);
168 const char* GetPieceLabel(int i);
170
172
177 vtkSetMacro(LegendVisibility, vtkTypeBool);
178 vtkGetMacro(LegendVisibility, vtkTypeBool);
179 vtkBooleanMacro(LegendVisibility, vtkTypeBool);
181
183
187 vtkGetObjectMacro(LegendActor, vtkLegendBoxActor);
189
191
198
203
210
211protected:
214
215private:
216 vtkPieChartActorConnection* ConnectionHolder;
217
218 vtkIdType ArrayNumber;
219 vtkIdType ComponentNumber;
220 vtkTypeBool TitleVisibility; // Should I see the title?
221 char* Title; // The title string
222 vtkTextProperty* TitleTextProperty;
223 vtkTypeBool LabelVisibility;
224 vtkTextProperty* LabelTextProperty;
225 vtkPieceLabelArray* Labels;
226 vtkTypeBool LegendVisibility;
227 vtkLegendBoxActor* LegendActor;
228 vtkGlyphSource2D* GlyphSource;
229
230 // Local variables needed to plot
231 vtkIdType N; // The number of values
232 double Total; // The total of all values in the data array
233 double* Fractions; // The fraction of the pie
234
235 vtkTextMapper** PieceMappers; // a label for each radial spoke
236 vtkActor2D** PieceActors;
237
238 vtkTextMapper* TitleMapper;
239 vtkActor2D* TitleActor;
240
241 vtkPolyData* WebData; // The web of the spider plot
242 vtkPolyDataMapper2D* WebMapper;
243 vtkActor2D* WebActor;
244
245 vtkPolyData* PlotData; // The lines drawn within the axes
246 vtkPolyDataMapper2D* PlotMapper;
247 vtkActor2D* PlotActor;
248
249 vtkTimeStamp BuildTime;
250
251 double Center[3];
252 double Radius;
253
254 int LastPosition[2];
255 int LastPosition2[2];
256 double P1[3];
257 double P2[3];
258
259 void Initialize();
260 int PlaceAxes(vtkViewport* viewport, const int* size);
261 int BuildPlot(vtkViewport*);
262
263private:
264 vtkPieChartActor(const vtkPieChartActor&) = delete;
265 void operator=(const vtkPieChartActor&) = delete;
266};
267
268#endif
a actor that draws 2D data
Definition: vtkActor2D.h:155
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:119
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:200
2D text annotation
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:55
abstract specification for Viewports
Definition: vtkViewport.h:56
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