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 "vtkRenderingAnnotationModule.h" // For export macro
55 #include "vtkActor2D.h"
56 
57 class vtkAlgorithmOutput;
58 class vtkAxisActor2D;
59 class vtkDataObject;
60 class vtkPolyData;
62 class vtkTextMapper;
63 class vtkTextProperty;
64 class vtkLegendBoxActor;
65 class vtkGlyphSource2D;
66 class vtkAxisLabelArray;
67 class vtkAxisRanges;
68 class vtkSpiderPlotActorConnection;
69 
70 
71 #define VTK_IV_COLUMN 0
72 #define VTK_IV_ROW 1
73 
75 {
76 public:
78 
80  void PrintSelf(ostream& os, vtkIndent indent);
82 
84  static vtkSpiderPlotActor *New();
85 
87 
89  virtual void SetInputData(vtkDataObject*);
90  virtual void SetInputConnection(vtkAlgorithmOutput*);
92 
94  virtual vtkDataObject* GetInput();
95 
97 
100  vtkSetClampMacro(IndependentVariables,int,VTK_IV_COLUMN, VTK_IV_ROW);
101  vtkGetMacro(IndependentVariables,int);
103  {this->SetIndependentVariables(VTK_IV_COLUMN);};
105  {this->SetIndependentVariables(VTK_IV_ROW);};
107 
109 
110  vtkSetMacro(TitleVisibility, int);
111  vtkGetMacro(TitleVisibility, int);
112  vtkBooleanMacro(TitleVisibility, int);
114 
116 
117  vtkSetStringMacro(Title);
118  vtkGetStringMacro(Title);
120 
122 
123  virtual void SetTitleTextProperty(vtkTextProperty *p);
124  vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
126 
127  // Enable/Disable the display axes titles. These are arranged on the end
128  // of each radial axis on the circumference of the spider plot. The label
129  // text strings are derived from the names of the data object arrays
130  // associated with the input.
131  vtkSetMacro(LabelVisibility, int);
132  vtkGetMacro(LabelVisibility, int);
133  vtkBooleanMacro(LabelVisibility, int);
134 
136 
139  virtual void SetLabelTextProperty(vtkTextProperty *p);
140  vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
142 
144 
146  vtkSetClampMacro(NumberOfRings,int,0,VTK_INT_MAX);
147  vtkGetMacro(NumberOfRings,int);
149 
151 
153  void SetAxisLabel(const int i, const char *);
154  const char* GetAxisLabel(int i);
156 
158 
160  void SetAxisRange(int i, double min, double max);
161  void SetAxisRange(int i, double range[2]);
162  void GetAxisRange(int i, double range[2]);
164 
166 
168  void SetPlotColor(int i, double r, double g, double b);
169  void SetPlotColor(int i, const double color[3])
170  { this->SetPlotColor(i, color[0], color[1], color[2]); }
171  double *GetPlotColor(int i);
173 
175 
178  vtkSetMacro(LegendVisibility, int);
179  vtkGetMacro(LegendVisibility, int);
180  vtkBooleanMacro(LegendVisibility, int);
182 
184 
186  vtkGetObjectMacro(LegendActor,vtkLegendBoxActor);
188 
190 
195 
197  virtual int HasTranslucentPolygonalGeometry();
198 
203 
204 protected:
207 
208 private:
209 
210  vtkSpiderPlotActorConnection* ConnectionHolder;
211 
212  int IndependentVariables; // Use column or row
213  int TitleVisibility; // Should I see the title?
214  char *Title; // The title string
215  vtkTextProperty *TitleTextProperty;
216  int LabelVisibility;
217  vtkTextProperty *LabelTextProperty;
218  vtkAxisLabelArray *Labels;
219  int LegendVisibility;
220  vtkLegendBoxActor *LegendActor;
221  vtkGlyphSource2D *GlyphSource;
222  int NumberOfRings;
223  int AutomaticRangeComputation;
224 
225  // Local variables needed to plot
226  vtkIdType N; // The number of independent variables
227  double *Mins; // Minimum data value along this row/column
228  double *Maxs; // Maximum data value along this row/column
229  vtkAxisRanges *Ranges;
230 
231  vtkTextMapper **LabelMappers; //a label for each radial spoke
232  vtkActor2D **LabelActors;
233 
234  vtkTextMapper *TitleMapper;
235  vtkActor2D *TitleActor;
236 
237  vtkPolyData *WebData; // The web of the spider plot
238  vtkPolyDataMapper2D *WebMapper;
239  vtkActor2D *WebActor;
240 
241  vtkPolyData *PlotData; // The lines drawn within the axes
242  vtkPolyDataMapper2D *PlotMapper;
243  vtkActor2D *PlotActor;
244 
246 
247  double Center[3];
248  double Radius;
249  double Theta;
250 
251  int LastPosition[2];
252  int LastPosition2[2];
253  double P1[3];
254  double P2[3];
255 
256  void Initialize();
257  int PlaceAxes(vtkViewport *viewport, int *size);
258  int BuildPlot(vtkViewport*);
259 
260 private:
261  vtkSpiderPlotActor(const vtkSpiderPlotActor&); // Not implemented.
262  void operator=(const vtkSpiderPlotActor&); // Not implemented.
263 };
264 
265 
266 #endif
267 
draw symbols with text
vtkTimeStamp BuildTime
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
virtual void ReleaseGraphicsResources(vtkWindow *)
abstract specification for Viewports
Definition: vtkViewport.h:46
#define VTK_IV_COLUMN
#define VTK_INT_MAX
Definition: vtkType.h:130
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:247
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
#define VTK_IV_ROW
void SetIndependentVariablesToColumns()
create a spider plot from input field
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()
virtual int RenderOpaqueGeometry(vtkViewport *viewport)
a simple class to control print indentation
Definition: vtkIndent.h:38
void SetPlotColor(int i, const double color[3])
void PrintSelf(ostream &os, vtkIndent indent)
#define P1
static vtkActor2D * New()
represent text properties.
#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
#define max(a, b)