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 
43 class vtkAlgorithmOutput;
44 class vtkAxisActor2D;
45 class vtkDataObject;
46 class vtkPolyData;
48 class vtkTextMapper;
49 class vtkTextProperty;
50 class vtkLegendBoxActor;
51 class vtkGlyphSource2D;
52 class vtkPieChartActorConnection;
53 class vtkPieceLabelArray;
54 
55 class VTKRENDERINGANNOTATION_EXPORT vtkPieChartActor : public vtkActor2D
56 {
57 public:
59 
63  void PrintSelf(ostream& os, vtkIndent indent);
65 
69  static vtkPieChartActor *New();
70 
72 
77  virtual void SetInputData(vtkDataObject*);
78  virtual void SetInputConnection(vtkAlgorithmOutput*);
80 
84  virtual vtkDataObject* GetInput();
85 
87 
90  vtkSetMacro(TitleVisibility, int);
91  vtkGetMacro(TitleVisibility, int);
92  vtkBooleanMacro(TitleVisibility, int);
94 
96 
99  vtkSetStringMacro(Title);
100  vtkGetStringMacro(Title);
102 
104 
108  virtual void SetTitleTextProperty(vtkTextProperty *p);
109  vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
111 
113 
116  vtkSetMacro(LabelVisibility, int);
117  vtkGetMacro(LabelVisibility, int);
118  vtkBooleanMacro(LabelVisibility, int);
120 
122 
126  virtual void SetLabelTextProperty(vtkTextProperty *p);
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 
181  virtual int HasTranslucentPolygonalGeometry();
182 
189 
190 protected:
192  ~vtkPieChartActor();
193 
194 private:
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 
243 private:
244  vtkPieChartActor(const vtkPieChartActor&) VTK_DELETE_FUNCTION;
245  void operator=(const vtkPieChartActor&) VTK_DELETE_FUNCTION;
246 };
247 
248 
249 #endif
250 
draw symbols with text
vtkTimeStamp BuildTime
abstract specification for Viewports
Definition: vtkViewport.h:47
a actor that draws 2D data
Definition: vtkActor2D.h:45
record modification and/or execution time
Definition: vtkTimeStamp.h:35
Create an axis with tick marks and labels.
int vtkIdType
Definition: vtkType.h:287
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
create a pie chart from an array
virtual int HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
2D text annotation
Definition: vtkTextMapper.h:53
Proxy object to connect input/output ports.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
void SetPieceColor(int i, const double color[3])
Specify colors for each piece of pie.
a simple class to control print indentation
Definition: vtkIndent.h:39
#define P1
static vtkActor2D * New()
Creates an actor2D with the following defaults: position (0,0) (coordinate system is viewport); at la...
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
virtual void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
represent text properties.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
Draw the pie plot.
#define P2
virtual int RenderOverlay(vtkViewport *viewport) override
Support the standard render methods.
virtual int RenderOpaqueGeometry(vtkViewport *viewport) override
Support the standard render methods.
create 2D glyphs represented by vtkPolyData
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
general representation of visualization data
Definition: vtkDataObject.h:64
draw vtkPolyData onto the image plane
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.