VTK
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 "vtkRenderingAnnotationModule.h" // For export macro
56#include "vtkActor2D.h"
57
59class vtkAxisActor2D;
60class vtkDataObject;
61class vtkPolyData;
63class vtkTextMapper;
64class vtkTextProperty;
67class vtkAxisLabelArray;
68class vtkAxisRanges;
69class vtkSpiderPlotActorConnection;
70
71
72#define VTK_IV_COLUMN 0
73#define VTK_IV_ROW 1
74
75class VTKRENDERINGANNOTATION_EXPORT vtkSpiderPlotActor : public vtkActor2D
76{
77public:
79
83 void PrintSelf(ostream& os, vtkIndent indent);
85
90
92
100
105
107
112 vtkSetClampMacro(IndependentVariables,int,VTK_IV_COLUMN, VTK_IV_ROW);
113 vtkGetMacro(IndependentVariables,int);
115 {this->SetIndependentVariables(VTK_IV_COLUMN);};
117 {this->SetIndependentVariables(VTK_IV_ROW);};
119
121
124 vtkSetMacro(TitleVisibility, int);
125 vtkGetMacro(TitleVisibility, int);
126 vtkBooleanMacro(TitleVisibility, int);
128
130
133 vtkSetStringMacro(Title);
136
138
142 vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
144
145 // Enable/Disable the display axes titles. These are arranged on the end
146 // of each radial axis on the circumference of the spider plot. The label
147 // text strings are derived from the names of the data object arrays
148 // associated with the input.
149 vtkSetMacro(LabelVisibility, int);
150 vtkGetMacro(LabelVisibility, int);
151 vtkBooleanMacro(LabelVisibility, int);
152
154
160 vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
162
164
168 vtkSetClampMacro(NumberOfRings,int,0,VTK_INT_MAX);
169 vtkGetMacro(NumberOfRings,int);
171
173
177 void SetAxisLabel(const int i, const char *);
178 const char* GetAxisLabel(int i);
180
182
186 void SetAxisRange(int i, double min, double max);
187 void SetAxisRange(int i, double range[2]);
188 void GetAxisRange(int i, double range[2]);
190
192
195 void SetPlotColor(int i, double r, double g, double b);
196 void SetPlotColor(int i, const double color[3])
197 { this->SetPlotColor(i, color[0], color[1], color[2]); }
198 double *GetPlotColor(int i);
200
202
207 vtkSetMacro(LegendVisibility, int);
208 vtkGetMacro(LegendVisibility, int);
209 vtkBooleanMacro(LegendVisibility, int);
211
213
217 vtkGetObjectMacro(LegendActor,vtkLegendBoxActor);
219
221
228
233
240
241protected:
244
245private:
246
247 vtkSpiderPlotActorConnection* ConnectionHolder;
248
249 int IndependentVariables; // Use column or row
250 int TitleVisibility; // Should I see the title?
251 char *Title; // The title string
252 vtkTextProperty *TitleTextProperty;
253 int LabelVisibility;
254 vtkTextProperty *LabelTextProperty;
255 vtkAxisLabelArray *Labels;
256 int LegendVisibility;
257 vtkLegendBoxActor *LegendActor;
258 vtkGlyphSource2D *GlyphSource;
259 int NumberOfRings;
260
261 // Local variables needed to plot
262 vtkIdType N; // The number of independent variables
263 double *Mins; // Minimum data value along this row/column
264 double *Maxs; // Maximum data value along this row/column
265 vtkAxisRanges *Ranges;
266
267 vtkTextMapper **LabelMappers; //a label for each radial spoke
268 vtkActor2D **LabelActors;
269
270 vtkTextMapper *TitleMapper;
271 vtkActor2D *TitleActor;
272
273 vtkPolyData *WebData; // The web of the spider plot
274 vtkPolyDataMapper2D *WebMapper;
275 vtkActor2D *WebActor;
276
277 vtkPolyData *PlotData; // The lines drawn within the axes
278 vtkPolyDataMapper2D *PlotMapper;
279 vtkActor2D *PlotActor;
280
282
283 double Center[3];
284 double Radius;
285 double Theta;
286
287 int LastPosition[2];
288 int LastPosition2[2];
289 double P1[3];
290 double P2[3];
291
292 void Initialize();
293 int PlaceAxes(vtkViewport *viewport, int *size);
294 int BuildPlot(vtkViewport*);
295
296private:
297 vtkSpiderPlotActor(const vtkSpiderPlotActor&) VTK_DELETE_FUNCTION;
298 void operator=(const vtkSpiderPlotActor&) VTK_DELETE_FUNCTION;
299};
300
301
302#endif
303
a actor that draws 2D data
Definition: vtkActor2D.h:46
Proxy object to connect input/output ports.
Create an axis with tick marks and labels.
general representation of visualization data
Definition: vtkDataObject.h:65
create 2D glyphs represented by vtkPolyData
a simple class to control print indentation
Definition: vtkIndent.h:40
draw symbols with text
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
create a spider plot from input field
void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this actor.
int RenderOpaqueGeometry(vtkViewport *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
virtual int HasTranslucentPolygonalGeometry()
Does this prop have some translucent polygonal geometry?
void SetPlotColor(int i, double r, double g, double b)
Specify colors for each plot.
virtual void SetInputConnection(vtkAlgorithmOutput *)
static vtkSpiderPlotActor * New()
Instantiate this class.
void SetPlotColor(int i, const double color[3])
int RenderOverlay(vtkViewport *)
Draw the spider 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])
virtual void SetTitleTextProperty(vtkTextProperty *p)
Set/Get the title text property.
const char * GetAxisLabel(int i)
void SetIndependentVariablesToColumns()
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
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.
double * GetPlotColor(int i)
void SetAxisLabel(const int i, const char *)
Specify the names of the radial spokes (i.e., the radial axes).
2D text annotation
Definition: vtkTextMapper.h:54
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:36
abstract specification for Viewports
Definition: vtkViewport.h:48
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
@ range
Definition: vtkX3D.h:238
@ color
Definition: vtkX3D.h:221
@ size
Definition: vtkX3D.h:253
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkTimeStamp BuildTime
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
#define VTK_IV_ROW
#define VTK_IV_COLUMN
#define P1
#define P2
int vtkIdType
Definition: vtkType.h:287
#define VTK_INT_MAX
Definition: vtkType.h:153
#define max(a, b)