VTK  9.3.20240318
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
148 #ifndef vtkAxesActor_h
149 #define vtkAxesActor_h
150 
151 #include "vtkProp3D.h"
152 #include "vtkRenderingAnnotationModule.h" // For export macro
153 
154 VTK_ABI_NAMESPACE_BEGIN
155 class vtkActor;
156 class vtkCaptionActor2D;
157 class vtkConeSource;
158 class vtkCylinderSource;
159 class vtkLineSource;
160 class vtkPolyData;
161 class vtkPropCollection;
162 class vtkProperty;
163 class vtkRenderer;
164 class vtkSphereSource;
165 
166 class VTKRENDERINGANNOTATION_EXPORT vtkAxesActor : public vtkProp3D
167 {
168 public:
169  static vtkAxesActor* New();
170  vtkTypeMacro(vtkAxesActor, vtkProp3D);
171  void PrintSelf(ostream& os, vtkIndent indent) override;
172 
178  void GetActors(vtkPropCollection*) override;
179 
181 
184  int RenderOpaqueGeometry(vtkViewport* viewport) override;
186  int RenderOverlay(vtkViewport* viewport) override;
188 
193 
197  void ShallowCopy(vtkProp* prop) override;
198 
205 
207 
211  void GetBounds(double bounds[6]);
212  double* GetBounds() VTK_SIZEHINT(6) override;
214 
218  vtkMTimeType GetMTime() override;
219 
226  vtkMTimeType GetRedrawMTime() override;
227 
229 
232  void SetTotalLength(double v[3]) { this->SetTotalLength(v[0], v[1], v[2]); }
233  void SetTotalLength(double x, double y, double z);
234  vtkGetVectorMacro(TotalLength, double, 3);
236 
238 
241  void SetNormalizedShaftLength(double v[3]) { this->SetNormalizedShaftLength(v[0], v[1], v[2]); }
242  void SetNormalizedShaftLength(double x, double y, double z);
243  vtkGetVectorMacro(NormalizedShaftLength, double, 3);
245 
247 
251  void SetNormalizedTipLength(double v[3]) { this->SetNormalizedTipLength(v[0], v[1], v[2]); }
252  void SetNormalizedTipLength(double x, double y, double z);
253  vtkGetVectorMacro(NormalizedTipLength, double, 3);
255 
257 
261  void SetNormalizedLabelPosition(double v[3])
262  {
263  this->SetNormalizedLabelPosition(v[0], v[1], v[2]);
264  }
265  void SetNormalizedLabelPosition(double x, double y, double z);
266  vtkGetVectorMacro(NormalizedLabelPosition, double, 3);
268 
270 
273  vtkSetClampMacro(ConeResolution, int, 3, 128);
274  vtkGetMacro(ConeResolution, int);
275  vtkSetClampMacro(SphereResolution, int, 3, 128);
276  vtkGetMacro(SphereResolution, int);
277  vtkSetClampMacro(CylinderResolution, int, 3, 128);
278  vtkGetMacro(CylinderResolution, int);
280 
282 
285  vtkSetClampMacro(ConeRadius, double, 0, VTK_FLOAT_MAX);
286  vtkGetMacro(ConeRadius, double);
287  vtkSetClampMacro(SphereRadius, double, 0, VTK_FLOAT_MAX);
288  vtkGetMacro(SphereRadius, double);
289  vtkSetClampMacro(CylinderRadius, double, 0, VTK_FLOAT_MAX);
290  vtkGetMacro(CylinderRadius, double);
292 
294 
297  void SetShaftType(int type);
298  void SetShaftTypeToCylinder() { this->SetShaftType(vtkAxesActor::CYLINDER_SHAFT); }
299  void SetShaftTypeToLine() { this->SetShaftType(vtkAxesActor::LINE_SHAFT); }
301  vtkGetMacro(ShaftType, int);
303 
305 
308  void SetTipType(int type);
309  void SetTipTypeToCone() { this->SetTipType(vtkAxesActor::CONE_TIP); }
310  void SetTipTypeToSphere() { this->SetTipType(vtkAxesActor::SPHERE_TIP); }
312  vtkGetMacro(TipType, int);
314 
316 
320  vtkGetObjectMacro(UserDefinedTip, vtkPolyData);
322 
324 
328  vtkGetObjectMacro(UserDefinedShaft, vtkPolyData);
330 
332 
339 
341 
348 
353  vtkCaptionActor2D* GetXAxisCaptionActor2D() { return this->XAxisLabel; }
354  vtkCaptionActor2D* GetYAxisCaptionActor2D() { return this->YAxisLabel; }
355  vtkCaptionActor2D* GetZAxisCaptionActor2D() { return this->ZAxisLabel; }
356 
358 
361  vtkSetStringMacro(XAxisLabelText);
362  vtkGetStringMacro(XAxisLabelText);
363  vtkSetStringMacro(YAxisLabelText);
364  vtkGetStringMacro(YAxisLabelText);
365  vtkSetStringMacro(ZAxisLabelText);
366  vtkGetStringMacro(ZAxisLabelText);
368 
370 
373  vtkSetMacro(AxisLabels, vtkTypeBool);
374  vtkGetMacro(AxisLabels, vtkTypeBool);
375  vtkBooleanMacro(AxisLabels, vtkTypeBool);
377 
378  enum
379  {
382  USER_DEFINED_SHAFT
383  };
384 
385  enum
386  {
389  USER_DEFINED_TIP
390  };
391 
392 protected:
394  ~vtkAxesActor() override;
395 
400 
404 
408 
409  void UpdateProps();
410 
411  double TotalLength[3];
412  double NormalizedShaftLength[3];
413  double NormalizedTipLength[3];
414  double NormalizedLabelPosition[3];
415 
417  int TipType;
418 
421 
425 
429 
431 
435 
436  double ConeRadius;
437  double SphereRadius;
439 
440 private:
441  vtkAxesActor(const vtkAxesActor&) = delete;
442  void operator=(const vtkAxesActor&) = delete;
443 };
444 
445 VTK_ABI_NAMESPACE_END
446 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:150
a 3D axes representation
Definition: vtkAxesActor.h:167
int SphereResolution
Definition: vtkAxesActor.h:433
vtkActor * XAxisTip
Definition: vtkAxesActor.h:405
void SetTipTypeToSphere()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:310
vtkLineSource * LineSource
Definition: vtkAxesActor.h:397
vtkProperty * GetXAxisShaftProperty()
Get the shaft properties.
char * XAxisLabelText
Definition: vtkAxesActor.h:422
void SetShaftTypeToLine()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:299
double ConeRadius
Definition: vtkAxesActor.h:436
void SetNormalizedShaftLength(double v[3])
Set the normalized (0-1) length of the shaft.
Definition: vtkAxesActor.h:241
char * ZAxisLabelText
Definition: vtkAxesActor.h:424
vtkPolyData * UserDefinedShaft
Definition: vtkAxesActor.h:420
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:399
vtkCylinderSource * CylinderSource
Definition: vtkAxesActor.h:396
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:423
vtkCaptionActor2D * GetZAxisCaptionActor2D()
Definition: vtkAxesActor.h:355
void SetTotalLength(double v[3])
Set the total length of the axes in 3 dimensions.
Definition: vtkAxesActor.h:232
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:403
vtkActor * YAxisTip
Definition: vtkAxesActor.h:406
void SetTipTypeToUserDefined()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:311
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:419
~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:353
vtkCaptionActor2D * GetYAxisCaptionActor2D()
Definition: vtkAxesActor.h:354
vtkProperty * GetXAxisTipProperty()
Get the tip properties.
vtkCaptionActor2D * ZAxisLabel
Definition: vtkAxesActor.h:428
double CylinderRadius
Definition: vtkAxesActor.h:438
vtkCaptionActor2D * XAxisLabel
Definition: vtkAxesActor.h:426
vtkConeSource * ConeSource
Definition: vtkAxesActor.h:398
vtkActor * YAxisShaft
Definition: vtkAxesActor.h:402
void SetShaftTypeToCylinder()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:298
vtkActor * ZAxisTip
Definition: vtkAxesActor.h:407
void SetTipTypeToCone()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:309
vtkCaptionActor2D * YAxisLabel
Definition: vtkAxesActor.h:427
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:300
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:261
vtkActor * XAxisShaft
Definition: vtkAxesActor.h:401
vtkTypeBool AxisLabels
Definition: vtkAxesActor.h:430
void UpdateProps()
int CylinderResolution
Definition: vtkAxesActor.h:434
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:251
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:437
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 polygonal cylinder centered at the origin
a simple class to control print indentation
Definition: vtkIndent.h:108
create a line defined by two end points
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:180
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:88
an ordered list of Props
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:65
represent surface properties of a geometric object
Definition: vtkProperty.h:166
abstract specification for renderers
Definition: vtkRenderer.h:171
create a polygonal sphere centered at the origin
abstract specification for Viewports
Definition: vtkViewport.h:64
window superclass for vtkRenderWindow
Definition: vtkWindow.h:47
@ 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(...)