VTK  9.1.0
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 =========================================================================*/
157 #ifndef vtkAxesActor_h
158 #define vtkAxesActor_h
159 
160 #include "vtkProp3D.h"
161 #include "vtkRenderingAnnotationModule.h" // For export macro
162 
163 class vtkActor;
164 class vtkCaptionActor2D;
165 class vtkConeSource;
166 class vtkCylinderSource;
167 class vtkLineSource;
168 class vtkPolyData;
169 class vtkPropCollection;
170 class vtkProperty;
171 class vtkRenderer;
172 class vtkSphereSource;
173 
174 class VTKRENDERINGANNOTATION_EXPORT vtkAxesActor : public vtkProp3D
175 {
176 public:
177  static vtkAxesActor* New();
178  vtkTypeMacro(vtkAxesActor, vtkProp3D);
179  void PrintSelf(ostream& os, vtkIndent indent) override;
180 
186  void GetActors(vtkPropCollection*) override;
187 
189 
192  int RenderOpaqueGeometry(vtkViewport* viewport) override;
194  int RenderOverlay(vtkViewport* viewport) override;
196 
201 
205  void ShallowCopy(vtkProp* prop) override;
206 
213 
215 
219  void GetBounds(double bounds[6]);
220  double* GetBounds() VTK_SIZEHINT(6) override;
222 
226  vtkMTimeType GetMTime() override;
227 
234  vtkMTimeType GetRedrawMTime() override;
235 
237 
240  void SetTotalLength(double v[3]) { this->SetTotalLength(v[0], v[1], v[2]); }
241  void SetTotalLength(double x, double y, double z);
242  vtkGetVectorMacro(TotalLength, double, 3);
244 
246 
249  void SetNormalizedShaftLength(double v[3]) { this->SetNormalizedShaftLength(v[0], v[1], v[2]); }
250  void SetNormalizedShaftLength(double x, double y, double z);
251  vtkGetVectorMacro(NormalizedShaftLength, double, 3);
253 
255 
259  void SetNormalizedTipLength(double v[3]) { this->SetNormalizedTipLength(v[0], v[1], v[2]); }
260  void SetNormalizedTipLength(double x, double y, double z);
261  vtkGetVectorMacro(NormalizedTipLength, double, 3);
263 
265 
269  void SetNormalizedLabelPosition(double v[3])
270  {
271  this->SetNormalizedLabelPosition(v[0], v[1], v[2]);
272  }
273  void SetNormalizedLabelPosition(double x, double y, double z);
274  vtkGetVectorMacro(NormalizedLabelPosition, double, 3);
276 
278 
281  vtkSetClampMacro(ConeResolution, int, 3, 128);
282  vtkGetMacro(ConeResolution, int);
283  vtkSetClampMacro(SphereResolution, int, 3, 128);
284  vtkGetMacro(SphereResolution, int);
285  vtkSetClampMacro(CylinderResolution, int, 3, 128);
286  vtkGetMacro(CylinderResolution, int);
288 
290 
293  vtkSetClampMacro(ConeRadius, double, 0, VTK_FLOAT_MAX);
294  vtkGetMacro(ConeRadius, double);
295  vtkSetClampMacro(SphereRadius, double, 0, VTK_FLOAT_MAX);
296  vtkGetMacro(SphereRadius, double);
297  vtkSetClampMacro(CylinderRadius, double, 0, VTK_FLOAT_MAX);
298  vtkGetMacro(CylinderRadius, double);
300 
302 
305  void SetShaftType(int type);
306  void SetShaftTypeToCylinder() { this->SetShaftType(vtkAxesActor::CYLINDER_SHAFT); }
307  void SetShaftTypeToLine() { this->SetShaftType(vtkAxesActor::LINE_SHAFT); }
309  vtkGetMacro(ShaftType, int);
311 
313 
316  void SetTipType(int type);
317  void SetTipTypeToCone() { this->SetTipType(vtkAxesActor::CONE_TIP); }
318  void SetTipTypeToSphere() { this->SetTipType(vtkAxesActor::SPHERE_TIP); }
320  vtkGetMacro(TipType, int);
322 
324 
328  vtkGetObjectMacro(UserDefinedTip, vtkPolyData);
330 
332 
336  vtkGetObjectMacro(UserDefinedShaft, vtkPolyData);
338 
340 
347 
349 
356 
361  vtkCaptionActor2D* GetXAxisCaptionActor2D() { return this->XAxisLabel; }
362  vtkCaptionActor2D* GetYAxisCaptionActor2D() { return this->YAxisLabel; }
363  vtkCaptionActor2D* GetZAxisCaptionActor2D() { return this->ZAxisLabel; }
364 
366 
369  vtkSetStringMacro(XAxisLabelText);
370  vtkGetStringMacro(XAxisLabelText);
371  vtkSetStringMacro(YAxisLabelText);
372  vtkGetStringMacro(YAxisLabelText);
373  vtkSetStringMacro(ZAxisLabelText);
374  vtkGetStringMacro(ZAxisLabelText);
376 
378 
381  vtkSetMacro(AxisLabels, vtkTypeBool);
382  vtkGetMacro(AxisLabels, vtkTypeBool);
383  vtkBooleanMacro(AxisLabels, vtkTypeBool);
385 
386  enum
387  {
390  USER_DEFINED_SHAFT
391  };
392 
393  enum
394  {
397  USER_DEFINED_TIP
398  };
399 
400 protected:
402  ~vtkAxesActor() override;
403 
408 
412 
416 
417  void UpdateProps();
418 
419  double TotalLength[3];
420  double NormalizedShaftLength[3];
421  double NormalizedTipLength[3];
422  double NormalizedLabelPosition[3];
423 
425  int TipType;
426 
429 
433 
437 
439 
443 
444  double ConeRadius;
445  double SphereRadius;
447 
448 private:
449  vtkAxesActor(const vtkAxesActor&) = delete;
450  void operator=(const vtkAxesActor&) = delete;
451 };
452 
453 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:155
a 3D axes representation
Definition: vtkAxesActor.h:175
int SphereResolution
Definition: vtkAxesActor.h:441
vtkActor * XAxisTip
Definition: vtkAxesActor.h:413
void SetTipTypeToSphere()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:318
vtkLineSource * LineSource
Definition: vtkAxesActor.h:405
vtkProperty * GetXAxisShaftProperty()
Get the shaft properties.
char * XAxisLabelText
Definition: vtkAxesActor.h:430
void SetShaftTypeToLine()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:307
double ConeRadius
Definition: vtkAxesActor.h:444
void SetNormalizedShaftLength(double v[3])
Set the normalized (0-1) length of the shaft.
Definition: vtkAxesActor.h:249
char * ZAxisLabelText
Definition: vtkAxesActor.h:432
vtkPolyData * UserDefinedShaft
Definition: vtkAxesActor.h:428
void SetNormalizedTipLength(double x, double y, double z)
Set the normalized (0-1) length of the tip.
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
Support the standard render methods.
vtkSphereSource * SphereSource
Definition: vtkAxesActor.h:407
vtkCylinderSource * CylinderSource
Definition: vtkAxesActor.h:404
void SetNormalizedShaftLength(double x, double y, double z)
Set the normalized (0-1) length of the shaft.
vtkProperty * GetYAxisShaftProperty()
Get the shaft properties.
void SetShaftType(int type)
Set the type of the shaft to a cylinder, line, or user defined geometry.
static vtkAxesActor * New()
vtkProperty * GetZAxisShaftProperty()
Get the shaft properties.
char * YAxisLabelText
Definition: vtkAxesActor.h:431
vtkCaptionActor2D * GetZAxisCaptionActor2D()
Definition: vtkAxesActor.h:363
void SetTotalLength(double v[3])
Set the total length of the axes in 3 dimensions.
Definition: vtkAxesActor.h:240
void SetUserDefinedShaft(vtkPolyData *)
Set the user defined shaft polydata.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
vtkActor * ZAxisShaft
Definition: vtkAxesActor.h:411
vtkActor * YAxisTip
Definition: vtkAxesActor.h:414
void SetTipTypeToUserDefined()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:319
void ShallowCopy(vtkProp *prop) override
Shallow copy of an axes actor.
int RenderOverlay(vtkViewport *viewport) override
Support the standard render methods.
vtkPolyData * UserDefinedTip
Definition: vtkAxesActor.h:427
~vtkAxesActor() override
vtkCaptionActor2D * GetXAxisCaptionActor2D()
Retrieve handles to the X, Y and Z axis (so that you can set their text properties for example)
Definition: vtkAxesActor.h:361
vtkCaptionActor2D * GetYAxisCaptionActor2D()
Definition: vtkAxesActor.h:362
vtkProperty * GetXAxisTipProperty()
Get the tip properties.
vtkCaptionActor2D * ZAxisLabel
Definition: vtkAxesActor.h:436
double CylinderRadius
Definition: vtkAxesActor.h:446
vtkCaptionActor2D * XAxisLabel
Definition: vtkAxesActor.h:434
vtkConeSource * ConeSource
Definition: vtkAxesActor.h:406
vtkActor * YAxisShaft
Definition: vtkAxesActor.h:410
void SetShaftTypeToCylinder()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:306
vtkActor * ZAxisTip
Definition: vtkAxesActor.h:415
void SetTipTypeToCone()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:317
vtkCaptionActor2D * YAxisLabel
Definition: vtkAxesActor.h:435
vtkProperty * GetYAxisTipProperty()
Get the tip properties.
void GetBounds(double bounds[6])
Get the bounds for this Actor as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
void SetShaftTypeToUserDefined()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:308
int RenderOpaqueGeometry(vtkViewport *viewport) override
Support the standard render methods.
void SetUserDefinedTip(vtkPolyData *)
Set the user defined tip polydata.
void SetNormalizedLabelPosition(double x, double y, double z)
Set the normalized (0-1) position of the label along the length of the shaft.
void SetNormalizedLabelPosition(double v[3])
Set the normalized (0-1) position of the label along the length of the shaft.
Definition: vtkAxesActor.h:269
vtkActor * XAxisShaft
Definition: vtkAxesActor.h:409
vtkTypeBool AxisLabels
Definition: vtkAxesActor.h:438
void UpdateProps()
int CylinderResolution
Definition: vtkAxesActor.h:442
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
void SetTotalLength(double x, double y, double z)
Set the total length of the axes in 3 dimensions.
void SetNormalizedTipLength(double v[3])
Set the normalized (0-1) length of the tip.
Definition: vtkAxesActor.h:259
double * GetBounds() override
Get the bounds for this Actor as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
void GetActors(vtkPropCollection *) override
For some exporters and other other operations we must be able to collect all the actors or volumes.
vtkProperty * GetZAxisTipProperty()
Get the tip properties.
double SphereRadius
Definition: vtkAxesActor.h:445
void SetTipType(int type)
Set the type of the tip to a cone, sphere, or user defined geometry.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
draw text label associated with a point
generate polygonal cone
generate a cylinder centered at origin
a simple class to control print indentation
Definition: vtkIndent.h:113
create a line defined by two end points
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:93
an ordered list of Props
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:67
represent surface properties of a geometric object
Definition: vtkProperty.h:171
abstract specification for renderers
Definition: vtkRenderer.h:173
create a polygonal sphere centered at the origin
abstract specification for Viewports
Definition: vtkViewport.h:47
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
@ type
Definition: vtkX3D.h:522
int vtkTypeBool
Definition: vtkABI.h:69
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define VTK_FLOAT_MAX
Definition: vtkType.h:163
#define VTK_SIZEHINT(...)