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 =========================================================================*/
49 #ifndef vtkSpiderPlotActor_h
50 #define vtkSpiderPlotActor_h
51 
52 #include "vtkRenderingAnnotationModule.h" // For export macro
53 #include "vtkActor2D.h"
54 
55 class vtkAlgorithmOutput;
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 class vtkSpiderPlotActorConnection;
67 
68 
69 #define VTK_IV_COLUMN 0
70 #define VTK_IV_ROW 1
71 
72 class VTKRENDERINGANNOTATION_EXPORT vtkSpiderPlotActor : public vtkActor2D
73 {
74 public:
76 
80  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
82 
86  static vtkSpiderPlotActor *New();
87 
89 
94  virtual void SetInputData(vtkDataObject*);
95  virtual void SetInputConnection(vtkAlgorithmOutput*);
97 
101  virtual vtkDataObject* GetInput();
102 
104 
109  vtkSetClampMacro(IndependentVariables,int,VTK_IV_COLUMN, VTK_IV_ROW);
110  vtkGetMacro(IndependentVariables,int);
112  {this->SetIndependentVariables(VTK_IV_COLUMN);};
114  {this->SetIndependentVariables(VTK_IV_ROW);};
116 
118 
121  vtkSetMacro(TitleVisibility, int);
122  vtkGetMacro(TitleVisibility, int);
123  vtkBooleanMacro(TitleVisibility, int);
125 
127 
130  vtkSetStringMacro(Title);
131  vtkGetStringMacro(Title);
133 
135 
138  virtual void SetTitleTextProperty(vtkTextProperty *p);
139  vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
141 
142  // Enable/Disable the display axes titles. These are arranged on the end
143  // of each radial axis on the circumference of the spider plot. The label
144  // text strings are derived from the names of the data object arrays
145  // associated with the input.
146  vtkSetMacro(LabelVisibility, int);
147  vtkGetMacro(LabelVisibility, int);
148  vtkBooleanMacro(LabelVisibility, int);
149 
151 
156  virtual void SetLabelTextProperty(vtkTextProperty *p);
157  vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
159 
161 
165  vtkSetClampMacro(NumberOfRings,int,0,VTK_INT_MAX);
166  vtkGetMacro(NumberOfRings,int);
168 
170 
174  void SetAxisLabel(const int i, const char *);
175  const char* GetAxisLabel(int i);
177 
179 
183  void SetAxisRange(int i, double min, double max);
184  void SetAxisRange(int i, double range[2]);
185  void GetAxisRange(int i, double range[2]);
187 
189 
192  void SetPlotColor(int i, double r, double g, double b);
193  void SetPlotColor(int i, const double color[3])
194  { this->SetPlotColor(i, color[0], color[1], color[2]); }
195  double *GetPlotColor(int i);
197 
199 
204  vtkSetMacro(LegendVisibility, int);
205  vtkGetMacro(LegendVisibility, int);
206  vtkBooleanMacro(LegendVisibility, int);
208 
210 
214  vtkGetObjectMacro(LegendActor,vtkLegendBoxActor);
216 
218 
221  int RenderOverlay(vtkViewport*) VTK_OVERRIDE;
222  int RenderOpaqueGeometry(vtkViewport*) VTK_OVERRIDE;
223  int RenderTranslucentPolygonalGeometry(vtkViewport* ) VTK_OVERRIDE {return 0;}
225 
229  int HasTranslucentPolygonalGeometry() VTK_OVERRIDE;
230 
236  void ReleaseGraphicsResources(vtkWindow *) VTK_OVERRIDE;
237 
238 protected:
240  ~vtkSpiderPlotActor() VTK_OVERRIDE;
241 
242 private:
243 
244  vtkSpiderPlotActorConnection* ConnectionHolder;
245 
246  int IndependentVariables; // Use column or row
247  int TitleVisibility; // Should I see the title?
248  char *Title; // The title string
249  vtkTextProperty *TitleTextProperty;
250  int LabelVisibility;
251  vtkTextProperty *LabelTextProperty;
252  vtkAxisLabelArray *Labels;
253  int LegendVisibility;
254  vtkLegendBoxActor *LegendActor;
255  vtkGlyphSource2D *GlyphSource;
256  int NumberOfRings;
257 
258  // Local variables needed to plot
259  vtkIdType N; // The number of independent variables
260  double *Mins; // Minimum data value along this row/column
261  double *Maxs; // Maximum data value along this row/column
262  vtkAxisRanges *Ranges;
263 
264  vtkTextMapper **LabelMappers; //a label for each radial spoke
265  vtkActor2D **LabelActors;
266 
267  vtkTextMapper *TitleMapper;
268  vtkActor2D *TitleActor;
269 
270  vtkPolyData *WebData; // The web of the spider plot
271  vtkPolyDataMapper2D *WebMapper;
272  vtkActor2D *WebActor;
273 
274  vtkPolyData *PlotData; // The lines drawn within the axes
275  vtkPolyDataMapper2D *PlotMapper;
276  vtkActor2D *PlotActor;
277 
279 
280  double Center[3];
281  double Radius;
282  double Theta;
283 
284  int LastPosition[2];
285  int LastPosition2[2];
286  double P1[3];
287  double P2[3];
288 
289  void Initialize();
290  int PlaceAxes(vtkViewport *viewport, int *size);
291  int BuildPlot(vtkViewport*);
292 
293 private:
294  vtkSpiderPlotActor(const vtkSpiderPlotActor&) VTK_DELETE_FUNCTION;
295  void operator=(const vtkSpiderPlotActor&) VTK_DELETE_FUNCTION;
296 };
297 
298 
299 #endif
300 
draw symbols with text
vtkTimeStamp BuildTime
void SetIndependentVariablesToRows()
Specify whether to use the rows or columns as independent variables.
int RenderOverlay(vtkViewport *viewport) override
Support the standard render methods.
abstract specification for Viewports
Definition: vtkViewport.h:44
#define VTK_IV_COLUMN
#define VTK_INT_MAX
Definition: vtkType.h:157
a actor that draws 2D data
Definition: vtkActor2D.h:39
record modification and/or execution time
Definition: vtkTimeStamp.h:32
Create an axis with tick marks and labels.
int vtkIdType
Definition: vtkType.h:345
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
#define VTK_IV_ROW
void SetIndependentVariablesToColumns()
Specify whether to use the rows or columns as independent variables.
create a spider plot from input field
2D text annotation
Definition: vtkTextMapper.h:47
Proxy object to connect input/output ports.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
a simple class to control print indentation
Definition: vtkIndent.h:33
void SetPlotColor(int i, const double color[3])
Specify colors for each plot.
int HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
#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.
represent text properties.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
#define P2
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.
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Draw the spider plot.
general representation of visualization data
Definition: vtkDataObject.h:58
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.