VTK  9.4.20251203
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
40#ifndef vtkSpiderPlotActor_h
41#define vtkSpiderPlotActor_h
42
43#include "vtkActor2D.h"
44#include "vtkRenderingAnnotationModule.h" // For export macro
45#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
46
47VTK_ABI_NAMESPACE_BEGIN
49class vtkAxisActor2D;
50class vtkDataObject;
51class vtkPolyData;
53class vtkTextMapper;
54class vtkTextProperty;
57class vtkAxisLabelArray;
58class vtkAxisRanges;
59class vtkSpiderPlotActorConnection;
60
61#define VTK_IV_COLUMN 0
62#define VTK_IV_ROW 1
63
64class VTKRENDERINGANNOTATION_EXPORT VTK_MARSHALAUTO vtkSpiderPlotActor : public vtkActor2D
65{
66public:
68
72 void PrintSelf(ostream& os, vtkIndent indent) override;
74
79
81
89
94
96
101 vtkSetClampMacro(IndependentVariables, int, VTK_IV_COLUMN, VTK_IV_ROW);
102 vtkGetMacro(IndependentVariables, int);
103 void SetIndependentVariablesToColumns() { this->SetIndependentVariables(VTK_IV_COLUMN); }
104 void SetIndependentVariablesToRows() { this->SetIndependentVariables(VTK_IV_ROW); }
106
108
111 vtkSetMacro(TitleVisibility, vtkTypeBool);
112 vtkGetMacro(TitleVisibility, vtkTypeBool);
113 vtkBooleanMacro(TitleVisibility, vtkTypeBool);
115
117
120 vtkSetStringMacro(Title);
121 vtkGetStringMacro(Title);
123
125
129 vtkGetObjectMacro(TitleTextProperty, vtkTextProperty);
131
132 // Enable/Disable the display axes titles. These are arranged on the end
133 // of each radial axis on the circumference of the spider plot. The label
134 // text strings are derived from the names of the data object arrays
135 // associated with the input.
136 vtkSetMacro(LabelVisibility, vtkTypeBool);
137 vtkGetMacro(LabelVisibility, vtkTypeBool);
138 vtkBooleanMacro(LabelVisibility, vtkTypeBool);
139
141
147 vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
149
151
155 vtkSetClampMacro(NumberOfRings, int, 0, VTK_INT_MAX);
156 vtkGetMacro(NumberOfRings, int);
158
160
164 void SetAxisLabel(int i, const char*);
165 const char* GetAxisLabel(int i);
167
169
173 void SetAxisRange(int i, double min, double max);
174 void SetAxisRange(int i, double range[2]);
175 void GetAxisRange(int i, double range[2]);
177
179
182 void SetPlotColor(int i, double r, double g, double b);
183 void SetPlotColor(int i, const double color[3])
184 {
185 this->SetPlotColor(i, color[0], color[1], color[2]);
186 }
187 double* GetPlotColor(int i);
189
191
196 vtkSetMacro(LegendVisibility, vtkTypeBool);
197 vtkGetMacro(LegendVisibility, vtkTypeBool);
198 vtkBooleanMacro(LegendVisibility, vtkTypeBool);
200
202
206 vtkGetObjectMacro(LegendActor, vtkLegendBoxActor);
208
210
217
222
229
230protected:
233
234private:
235 vtkSpiderPlotActorConnection* ConnectionHolder;
236
237 int IndependentVariables; // Use column or row
238 vtkTypeBool TitleVisibility; // Should I see the title?
239 char* Title; // The title string
240 vtkTextProperty* TitleTextProperty;
241 vtkTypeBool LabelVisibility;
242 vtkTextProperty* LabelTextProperty;
243 vtkAxisLabelArray* Labels;
244 vtkTypeBool LegendVisibility;
245 vtkLegendBoxActor* LegendActor;
246 vtkGlyphSource2D* GlyphSource;
247 int NumberOfRings;
248
249 // Local variables needed to plot
250 vtkIdType N; // The number of independent variables
251 double* Mins; // Minimum data value along this row/column
252 double* Maxs; // Maximum data value along this row/column
253 vtkAxisRanges* Ranges;
254
255 vtkTextMapper** LabelMappers; // a label for each radial spoke
256 vtkActor2D** LabelActors;
257
258 vtkTextMapper* TitleMapper;
259 vtkActor2D* TitleActor;
260
261 vtkPolyData* WebData; // The web of the spider plot
262 vtkPolyDataMapper2D* WebMapper;
263 vtkActor2D* WebActor;
264
265 vtkPolyData* PlotData; // The lines drawn within the axes
266 vtkPolyDataMapper2D* PlotMapper;
267 vtkActor2D* PlotActor;
268
269 vtkTimeStamp BuildTime;
270
271 double Center[3];
272 double Radius;
273 double Theta;
274
275 int LastPosition[2];
276 int LastPosition2[2];
277 double P1[3];
278 double P2[3];
279
280 void Initialize();
281 int PlaceAxes(vtkViewport* viewport, const int* size);
282 int BuildPlot(vtkViewport*);
283
284 vtkSpiderPlotActor(const vtkSpiderPlotActor&) = delete;
285 void operator=(const vtkSpiderPlotActor&) = delete;
286};
287
288VTK_ABI_NAMESPACE_END
289#endif
a actor that draws 2D data
Definition vtkActor2D.h:36
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:29
draw symbols with text
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:72
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:46
window superclass for vtkRenderWindow
Definition vtkWindow.h:29
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)