VTK  9.0.3
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 =========================================================================*/
49 #ifndef vtkSpiderPlotActor_h
50 #define vtkSpiderPlotActor_h
51 
52 #include "vtkActor2D.h"
53 #include "vtkRenderingAnnotationModule.h" // For export macro
54 
55 class vtkAlgorithmOutput;
56 class vtkAxisActor2D;
57 class vtkDataObject;
58 class vtkPolyData;
60 class vtkTextMapper;
61 class vtkTextProperty;
62 class vtkLegendBoxActor;
63 class vtkGlyphSource2D;
64 class vtkAxisLabelArray;
65 class vtkAxisRanges;
66 class vtkSpiderPlotActorConnection;
67 
68 #define VTK_IV_COLUMN 0
69 #define VTK_IV_ROW 1
70 
71 class VTKRENDERINGANNOTATION_EXPORT vtkSpiderPlotActor : public vtkActor2D
72 {
73 public:
75 
79  void PrintSelf(ostream& os, vtkIndent indent) override;
81 
86 
88 
93  virtual void SetInputData(vtkDataObject*);
96 
101 
103 
108  vtkSetClampMacro(IndependentVariables, int, VTK_IV_COLUMN, VTK_IV_ROW);
109  vtkGetMacro(IndependentVariables, int);
110  void SetIndependentVariablesToColumns() { this->SetIndependentVariables(VTK_IV_COLUMN); }
111  void SetIndependentVariablesToRows() { this->SetIndependentVariables(VTK_IV_ROW); }
113 
115 
118  vtkSetMacro(TitleVisibility, vtkTypeBool);
119  vtkGetMacro(TitleVisibility, vtkTypeBool);
120  vtkBooleanMacro(TitleVisibility, vtkTypeBool);
122 
124 
127  vtkSetStringMacro(Title);
128  vtkGetStringMacro(Title);
130 
132 
136  vtkGetObjectMacro(TitleTextProperty, vtkTextProperty);
138 
139  // Enable/Disable the display axes titles. These are arranged on the end
140  // of each radial axis on the circumference of the spider plot. The label
141  // text strings are derived from the names of the data object arrays
142  // associated with the input.
143  vtkSetMacro(LabelVisibility, vtkTypeBool);
144  vtkGetMacro(LabelVisibility, vtkTypeBool);
145  vtkBooleanMacro(LabelVisibility, vtkTypeBool);
146 
148 
154  vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
156 
158 
162  vtkSetClampMacro(NumberOfRings, int, 0, VTK_INT_MAX);
163  vtkGetMacro(NumberOfRings, int);
165 
167 
171  void SetAxisLabel(const int i, const char*);
172  const char* GetAxisLabel(int i);
174 
176 
180  void SetAxisRange(int i, double min, double max);
181  void SetAxisRange(int i, double range[2]);
182  void GetAxisRange(int i, double range[2]);
184 
186 
189  void SetPlotColor(int i, double r, double g, double b);
190  void SetPlotColor(int i, const double color[3])
191  {
192  this->SetPlotColor(i, color[0], color[1], color[2]);
193  }
194  double* GetPlotColor(int i);
196 
198 
203  vtkSetMacro(LegendVisibility, vtkTypeBool);
204  vtkGetMacro(LegendVisibility, vtkTypeBool);
205  vtkBooleanMacro(LegendVisibility, vtkTypeBool);
207 
209 
213  vtkGetObjectMacro(LegendActor, vtkLegendBoxActor);
215 
217 
220  int RenderOverlay(vtkViewport*) override;
222  int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
224 
229 
236 
237 protected:
240 
241 private:
242  vtkSpiderPlotActorConnection* ConnectionHolder;
243 
244  int IndependentVariables; // Use column or row
245  vtkTypeBool TitleVisibility; // Should I see the title?
246  char* Title; // The title string
247  vtkTextProperty* TitleTextProperty;
248  vtkTypeBool LabelVisibility;
249  vtkTextProperty* LabelTextProperty;
250  vtkAxisLabelArray* Labels;
251  vtkTypeBool LegendVisibility;
252  vtkLegendBoxActor* LegendActor;
253  vtkGlyphSource2D* GlyphSource;
254  int NumberOfRings;
255 
256  // Local variables needed to plot
257  vtkIdType N; // The number of independent variables
258  double* Mins; // Minimum data value along this row/column
259  double* Maxs; // Maximum data value along this row/column
260  vtkAxisRanges* Ranges;
261 
262  vtkTextMapper** LabelMappers; // a label for each radial spoke
263  vtkActor2D** LabelActors;
264 
265  vtkTextMapper* TitleMapper;
266  vtkActor2D* TitleActor;
267 
268  vtkPolyData* WebData; // The web of the spider plot
269  vtkPolyDataMapper2D* WebMapper;
270  vtkActor2D* WebActor;
271 
272  vtkPolyData* PlotData; // The lines drawn within the axes
273  vtkPolyDataMapper2D* PlotMapper;
274  vtkActor2D* PlotActor;
275 
276  vtkTimeStamp BuildTime;
277 
278  double Center[3];
279  double Radius;
280  double Theta;
281 
282  int LastPosition[2];
283  int LastPosition2[2];
284  double P1[3];
285  double P2[3];
286 
287  void Initialize();
288  int PlaceAxes(vtkViewport* viewport, const int* size);
289  int BuildPlot(vtkViewport*);
290 
291 private:
292  vtkSpiderPlotActor(const vtkSpiderPlotActor&) = delete;
293  void operator=(const vtkSpiderPlotActor&) = delete;
294 };
295 
296 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:40
Proxy object to connect input/output ports.
Create an axis with tick marks and labels.
general representation of visualization data
Definition: vtkDataObject.h:60
create 2D glyphs represented by vtkPolyData
a simple class to control print indentation
Definition: vtkIndent.h:34
draw symbols with text
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
create a spider plot from input field
int RenderOpaqueGeometry(vtkViewport *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
const char * GetAxisLabel(int i)
void SetPlotColor(int i, double r, double g, double b)
Specify colors for each plot.
virtual void SetInputConnection(vtkAlgorithmOutput *)
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
void SetPlotColor(int i, const double color[3])
double * GetPlotColor(int i)
virtual void SetInputData(vtkDataObject *)
Set the input to the pie chart actor.
void GetAxisRange(int i, double range[2])
virtual void SetTitleTextProperty(vtkTextProperty *p)
Set/Get the title text property.
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
void SetIndependentVariablesToColumns()
virtual vtkDataObject * GetInput()
Get the input data object to this actor.
~vtkSpiderPlotActor() override
virtual void SetLabelTextProperty(vtkTextProperty *p)
Enable/Disable the creation of a legend.
void SetAxisRange(int i, double range[2])
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.
void SetAxisLabel(const int i, const char *)
Specify the names of the radial spokes (i.e., the radial axes).
static vtkSpiderPlotActor * New()
Instantiate this class.
2D text annotation
Definition: vtkTextMapper.h:48
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:33
abstract specification for Viewports
Definition: vtkViewport.h:45
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
@ 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:338
#define VTK_INT_MAX
Definition: vtkType.h:155
#define max(a, b)