VTK  9.2.6
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 =========================================================================*/
52 #ifndef vtkSpiderPlotActor_h
53 #define vtkSpiderPlotActor_h
54 
55 #include "vtkActor2D.h"
56 #include "vtkRenderingAnnotationModule.h" // For export macro
57 
58 class vtkAlgorithmOutput;
59 class vtkAxisActor2D;
60 class vtkDataObject;
61 class vtkPolyData;
63 class vtkTextMapper;
64 class vtkTextProperty;
65 class vtkLegendBoxActor;
66 class vtkGlyphSource2D;
67 class vtkAxisLabelArray;
68 class vtkAxisRanges;
69 class vtkSpiderPlotActorConnection;
70 
71 #define VTK_IV_COLUMN 0
72 #define VTK_IV_ROW 1
73 
74 class VTKRENDERINGANNOTATION_EXPORT vtkSpiderPlotActor : public vtkActor2D
75 {
76 public:
78 
82  void PrintSelf(ostream& os, vtkIndent indent) override;
84 
88  static vtkSpiderPlotActor* New();
89 
91 
96  virtual void SetInputData(vtkDataObject*);
97  virtual void SetInputConnection(vtkAlgorithmOutput*);
99 
103  virtual vtkDataObject* GetInput();
104 
106 
111  vtkSetClampMacro(IndependentVariables, int, VTK_IV_COLUMN, VTK_IV_ROW);
112  vtkGetMacro(IndependentVariables, int);
113  void SetIndependentVariablesToColumns() { this->SetIndependentVariables(VTK_IV_COLUMN); }
114  void SetIndependentVariablesToRows() { this->SetIndependentVariables(VTK_IV_ROW); }
116 
118 
121  vtkSetMacro(TitleVisibility, vtkTypeBool);
122  vtkGetMacro(TitleVisibility, vtkTypeBool);
123  vtkBooleanMacro(TitleVisibility, vtkTypeBool);
125 
127 
130  vtkSetStringMacro(Title);
131  vtkGetStringMacro(Title);
133 
135 
138  virtual void SetTitleTextProperty(vtkTextProperty* p);
139  vtkGetObjectMacro(TitleTextProperty, vtkTextProperty);
141 
142  // Enable/Disable the display axes titles. These are arranged on the end
143  // of each radial axis on the circumference of the spider plot. The label
144  // text strings are derived from the names of the data object arrays
145  // associated with the input.
146  vtkSetMacro(LabelVisibility, vtkTypeBool);
147  vtkGetMacro(LabelVisibility, vtkTypeBool);
148  vtkBooleanMacro(LabelVisibility, vtkTypeBool);
149 
151 
156  virtual void SetLabelTextProperty(vtkTextProperty* p);
157  vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
159 
161 
165  vtkSetClampMacro(NumberOfRings, int, 0, VTK_INT_MAX);
166  vtkGetMacro(NumberOfRings, int);
168 
170 
174  void SetAxisLabel(const int i, const char*);
175  const char* GetAxisLabel(int i);
177 
179 
183  void SetAxisRange(int i, double min, double max);
184  void SetAxisRange(int i, double range[2]);
185  void GetAxisRange(int i, double range[2]);
187 
189 
192  void SetPlotColor(int i, double r, double g, double b);
193  void SetPlotColor(int i, const double color[3])
194  {
195  this->SetPlotColor(i, color[0], color[1], color[2]);
196  }
197  double* GetPlotColor(int i);
199 
201 
206  vtkSetMacro(LegendVisibility, vtkTypeBool);
207  vtkGetMacro(LegendVisibility, vtkTypeBool);
208  vtkBooleanMacro(LegendVisibility, vtkTypeBool);
210 
212 
216  vtkGetObjectMacro(LegendActor, vtkLegendBoxActor);
218 
220 
223  int RenderOverlay(vtkViewport*) override;
224  int RenderOpaqueGeometry(vtkViewport*) override;
225  int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
227 
232 
238  void ReleaseGraphicsResources(vtkWindow*) override;
239 
240 protected:
242  ~vtkSpiderPlotActor() override;
243 
244 private:
245  vtkSpiderPlotActorConnection* ConnectionHolder;
246 
247  int IndependentVariables; // Use column or row
248  vtkTypeBool TitleVisibility; // Should I see the title?
249  char* Title; // The title string
250  vtkTextProperty* TitleTextProperty;
251  vtkTypeBool LabelVisibility;
252  vtkTextProperty* LabelTextProperty;
253  vtkAxisLabelArray* Labels;
254  vtkTypeBool LegendVisibility;
255  vtkLegendBoxActor* LegendActor;
256  vtkGlyphSource2D* GlyphSource;
257  int NumberOfRings;
258 
259  // Local variables needed to plot
260  vtkIdType N; // The number of independent variables
261  double* Mins; // Minimum data value along this row/column
262  double* Maxs; // Maximum data value along this row/column
263  vtkAxisRanges* Ranges;
264 
265  vtkTextMapper** LabelMappers; // a label for each radial spoke
266  vtkActor2D** LabelActors;
267 
268  vtkTextMapper* TitleMapper;
269  vtkActor2D* TitleActor;
270 
271  vtkPolyData* WebData; // The web of the spider plot
272  vtkPolyDataMapper2D* WebMapper;
273  vtkActor2D* WebActor;
274 
275  vtkPolyData* PlotData; // The lines drawn within the axes
276  vtkPolyDataMapper2D* PlotMapper;
277  vtkActor2D* PlotActor;
278 
279  vtkTimeStamp BuildTime;
280 
281  double Center[3];
282  double Radius;
283  double Theta;
284 
285  int LastPosition[2];
286  int LastPosition2[2];
287  double P1[3];
288  double P2[3];
289 
290  void Initialize();
291  int PlaceAxes(vtkViewport* viewport, const int* size);
292  int BuildPlot(vtkViewport*);
293 
294 private:
295  vtkSpiderPlotActor(const vtkSpiderPlotActor&) = delete;
296  void operator=(const vtkSpiderPlotActor&) = delete;
297 };
298 
299 #endif
draw symbols with text
void SetIndependentVariablesToRows()
Specify whether to use the rows or columns as independent variables.
int RenderOverlay(vtkViewport *viewport) override
Support the standard render methods.
abstract specification for Viewports
Definition: vtkViewport.h:55
#define VTK_IV_COLUMN
#define VTK_INT_MAX
Definition: vtkType.h:155
a actor that draws 2D data
Definition: vtkActor2D.h:45
record modification and/or execution time
Definition: vtkTimeStamp.h:35
Create an axis with tick marks and labels.
int vtkIdType
Definition: vtkType.h:332
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:90
#define VTK_IV_ROW
void SetIndependentVariablesToColumns()
Specify whether to use the rows or columns as independent variables.
create a spider plot from input field
2D text annotation
Definition: vtkTextMapper.h:50
Proxy object to connect input/output ports.
int vtkTypeBool
Definition: vtkABI.h:69
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
a simple class to control print indentation
Definition: vtkIndent.h:39
void SetPlotColor(int i, const double color[3])
Specify colors for each plot.
static vtkActor2D * New()
Creates an actor2D with the following defaults: position (0,0) (coordinate system is viewport); at la...
represent text properties.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
int RenderOpaqueGeometry(vtkViewport *viewport) override
Support the standard render methods.
create 2D glyphs represented by vtkPolyData
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Draw the spider plot.
general representation of visualization data
Definition: vtkDataObject.h:65
draw vtkPolyData onto the image plane
#define max(a, b)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.