VTK  9.7.1
vtkAxesActor.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
39 #ifndef vtkAxesActor_h
40 #define vtkAxesActor_h
41 
42 #include "vtkProp3D.h"
43 #include "vtkRenderingAnnotationModule.h" // For export macro
44 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
45 
46 VTK_ABI_NAMESPACE_BEGIN
47 class vtkActor;
48 class vtkCaptionActor2D;
49 class vtkConeSource;
50 class vtkCylinderSource;
51 class vtkLineSource;
52 class vtkPolyData;
53 class vtkPropCollection;
54 class vtkProperty;
55 class vtkRenderer;
56 class vtkSphereSource;
57 
58 class VTKRENDERINGANNOTATION_EXPORT VTK_MARSHALAUTO vtkAxesActor : public vtkProp3D
59 {
60 public:
61  static vtkAxesActor* New();
62  vtkTypeMacro(vtkAxesActor, vtkProp3D);
63  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
70  void GetActors(vtkPropCollection*) override;
71 
73 
76  int RenderOpaqueGeometry(vtkViewport* viewport) override;
77  int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
78  int RenderOverlay(vtkViewport* viewport) override;
80 
85 
89  void ShallowCopy(vtkProp* prop) override;
90 
96  void ReleaseGraphicsResources(vtkWindow*) override;
97 
99 
103  void GetBounds(double bounds[6]);
104  double* GetBounds() VTK_SIZEHINT(6) override;
106 
110  vtkMTimeType GetMTime() override;
111 
118  vtkMTimeType GetRedrawMTime() override;
119 
121 
124  void SetTotalLength(double v[3]) { this->SetTotalLength(v[0], v[1], v[2]); }
125  void SetTotalLength(double x, double y, double z);
126  vtkGetVectorMacro(TotalLength, double, 3);
128 
130 
133  void SetNormalizedShaftLength(double v[3]) { this->SetNormalizedShaftLength(v[0], v[1], v[2]); }
134  void SetNormalizedShaftLength(double x, double y, double z);
135  vtkGetVectorMacro(NormalizedShaftLength, double, 3);
137 
139 
143  void SetNormalizedTipLength(double v[3]) { this->SetNormalizedTipLength(v[0], v[1], v[2]); }
144  void SetNormalizedTipLength(double x, double y, double z);
145  vtkGetVectorMacro(NormalizedTipLength, double, 3);
147 
149 
153  void SetNormalizedLabelPosition(double v[3])
154  {
155  this->SetNormalizedLabelPosition(v[0], v[1], v[2]);
156  }
157  void SetNormalizedLabelPosition(double x, double y, double z);
158  vtkGetVectorMacro(NormalizedLabelPosition, double, 3);
160 
162 
165  vtkSetClampMacro(ConeResolution, int, 3, 128);
166  vtkGetMacro(ConeResolution, int);
167  vtkSetClampMacro(SphereResolution, int, 3, 128);
168  vtkGetMacro(SphereResolution, int);
169  vtkSetClampMacro(CylinderResolution, int, 3, 128);
170  vtkGetMacro(CylinderResolution, int);
172 
174 
177  vtkSetClampMacro(ConeRadius, double, 0, VTK_FLOAT_MAX);
178  vtkGetMacro(ConeRadius, double);
179  vtkSetClampMacro(SphereRadius, double, 0, VTK_FLOAT_MAX);
180  vtkGetMacro(SphereRadius, double);
181  vtkSetClampMacro(CylinderRadius, double, 0, VTK_FLOAT_MAX);
182  vtkGetMacro(CylinderRadius, double);
184 
186 
189  void SetShaftType(int type);
190  void SetShaftTypeToCylinder() { this->SetShaftType(vtkAxesActor::CYLINDER_SHAFT); }
191  void SetShaftTypeToLine() { this->SetShaftType(vtkAxesActor::LINE_SHAFT); }
193  vtkGetMacro(ShaftType, int);
195 
197 
200  void SetTipType(int type);
201  void SetTipTypeToCone() { this->SetTipType(vtkAxesActor::CONE_TIP); }
202  void SetTipTypeToSphere() { this->SetTipType(vtkAxesActor::SPHERE_TIP); }
204  vtkGetMacro(TipType, int);
206 
208 
211  void SetUserDefinedTip(vtkPolyData*);
212  vtkGetObjectMacro(UserDefinedTip, vtkPolyData);
214 
216 
219  void SetUserDefinedShaft(vtkPolyData*);
220  vtkGetObjectMacro(UserDefinedShaft, vtkPolyData);
222 
224 
227  vtkProperty* GetXAxisTipProperty();
228  vtkProperty* GetYAxisTipProperty();
229  vtkProperty* GetZAxisTipProperty();
231 
233 
236  vtkProperty* GetXAxisShaftProperty();
237  vtkProperty* GetYAxisShaftProperty();
238  vtkProperty* GetZAxisShaftProperty();
240 
245  vtkCaptionActor2D* GetXAxisCaptionActor2D() { return this->XAxisLabel; }
246  vtkCaptionActor2D* GetYAxisCaptionActor2D() { return this->YAxisLabel; }
247  vtkCaptionActor2D* GetZAxisCaptionActor2D() { return this->ZAxisLabel; }
248 
250 
253  vtkSetStringMacro(XAxisLabelText);
254  vtkGetStringMacro(XAxisLabelText);
255  vtkSetStringMacro(YAxisLabelText);
256  vtkGetStringMacro(YAxisLabelText);
257  vtkSetStringMacro(ZAxisLabelText);
258  vtkGetStringMacro(ZAxisLabelText);
260 
262 
265  vtkSetMacro(AxisLabels, vtkTypeBool);
266  vtkGetMacro(AxisLabels, vtkTypeBool);
267  vtkBooleanMacro(AxisLabels, vtkTypeBool);
269 
270  enum
271  {
274  USER_DEFINED_SHAFT
275  };
276 
277  enum
278  {
281  USER_DEFINED_TIP
282  };
283 
284 protected:
285  vtkAxesActor();
286  ~vtkAxesActor() override;
287 
292 
296 
300 
301  void UpdateProps();
302 
303  double TotalLength[3];
304  double NormalizedShaftLength[3];
305  double NormalizedTipLength[3];
306  double NormalizedLabelPosition[3];
307 
309  int TipType;
310 
313 
317 
321 
323 
327 
328  double ConeRadius;
329  double SphereRadius;
331 
332 private:
333  vtkAxesActor(const vtkAxesActor&) = delete;
334  void operator=(const vtkAxesActor&) = delete;
335 };
336 
337 VTK_ABI_NAMESPACE_END
338 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:49
vtkCaptionActor2D * GetXAxisCaptionActor2D()
Retrieve handles to the X, Y and Z axis (so that you can set their text properties for example) ...
Definition: vtkAxesActor.h:245
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:41
void SetTotalLength(double v[3])
Set the total length of the axes in 3 dimensions.
Definition: vtkAxesActor.h:124
vtkPolyData * UserDefinedTip
Definition: vtkAxesActor.h:311
generate a polygonal cylinder centered at the origin
double * GetBounds() override=0
Return a reference to the Prop3D's composite transform.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:318
abstract specification for Viewports
Definition: vtkViewport.h:46
represent surface properties of a geometric object
Definition: vtkProperty.h:59
virtual int RenderOpaqueGeometry(vtkViewport *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:236
virtual vtkTypeBool HasTranslucentPolygonalGeometry()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:300
virtual int RenderOverlay(vtkViewport *)
Definition: vtkProp.h:239
vtkCaptionActor2D * GetYAxisCaptionActor2D()
Definition: vtkAxesActor.h:246
vtkCaptionActor2D * GetZAxisCaptionActor2D()
Definition: vtkAxesActor.h:247
int CylinderResolution
Definition: vtkAxesActor.h:326
a 3D axes representation
Definition: vtkAxesActor.h:58
char * ZAxisLabelText
Definition: vtkAxesActor.h:316
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkLineSource * LineSource
Definition: vtkAxesActor.h:289
generate polygonal cone
Definition: vtkConeSource.h:34
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:39
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
vtkSphereSource * SphereSource
Definition: vtkAxesActor.h:291
an ordered list of Props
int vtkTypeBool
Definition: vtkABI.h:64
virtual void ReleaseGraphicsResources(vtkWindow *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
Definition: vtkProp.h:321
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
create a polygonal sphere centered at the origin
#define VTK_FLOAT_MAX
Definition: vtkType.h:200
char * XAxisLabelText
Definition: vtkAxesActor.h:314
vtkActor * ZAxisShaft
Definition: vtkAxesActor.h:295
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkCaptionActor2D * ZAxisLabel
Definition: vtkAxesActor.h:320
vtkConeSource * ConeSource
Definition: vtkAxesActor.h:290
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkProp3D.
vtkActor * XAxisTip
Definition: vtkAxesActor.h:297
vtkCaptionActor2D * YAxisLabel
Definition: vtkAxesActor.h:319
#define VTK_SIZEHINT(...)
vtkActor * ZAxisTip
Definition: vtkAxesActor.h:299
double SphereRadius
Definition: vtkAxesActor.h:329
create a line defined by two end points
Definition: vtkLineSource.h:53
void SetShaftTypeToUserDefined()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:192
vtkActor * YAxisTip
Definition: vtkAxesActor.h:298
void SetShaftTypeToLine()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:191
double ConeRadius
Definition: vtkAxesActor.h:328
vtkCylinderSource * CylinderSource
Definition: vtkAxesActor.h:288
vtkTypeBool AxisLabels
Definition: vtkAxesActor.h:322
vtkActor * YAxisShaft
Definition: vtkAxesActor.h:294
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:237
void SetTipTypeToCone()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:201
vtkActor * XAxisShaft
Definition: vtkAxesActor.h:293
#define VTK_MARSHALAUTO
vtkCaptionActor2D * XAxisLabel
Definition: vtkAxesActor.h:318
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:153
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
char * YAxisLabelText
Definition: vtkAxesActor.h:315
void SetShaftTypeToCylinder()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:190
int SphereResolution
Definition: vtkAxesActor.h:325
void SetNormalizedTipLength(double v[3])
Set the normalized (0-1) length of the tip.
Definition: vtkAxesActor.h:143
double CylinderRadius
Definition: vtkAxesActor.h:330
vtkPolyData * UserDefinedShaft
Definition: vtkAxesActor.h:312
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:60
void SetTipTypeToUserDefined()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:203
void SetTipTypeToSphere()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:202
void SetNormalizedShaftLength(double v[3])
Set the normalized (0-1) length of the shaft.
Definition: vtkAxesActor.h:133