VTK  9.5.20250804
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
59#ifndef vtkSpiderPlotActor_h
60#define vtkSpiderPlotActor_h
61
62#include "vtkActor2D.h"
63#include "vtkNew.h" // For vtkNew
64#include "vtkRenderingAnnotationModule.h" // For export macro
65#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
66
67VTK_ABI_NAMESPACE_BEGIN
69class vtkAxisActor2D;
70class vtkDataObject;
71class vtkPolyData;
73class vtkTextMapper;
74class vtkTextProperty;
77class vtkAxisLabelArray;
78class vtkAxisRanges;
79class vtkSpiderPlotActorConnection;
80
81#define VTK_IV_COLUMN 0
82#define VTK_IV_ROW 1
83
84class VTKRENDERINGANNOTATION_EXPORT VTK_MARSHALAUTO vtkSpiderPlotActor : public vtkActor2D
85{
86public:
88
92 void PrintSelf(ostream& os, vtkIndent indent) override;
94
99
101
106 VTK_MARSHALSETTER(Input)
107 virtual void SetInputData(vtkDataObject*);
108 virtual void SetInputConnection(vtkAlgorithmOutput*);
110
114 VTK_MARSHALGETTER(Input)
115 virtual vtkDataObject* GetInput();
116
118
123 vtkSetClampMacro(IndependentVariables, int, VTK_IV_COLUMN, VTK_IV_ROW);
124 vtkGetMacro(IndependentVariables, int);
125 void SetIndependentVariablesToColumns() { this->SetIndependentVariables(VTK_IV_COLUMN); }
126 void SetIndependentVariablesToRows() { this->SetIndependentVariables(VTK_IV_ROW); }
128
130
133 vtkSetMacro(TitleVisibility, vtkTypeBool);
134 vtkGetMacro(TitleVisibility, vtkTypeBool);
135 vtkBooleanMacro(TitleVisibility, vtkTypeBool);
137
139
142 vtkSetStringMacro(Title);
143 vtkGetStringMacro(Title);
145
147
151 vtkGetObjectMacro(TitleTextProperty, vtkTextProperty);
153
154 // Enable/Disable the display axes titles. These are arranged on the end
155 // of each radial axis on the circumference of the spider plot. The label
156 // text strings are derived from the names of the data object arrays
157 // associated with the input.
158 vtkSetMacro(LabelVisibility, vtkTypeBool);
159 vtkGetMacro(LabelVisibility, vtkTypeBool);
160 vtkBooleanMacro(LabelVisibility, vtkTypeBool);
161
163
169 vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
171
173
177 vtkSetClampMacro(NumberOfRings, int, 0, VTK_INT_MAX);
178 vtkGetMacro(NumberOfRings, int);
180
182
186 void SetAxisLabel(int i, const char*);
187 const char* GetAxisLabel(int i);
190
192
196 void SetAxisRange(int i, double min, double max);
197 void SetAxisRange(int i, double range[2]);
198 void GetAxisRange(int i, double range[2]);
201
203
206 void SetPlotColor(int i, double r, double g, double b);
207 void SetPlotColor(int i, const double color[3])
208 {
209 this->SetPlotColor(i, color[0], color[1], color[2]);
210 }
211 double* GetPlotColor(int i);
213
215
220 vtkSetMacro(LegendVisibility, vtkTypeBool);
221 vtkGetMacro(LegendVisibility, vtkTypeBool);
222 vtkBooleanMacro(LegendVisibility, vtkTypeBool);
224
226
230 vtkGetObjectMacro(LegendActor, vtkLegendBoxActor);
232
234
241
246
253
254protected:
257
258private:
259 vtkSpiderPlotActorConnection* ConnectionHolder;
260
261 int IndependentVariables; // Use column or row
262 vtkTypeBool TitleVisibility; // Should I see the title?
263 char* Title; // The title string
264 vtkTextProperty* TitleTextProperty;
265 vtkTypeBool LabelVisibility;
266 vtkTextProperty* LabelTextProperty;
267 vtkAxisLabelArray* Labels;
268 vtkTypeBool LegendVisibility;
269 vtkNew<vtkLegendBoxActor> LegendActor;
270 vtkGlyphSource2D* GlyphSource;
271 int NumberOfRings;
272
273 // Local variables needed to plot
274 vtkIdType N; // The number of independent variables
275 double* Mins; // Minimum data value along this row/column
276 double* Maxs; // Maximum data value along this row/column
277 vtkAxisRanges* Ranges;
278
279 vtkTextMapper** LabelMappers; // a label for each radial spoke
280 vtkActor2D** LabelActors;
281
282 vtkTextMapper* TitleMapper;
283 vtkActor2D* TitleActor;
284
285 vtkPolyData* WebData; // The web of the spider plot
286 vtkPolyDataMapper2D* WebMapper;
287 vtkActor2D* WebActor;
288
289 vtkPolyData* PlotData; // The lines drawn within the axes
290 vtkPolyDataMapper2D* PlotMapper;
291 vtkActor2D* PlotActor;
292
293 vtkTimeStamp BuildTime;
294
295 double Center[3];
296 double Radius;
297 double Theta;
298
299 int LastPosition[2];
300 int LastPosition2[2];
301 double P1[3];
302 double P2[3];
303
304 void Initialize();
305 int PlaceAxes(vtkViewport* viewport, const int* size);
306 int BuildPlot(vtkViewport*);
307
308 vtkSpiderPlotActor(const vtkSpiderPlotActor&) = delete;
309 void operator=(const vtkSpiderPlotActor&) = delete;
310};
311
312VTK_ABI_NAMESPACE_END
313#endif
a actor that draws 2D data
Definition vtkActor2D.h:145
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:108
draw symbols with text
Allocate and hold a VTK object.
Definition vtkNew.h:167
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
create a spider plot from input field
int GetNumberOfAxisRanges()
Specify the range of data on each radial axis.
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.
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.
int GetNumberOfAxisLabels()
Specify the names of the radial spokes (i.e., the radial axes).
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.
~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:66
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_IV_ROW
#define VTK_IV_COLUMN
int vtkIdType
Definition vtkType.h:332
#define VTK_INT_MAX
Definition vtkType.h:161
#define VTK_MARSHALSETTER(property)
#define VTK_MARSHALGETTER(property)
#define VTK_MARSHALAUTO
#define max(a, b)