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 "vtkActor2D.h"
40 
41 class vtkAxisActor2D;
42 class vtkDataObject;
43 class vtkPolyData;
45 class vtkTextMapper;
46 class vtkTextProperty;
47 class vtkLegendBoxActor;
48 class vtkGlyphSource2D;
49 class vtkPieceLabelArray;
50 
52 {
53 public:
55 
57  void PrintSelf(ostream& os, vtkIndent indent);
59 
61  static vtkPieChartActor *New();
62 
64  virtual void SetInput(vtkDataObject*);
65 
67 
68  vtkGetObjectMacro(Input,vtkDataObject);
70 
72 
73  vtkSetMacro(TitleVisibility, int);
74  vtkGetMacro(TitleVisibility, int);
75  vtkBooleanMacro(TitleVisibility, int);
77 
79 
80  vtkSetStringMacro(Title);
81  vtkGetStringMacro(Title);
83 
85 
87  virtual void SetTitleTextProperty(vtkTextProperty *p);
88  vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
90 
92 
93  vtkSetMacro(LabelVisibility, int);
94  vtkGetMacro(LabelVisibility, int);
95  vtkBooleanMacro(LabelVisibility, int);
97 
99 
101  virtual void SetLabelTextProperty(vtkTextProperty *p);
102  vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
104 
106 
108  void SetPieceColor(int i, double r, double g, double b);
109  void SetPieceColor(int i, const double color[3])
110  { this->SetPieceColor(i, color[0], color[1], color[2]); }
111  double *GetPieceColor(int i);
113 
115 
117  void SetPieceLabel(const int i, const char *);
118  const char* GetPieceLabel(int i);
120 
122 
125  vtkSetMacro(LegendVisibility, int);
126  vtkGetMacro(LegendVisibility, int);
127  vtkBooleanMacro(LegendVisibility, int);
129 
131 
133  vtkGetObjectMacro(LegendActor,vtkLegendBoxActor);
135 
137 
142 
144  virtual int HasTranslucentPolygonalGeometry();
145 
150 
151 protected:
153  ~vtkPieChartActor();
154 
155 private:
156  vtkDataObject *Input; // List of data sets to plot
157  vtkIdType ArrayNumber;
158  vtkIdType ComponentNumber;
159  int TitleVisibility; // Should I see the title?
160  char *Title; // The title string
161  vtkTextProperty *TitleTextProperty;
162  int LabelVisibility;
163  vtkTextProperty *LabelTextProperty;
164  vtkPieceLabelArray *Labels;
165  int LegendVisibility;
166  vtkLegendBoxActor *LegendActor;
167  vtkGlyphSource2D *GlyphSource;
168 
169  // Local variables needed to plot
170  vtkIdType N; // The number of values
171  double Total; // The total of all values in the data array
172  double *Fractions; // The fraction of the pie
173 
174  vtkTextMapper **PieceMappers; //a label for each radial spoke
175  vtkActor2D **PieceActors;
176 
177  vtkTextMapper *TitleMapper;
178  vtkActor2D *TitleActor;
179 
180  vtkPolyData *WebData; // The web of the spider plot
181  vtkPolyDataMapper2D *WebMapper;
182  vtkActor2D *WebActor;
183 
184  vtkPolyData *PlotData; // The lines drawn within the axes
185  vtkPolyDataMapper2D *PlotMapper;
186  vtkActor2D *PlotActor;
187 
188  vtkTimeStamp BuildTime;
189 
190  double Center[3];
191  double Radius;
192 
193  int LastPosition[2];
194  int LastPosition2[2];
195  double P1[3];
196  double P2[3];
197 
198  void Initialize();
199  int PlaceAxes(vtkViewport *viewport, int *size);
200  int BuildPlot(vtkViewport*);
201 
202 private:
203  vtkPieChartActor(const vtkPieChartActor&); // Not implemented.
204  void operator=(const vtkPieChartActor&); // Not implemented.
205 };
206 
207 
208 #endif
209 
draw symbols with text
virtual void ReleaseGraphicsResources(vtkWindow *)
abstract specification for Viewports
Definition: vtkViewport.h:45
a actor that draws 2D data
Definition: vtkActor2D.h:43
record modification and/or execution time
Definition: vtkTimeStamp.h:33
Create an axis with tick marks and labels.
int vtkIdType
Definition: vtkType.h:255
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:81
create a pie chart from an array
2D text annotation
Definition: vtkTextMapper.h:43
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
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:37
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
#define VTK_HYBRID_EXPORT
general representation of visualization data
Definition: vtkDataObject.h:70
draw vtkPolyData onto the image plane