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) VTK_OVERRIDE;
71 
77  void GetActors(vtkPropCollection *) VTK_OVERRIDE;
78 
80 
83  int RenderOpaqueGeometry(vtkViewport *viewport) VTK_OVERRIDE;
84  int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) VTK_OVERRIDE;
85  int RenderOverlay(vtkViewport *viewport) VTK_OVERRIDE;
87 
91  int HasTranslucentPolygonalGeometry() VTK_OVERRIDE;
92 
96  void ShallowCopy(vtkProp *prop) VTK_OVERRIDE;
97 
103  void ReleaseGraphicsResources(vtkWindow *) VTK_OVERRIDE;
104 
106 
110  void GetBounds(double bounds[6]);
111  double *GetBounds() VTK_OVERRIDE;
113 
117  vtkMTimeType GetMTime() VTK_OVERRIDE;
118 
125  vtkMTimeType GetRedrawMTime() VTK_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, int);
283  vtkGetMacro(AxisLabels, int);
284  vtkBooleanMacro(AxisLabels, int);
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() VTK_OVERRIDE;
304 
305  vtkCylinderSource *CylinderSource;
306  vtkLineSource *LineSource;
307  vtkConeSource *ConeSource;
308  vtkSphereSource *SphereSource;
309 
310  vtkActor *XAxisShaft;
311  vtkActor *YAxisShaft;
312  vtkActor *ZAxisShaft;
313 
314  vtkActor *XAxisTip;
315  vtkActor *YAxisTip;
316  vtkActor *ZAxisTip;
317 
318  void UpdateProps();
319 
320  double TotalLength[3];
321  double NormalizedShaftLength[3];
322  double NormalizedTipLength[3];
323  double NormalizedLabelPosition[3];
324 
325  int ShaftType;
326  int TipType;
327 
328  vtkPolyData *UserDefinedTip;
329  vtkPolyData *UserDefinedShaft;
330 
331  char *XAxisLabelText;
332  char *YAxisLabelText;
333  char *ZAxisLabelText;
334 
335  vtkCaptionActor2D *XAxisLabel;
336  vtkCaptionActor2D *YAxisLabel;
337  vtkCaptionActor2D *ZAxisLabel;
338 
339  int AxisLabels;
340 
341 
342  int ConeResolution;
343  int SphereResolution;
344  int CylinderResolution;
345 
346  double ConeRadius;
347  double SphereRadius;
348  double CylinderRadius;
349 
350 private:
351  vtkAxesActor(const vtkAxesActor&) VTK_DELETE_FUNCTION;
352  void operator=(const vtkAxesActor&) VTK_DELETE_FUNCTION;
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
generate a cylinder centered at origin
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:300
abstract specification for Viewports
Definition: vtkViewport.h:44
represent surface properties of a geometric object
Definition: vtkProperty.h:58
vtkCaptionActor2D * GetYAxisCaptionActor2D()
Definition: vtkAxesActor.h:261
vtkCaptionActor2D * GetZAxisCaptionActor2D()
Definition: vtkAxesActor.h:263
a 3D axes representation
Definition: vtkAxesActor.h:65
abstract specification for renderers
Definition: vtkRenderer.h:57
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
an ordered list of Props
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
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:33
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:36
void SetShaftTypeToUserDefined()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:202
void SetShaftTypeToLine()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:200
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetTipTypeToCone()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:212
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
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:198
void SetNormalizedTipLength(double v[3])
Set the normalized (0-1) length of the tip.
Definition: vtkAxesActor.h:152
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