VTK
vtkAxesActor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAxesActor.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 =========================================================================*/
51 #ifndef vtkAxesActor_h
52 #define vtkAxesActor_h
53 
54 #include "vtkRenderingAnnotationModule.h" // For export macro
55 #include "vtkProp3D.h"
56 
57 class vtkActor;
58 class vtkCaptionActor2D;
59 class vtkConeSource;
60 class vtkCylinderSource;
61 class vtkLineSource;
62 class vtkPolyData;
63 class vtkPropCollection;
64 class vtkProperty;
65 class vtkRenderer;
66 class vtkSphereSource;
67 
68 class VTKRENDERINGANNOTATION_EXPORT vtkAxesActor : public vtkProp3D
69 {
70 public:
71  static vtkAxesActor *New();
72  vtkTypeMacro(vtkAxesActor,vtkProp3D);
73  void PrintSelf(ostream& os, vtkIndent indent) override;
74 
80  void GetActors(vtkPropCollection *) override;
81 
83 
86  int RenderOpaqueGeometry(vtkViewport *viewport) override;
87  int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override;
88  int RenderOverlay(vtkViewport *viewport) override;
90 
95 
99  void ShallowCopy(vtkProp *prop) override;
100 
106  void ReleaseGraphicsResources(vtkWindow *) override;
107 
109 
113  void GetBounds(double bounds[6]);
114  double *GetBounds() VTK_SIZEHINT(6) override;
116 
120  vtkMTimeType GetMTime() override;
121 
128  vtkMTimeType GetRedrawMTime() override;
129 
131 
134  void SetTotalLength( double v[3] )
135  { this->SetTotalLength( v[0], v[1], v[2] ); }
136  void SetTotalLength( double x, double y, double z );
137  vtkGetVectorMacro( TotalLength, double, 3 );
139 
141 
144  void SetNormalizedShaftLength( double v[3] )
145  { this->SetNormalizedShaftLength( v[0], v[1], v[2] ); }
146  void SetNormalizedShaftLength( double x, double y, double z );
147  vtkGetVectorMacro( NormalizedShaftLength, double, 3 );
149 
151 
155  void SetNormalizedTipLength( double v[3] )
156  { this->SetNormalizedTipLength( v[0], v[1], v[2] ); }
157  void SetNormalizedTipLength( double x, double y, double z );
158  vtkGetVectorMacro( NormalizedTipLength, double, 3 );
160 
162 
166  void SetNormalizedLabelPosition( double v[3] )
167  { this->SetNormalizedLabelPosition( v[0], v[1], v[2] ); }
168  void SetNormalizedLabelPosition( double x, double y, double z );
169  vtkGetVectorMacro( NormalizedLabelPosition, double, 3 );
171 
173 
176  vtkSetClampMacro(ConeResolution, int, 3, 128);
177  vtkGetMacro(ConeResolution, int);
178  vtkSetClampMacro(SphereResolution, int, 3, 128);
179  vtkGetMacro(SphereResolution, int);
180  vtkSetClampMacro(CylinderResolution, int, 3, 128);
181  vtkGetMacro(CylinderResolution, int);
183 
185 
188  vtkSetClampMacro(ConeRadius, double, 0, VTK_FLOAT_MAX);
189  vtkGetMacro(ConeRadius, double);
190  vtkSetClampMacro(SphereRadius, double, 0, VTK_FLOAT_MAX);
191  vtkGetMacro(SphereRadius, double);
192  vtkSetClampMacro(CylinderRadius, double, 0, VTK_FLOAT_MAX);
193  vtkGetMacro(CylinderRadius, double);
195 
197 
200  void SetShaftType( int type );
202  { this->SetShaftType( vtkAxesActor::CYLINDER_SHAFT ); }
204  { this->SetShaftType( vtkAxesActor::LINE_SHAFT ); }
206  { this->SetShaftType( vtkAxesActor::USER_DEFINED_SHAFT ); }
207  vtkGetMacro(ShaftType, int);
209 
211 
214  void SetTipType( int type );
216  { this->SetTipType( vtkAxesActor::CONE_TIP ); }
218  { this->SetTipType( vtkAxesActor::SPHERE_TIP ); }
220  { this->SetTipType( vtkAxesActor::USER_DEFINED_TIP ); }
221  vtkGetMacro(TipType, int);
223 
225 
228  void SetUserDefinedTip( vtkPolyData * );
229  vtkGetObjectMacro( UserDefinedTip, vtkPolyData );
231 
233 
236  void SetUserDefinedShaft( vtkPolyData * );
237  vtkGetObjectMacro( UserDefinedShaft, vtkPolyData );
239 
241 
244  vtkProperty *GetXAxisTipProperty();
245  vtkProperty *GetYAxisTipProperty();
246  vtkProperty *GetZAxisTipProperty();
248 
250 
253  vtkProperty *GetXAxisShaftProperty();
254  vtkProperty *GetYAxisShaftProperty();
255  vtkProperty *GetZAxisShaftProperty();
257 
263  {return this->XAxisLabel;}
265  {return this->YAxisLabel;}
267  {return this->ZAxisLabel;}
268 
270 
273  vtkSetStringMacro( XAxisLabelText );
274  vtkGetStringMacro( XAxisLabelText );
275  vtkSetStringMacro( YAxisLabelText );
276  vtkGetStringMacro( YAxisLabelText );
277  vtkSetStringMacro( ZAxisLabelText );
278  vtkGetStringMacro( ZAxisLabelText );
280 
282 
285  vtkSetMacro(AxisLabels, vtkTypeBool);
286  vtkGetMacro(AxisLabels, vtkTypeBool);
287  vtkBooleanMacro(AxisLabels, vtkTypeBool);
289 
290  enum
291  {
294  USER_DEFINED_SHAFT
295  };
296 
297  enum
298  {
301  USER_DEFINED_TIP
302  };
303 
304 protected:
305  vtkAxesActor();
306  ~vtkAxesActor() override;
307 
312 
316 
320 
321  void UpdateProps();
322 
323  double TotalLength[3];
324  double NormalizedShaftLength[3];
325  double NormalizedTipLength[3];
326  double NormalizedLabelPosition[3];
327 
329  int TipType;
330 
333 
337 
341 
343 
344 
348 
349  double ConeRadius;
350  double SphereRadius;
352 
353 private:
354  vtkAxesActor(const vtkAxesActor&) = delete;
355  void operator=(const vtkAxesActor&) = delete;
356 };
357 
358 #endif
359 
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
vtkCaptionActor2D * GetXAxisCaptionActor2D()
Retrieve handles to the X, Y and Z axis (so that you can set their text properties for example) ...
Definition: vtkAxesActor.h:262
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
vtkPolyData * UserDefinedTip
Definition: vtkAxesActor.h:331
generate a cylinder centered at origin
double * GetBounds() override=0
Return a reference to the Prop3D's composite transform.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
abstract specification for Viewports
Definition: vtkViewport.h:47
represent surface properties of a geometric object
Definition: vtkProperty.h:66
virtual int RenderOpaqueGeometry(vtkViewport *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:224
virtual vtkTypeBool HasTranslucentPolygonalGeometry()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:296
virtual int RenderOverlay(vtkViewport *)
Definition: vtkProp.h:230
vtkCaptionActor2D * GetYAxisCaptionActor2D()
Definition: vtkAxesActor.h:264
vtkCaptionActor2D * GetZAxisCaptionActor2D()
Definition: vtkAxesActor.h:266
int CylinderResolution
Definition: vtkAxesActor.h:347
a 3D axes representation
Definition: vtkAxesActor.h:68
char * ZAxisLabelText
Definition: vtkAxesActor.h:336
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkLineSource * LineSource
Definition: vtkAxesActor.h:309
generate polygonal cone
Definition: vtkConeSource.h:44
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:46
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkSphereSource * SphereSource
Definition: vtkAxesActor.h:311
an ordered list of Props
int vtkTypeBool
Definition: vtkABI.h:69
virtual void ReleaseGraphicsResources(vtkWindow *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
Definition: vtkProp.h:305
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
create a polygonal sphere centered at the origin
#define VTK_FLOAT_MAX
Definition: vtkType.h:167
char * XAxisLabelText
Definition: vtkAxesActor.h:334
vtkActor * ZAxisShaft
Definition: vtkAxesActor.h:315
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkCaptionActor2D * ZAxisLabel
Definition: vtkAxesActor.h:340
vtkConeSource * ConeSource
Definition: vtkAxesActor.h:310
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkProp3D.
vtkActor * XAxisTip
Definition: vtkAxesActor.h:317
vtkCaptionActor2D * YAxisLabel
Definition: vtkAxesActor.h:339
#define VTK_SIZEHINT(...)
vtkActor * ZAxisTip
Definition: vtkAxesActor.h:319
double SphereRadius
Definition: vtkAxesActor.h:350
create a line defined by two end points
Definition: vtkLineSource.h:42
void SetShaftTypeToUserDefined()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:205
vtkActor * YAxisTip
Definition: vtkAxesActor.h:318
void SetShaftTypeToLine()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:203
double ConeRadius
Definition: vtkAxesActor.h:349
vtkCylinderSource * CylinderSource
Definition: vtkAxesActor.h:308
vtkTypeBool AxisLabels
Definition: vtkAxesActor.h:342
vtkActor * YAxisShaft
Definition: vtkAxesActor.h:314
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
Definition: vtkProp.h:226
void SetTipTypeToCone()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:215
vtkActor * XAxisShaft
Definition: vtkAxesActor.h:313
vtkCaptionActor2D * XAxisLabel
Definition: vtkAxesActor.h:338
draw text label associated with a point
void SetNormalizedLabelPosition(double v[3])
Set the normalized (0-1) position of the label along the length of the shaft.
Definition: vtkAxesActor.h:166
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
char * YAxisLabelText
Definition: vtkAxesActor.h:335
void SetShaftTypeToCylinder()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:201
int SphereResolution
Definition: vtkAxesActor.h:346
void SetNormalizedTipLength(double v[3])
Set the normalized (0-1) length of the tip.
Definition: vtkAxesActor.h:155
double CylinderRadius
Definition: vtkAxesActor.h:351
vtkPolyData * UserDefinedShaft
Definition: vtkAxesActor.h:332
virtual void GetActors(vtkPropCollection *)
For some exporters and other other operations we must be able to collect all the actors or volumes...
Definition: vtkProp.h:63
void SetTipTypeToUserDefined()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:219
void SetTipTypeToSphere()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:217
void SetNormalizedShaftLength(double v[3])
Set the normalized (0-1) length of the shaft.
Definition: vtkAxesActor.h:144