VTK  9.1.0
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=========================================================================*/
68#ifndef vtkSpiderPlotActor_h
69#define vtkSpiderPlotActor_h
70
71#include "vtkActor2D.h"
72#include "vtkRenderingAnnotationModule.h" // For export macro
73
75class vtkAxisActor2D;
76class vtkDataObject;
77class vtkPolyData;
79class vtkTextMapper;
80class vtkTextProperty;
83class vtkAxisLabelArray;
84class vtkAxisRanges;
85class vtkSpiderPlotActorConnection;
86
87#define VTK_IV_COLUMN 0
88#define VTK_IV_ROW 1
89
90class VTKRENDERINGANNOTATION_EXPORT vtkSpiderPlotActor : public vtkActor2D
91{
92public:
94
98 void PrintSelf(ostream& os, vtkIndent indent) override;
100
105
107
115
120
122
127 vtkSetClampMacro(IndependentVariables, int, VTK_IV_COLUMN, VTK_IV_ROW);
128 vtkGetMacro(IndependentVariables, int);
129 void SetIndependentVariablesToColumns() { this->SetIndependentVariables(VTK_IV_COLUMN); }
130 void SetIndependentVariablesToRows() { this->SetIndependentVariables(VTK_IV_ROW); }
132
134
137 vtkSetMacro(TitleVisibility, vtkTypeBool);
138 vtkGetMacro(TitleVisibility, vtkTypeBool);
139 vtkBooleanMacro(TitleVisibility, vtkTypeBool);
141
143
146 vtkSetStringMacro(Title);
147 vtkGetStringMacro(Title);
149
151
155 vtkGetObjectMacro(TitleTextProperty, vtkTextProperty);
157
158 // Enable/Disable the display axes titles. These are arranged on the end
159 // of each radial axis on the circumference of the spider plot. The label
160 // text strings are derived from the names of the data object arrays
161 // associated with the input.
162 vtkSetMacro(LabelVisibility, vtkTypeBool);
163 vtkGetMacro(LabelVisibility, vtkTypeBool);
164 vtkBooleanMacro(LabelVisibility, vtkTypeBool);
165
167
173 vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
175
177
181 vtkSetClampMacro(NumberOfRings, int, 0, VTK_INT_MAX);
182 vtkGetMacro(NumberOfRings, int);
184
186
190 void SetAxisLabel(const int i, const char*);
191 const char* GetAxisLabel(int i);
193
195
199 void SetAxisRange(int i, double min, double max);
200 void SetAxisRange(int i, double range[2]);
201 void GetAxisRange(int i, double range[2]);
203
205
208 void SetPlotColor(int i, double r, double g, double b);
209 void SetPlotColor(int i, const double color[3])
210 {
211 this->SetPlotColor(i, color[0], color[1], color[2]);
212 }
213 double* GetPlotColor(int i);
215
217
222 vtkSetMacro(LegendVisibility, vtkTypeBool);
223 vtkGetMacro(LegendVisibility, vtkTypeBool);
224 vtkBooleanMacro(LegendVisibility, vtkTypeBool);
226
228
232 vtkGetObjectMacro(LegendActor, vtkLegendBoxActor);
234
236
243
248
255
256protected:
259
260private:
261 vtkSpiderPlotActorConnection* ConnectionHolder;
262
263 int IndependentVariables; // Use column or row
264 vtkTypeBool TitleVisibility; // Should I see the title?
265 char* Title; // The title string
266 vtkTextProperty* TitleTextProperty;
267 vtkTypeBool LabelVisibility;
268 vtkTextProperty* LabelTextProperty;
269 vtkAxisLabelArray* Labels;
270 vtkTypeBool LegendVisibility;
271 vtkLegendBoxActor* LegendActor;
272 vtkGlyphSource2D* GlyphSource;
273 int NumberOfRings;
274
275 // Local variables needed to plot
276 vtkIdType N; // The number of independent variables
277 double* Mins; // Minimum data value along this row/column
278 double* Maxs; // Maximum data value along this row/column
279 vtkAxisRanges* Ranges;
280
281 vtkTextMapper** LabelMappers; // a label for each radial spoke
282 vtkActor2D** LabelActors;
283
284 vtkTextMapper* TitleMapper;
285 vtkActor2D* TitleActor;
286
287 vtkPolyData* WebData; // The web of the spider plot
288 vtkPolyDataMapper2D* WebMapper;
289 vtkActor2D* WebActor;
290
291 vtkPolyData* PlotData; // The lines drawn within the axes
292 vtkPolyDataMapper2D* PlotMapper;
293 vtkActor2D* PlotActor;
294
295 vtkTimeStamp BuildTime;
296
297 double Center[3];
298 double Radius;
299 double Theta;
300
301 int LastPosition[2];
302 int LastPosition2[2];
303 double P1[3];
304 double P2[3];
305
306 void Initialize();
307 int PlaceAxes(vtkViewport* viewport, const int* size);
308 int BuildPlot(vtkViewport*);
309
310private:
311 vtkSpiderPlotActor(const vtkSpiderPlotActor&) = delete;
312 void operator=(const vtkSpiderPlotActor&) = delete;
313};
314
315#endif
a actor that draws 2D data
Definition: vtkActor2D.h:149
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:113
draw symbols with text
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
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
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:52
abstract specification for Viewports
Definition: vtkViewport.h:47
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
@ range
Definition: vtkX3D.h:244
@ color
Definition: vtkX3D.h:227
@ size
Definition: vtkX3D.h:259
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)