VTK  9.2.6
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 =========================================================================*/
60 #ifndef vtkAxesActor_h
61 #define vtkAxesActor_h
62 
63 #include "vtkProp3D.h"
64 #include "vtkRenderingAnnotationModule.h" // For export macro
65 
66 class vtkActor;
67 class vtkCaptionActor2D;
68 class vtkConeSource;
69 class vtkCylinderSource;
70 class vtkLineSource;
71 class vtkPolyData;
72 class vtkPropCollection;
73 class vtkProperty;
74 class vtkRenderer;
75 class vtkSphereSource;
76 
77 class VTKRENDERINGANNOTATION_EXPORT vtkAxesActor : public vtkProp3D
78 {
79 public:
80  static vtkAxesActor* New();
81  vtkTypeMacro(vtkAxesActor, vtkProp3D);
82  void PrintSelf(ostream& os, vtkIndent indent) override;
83 
89  void GetActors(vtkPropCollection*) override;
90 
92 
95  int RenderOpaqueGeometry(vtkViewport* viewport) override;
97  int RenderOverlay(vtkViewport* viewport) override;
99 
104 
108  void ShallowCopy(vtkProp* prop) override;
109 
116 
118 
122  void GetBounds(double bounds[6]);
123  double* GetBounds() VTK_SIZEHINT(6) override;
125 
129  vtkMTimeType GetMTime() override;
130 
137  vtkMTimeType GetRedrawMTime() override;
138 
140 
143  void SetTotalLength(double v[3]) { this->SetTotalLength(v[0], v[1], v[2]); }
144  void SetTotalLength(double x, double y, double z);
145  vtkGetVectorMacro(TotalLength, double, 3);
147 
149 
152  void SetNormalizedShaftLength(double v[3]) { this->SetNormalizedShaftLength(v[0], v[1], v[2]); }
153  void SetNormalizedShaftLength(double x, double y, double z);
154  vtkGetVectorMacro(NormalizedShaftLength, double, 3);
156 
158 
162  void SetNormalizedTipLength(double v[3]) { this->SetNormalizedTipLength(v[0], v[1], v[2]); }
163  void SetNormalizedTipLength(double x, double y, double z);
164  vtkGetVectorMacro(NormalizedTipLength, double, 3);
166 
168 
172  void SetNormalizedLabelPosition(double v[3])
173  {
174  this->SetNormalizedLabelPosition(v[0], v[1], v[2]);
175  }
176  void SetNormalizedLabelPosition(double x, double y, double z);
177  vtkGetVectorMacro(NormalizedLabelPosition, double, 3);
179 
181 
184  vtkSetClampMacro(ConeResolution, int, 3, 128);
185  vtkGetMacro(ConeResolution, int);
186  vtkSetClampMacro(SphereResolution, int, 3, 128);
187  vtkGetMacro(SphereResolution, int);
188  vtkSetClampMacro(CylinderResolution, int, 3, 128);
189  vtkGetMacro(CylinderResolution, int);
191 
193 
196  vtkSetClampMacro(ConeRadius, double, 0, VTK_FLOAT_MAX);
197  vtkGetMacro(ConeRadius, double);
198  vtkSetClampMacro(SphereRadius, double, 0, VTK_FLOAT_MAX);
199  vtkGetMacro(SphereRadius, double);
200  vtkSetClampMacro(CylinderRadius, double, 0, VTK_FLOAT_MAX);
201  vtkGetMacro(CylinderRadius, double);
203 
205 
208  void SetShaftType(int type);
209  void SetShaftTypeToCylinder() { this->SetShaftType(vtkAxesActor::CYLINDER_SHAFT); }
210  void SetShaftTypeToLine() { this->SetShaftType(vtkAxesActor::LINE_SHAFT); }
212  vtkGetMacro(ShaftType, int);
214 
216 
219  void SetTipType(int type);
220  void SetTipTypeToCone() { this->SetTipType(vtkAxesActor::CONE_TIP); }
221  void SetTipTypeToSphere() { this->SetTipType(vtkAxesActor::SPHERE_TIP); }
223  vtkGetMacro(TipType, int);
225 
227 
231  vtkGetObjectMacro(UserDefinedTip, vtkPolyData);
233 
235 
239  vtkGetObjectMacro(UserDefinedShaft, vtkPolyData);
241 
243 
250 
252 
259 
264  vtkCaptionActor2D* GetXAxisCaptionActor2D() { return this->XAxisLabel; }
265  vtkCaptionActor2D* GetYAxisCaptionActor2D() { return this->YAxisLabel; }
266  vtkCaptionActor2D* GetZAxisCaptionActor2D() { return this->ZAxisLabel; }
267 
269 
272  vtkSetStringMacro(XAxisLabelText);
273  vtkGetStringMacro(XAxisLabelText);
274  vtkSetStringMacro(YAxisLabelText);
275  vtkGetStringMacro(YAxisLabelText);
276  vtkSetStringMacro(ZAxisLabelText);
277  vtkGetStringMacro(ZAxisLabelText);
279 
281 
284  vtkSetMacro(AxisLabels, vtkTypeBool);
285  vtkGetMacro(AxisLabels, vtkTypeBool);
286  vtkBooleanMacro(AxisLabels, vtkTypeBool);
288 
289  enum
290  {
293  USER_DEFINED_SHAFT
294  };
295 
296  enum
297  {
300  USER_DEFINED_TIP
301  };
302 
303 protected:
305  ~vtkAxesActor() override;
306 
311 
315 
319 
320  void UpdateProps();
321 
322  double TotalLength[3];
323  double NormalizedShaftLength[3];
324  double NormalizedTipLength[3];
325  double NormalizedLabelPosition[3];
326 
328  int TipType;
329 
332 
336 
340 
342 
346 
347  double ConeRadius;
348  double SphereRadius;
350 
351 private:
352  vtkAxesActor(const vtkAxesActor&) = delete;
353  void operator=(const vtkAxesActor&) = delete;
354 };
355 
356 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:61
a 3D axes representation
Definition: vtkAxesActor.h:78
int SphereResolution
Definition: vtkAxesActor.h:344
vtkActor * XAxisTip
Definition: vtkAxesActor.h:316
void SetTipTypeToSphere()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:221
vtkLineSource * LineSource
Definition: vtkAxesActor.h:308
vtkProperty * GetXAxisShaftProperty()
Get the shaft properties.
char * XAxisLabelText
Definition: vtkAxesActor.h:333
void SetShaftTypeToLine()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:210
double ConeRadius
Definition: vtkAxesActor.h:347
void SetNormalizedShaftLength(double v[3])
Set the normalized (0-1) length of the shaft.
Definition: vtkAxesActor.h:152
char * ZAxisLabelText
Definition: vtkAxesActor.h:335
vtkPolyData * UserDefinedShaft
Definition: vtkAxesActor.h:331
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:310
vtkCylinderSource * CylinderSource
Definition: vtkAxesActor.h:307
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:334
vtkCaptionActor2D * GetZAxisCaptionActor2D()
Definition: vtkAxesActor.h:266
void SetTotalLength(double v[3])
Set the total length of the axes in 3 dimensions.
Definition: vtkAxesActor.h:143
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:314
vtkActor * YAxisTip
Definition: vtkAxesActor.h:317
void SetTipTypeToUserDefined()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:222
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:330
~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:264
vtkCaptionActor2D * GetYAxisCaptionActor2D()
Definition: vtkAxesActor.h:265
vtkProperty * GetXAxisTipProperty()
Get the tip properties.
vtkCaptionActor2D * ZAxisLabel
Definition: vtkAxesActor.h:339
double CylinderRadius
Definition: vtkAxesActor.h:349
vtkCaptionActor2D * XAxisLabel
Definition: vtkAxesActor.h:337
vtkConeSource * ConeSource
Definition: vtkAxesActor.h:309
vtkActor * YAxisShaft
Definition: vtkAxesActor.h:313
void SetShaftTypeToCylinder()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:209
vtkActor * ZAxisTip
Definition: vtkAxesActor.h:318
void SetTipTypeToCone()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:220
vtkCaptionActor2D * YAxisLabel
Definition: vtkAxesActor.h:338
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:211
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:172
vtkActor * XAxisShaft
Definition: vtkAxesActor.h:312
vtkTypeBool AxisLabels
Definition: vtkAxesActor.h:341
void UpdateProps()
int CylinderResolution
Definition: vtkAxesActor.h:345
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:162
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:348
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:54
generate a polygonal cylinder centered at the origin
a simple class to control print indentation
Definition: vtkIndent.h:49
create a line defined by two end points
Definition: vtkLineSource.h:73
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:100
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:59
an ordered list of Props
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:66
represent surface properties of a geometric object
Definition: vtkProperty.h:77
abstract specification for renderers
Definition: vtkRenderer.h:82
create a polygonal sphere centered at the origin
abstract specification for Viewports
Definition: vtkViewport.h:65
window superclass for vtkRenderWindow
Definition: vtkWindow.h:48
@ 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(...)