VTK  9.3.20240424
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 "vtkRenderingAnnotationModule.h" // For export macro
64#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
65
66VTK_ABI_NAMESPACE_BEGIN
68class vtkAxisActor2D;
69class vtkDataObject;
70class vtkPolyData;
72class vtkTextMapper;
73class vtkTextProperty;
76class vtkAxisLabelArray;
77class vtkAxisRanges;
78class vtkSpiderPlotActorConnection;
79
80#define VTK_IV_COLUMN 0
81#define VTK_IV_ROW 1
82
83class VTKRENDERINGANNOTATION_EXPORT VTK_MARSHALAUTO vtkSpiderPlotActor : public vtkActor2D
84{
85public:
87
91 void PrintSelf(ostream& os, vtkIndent indent) override;
93
98
100
108
113
115
120 vtkSetClampMacro(IndependentVariables, int, VTK_IV_COLUMN, VTK_IV_ROW);
121 vtkGetMacro(IndependentVariables, int);
122 void SetIndependentVariablesToColumns() { this->SetIndependentVariables(VTK_IV_COLUMN); }
123 void SetIndependentVariablesToRows() { this->SetIndependentVariables(VTK_IV_ROW); }
125
127
130 vtkSetMacro(TitleVisibility, vtkTypeBool);
131 vtkGetMacro(TitleVisibility, vtkTypeBool);
132 vtkBooleanMacro(TitleVisibility, vtkTypeBool);
134
136
139 vtkSetStringMacro(Title);
140 vtkGetStringMacro(Title);
142
144
148 vtkGetObjectMacro(TitleTextProperty, vtkTextProperty);
150
151 // Enable/Disable the display axes titles. These are arranged on the end
152 // of each radial axis on the circumference of the spider plot. The label
153 // text strings are derived from the names of the data object arrays
154 // associated with the input.
155 vtkSetMacro(LabelVisibility, vtkTypeBool);
156 vtkGetMacro(LabelVisibility, vtkTypeBool);
157 vtkBooleanMacro(LabelVisibility, vtkTypeBool);
158
160
166 vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
168
170
174 vtkSetClampMacro(NumberOfRings, int, 0, VTK_INT_MAX);
175 vtkGetMacro(NumberOfRings, int);
177
179
183 void SetAxisLabel(int i, const char*);
184 const char* GetAxisLabel(int i);
186
188
192 void SetAxisRange(int i, double min, double max);
193 void SetAxisRange(int i, double range[2]);
194 void GetAxisRange(int i, double range[2]);
196
198
201 void SetPlotColor(int i, double r, double g, double b);
202 void SetPlotColor(int i, const double color[3])
203 {
204 this->SetPlotColor(i, color[0], color[1], color[2]);
205 }
206 double* GetPlotColor(int i);
208
210
215 vtkSetMacro(LegendVisibility, vtkTypeBool);
216 vtkGetMacro(LegendVisibility, vtkTypeBool);
217 vtkBooleanMacro(LegendVisibility, vtkTypeBool);
219
221
225 vtkGetObjectMacro(LegendActor, vtkLegendBoxActor);
227
229
236
241
248
249protected:
252
253private:
254 vtkSpiderPlotActorConnection* ConnectionHolder;
255
256 int IndependentVariables; // Use column or row
257 vtkTypeBool TitleVisibility; // Should I see the title?
258 char* Title; // The title string
259 vtkTextProperty* TitleTextProperty;
260 vtkTypeBool LabelVisibility;
261 vtkTextProperty* LabelTextProperty;
262 vtkAxisLabelArray* Labels;
263 vtkTypeBool LegendVisibility;
264 vtkLegendBoxActor* LegendActor;
265 vtkGlyphSource2D* GlyphSource;
266 int NumberOfRings;
267
268 // Local variables needed to plot
269 vtkIdType N; // The number of independent variables
270 double* Mins; // Minimum data value along this row/column
271 double* Maxs; // Maximum data value along this row/column
272 vtkAxisRanges* Ranges;
273
274 vtkTextMapper** LabelMappers; // a label for each radial spoke
275 vtkActor2D** LabelActors;
276
277 vtkTextMapper* TitleMapper;
278 vtkActor2D* TitleActor;
279
280 vtkPolyData* WebData; // The web of the spider plot
281 vtkPolyDataMapper2D* WebMapper;
282 vtkActor2D* WebActor;
283
284 vtkPolyData* PlotData; // The lines drawn within the axes
285 vtkPolyDataMapper2D* PlotMapper;
286 vtkActor2D* PlotActor;
287
288 vtkTimeStamp BuildTime;
289
290 double Center[3];
291 double Radius;
292 double Theta;
293
294 int LastPosition[2];
295 int LastPosition2[2];
296 double P1[3];
297 double P2[3];
298
299 void Initialize();
300 int PlaceAxes(vtkViewport* viewport, const int* size);
301 int BuildPlot(vtkViewport*);
302
303 vtkSpiderPlotActor(const vtkSpiderPlotActor&) = delete;
304 void operator=(const vtkSpiderPlotActor&) = delete;
305};
306
307VTK_ABI_NAMESPACE_END
308#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
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
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:65
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:315
#define VTK_INT_MAX
Definition vtkType.h:144
#define VTK_MARSHALAUTO
#define max(a, b)