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 =========================================================================*/
54 #ifndef vtkAxesActor_h
55 #define vtkAxesActor_h
56 
57 #include "vtkRenderingAnnotationModule.h" // For export macro
58 #include "vtkProp3D.h"
59 
60 class vtkActor;
61 class vtkCaptionActor2D;
62 class vtkConeSource;
63 class vtkCylinderSource;
64 class vtkLineSource;
65 class vtkPolyData;
66 class vtkPropCollection;
67 class vtkProperty;
68 class vtkRenderer;
69 class vtkSphereSource;
70 
71 class VTKRENDERINGANNOTATION_EXPORT vtkAxesActor : public vtkProp3D
72 {
73 public:
74  static vtkAxesActor *New();
75  vtkTypeMacro(vtkAxesActor,vtkProp3D);
76  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
77 
83  void GetActors(vtkPropCollection *) VTK_OVERRIDE;
84 
86 
89  int RenderOpaqueGeometry(vtkViewport *viewport) VTK_OVERRIDE;
90  int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) VTK_OVERRIDE;
91  int RenderOverlay(vtkViewport *viewport) VTK_OVERRIDE;
93 
97  int HasTranslucentPolygonalGeometry() VTK_OVERRIDE;
98 
102  void ShallowCopy(vtkProp *prop) VTK_OVERRIDE;
103 
109  void ReleaseGraphicsResources(vtkWindow *) VTK_OVERRIDE;
110 
112 
116  void GetBounds(double bounds[6]);
117  double *GetBounds() VTK_OVERRIDE;
119 
123  vtkMTimeType GetMTime() VTK_OVERRIDE;
124 
131  vtkMTimeType GetRedrawMTime() VTK_OVERRIDE;
132 
134 
137  void SetTotalLength( double v[3] )
138  { this->SetTotalLength( v[0], v[1], v[2] ); }
139  void SetTotalLength( double x, double y, double z );
140  vtkGetVectorMacro( TotalLength, double, 3 );
142 
144 
147  void SetNormalizedShaftLength( double v[3] )
148  { this->SetNormalizedShaftLength( v[0], v[1], v[2] ); }
149  void SetNormalizedShaftLength( double x, double y, double z );
150  vtkGetVectorMacro( NormalizedShaftLength, double, 3 );
152 
154 
158  void SetNormalizedTipLength( double v[3] )
159  { this->SetNormalizedTipLength( v[0], v[1], v[2] ); }
160  void SetNormalizedTipLength( double x, double y, double z );
161  vtkGetVectorMacro( NormalizedTipLength, double, 3 );
163 
165 
169  void SetNormalizedLabelPosition( double v[3] )
170  { this->SetNormalizedLabelPosition( v[0], v[1], v[2] ); }
171  void SetNormalizedLabelPosition( double x, double y, double z );
172  vtkGetVectorMacro( NormalizedLabelPosition, double, 3 );
174 
176 
179  vtkSetClampMacro(ConeResolution, int, 3, 128);
180  vtkGetMacro(ConeResolution, int);
181  vtkSetClampMacro(SphereResolution, int, 3, 128);
182  vtkGetMacro(SphereResolution, int);
183  vtkSetClampMacro(CylinderResolution, int, 3, 128);
184  vtkGetMacro(CylinderResolution, int);
186 
188 
191  vtkSetClampMacro(ConeRadius, double, 0, VTK_FLOAT_MAX);
192  vtkGetMacro(ConeRadius, double);
193  vtkSetClampMacro(SphereRadius, double, 0, VTK_FLOAT_MAX);
194  vtkGetMacro(SphereRadius, double);
195  vtkSetClampMacro(CylinderRadius, double, 0, VTK_FLOAT_MAX);
196  vtkGetMacro(CylinderRadius, double);
198 
200 
203  void SetShaftType( int type );
205  { this->SetShaftType( vtkAxesActor::CYLINDER_SHAFT ); }
207  { this->SetShaftType( vtkAxesActor::LINE_SHAFT ); }
209  { this->SetShaftType( vtkAxesActor::USER_DEFINED_SHAFT ); }
210  vtkGetMacro(ShaftType, int);
212 
214 
217  void SetTipType( int type );
219  { this->SetTipType( vtkAxesActor::CONE_TIP ); }
221  { this->SetTipType( vtkAxesActor::SPHERE_TIP ); }
223  { this->SetTipType( vtkAxesActor::USER_DEFINED_TIP ); }
224  vtkGetMacro(TipType, int);
226 
228 
231  void SetUserDefinedTip( vtkPolyData * );
232  vtkGetObjectMacro( UserDefinedTip, vtkPolyData );
234 
236 
239  void SetUserDefinedShaft( vtkPolyData * );
240  vtkGetObjectMacro( UserDefinedShaft, vtkPolyData );
242 
244 
247  vtkProperty *GetXAxisTipProperty();
248  vtkProperty *GetYAxisTipProperty();
249  vtkProperty *GetZAxisTipProperty();
251 
253 
256  vtkProperty *GetXAxisShaftProperty();
257  vtkProperty *GetYAxisShaftProperty();
258  vtkProperty *GetZAxisShaftProperty();
260 
266  {return this->XAxisLabel;}
268  {return this->YAxisLabel;}
270  {return this->ZAxisLabel;}
271 
273 
276  vtkSetStringMacro( XAxisLabelText );
277  vtkGetStringMacro( XAxisLabelText );
278  vtkSetStringMacro( YAxisLabelText );
279  vtkGetStringMacro( YAxisLabelText );
280  vtkSetStringMacro( ZAxisLabelText );
281  vtkGetStringMacro( ZAxisLabelText );
283 
285 
288  vtkSetMacro(AxisLabels, int);
289  vtkGetMacro(AxisLabels, int);
290  vtkBooleanMacro(AxisLabels, int);
292 
293  enum
294  {
297  USER_DEFINED_SHAFT
298  };
299 
300  enum
301  {
304  USER_DEFINED_TIP
305  };
306 
307 protected:
308  vtkAxesActor();
309  ~vtkAxesActor() VTK_OVERRIDE;
310 
311  vtkCylinderSource *CylinderSource;
312  vtkLineSource *LineSource;
313  vtkConeSource *ConeSource;
314  vtkSphereSource *SphereSource;
315 
316  vtkActor *XAxisShaft;
317  vtkActor *YAxisShaft;
318  vtkActor *ZAxisShaft;
319 
320  vtkActor *XAxisTip;
321  vtkActor *YAxisTip;
322  vtkActor *ZAxisTip;
323 
324  void UpdateProps();
325 
326  double TotalLength[3];
327  double NormalizedShaftLength[3];
328  double NormalizedTipLength[3];
329  double NormalizedLabelPosition[3];
330 
331  int ShaftType;
332  int TipType;
333 
334  vtkPolyData *UserDefinedTip;
335  vtkPolyData *UserDefinedShaft;
336 
337  char *XAxisLabelText;
338  char *YAxisLabelText;
339  char *ZAxisLabelText;
340 
341  vtkCaptionActor2D *XAxisLabel;
342  vtkCaptionActor2D *YAxisLabel;
343  vtkCaptionActor2D *ZAxisLabel;
344 
345  int AxisLabels;
346 
347 
348  int ConeResolution;
349  int SphereResolution;
350  int CylinderResolution;
351 
352  double ConeRadius;
353  double SphereRadius;
354  double CylinderRadius;
355 
356 private:
357  vtkAxesActor(const vtkAxesActor&) VTK_DELETE_FUNCTION;
358  void operator=(const vtkAxesActor&) VTK_DELETE_FUNCTION;
359 };
360 
361 #endif
362 
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:50
vtkCaptionActor2D * GetXAxisCaptionActor2D()
Retrieve handles to the X, Y and Z axis (so that you can set their text properties for example) ...
Definition: vtkAxesActor.h:265
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
generate a cylinder centered at origin
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:300
abstract specification for Viewports
Definition: vtkViewport.h:47
represent surface properties of a geometric object
Definition: vtkProperty.h:64
virtual int RenderOpaqueGeometry(vtkViewport *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:222
virtual int HasTranslucentPolygonalGeometry()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:294
virtual int RenderOverlay(vtkViewport *)
Definition: vtkProp.h:228
vtkCaptionActor2D * GetYAxisCaptionActor2D()
Definition: vtkAxesActor.h:267
vtkCaptionActor2D * GetZAxisCaptionActor2D()
Definition: vtkAxesActor.h:269
a 3D axes representation
Definition: vtkAxesActor.h:71
abstract specification for renderers
Definition: vtkRenderer.h:63
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
an ordered list of Props
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
create a polygonal sphere centered at the origin
#define VTK_FLOAT_MAX
Definition: vtkType.h:165
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
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:208
void SetShaftTypeToLine()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:206
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:224
void SetTipTypeToCone()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:218
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:169
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
void SetShaftTypeToCylinder()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:204
void SetNormalizedTipLength(double v[3])
Set the normalized (0-1) length of the tip.
Definition: vtkAxesActor.h:158
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:61
void SetTipTypeToUserDefined()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:222
void SetTipTypeToSphere()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:220
void SetNormalizedShaftLength(double v[3])
Set the normalized (0-1) length of the shaft.
Definition: vtkAxesActor.h:147