VTK
vtkSpiderPlotActor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSpiderPlotActor.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 =========================================================================*/
51 #ifndef __vtkSpiderPlotActor_h
52 #define __vtkSpiderPlotActor_h
53 
54 #include "vtkActor2D.h"
55 
56 class vtkAxisActor2D;
57 class vtkDataObject;
58 class vtkPolyData;
60 class vtkTextMapper;
61 class vtkTextProperty;
62 class vtkLegendBoxActor;
63 class vtkGlyphSource2D;
64 class vtkAxisLabelArray;
65 class vtkAxisRanges;
66 
67 
68 #define VTK_IV_COLUMN 0
69 #define VTK_IV_ROW 1
70 
72 {
73 public:
75 
77  void PrintSelf(ostream& os, vtkIndent indent);
79 
81  static vtkSpiderPlotActor *New();
82 
84  virtual void SetInput(vtkDataObject*);
85 
87 
88  vtkGetObjectMacro(Input,vtkDataObject);
90 
92 
95  vtkSetClampMacro(IndependentVariables,int,VTK_IV_COLUMN, VTK_IV_ROW);
96  vtkGetMacro(IndependentVariables,int);
98  {this->SetIndependentVariables(VTK_IV_COLUMN);};
100  {this->SetIndependentVariables(VTK_IV_ROW);};
102 
104 
105  vtkSetMacro(TitleVisibility, int);
106  vtkGetMacro(TitleVisibility, int);
107  vtkBooleanMacro(TitleVisibility, int);
109 
111 
112  vtkSetStringMacro(Title);
113  vtkGetStringMacro(Title);
115 
117 
118  virtual void SetTitleTextProperty(vtkTextProperty *p);
119  vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
121 
122  // Enable/Disable the display axes titles. These are arranged on the end
123  // of each radial axis on the circumference of the spider plot. The label
124  // text strings are derived from the names of the data object arrays
125  // associated with the input.
126  vtkSetMacro(LabelVisibility, int);
127  vtkGetMacro(LabelVisibility, int);
128  vtkBooleanMacro(LabelVisibility, int);
129 
131 
134  virtual void SetLabelTextProperty(vtkTextProperty *p);
135  vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
137 
139 
141  vtkSetClampMacro(NumberOfRings,int,0,VTK_LARGE_INTEGER);
142  vtkGetMacro(NumberOfRings,int);
144 
146 
148  void SetAxisLabel(const int i, const char *);
149  const char* GetAxisLabel(int i);
151 
153 
155  void SetAxisRange(int i, double min, double max);
156  void SetAxisRange(int i, double range[2]);
157  void GetAxisRange(int i, double range[2]);
159 
161 
163  void SetPlotColor(int i, double r, double g, double b);
164  void SetPlotColor(int i, const double color[3])
165  { this->SetPlotColor(i, color[0], color[1], color[2]); }
166  double *GetPlotColor(int i);
168 
170 
173  vtkSetMacro(LegendVisibility, int);
174  vtkGetMacro(LegendVisibility, int);
175  vtkBooleanMacro(LegendVisibility, int);
177 
179 
181  vtkGetObjectMacro(LegendActor,vtkLegendBoxActor);
183 
185 
190 
192  virtual int HasTranslucentPolygonalGeometry();
193 
198 
199 protected:
202 
203 private:
204  vtkDataObject *Input; // List of data sets to plot
205  int IndependentVariables; // Use column or row
206  int TitleVisibility; // Should I see the title?
207  char *Title; // The title string
208  vtkTextProperty *TitleTextProperty;
209  int LabelVisibility;
210  vtkTextProperty *LabelTextProperty;
211  vtkAxisLabelArray *Labels;
212  int LegendVisibility;
213  vtkLegendBoxActor *LegendActor;
214  vtkGlyphSource2D *GlyphSource;
215  int NumberOfRings;
216  int AutomaticRangeComputation;
217 
218  // Local variables needed to plot
219  vtkIdType N; // The number of independent variables
220  double *Mins; // Minimum data value along this row/column
221  double *Maxs; // Maximum data value along this row/column
222  vtkAxisRanges *Ranges;
223 
224  vtkTextMapper **LabelMappers; //a label for each radial spoke
225  vtkActor2D **LabelActors;
226 
227  vtkTextMapper *TitleMapper;
228  vtkActor2D *TitleActor;
229 
230  vtkPolyData *WebData; // The web of the spider plot
231  vtkPolyDataMapper2D *WebMapper;
232  vtkActor2D *WebActor;
233 
234  vtkPolyData *PlotData; // The lines drawn within the axes
235  vtkPolyDataMapper2D *PlotMapper;
236  vtkActor2D *PlotActor;
237 
238  vtkTimeStamp BuildTime;
239 
240  double Center[3];
241  double Radius;
242  double Theta;
243 
244  int LastPosition[2];
245  int LastPosition2[2];
246  double P1[3];
247  double P2[3];
248 
249  void Initialize();
250  int PlaceAxes(vtkViewport *viewport, int *size);
251  int BuildPlot(vtkViewport*);
252 
253 private:
254  vtkSpiderPlotActor(const vtkSpiderPlotActor&); // Not implemented.
255  void operator=(const vtkSpiderPlotActor&); // Not implemented.
256 };
257 
258 
259 #endif
260