VTK
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=========================================================================*/
37#ifndef vtkPieChartActor_h
38#define vtkPieChartActor_h
39
40#include "vtkRenderingAnnotationModule.h" // For export macro
41#include "vtkActor2D.h"
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);
65
70
72
80
85
87
90 vtkSetMacro(TitleVisibility, int);
91 vtkGetMacro(TitleVisibility, int);
92 vtkBooleanMacro(TitleVisibility, int);
94
96
99 vtkSetStringMacro(Title);
102
104
109 vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
111
113
116 vtkSetMacro(LabelVisibility, int);
117 vtkGetMacro(LabelVisibility, int);
118 vtkBooleanMacro(LabelVisibility, int);
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 { this->SetPieceColor(i, color[0], color[1], color[2]); }
138 double *GetPieceColor(int i);
140
142
146 void SetPieceLabel(const int i, const char *);
147 const char* GetPieceLabel(int i);
149
151
156 vtkSetMacro(LegendVisibility, int);
157 vtkGetMacro(LegendVisibility, int);
158 vtkBooleanMacro(LegendVisibility, int);
160
162
166 vtkGetObjectMacro(LegendActor,vtkLegendBoxActor);
168
170
177
182
189
190protected:
193
194private:
195
196 vtkPieChartActorConnection* ConnectionHolder;
197
198 vtkIdType ArrayNumber;
199 vtkIdType ComponentNumber;
200 int TitleVisibility; // Should I see the title?
201 char *Title; // The title string
202 vtkTextProperty *TitleTextProperty;
203 int LabelVisibility;
204 vtkTextProperty *LabelTextProperty;
205 vtkPieceLabelArray *Labels;
206 int LegendVisibility;
207 vtkLegendBoxActor *LegendActor;
208 vtkGlyphSource2D *GlyphSource;
209
210 // Local variables needed to plot
211 vtkIdType N; // The number of values
212 double Total; // The total of all values in the data array
213 double *Fractions; // The fraction of the pie
214
215 vtkTextMapper **PieceMappers; //a label for each radial spoke
216 vtkActor2D **PieceActors;
217
218 vtkTextMapper *TitleMapper;
219 vtkActor2D *TitleActor;
220
221 vtkPolyData *WebData; // The web of the spider plot
222 vtkPolyDataMapper2D *WebMapper;
223 vtkActor2D *WebActor;
224
225 vtkPolyData *PlotData; // The lines drawn within the axes
226 vtkPolyDataMapper2D *PlotMapper;
227 vtkActor2D *PlotActor;
228
230
231 double Center[3];
232 double Radius;
233
234 int LastPosition[2];
235 int LastPosition2[2];
236 double P1[3];
237 double P2[3];
238
239 void Initialize();
240 int PlaceAxes(vtkViewport *viewport, int *size);
241 int BuildPlot(vtkViewport*);
242
243private:
244 vtkPieChartActor(const vtkPieChartActor&) VTK_DELETE_FUNCTION;
245 void operator=(const vtkPieChartActor&) VTK_DELETE_FUNCTION;
246};
247
248
249#endif
250
a actor that draws 2D data
Definition: vtkActor2D.h:46
Proxy object to connect input/output ports.
Create an axis with tick marks and labels.
general representation of visualization data
Definition: vtkDataObject.h:65
create 2D glyphs represented by vtkPolyData
a simple class to control print indentation
Definition: vtkIndent.h:40
draw symbols with text
create a pie chart from an array
virtual void SetInputConnection(vtkAlgorithmOutput *)
const char * GetPieceLabel(int i)
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.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
double * GetPieceColor(int i)
void SetPieceColor(int i, const double color[3])
virtual int HasTranslucentPolygonalGeometry()
Does this prop have some translucent polygonal geometry?
int RenderOverlay(vtkViewport *)
Draw the pie plot.
int RenderOpaqueGeometry(vtkViewport *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this actor.
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
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:86
2D text annotation
Definition: vtkTextMapper.h:54
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:36
abstract specification for Viewports
Definition: vtkViewport.h:48
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
@ color
Definition: vtkX3D.h:221
@ size
Definition: vtkX3D.h:253
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkTimeStamp BuildTime
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
#define P1
#define P2
int vtkIdType
Definition: vtkType.h:287