VTK  9.3.0
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
48 #ifndef vtkAxesActor_h
49 #define vtkAxesActor_h
50 
51 #include "vtkProp3D.h"
52 #include "vtkRenderingAnnotationModule.h" // For export macro
53 
54 VTK_ABI_NAMESPACE_BEGIN
55 class vtkActor;
56 class vtkCaptionActor2D;
57 class vtkConeSource;
58 class vtkCylinderSource;
59 class vtkLineSource;
60 class vtkPolyData;
61 class vtkPropCollection;
62 class vtkProperty;
63 class vtkRenderer;
64 class vtkSphereSource;
65 
66 class VTKRENDERINGANNOTATION_EXPORT vtkAxesActor : public vtkProp3D
67 {
68 public:
69  static vtkAxesActor* New();
70  vtkTypeMacro(vtkAxesActor, vtkProp3D);
71  void PrintSelf(ostream& os, vtkIndent indent) override;
72 
78  void GetActors(vtkPropCollection*) override;
79 
81 
84  int RenderOpaqueGeometry(vtkViewport* viewport) override;
86  int RenderOverlay(vtkViewport* viewport) override;
88 
93 
97  void ShallowCopy(vtkProp* prop) override;
98 
105 
107 
111  void GetBounds(double bounds[6]);
112  double* GetBounds() VTK_SIZEHINT(6) override;
114 
118  vtkMTimeType GetMTime() override;
119 
126  vtkMTimeType GetRedrawMTime() override;
127 
129 
132  void SetTotalLength(double v[3]) { 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]) { this->SetNormalizedShaftLength(v[0], v[1], v[2]); }
142  void SetNormalizedShaftLength(double x, double y, double z);
143  vtkGetVectorMacro(NormalizedShaftLength, double, 3);
145 
147 
151  void SetNormalizedTipLength(double v[3]) { this->SetNormalizedTipLength(v[0], v[1], v[2]); }
152  void SetNormalizedTipLength(double x, double y, double z);
153  vtkGetVectorMacro(NormalizedTipLength, double, 3);
155 
157 
161  void SetNormalizedLabelPosition(double v[3])
162  {
163  this->SetNormalizedLabelPosition(v[0], v[1], v[2]);
164  }
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);
198  void SetShaftTypeToCylinder() { this->SetShaftType(vtkAxesActor::CYLINDER_SHAFT); }
199  void SetShaftTypeToLine() { this->SetShaftType(vtkAxesActor::LINE_SHAFT); }
201  vtkGetMacro(ShaftType, int);
203 
205 
208  void SetTipType(int type);
209  void SetTipTypeToCone() { this->SetTipType(vtkAxesActor::CONE_TIP); }
210  void SetTipTypeToSphere() { this->SetTipType(vtkAxesActor::SPHERE_TIP); }
212  vtkGetMacro(TipType, int);
214 
216 
220  vtkGetObjectMacro(UserDefinedTip, vtkPolyData);
222 
224 
228  vtkGetObjectMacro(UserDefinedShaft, vtkPolyData);
230 
232 
239 
241 
248 
253  vtkCaptionActor2D* GetXAxisCaptionActor2D() { return this->XAxisLabel; }
254  vtkCaptionActor2D* GetYAxisCaptionActor2D() { return this->YAxisLabel; }
255  vtkCaptionActor2D* GetZAxisCaptionActor2D() { return this->ZAxisLabel; }
256 
258 
261  vtkSetStringMacro(XAxisLabelText);
262  vtkGetStringMacro(XAxisLabelText);
263  vtkSetStringMacro(YAxisLabelText);
264  vtkGetStringMacro(YAxisLabelText);
265  vtkSetStringMacro(ZAxisLabelText);
266  vtkGetStringMacro(ZAxisLabelText);
268 
270 
273  vtkSetMacro(AxisLabels, vtkTypeBool);
274  vtkGetMacro(AxisLabels, vtkTypeBool);
275  vtkBooleanMacro(AxisLabels, vtkTypeBool);
277 
278  enum
279  {
282  USER_DEFINED_SHAFT
283  };
284 
285  enum
286  {
289  USER_DEFINED_TIP
290  };
291 
292 protected:
294  ~vtkAxesActor() override;
295 
300 
304 
308 
309  void UpdateProps();
310 
311  double TotalLength[3];
312  double NormalizedShaftLength[3];
313  double NormalizedTipLength[3];
314  double NormalizedLabelPosition[3];
315 
317  int TipType;
318 
321 
325 
329 
331 
335 
336  double ConeRadius;
337  double SphereRadius;
339 
340 private:
341  vtkAxesActor(const vtkAxesActor&) = delete;
342  void operator=(const vtkAxesActor&) = delete;
343 };
344 
345 VTK_ABI_NAMESPACE_END
346 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:50
a 3D axes representation
Definition: vtkAxesActor.h:67
int SphereResolution
Definition: vtkAxesActor.h:333
vtkActor * XAxisTip
Definition: vtkAxesActor.h:305
void SetTipTypeToSphere()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:210
vtkLineSource * LineSource
Definition: vtkAxesActor.h:297
vtkProperty * GetXAxisShaftProperty()
Get the shaft properties.
char * XAxisLabelText
Definition: vtkAxesActor.h:322
void SetShaftTypeToLine()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:199
double ConeRadius
Definition: vtkAxesActor.h:336
void SetNormalizedShaftLength(double v[3])
Set the normalized (0-1) length of the shaft.
Definition: vtkAxesActor.h:141
char * ZAxisLabelText
Definition: vtkAxesActor.h:324
vtkPolyData * UserDefinedShaft
Definition: vtkAxesActor.h:320
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:299
vtkCylinderSource * CylinderSource
Definition: vtkAxesActor.h:296
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:323
vtkCaptionActor2D * GetZAxisCaptionActor2D()
Definition: vtkAxesActor.h:255
void SetTotalLength(double v[3])
Set the total length of the axes in 3 dimensions.
Definition: vtkAxesActor.h:132
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:303
vtkActor * YAxisTip
Definition: vtkAxesActor.h:306
void SetTipTypeToUserDefined()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:211
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:319
~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:253
vtkCaptionActor2D * GetYAxisCaptionActor2D()
Definition: vtkAxesActor.h:254
vtkProperty * GetXAxisTipProperty()
Get the tip properties.
vtkCaptionActor2D * ZAxisLabel
Definition: vtkAxesActor.h:328
double CylinderRadius
Definition: vtkAxesActor.h:338
vtkCaptionActor2D * XAxisLabel
Definition: vtkAxesActor.h:326
vtkConeSource * ConeSource
Definition: vtkAxesActor.h:298
vtkActor * YAxisShaft
Definition: vtkAxesActor.h:302
void SetShaftTypeToCylinder()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:198
vtkActor * ZAxisTip
Definition: vtkAxesActor.h:307
void SetTipTypeToCone()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:209
vtkCaptionActor2D * YAxisLabel
Definition: vtkAxesActor.h:327
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:200
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:161
vtkActor * XAxisShaft
Definition: vtkAxesActor.h:301
vtkTypeBool AxisLabels
Definition: vtkAxesActor.h:330
void UpdateProps()
int CylinderResolution
Definition: vtkAxesActor.h:334
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:151
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:337
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
Definition: vtkConeSource.h:43
generate a polygonal cylinder centered at the origin
a simple class to control print indentation
Definition: vtkIndent.h:38
create a line defined by two end points
Definition: vtkLineSource.h:62
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:89
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:48
an ordered list of Props
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:55
represent surface properties of a geometric object
Definition: vtkProperty.h:66
abstract specification for renderers
Definition: vtkRenderer.h:71
create a polygonal sphere centered at the origin
abstract specification for Viewports
Definition: vtkViewport.h:54
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
@ type
Definition: vtkX3D.h:516
int vtkTypeBool
Definition: vtkABI.h:64
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
#define VTK_FLOAT_MAX
Definition: vtkType.h:152
#define VTK_SIZEHINT(...)