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=========================================================================*/
52#ifndef vtkSpiderPlotActor_h
53#define vtkSpiderPlotActor_h
54
55#include "vtkActor2D.h"
56#include "vtkRenderingAnnotationModule.h" // For export macro
57
59class vtkAxisActor2D;
60class vtkDataObject;
61class vtkPolyData;
63class vtkTextMapper;
64class vtkTextProperty;
67class vtkAxisLabelArray;
68class vtkAxisRanges;
69class vtkSpiderPlotActorConnection;
70
71#define VTK_IV_COLUMN 0
72#define VTK_IV_ROW 1
73
74class VTKRENDERINGANNOTATION_EXPORT vtkSpiderPlotActor : public vtkActor2D
75{
76public:
78
82 void PrintSelf(ostream& os, vtkIndent indent) override;
84
89
91
99
104
106
111 vtkSetClampMacro(IndependentVariables, int, VTK_IV_COLUMN, VTK_IV_ROW);
112 vtkGetMacro(IndependentVariables, int);
113 void SetIndependentVariablesToColumns() { this->SetIndependentVariables(VTK_IV_COLUMN); }
114 void SetIndependentVariablesToRows() { this->SetIndependentVariables(VTK_IV_ROW); }
116
118
121 vtkSetMacro(TitleVisibility, vtkTypeBool);
122 vtkGetMacro(TitleVisibility, vtkTypeBool);
123 vtkBooleanMacro(TitleVisibility, vtkTypeBool);
125
127
130 vtkSetStringMacro(Title);
131 vtkGetStringMacro(Title);
133
135
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, vtkTypeBool);
147 vtkGetMacro(LabelVisibility, vtkTypeBool);
148 vtkBooleanMacro(LabelVisibility, vtkTypeBool);
149
151
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 {
195 this->SetPlotColor(i, color[0], color[1], color[2]);
196 }
197 double* GetPlotColor(int i);
199
201
206 vtkSetMacro(LegendVisibility, vtkTypeBool);
207 vtkGetMacro(LegendVisibility, vtkTypeBool);
208 vtkBooleanMacro(LegendVisibility, vtkTypeBool);
210
212
216 vtkGetObjectMacro(LegendActor, vtkLegendBoxActor);
218
220
227
232
239
240protected:
243
244private:
245 vtkSpiderPlotActorConnection* ConnectionHolder;
246
247 int IndependentVariables; // Use column or row
248 vtkTypeBool TitleVisibility; // Should I see the title?
249 char* Title; // The title string
250 vtkTextProperty* TitleTextProperty;
251 vtkTypeBool LabelVisibility;
252 vtkTextProperty* LabelTextProperty;
253 vtkAxisLabelArray* Labels;
254 vtkTypeBool LegendVisibility;
255 vtkLegendBoxActor* LegendActor;
256 vtkGlyphSource2D* GlyphSource;
257 int NumberOfRings;
258
259 // Local variables needed to plot
260 vtkIdType N; // The number of independent variables
261 double* Mins; // Minimum data value along this row/column
262 double* Maxs; // Maximum data value along this row/column
263 vtkAxisRanges* Ranges;
264
265 vtkTextMapper** LabelMappers; // a label for each radial spoke
266 vtkActor2D** LabelActors;
267
268 vtkTextMapper* TitleMapper;
269 vtkActor2D* TitleActor;
270
271 vtkPolyData* WebData; // The web of the spider plot
272 vtkPolyDataMapper2D* WebMapper;
273 vtkActor2D* WebActor;
274
275 vtkPolyData* PlotData; // The lines drawn within the axes
276 vtkPolyDataMapper2D* PlotMapper;
277 vtkActor2D* PlotActor;
278
279 vtkTimeStamp BuildTime;
280
281 double Center[3];
282 double Radius;
283 double Theta;
284
285 int LastPosition[2];
286 int LastPosition2[2];
287 double P1[3];
288 double P2[3];
289
290 void Initialize();
291 int PlaceAxes(vtkViewport* viewport, const int* size);
292 int BuildPlot(vtkViewport*);
293
294private:
295 vtkSpiderPlotActor(const vtkSpiderPlotActor&) = delete;
296 void operator=(const vtkSpiderPlotActor&) = delete;
297};
298
299#endif
a actor that draws 2D data
Definition: vtkActor2D.h:46
Proxy object to connect input/output ports.
Create an axis with tick marks and labels.
general representation of visualization data
Definition: vtkDataObject.h:66
create 2D glyphs represented by vtkPolyData
a simple class to control print indentation
Definition: vtkIndent.h:40
draw symbols with text
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:91
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:51
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:36
abstract specification for Viewports
Definition: vtkViewport.h:56
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
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)