VTK  9.2.5
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 =========================================================================*/
71 #ifndef vtkSpiderPlotActor_h
72 #define vtkSpiderPlotActor_h
73 
74 #include "vtkActor2D.h"
75 #include "vtkRenderingAnnotationModule.h" // For export macro
76 
77 class vtkAlgorithmOutput;
78 class vtkAxisActor2D;
79 class vtkDataObject;
80 class vtkPolyData;
82 class vtkTextMapper;
83 class vtkTextProperty;
84 class vtkLegendBoxActor;
85 class vtkGlyphSource2D;
86 class vtkAxisLabelArray;
87 class vtkAxisRanges;
88 class vtkSpiderPlotActorConnection;
89 
90 #define VTK_IV_COLUMN 0
91 #define VTK_IV_ROW 1
92 
93 class VTKRENDERINGANNOTATION_EXPORT vtkSpiderPlotActor : public vtkActor2D
94 {
95 public:
97 
101  void PrintSelf(ostream& os, vtkIndent indent) override;
103 
108 
110 
115  virtual void SetInputData(vtkDataObject*);
118 
123 
125 
130  vtkSetClampMacro(IndependentVariables, int, VTK_IV_COLUMN, VTK_IV_ROW);
131  vtkGetMacro(IndependentVariables, int);
132  void SetIndependentVariablesToColumns() { this->SetIndependentVariables(VTK_IV_COLUMN); }
133  void SetIndependentVariablesToRows() { this->SetIndependentVariables(VTK_IV_ROW); }
135 
137 
140  vtkSetMacro(TitleVisibility, vtkTypeBool);
141  vtkGetMacro(TitleVisibility, vtkTypeBool);
142  vtkBooleanMacro(TitleVisibility, vtkTypeBool);
144 
146 
149  vtkSetStringMacro(Title);
150  vtkGetStringMacro(Title);
152 
154 
158  vtkGetObjectMacro(TitleTextProperty, vtkTextProperty);
160 
161  // Enable/Disable the display axes titles. These are arranged on the end
162  // of each radial axis on the circumference of the spider plot. The label
163  // text strings are derived from the names of the data object arrays
164  // associated with the input.
165  vtkSetMacro(LabelVisibility, vtkTypeBool);
166  vtkGetMacro(LabelVisibility, vtkTypeBool);
167  vtkBooleanMacro(LabelVisibility, vtkTypeBool);
168 
170 
176  vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
178 
180 
184  vtkSetClampMacro(NumberOfRings, int, 0, VTK_INT_MAX);
185  vtkGetMacro(NumberOfRings, int);
187 
189 
193  void SetAxisLabel(const int i, const char*);
194  const char* GetAxisLabel(int i);
196 
198 
202  void SetAxisRange(int i, double min, double max);
203  void SetAxisRange(int i, double range[2]);
204  void GetAxisRange(int i, double range[2]);
206 
208 
211  void SetPlotColor(int i, double r, double g, double b);
212  void SetPlotColor(int i, const double color[3])
213  {
214  this->SetPlotColor(i, color[0], color[1], color[2]);
215  }
216  double* GetPlotColor(int i);
218 
220 
225  vtkSetMacro(LegendVisibility, vtkTypeBool);
226  vtkGetMacro(LegendVisibility, vtkTypeBool);
227  vtkBooleanMacro(LegendVisibility, vtkTypeBool);
229 
231 
235  vtkGetObjectMacro(LegendActor, vtkLegendBoxActor);
237 
239 
242  int RenderOverlay(vtkViewport*) override;
244  int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
246 
251 
258 
259 protected:
262 
263 private:
264  vtkSpiderPlotActorConnection* ConnectionHolder;
265 
266  int IndependentVariables; // Use column or row
267  vtkTypeBool TitleVisibility; // Should I see the title?
268  char* Title; // The title string
269  vtkTextProperty* TitleTextProperty;
270  vtkTypeBool LabelVisibility;
271  vtkTextProperty* LabelTextProperty;
272  vtkAxisLabelArray* Labels;
273  vtkTypeBool LegendVisibility;
274  vtkLegendBoxActor* LegendActor;
275  vtkGlyphSource2D* GlyphSource;
276  int NumberOfRings;
277 
278  // Local variables needed to plot
279  vtkIdType N; // The number of independent variables
280  double* Mins; // Minimum data value along this row/column
281  double* Maxs; // Maximum data value along this row/column
282  vtkAxisRanges* Ranges;
283 
284  vtkTextMapper** LabelMappers; // a label for each radial spoke
285  vtkActor2D** LabelActors;
286 
287  vtkTextMapper* TitleMapper;
288  vtkActor2D* TitleActor;
289 
290  vtkPolyData* WebData; // The web of the spider plot
291  vtkPolyDataMapper2D* WebMapper;
292  vtkActor2D* WebActor;
293 
294  vtkPolyData* PlotData; // The lines drawn within the axes
295  vtkPolyDataMapper2D* PlotMapper;
296  vtkActor2D* PlotActor;
297 
298  vtkTimeStamp BuildTime;
299 
300  double Center[3];
301  double Radius;
302  double Theta;
303 
304  int LastPosition[2];
305  int LastPosition2[2];
306  double P1[3];
307  double P2[3];
308 
309  void Initialize();
310  int PlaceAxes(vtkViewport* viewport, const int* size);
311  int BuildPlot(vtkViewport*);
312 
313 private:
314  vtkSpiderPlotActor(const vtkSpiderPlotActor&) = delete;
315  void operator=(const vtkSpiderPlotActor&) = delete;
316 };
317 
318 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:155
Proxy object to connect input/output ports.
Create an axis with tick marks and labels.
general representation of visualization data
create 2D glyphs represented by vtkPolyData
a simple class to control print indentation
Definition: vtkIndent.h:119
draw symbols with text
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:200
create a spider plot from input field
void SetIndependentVariablesToRows()
Specify whether to use the rows or columns as independent variables.
int RenderOpaqueGeometry(vtkViewport *) override
Draw the spider plot.
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for type information and printing.
const char * GetAxisLabel(int i)
Specify the names of the radial spokes (i.e., the radial axes).
void SetPlotColor(int i, double r, double g, double b)
Specify colors for each plot.
virtual void SetInputConnection(vtkAlgorithmOutput *)
Set the input to the pie chart actor.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
void SetPlotColor(int i, const double color[3])
Specify colors for each plot.
double * GetPlotColor(int i)
Specify colors for each plot.
virtual void SetInputData(vtkDataObject *)
Set the input to the pie chart actor.
void GetAxisRange(int i, double range[2])
Specify the range of data on each radial axis.
virtual void SetTitleTextProperty(vtkTextProperty *p)
Set/Get the title text property.
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Draw the spider plot.
void SetIndependentVariablesToColumns()
Specify whether to use the rows or columns as independent variables.
virtual vtkDataObject * GetInput()
Get the input data object to this actor.
~vtkSpiderPlotActor() override
virtual void SetLabelTextProperty(vtkTextProperty *p)
Enable/Disable the creation of a legend.
void SetAxisRange(int i, double range[2])
Specify the range of data on each radial axis.
void SetAxisRange(int i, double min, double max)
Specify the range of data on each radial axis.
int RenderOverlay(vtkViewport *) override
Draw the spider plot.
void SetAxisLabel(const int i, const char *)
Specify the names of the radial spokes (i.e., the radial axes).
static vtkSpiderPlotActor * New()
Instantiate this class.
2D text annotation
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:55
abstract specification for Viewports
Definition: vtkViewport.h:56
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
@ range
Definition: vtkX3D.h:244
@ color
Definition: vtkX3D.h:227
@ size
Definition: vtkX3D.h:259
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_IV_ROW
#define VTK_IV_COLUMN
int vtkIdType
Definition: vtkType.h:332
#define VTK_INT_MAX
Definition: vtkType.h:155
#define max(a, b)