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 =========================================================================*/
52 #ifndef vtkSpiderPlotActor_h
53 #define vtkSpiderPlotActor_h
54 
55 #include "vtkRenderingAnnotationModule.h" // For export macro
56 #include "vtkActor2D.h"
57 
58 class vtkAlgorithmOutput;
59 class vtkAxisActor2D;
60 class vtkDataObject;
61 class vtkPolyData;
63 class vtkTextMapper;
64 class vtkTextProperty;
65 class vtkLegendBoxActor;
66 class vtkGlyphSource2D;
67 class vtkAxisLabelArray;
68 class vtkAxisRanges;
69 class vtkSpiderPlotActorConnection;
70 
71 
72 #define VTK_IV_COLUMN 0
73 #define VTK_IV_ROW 1
74 
75 class VTKRENDERINGANNOTATION_EXPORT vtkSpiderPlotActor : public vtkActor2D
76 {
77 public:
79 
83  void PrintSelf(ostream& os, vtkIndent indent);
85 
89  static vtkSpiderPlotActor *New();
90 
92 
97  virtual void SetInputData(vtkDataObject*);
98  virtual void SetInputConnection(vtkAlgorithmOutput*);
100 
104  virtual vtkDataObject* GetInput();
105 
107 
112  vtkSetClampMacro(IndependentVariables,int,VTK_IV_COLUMN, VTK_IV_ROW);
113  vtkGetMacro(IndependentVariables,int);
115  {this->SetIndependentVariables(VTK_IV_COLUMN);};
117  {this->SetIndependentVariables(VTK_IV_ROW);};
119 
121 
124  vtkSetMacro(TitleVisibility, int);
125  vtkGetMacro(TitleVisibility, int);
126  vtkBooleanMacro(TitleVisibility, int);
128 
130 
133  vtkSetStringMacro(Title);
134  vtkGetStringMacro(Title);
136 
138 
141  virtual void SetTitleTextProperty(vtkTextProperty *p);
142  vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
144 
145  // Enable/Disable the display axes titles. These are arranged on the end
146  // of each radial axis on the circumference of the spider plot. The label
147  // text strings are derived from the names of the data object arrays
148  // associated with the input.
149  vtkSetMacro(LabelVisibility, int);
150  vtkGetMacro(LabelVisibility, int);
151  vtkBooleanMacro(LabelVisibility, int);
152 
154 
159  virtual void SetLabelTextProperty(vtkTextProperty *p);
160  vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
162 
164 
168  vtkSetClampMacro(NumberOfRings,int,0,VTK_INT_MAX);
169  vtkGetMacro(NumberOfRings,int);
171 
173 
177  void SetAxisLabel(const int i, const char *);
178  const char* GetAxisLabel(int i);
180 
182 
186  void SetAxisRange(int i, double min, double max);
187  void SetAxisRange(int i, double range[2]);
188  void GetAxisRange(int i, double range[2]);
190 
192 
195  void SetPlotColor(int i, double r, double g, double b);
196  void SetPlotColor(int i, const double color[3])
197  { this->SetPlotColor(i, color[0], color[1], color[2]); }
198  double *GetPlotColor(int i);
200 
202 
207  vtkSetMacro(LegendVisibility, int);
208  vtkGetMacro(LegendVisibility, int);
209  vtkBooleanMacro(LegendVisibility, int);
211 
213 
217  vtkGetObjectMacro(LegendActor,vtkLegendBoxActor);
219 
221 
228 
232  virtual int HasTranslucentPolygonalGeometry();
233 
240 
241 protected:
244 
245 private:
246 
247  vtkSpiderPlotActorConnection* ConnectionHolder;
248 
249  int IndependentVariables; // Use column or row
250  int TitleVisibility; // Should I see the title?
251  char *Title; // The title string
252  vtkTextProperty *TitleTextProperty;
253  int LabelVisibility;
254  vtkTextProperty *LabelTextProperty;
255  vtkAxisLabelArray *Labels;
256  int LegendVisibility;
257  vtkLegendBoxActor *LegendActor;
258  vtkGlyphSource2D *GlyphSource;
259  int NumberOfRings;
260 
261  // Local variables needed to plot
262  vtkIdType N; // The number of independent variables
263  double *Mins; // Minimum data value along this row/column
264  double *Maxs; // Maximum data value along this row/column
265  vtkAxisRanges *Ranges;
266 
267  vtkTextMapper **LabelMappers; //a label for each radial spoke
268  vtkActor2D **LabelActors;
269 
270  vtkTextMapper *TitleMapper;
271  vtkActor2D *TitleActor;
272 
273  vtkPolyData *WebData; // The web of the spider plot
274  vtkPolyDataMapper2D *WebMapper;
275  vtkActor2D *WebActor;
276 
277  vtkPolyData *PlotData; // The lines drawn within the axes
278  vtkPolyDataMapper2D *PlotMapper;
279  vtkActor2D *PlotActor;
280 
282 
283  double Center[3];
284  double Radius;
285  double Theta;
286 
287  int LastPosition[2];
288  int LastPosition2[2];
289  double P1[3];
290  double P2[3];
291 
292  void Initialize();
293  int PlaceAxes(vtkViewport *viewport, int *size);
294  int BuildPlot(vtkViewport*);
295 
296 private:
297  vtkSpiderPlotActor(const vtkSpiderPlotActor&) VTK_DELETE_FUNCTION;
298  void operator=(const vtkSpiderPlotActor&) VTK_DELETE_FUNCTION;
299 };
300 
301 
302 #endif
303 
draw symbols with text
vtkTimeStamp BuildTime
void SetIndependentVariablesToRows()
Specify whether to use the rows or columns as independent variables.
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
Draw the spider plot.
abstract specification for Viewports
Definition: vtkViewport.h:47
#define VTK_IV_COLUMN
#define VTK_INT_MAX
Definition: vtkType.h:153
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
#define VTK_IV_ROW
void SetIndependentVariablesToColumns()
Specify whether to use the rows or columns as independent variables.
virtual int HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
create a spider plot from input field
2D text annotation
Definition: vtkTextMapper.h:53
Proxy object to connect input/output ports.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
a simple class to control print indentation
Definition: vtkIndent.h:39
void SetPlotColor(int i, const double color[3])
Specify colors for each plot.
#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.
#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
#define max(a, b)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.