VTK  9.3.0
vtkSpiderPlotActor.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
49#ifndef vtkSpiderPlotActor_h
50#define vtkSpiderPlotActor_h
51
52#include "vtkActor2D.h"
53#include "vtkRenderingAnnotationModule.h" // For export macro
54
55VTK_ABI_NAMESPACE_BEGIN
57class vtkAxisActor2D;
58class vtkDataObject;
59class vtkPolyData;
61class vtkTextMapper;
62class vtkTextProperty;
65class vtkAxisLabelArray;
66class vtkAxisRanges;
67class vtkSpiderPlotActorConnection;
68
69#define VTK_IV_COLUMN 0
70#define VTK_IV_ROW 1
71
72class VTKRENDERINGANNOTATION_EXPORT vtkSpiderPlotActor : public vtkActor2D
73{
74public:
76
80 void PrintSelf(ostream& os, vtkIndent indent) override;
82
87
89
97
102
104
109 vtkSetClampMacro(IndependentVariables, int, VTK_IV_COLUMN, VTK_IV_ROW);
110 vtkGetMacro(IndependentVariables, int);
111 void SetIndependentVariablesToColumns() { this->SetIndependentVariables(VTK_IV_COLUMN); }
112 void SetIndependentVariablesToRows() { this->SetIndependentVariables(VTK_IV_ROW); }
114
116
119 vtkSetMacro(TitleVisibility, vtkTypeBool);
120 vtkGetMacro(TitleVisibility, vtkTypeBool);
121 vtkBooleanMacro(TitleVisibility, vtkTypeBool);
123
125
128 vtkSetStringMacro(Title);
129 vtkGetStringMacro(Title);
131
133
137 vtkGetObjectMacro(TitleTextProperty, vtkTextProperty);
139
140 // Enable/Disable the display axes titles. These are arranged on the end
141 // of each radial axis on the circumference of the spider plot. The label
142 // text strings are derived from the names of the data object arrays
143 // associated with the input.
144 vtkSetMacro(LabelVisibility, vtkTypeBool);
145 vtkGetMacro(LabelVisibility, vtkTypeBool);
146 vtkBooleanMacro(LabelVisibility, vtkTypeBool);
147
149
155 vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
157
159
163 vtkSetClampMacro(NumberOfRings, int, 0, VTK_INT_MAX);
164 vtkGetMacro(NumberOfRings, int);
166
168
172 void SetAxisLabel(int i, const char*);
173 const char* GetAxisLabel(int i);
175
177
181 void SetAxisRange(int i, double min, double max);
182 void SetAxisRange(int i, double range[2]);
183 void GetAxisRange(int i, double range[2]);
185
187
190 void SetPlotColor(int i, double r, double g, double b);
191 void SetPlotColor(int i, const double color[3])
192 {
193 this->SetPlotColor(i, color[0], color[1], color[2]);
194 }
195 double* GetPlotColor(int i);
197
199
204 vtkSetMacro(LegendVisibility, vtkTypeBool);
205 vtkGetMacro(LegendVisibility, vtkTypeBool);
206 vtkBooleanMacro(LegendVisibility, vtkTypeBool);
208
210
214 vtkGetObjectMacro(LegendActor, vtkLegendBoxActor);
216
218
225
230
237
238protected:
241
242private:
243 vtkSpiderPlotActorConnection* ConnectionHolder;
244
245 int IndependentVariables; // Use column or row
246 vtkTypeBool TitleVisibility; // Should I see the title?
247 char* Title; // The title string
248 vtkTextProperty* TitleTextProperty;
249 vtkTypeBool LabelVisibility;
250 vtkTextProperty* LabelTextProperty;
251 vtkAxisLabelArray* Labels;
252 vtkTypeBool LegendVisibility;
253 vtkLegendBoxActor* LegendActor;
254 vtkGlyphSource2D* GlyphSource;
255 int NumberOfRings;
256
257 // Local variables needed to plot
258 vtkIdType N; // The number of independent variables
259 double* Mins; // Minimum data value along this row/column
260 double* Maxs; // Maximum data value along this row/column
261 vtkAxisRanges* Ranges;
262
263 vtkTextMapper** LabelMappers; // a label for each radial spoke
264 vtkActor2D** LabelActors;
265
266 vtkTextMapper* TitleMapper;
267 vtkActor2D* TitleActor;
268
269 vtkPolyData* WebData; // The web of the spider plot
270 vtkPolyDataMapper2D* WebMapper;
271 vtkActor2D* WebActor;
272
273 vtkPolyData* PlotData; // The lines drawn within the axes
274 vtkPolyDataMapper2D* PlotMapper;
275 vtkActor2D* PlotActor;
276
277 vtkTimeStamp BuildTime;
278
279 double Center[3];
280 double Radius;
281 double Theta;
282
283 int LastPosition[2];
284 int LastPosition2[2];
285 double P1[3];
286 double P2[3];
287
288 void Initialize();
289 int PlaceAxes(vtkViewport* viewport, const int* size);
290 int BuildPlot(vtkViewport*);
291
292 vtkSpiderPlotActor(const vtkSpiderPlotActor&) = delete;
293 void operator=(const vtkSpiderPlotActor&) = delete;
294};
295
296VTK_ABI_NAMESPACE_END
297#endif
a actor that draws 2D data
Definition vtkActor2D.h:44
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:38
draw symbols with text
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:89
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 SetAxisLabel(int i, const char *)
Specify the names of the radial spokes (i.e., the radial axes).
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.
2D text annotation
represent text properties.
record modification and/or execution time
abstract specification for Viewports
Definition vtkViewport.h:54
window superclass for vtkRenderWindow
Definition vtkWindow.h:34
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_IV_ROW
#define VTK_IV_COLUMN
int vtkIdType
Definition vtkType.h:315
#define VTK_INT_MAX
Definition vtkType.h:144
#define max(a, b)