VTK  9.1.0
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=========================================================================*/
58#ifndef vtkSpiderPlotActor_h
59#define vtkSpiderPlotActor_h
60
61#include "vtkActor2D.h"
62#include "vtkRenderingAnnotationModule.h" // For export macro
63
65class vtkAxisActor2D;
66class vtkDataObject;
67class vtkPolyData;
69class vtkTextMapper;
70class vtkTextProperty;
73class vtkAxisLabelArray;
74class vtkAxisRanges;
75class vtkSpiderPlotActorConnection;
76
77#define VTK_IV_COLUMN 0
78#define VTK_IV_ROW 1
79
80class VTKRENDERINGANNOTATION_EXPORT vtkSpiderPlotActor : public vtkActor2D
81{
82public:
84
88 void PrintSelf(ostream& os, vtkIndent indent) override;
90
95
97
105
110
112
117 vtkSetClampMacro(IndependentVariables, int, VTK_IV_COLUMN, VTK_IV_ROW);
118 vtkGetMacro(IndependentVariables, int);
119 void SetIndependentVariablesToColumns() { this->SetIndependentVariables(VTK_IV_COLUMN); }
120 void SetIndependentVariablesToRows() { this->SetIndependentVariables(VTK_IV_ROW); }
122
124
127 vtkSetMacro(TitleVisibility, vtkTypeBool);
128 vtkGetMacro(TitleVisibility, vtkTypeBool);
129 vtkBooleanMacro(TitleVisibility, vtkTypeBool);
131
133
136 vtkSetStringMacro(Title);
137 vtkGetStringMacro(Title);
139
141
145 vtkGetObjectMacro(TitleTextProperty, vtkTextProperty);
147
148 // Enable/Disable the display axes titles. These are arranged on the end
149 // of each radial axis on the circumference of the spider plot. The label
150 // text strings are derived from the names of the data object arrays
151 // associated with the input.
152 vtkSetMacro(LabelVisibility, vtkTypeBool);
153 vtkGetMacro(LabelVisibility, vtkTypeBool);
154 vtkBooleanMacro(LabelVisibility, vtkTypeBool);
155
157
163 vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
165
167
171 vtkSetClampMacro(NumberOfRings, int, 0, VTK_INT_MAX);
172 vtkGetMacro(NumberOfRings, int);
174
176
180 void SetAxisLabel(const int i, const char*);
181 const char* GetAxisLabel(int i);
183
185
189 void SetAxisRange(int i, double min, double max);
190 void SetAxisRange(int i, double range[2]);
191 void GetAxisRange(int i, double range[2]);
193
195
198 void SetPlotColor(int i, double r, double g, double b);
199 void SetPlotColor(int i, const double color[3])
200 {
201 this->SetPlotColor(i, color[0], color[1], color[2]);
202 }
203 double* GetPlotColor(int i);
205
207
212 vtkSetMacro(LegendVisibility, vtkTypeBool);
213 vtkGetMacro(LegendVisibility, vtkTypeBool);
214 vtkBooleanMacro(LegendVisibility, vtkTypeBool);
216
218
222 vtkGetObjectMacro(LegendActor, vtkLegendBoxActor);
224
226
233
238
245
246protected:
249
250private:
251 vtkSpiderPlotActorConnection* ConnectionHolder;
252
253 int IndependentVariables; // Use column or row
254 vtkTypeBool TitleVisibility; // Should I see the title?
255 char* Title; // The title string
256 vtkTextProperty* TitleTextProperty;
257 vtkTypeBool LabelVisibility;
258 vtkTextProperty* LabelTextProperty;
259 vtkAxisLabelArray* Labels;
260 vtkTypeBool LegendVisibility;
261 vtkLegendBoxActor* LegendActor;
262 vtkGlyphSource2D* GlyphSource;
263 int NumberOfRings;
264
265 // Local variables needed to plot
266 vtkIdType N; // The number of independent variables
267 double* Mins; // Minimum data value along this row/column
268 double* Maxs; // Maximum data value along this row/column
269 vtkAxisRanges* Ranges;
270
271 vtkTextMapper** LabelMappers; // a label for each radial spoke
272 vtkActor2D** LabelActors;
273
274 vtkTextMapper* TitleMapper;
275 vtkActor2D* TitleActor;
276
277 vtkPolyData* WebData; // The web of the spider plot
278 vtkPolyDataMapper2D* WebMapper;
279 vtkActor2D* WebActor;
280
281 vtkPolyData* PlotData; // The lines drawn within the axes
282 vtkPolyDataMapper2D* PlotMapper;
283 vtkActor2D* PlotActor;
284
285 vtkTimeStamp BuildTime;
286
287 double Center[3];
288 double Radius;
289 double Theta;
290
291 int LastPosition[2];
292 int LastPosition2[2];
293 double P1[3];
294 double P2[3];
295
296 void Initialize();
297 int PlaceAxes(vtkViewport* viewport, const int* size);
298 int BuildPlot(vtkViewport*);
299
300private:
301 vtkSpiderPlotActor(const vtkSpiderPlotActor&) = delete;
302 void operator=(const vtkSpiderPlotActor&) = delete;
303};
304
305#endif
a actor that draws 2D data
Definition: vtkActor2D.h:49
Proxy object to connect input/output ports.
Create an axis with tick marks and labels.
general representation of visualization data
Definition: vtkDataObject.h:69
create 2D glyphs represented by vtkPolyData
a simple class to control print indentation
Definition: vtkIndent.h:43
draw symbols with text
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:95
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.
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?
static vtkSpiderPlotActor * New()
Instantiate this class.
void SetPlotColor(int i, const double color[3])
Specify colors for each plot.
virtual void SetInputData(vtkDataObject *)
Set the input to the pie chart actor.
virtual vtkDataObject * GetInput()
Get the input data object to this 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.
const char * GetAxisLabel(int i)
Specify the names of the radial spokes (i.e., the radial axes).
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Draw the spider plot.
void SetIndependentVariablesToColumns()
Specify whether to use the rows or columns as independent variables.
~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.
double * GetPlotColor(int i)
Specify colors for each plot.
void SetAxisLabel(const int i, const char *)
Specify the names of the radial spokes (i.e., the radial axes).
2D text annotation
Definition: vtkTextMapper.h:57
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:42
abstract specification for Viewports
Definition: vtkViewport.h:56
window superclass for vtkRenderWindow
Definition: vtkWindow.h:45
@ 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)