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 =========================================================================*/
36 #ifndef vtkPieChartActor_h
37 #define vtkPieChartActor_h
38 
39 #include "vtkRenderingAnnotationModule.h" // For export macro
40 #include "vtkActor2D.h"
41 
42 class vtkAlgorithmOutput;
43 class vtkAxisActor2D;
44 class vtkDataObject;
45 class vtkPolyData;
47 class vtkTextMapper;
48 class vtkTextProperty;
49 class vtkLegendBoxActor;
50 class vtkGlyphSource2D;
51 class vtkPieChartActorConnection;
52 class vtkPieceLabelArray;
53 
55 {
56 public:
58 
60  void PrintSelf(ostream& os, vtkIndent indent);
62 
64  static vtkPieChartActor *New();
65 
67 
69  virtual void SetInputData(vtkDataObject*);
70  virtual void SetInputConnection(vtkAlgorithmOutput*);
72 
74  virtual vtkDataObject* GetInput();
75 
77 
78  vtkSetMacro(TitleVisibility, int);
79  vtkGetMacro(TitleVisibility, int);
80  vtkBooleanMacro(TitleVisibility, int);
82 
84 
85  vtkSetStringMacro(Title);
86  vtkGetStringMacro(Title);
88 
90 
92  virtual void SetTitleTextProperty(vtkTextProperty *p);
93  vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
95 
97 
98  vtkSetMacro(LabelVisibility, int);
99  vtkGetMacro(LabelVisibility, int);
100  vtkBooleanMacro(LabelVisibility, int);
102 
104 
106  virtual void SetLabelTextProperty(vtkTextProperty *p);
107  vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
109 
111 
113  void SetPieceColor(int i, double r, double g, double b);
114  void SetPieceColor(int i, const double color[3])
115  { this->SetPieceColor(i, color[0], color[1], color[2]); }
116  double *GetPieceColor(int i);
118 
120 
122  void SetPieceLabel(const int i, const char *);
123  const char* GetPieceLabel(int i);
125 
127 
130  vtkSetMacro(LegendVisibility, int);
131  vtkGetMacro(LegendVisibility, int);
132  vtkBooleanMacro(LegendVisibility, int);
134 
136 
138  vtkGetObjectMacro(LegendActor,vtkLegendBoxActor);
140 
142 
147 
149  virtual int HasTranslucentPolygonalGeometry();
150 
155 
156 protected:
158  ~vtkPieChartActor();
159 
160 private:
161 
162  vtkPieChartActorConnection* ConnectionHolder;
163 
164  vtkIdType ArrayNumber;
165  vtkIdType ComponentNumber;
166  int TitleVisibility; // Should I see the title?
167  char *Title; // The title string
168  vtkTextProperty *TitleTextProperty;
169  int LabelVisibility;
170  vtkTextProperty *LabelTextProperty;
171  vtkPieceLabelArray *Labels;
172  int LegendVisibility;
173  vtkLegendBoxActor *LegendActor;
174  vtkGlyphSource2D *GlyphSource;
175 
176  // Local variables needed to plot
177  vtkIdType N; // The number of values
178  double Total; // The total of all values in the data array
179  double *Fractions; // The fraction of the pie
180 
181  vtkTextMapper **PieceMappers; //a label for each radial spoke
182  vtkActor2D **PieceActors;
183 
184  vtkTextMapper *TitleMapper;
185  vtkActor2D *TitleActor;
186 
187  vtkPolyData *WebData; // The web of the spider plot
188  vtkPolyDataMapper2D *WebMapper;
189  vtkActor2D *WebActor;
190 
191  vtkPolyData *PlotData; // The lines drawn within the axes
192  vtkPolyDataMapper2D *PlotMapper;
193  vtkActor2D *PlotActor;
194 
196 
197  double Center[3];
198  double Radius;
199 
200  int LastPosition[2];
201  int LastPosition2[2];
202  double P1[3];
203  double P2[3];
204 
205  void Initialize();
206  int PlaceAxes(vtkViewport *viewport, int *size);
207  int BuildPlot(vtkViewport*);
208 
209 private:
210  vtkPieChartActor(const vtkPieChartActor&); // Not implemented.
211  void operator=(const vtkPieChartActor&); // Not implemented.
212 };
213 
214 
215 #endif
216 
draw symbols with text
vtkTimeStamp BuildTime
virtual void ReleaseGraphicsResources(vtkWindow *)
abstract specification for Viewports
Definition: vtkViewport.h:46
a actor that draws 2D data
Definition: vtkActor2D.h:44
record modification and/or execution time
Definition: vtkTimeStamp.h:34
Create an axis with tick marks and labels.
int vtkIdType
Definition: vtkType.h:275
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:83
create a pie chart from an array
2D text annotation
Definition: vtkTextMapper.h:52
#define VTKRENDERINGANNOTATION_EXPORT
Proxy object to connect input/output ports.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
virtual int HasTranslucentPolygonalGeometry()
void SetPieceColor(int i, const double color[3])
virtual int RenderOpaqueGeometry(vtkViewport *viewport)
a simple class to control print indentation
Definition: vtkIndent.h:38
void PrintSelf(ostream &os, vtkIndent indent)
#define P1
static vtkActor2D * New()
represent text properties.
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
#define P2
virtual int RenderOverlay(vtkViewport *viewport)
create 2D glyphs represented by vtkPolyData
general representation of visualization data
Definition: vtkDataObject.h:64
draw vtkPolyData onto the image plane