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 =========================================================================*/
48 #ifndef vtkAxesActor_h
49 #define vtkAxesActor_h
50 
51 #include "vtkRenderingAnnotationModule.h" // For export macro
52 #include "vtkProp3D.h"
53 
54 class vtkActor;
55 class vtkCaptionActor2D;
56 class vtkConeSource;
57 class vtkCylinderSource;
58 class vtkLineSource;
59 class vtkPolyData;
60 class vtkPropCollection;
61 class vtkProperty;
62 class vtkRenderer;
63 class vtkSphereSource;
64 
65 class VTKRENDERINGANNOTATION_EXPORT vtkAxesActor : public vtkProp3D
66 {
67 public:
68  static vtkAxesActor *New();
69  vtkTypeMacro(vtkAxesActor,vtkProp3D);
70  void PrintSelf(ostream& os, vtkIndent indent) override;
71 
77  void GetActors(vtkPropCollection *) override;
78 
80 
83  int RenderOpaqueGeometry(vtkViewport *viewport) override;
84  int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override;
85  int RenderOverlay(vtkViewport *viewport) override;
87 
91  int HasTranslucentPolygonalGeometry() override;
92 
96  void ShallowCopy(vtkProp *prop) override;
97 
103  void ReleaseGraphicsResources(vtkWindow *) override;
104 
106 
110  void GetBounds(double bounds[6]);
111  double *GetBounds() VTK_SIZEHINT(6) override;
113 
117  vtkMTimeType GetMTime() override;
118 
125  vtkMTimeType GetRedrawMTime() override;
126 
128 
131  void SetTotalLength( double v[3] )
132  { this->SetTotalLength( v[0], v[1], v[2] ); }
133  void SetTotalLength( double x, double y, double z );
134  vtkGetVectorMacro( TotalLength, double, 3 );
136 
138 
141  void SetNormalizedShaftLength( double v[3] )
142  { this->SetNormalizedShaftLength( v[0], v[1], v[2] ); }
143  void SetNormalizedShaftLength( double x, double y, double z );
144  vtkGetVectorMacro( NormalizedShaftLength, double, 3 );
146 
148 
152  void SetNormalizedTipLength( double v[3] )
153  { this->SetNormalizedTipLength( v[0], v[1], v[2] ); }
154  void SetNormalizedTipLength( double x, double y, double z );
155  vtkGetVectorMacro( NormalizedTipLength, double, 3 );
157 
159 
163  void SetNormalizedLabelPosition( double v[3] )
164  { this->SetNormalizedLabelPosition( v[0], v[1], v[2] ); }
165  void SetNormalizedLabelPosition( double x, double y, double z );
166  vtkGetVectorMacro( NormalizedLabelPosition, double, 3 );
168 
170 
173  vtkSetClampMacro(ConeResolution, int, 3, 128);
174  vtkGetMacro(ConeResolution, int);
175  vtkSetClampMacro(SphereResolution, int, 3, 128);
176  vtkGetMacro(SphereResolution, int);
177  vtkSetClampMacro(CylinderResolution, int, 3, 128);
178  vtkGetMacro(CylinderResolution, int);
180 
182 
185  vtkSetClampMacro(ConeRadius, double, 0, VTK_FLOAT_MAX);
186  vtkGetMacro(ConeRadius, double);
187  vtkSetClampMacro(SphereRadius, double, 0, VTK_FLOAT_MAX);
188  vtkGetMacro(SphereRadius, double);
189  vtkSetClampMacro(CylinderRadius, double, 0, VTK_FLOAT_MAX);
190  vtkGetMacro(CylinderRadius, double);
192 
194 
197  void SetShaftType( int type );
199  { this->SetShaftType( vtkAxesActor::CYLINDER_SHAFT ); }
201  { this->SetShaftType( vtkAxesActor::LINE_SHAFT ); }
203  { this->SetShaftType( vtkAxesActor::USER_DEFINED_SHAFT ); }
204  vtkGetMacro(ShaftType, int);
206 
208 
211  void SetTipType( int type );
213  { this->SetTipType( vtkAxesActor::CONE_TIP ); }
215  { this->SetTipType( vtkAxesActor::SPHERE_TIP ); }
217  { this->SetTipType( vtkAxesActor::USER_DEFINED_TIP ); }
218  vtkGetMacro(TipType, int);
220 
222 
225  void SetUserDefinedTip( vtkPolyData * );
226  vtkGetObjectMacro( UserDefinedTip, vtkPolyData );
228 
230 
233  void SetUserDefinedShaft( vtkPolyData * );
234  vtkGetObjectMacro( UserDefinedShaft, vtkPolyData );
236 
238 
241  vtkProperty *GetXAxisTipProperty();
242  vtkProperty *GetYAxisTipProperty();
243  vtkProperty *GetZAxisTipProperty();
245 
247 
250  vtkProperty *GetXAxisShaftProperty();
251  vtkProperty *GetYAxisShaftProperty();
252  vtkProperty *GetZAxisShaftProperty();
254 
260  {return this->XAxisLabel;}
262  {return this->YAxisLabel;}
264  {return this->ZAxisLabel;}
265 
267 
270  vtkSetStringMacro( XAxisLabelText );
271  vtkGetStringMacro( XAxisLabelText );
272  vtkSetStringMacro( YAxisLabelText );
273  vtkGetStringMacro( YAxisLabelText );
274  vtkSetStringMacro( ZAxisLabelText );
275  vtkGetStringMacro( ZAxisLabelText );
277 
279 
282  vtkSetMacro(AxisLabels, vtkTypeBool);
283  vtkGetMacro(AxisLabels, vtkTypeBool);
284  vtkBooleanMacro(AxisLabels, vtkTypeBool);
286 
287  enum
288  {
291  USER_DEFINED_SHAFT
292  };
293 
294  enum
295  {
298  USER_DEFINED_TIP
299  };
300 
301 protected:
302  vtkAxesActor();
303  ~vtkAxesActor() override;
304 
309 
313 
317 
318  void UpdateProps();
319 
320  double TotalLength[3];
321  double NormalizedShaftLength[3];
322  double NormalizedTipLength[3];
323  double NormalizedLabelPosition[3];
324 
326  int TipType;
327 
330 
334 
338 
340 
341 
345 
346  double ConeRadius;
347  double SphereRadius;
349 
350 private:
351  vtkAxesActor(const vtkAxesActor&) = delete;
352  void operator=(const vtkAxesActor&) = delete;
353 };
354 
355 #endif
356 
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:44
vtkCaptionActor2D * GetXAxisCaptionActor2D()
Retrieve handles to the X, Y and Z axis (so that you can set their text properties for example) ...
Definition: vtkAxesActor.h:259
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
vtkPolyData * UserDefinedTip
Definition: vtkAxesActor.h:328
generate a cylinder centered at origin
double * GetBounds() override=0
Return a reference to the Prop3D's composite transform.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:300
abstract specification for Viewports
Definition: vtkViewport.h:44
represent surface properties of a geometric object
Definition: vtkProperty.h:60
virtual int RenderOpaqueGeometry(vtkViewport *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:216
virtual int HasTranslucentPolygonalGeometry()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:288
virtual int RenderOverlay(vtkViewport *)
Definition: vtkProp.h:222
vtkCaptionActor2D * GetYAxisCaptionActor2D()
Definition: vtkAxesActor.h:261
vtkCaptionActor2D * GetZAxisCaptionActor2D()
Definition: vtkAxesActor.h:263
int CylinderResolution
Definition: vtkAxesActor.h:344
a 3D axes representation
Definition: vtkAxesActor.h:65
char * ZAxisLabelText
Definition: vtkAxesActor.h:333
abstract specification for renderers
Definition: vtkRenderer.h:57
vtkLineSource * LineSource
Definition: vtkAxesActor.h:306
generate polygonal cone
Definition: vtkConeSource.h:38
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:43
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
vtkSphereSource * SphereSource
Definition: vtkAxesActor.h:308
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:297
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
create a polygonal sphere centered at the origin
#define VTK_FLOAT_MAX
Definition: vtkType.h:165
char * XAxisLabelText
Definition: vtkAxesActor.h:331
vtkActor * ZAxisShaft
Definition: vtkAxesActor.h:312
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkCaptionActor2D * ZAxisLabel
Definition: vtkAxesActor.h:337
vtkConeSource * ConeSource
Definition: vtkAxesActor.h:307
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkProp3D.
vtkActor * XAxisTip
Definition: vtkAxesActor.h:314
vtkCaptionActor2D * YAxisLabel
Definition: vtkAxesActor.h:336
#define VTK_SIZEHINT(...)
vtkActor * ZAxisTip
Definition: vtkAxesActor.h:316
double SphereRadius
Definition: vtkAxesActor.h:347
create a line defined by two end points
Definition: vtkLineSource.h:36
void SetShaftTypeToUserDefined()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:202
vtkActor * YAxisTip
Definition: vtkAxesActor.h:315
void SetShaftTypeToLine()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:200
double ConeRadius
Definition: vtkAxesActor.h:346
vtkCylinderSource * CylinderSource
Definition: vtkAxesActor.h:305
vtkTypeBool AxisLabels
Definition: vtkAxesActor.h:339
vtkActor * YAxisShaft
Definition: vtkAxesActor.h:311
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:218
void SetTipTypeToCone()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:212
vtkActor * XAxisShaft
Definition: vtkAxesActor.h:310
vtkCaptionActor2D * XAxisLabel
Definition: vtkAxesActor.h:335
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:163
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
char * YAxisLabelText
Definition: vtkAxesActor.h:332
void SetShaftTypeToCylinder()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:198
int SphereResolution
Definition: vtkAxesActor.h:343
void SetNormalizedTipLength(double v[3])
Set the normalized (0-1) length of the tip.
Definition: vtkAxesActor.h:152
double CylinderRadius
Definition: vtkAxesActor.h:348
vtkPolyData * UserDefinedShaft
Definition: vtkAxesActor.h:329
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:55
void SetTipTypeToUserDefined()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:216
void SetTipTypeToSphere()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:214
void SetNormalizedShaftLength(double v[3])
Set the normalized (0-1) length of the shaft.
Definition: vtkAxesActor.h:141