VTK  9.3.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 
45 VTK_ABI_NAMESPACE_BEGIN
46 class vtkActor;
47 class vtkCaptionActor2D;
48 class vtkConeSource;
49 class vtkCylinderSource;
50 class vtkLineSource;
51 class vtkPolyData;
52 class vtkPropCollection;
53 class vtkProperty;
54 class vtkRenderer;
55 class vtkSphereSource;
56 
57 class VTKRENDERINGANNOTATION_EXPORT vtkAxesActor : public vtkProp3D
58 {
59 public:
60  static vtkAxesActor* New();
61  vtkTypeMacro(vtkAxesActor, vtkProp3D);
62  void PrintSelf(ostream& os, vtkIndent indent) override;
63 
69  void GetActors(vtkPropCollection*) override;
70 
72 
75  int RenderOpaqueGeometry(vtkViewport* viewport) override;
76  int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
77  int RenderOverlay(vtkViewport* viewport) override;
79 
84 
88  void ShallowCopy(vtkProp* prop) override;
89 
95  void ReleaseGraphicsResources(vtkWindow*) override;
96 
98 
102  void GetBounds(double bounds[6]);
103  double* GetBounds() VTK_SIZEHINT(6) override;
105 
109  vtkMTimeType GetMTime() override;
110 
117  vtkMTimeType GetRedrawMTime() override;
118 
120 
123  void SetTotalLength(double v[3]) { this->SetTotalLength(v[0], v[1], v[2]); }
124  void SetTotalLength(double x, double y, double z);
125  vtkGetVectorMacro(TotalLength, double, 3);
127 
129 
132  void SetNormalizedShaftLength(double v[3]) { this->SetNormalizedShaftLength(v[0], v[1], v[2]); }
133  void SetNormalizedShaftLength(double x, double y, double z);
134  vtkGetVectorMacro(NormalizedShaftLength, double, 3);
136 
138 
142  void SetNormalizedTipLength(double v[3]) { this->SetNormalizedTipLength(v[0], v[1], v[2]); }
143  void SetNormalizedTipLength(double x, double y, double z);
144  vtkGetVectorMacro(NormalizedTipLength, double, 3);
146 
148 
152  void SetNormalizedLabelPosition(double v[3])
153  {
154  this->SetNormalizedLabelPosition(v[0], v[1], v[2]);
155  }
156  void SetNormalizedLabelPosition(double x, double y, double z);
157  vtkGetVectorMacro(NormalizedLabelPosition, double, 3);
159 
161 
164  vtkSetClampMacro(ConeResolution, int, 3, 128);
165  vtkGetMacro(ConeResolution, int);
166  vtkSetClampMacro(SphereResolution, int, 3, 128);
167  vtkGetMacro(SphereResolution, int);
168  vtkSetClampMacro(CylinderResolution, int, 3, 128);
169  vtkGetMacro(CylinderResolution, int);
171 
173 
176  vtkSetClampMacro(ConeRadius, double, 0, VTK_FLOAT_MAX);
177  vtkGetMacro(ConeRadius, double);
178  vtkSetClampMacro(SphereRadius, double, 0, VTK_FLOAT_MAX);
179  vtkGetMacro(SphereRadius, double);
180  vtkSetClampMacro(CylinderRadius, double, 0, VTK_FLOAT_MAX);
181  vtkGetMacro(CylinderRadius, double);
183 
185 
188  void SetShaftType(int type);
189  void SetShaftTypeToCylinder() { this->SetShaftType(vtkAxesActor::CYLINDER_SHAFT); }
190  void SetShaftTypeToLine() { this->SetShaftType(vtkAxesActor::LINE_SHAFT); }
192  vtkGetMacro(ShaftType, int);
194 
196 
199  void SetTipType(int type);
200  void SetTipTypeToCone() { this->SetTipType(vtkAxesActor::CONE_TIP); }
201  void SetTipTypeToSphere() { this->SetTipType(vtkAxesActor::SPHERE_TIP); }
203  vtkGetMacro(TipType, int);
205 
207 
210  void SetUserDefinedTip(vtkPolyData*);
211  vtkGetObjectMacro(UserDefinedTip, vtkPolyData);
213 
215 
218  void SetUserDefinedShaft(vtkPolyData*);
219  vtkGetObjectMacro(UserDefinedShaft, vtkPolyData);
221 
223 
226  vtkProperty* GetXAxisTipProperty();
227  vtkProperty* GetYAxisTipProperty();
228  vtkProperty* GetZAxisTipProperty();
230 
232 
235  vtkProperty* GetXAxisShaftProperty();
236  vtkProperty* GetYAxisShaftProperty();
237  vtkProperty* GetZAxisShaftProperty();
239 
244  vtkCaptionActor2D* GetXAxisCaptionActor2D() { return this->XAxisLabel; }
245  vtkCaptionActor2D* GetYAxisCaptionActor2D() { return this->YAxisLabel; }
246  vtkCaptionActor2D* GetZAxisCaptionActor2D() { return this->ZAxisLabel; }
247 
249 
252  vtkSetStringMacro(XAxisLabelText);
253  vtkGetStringMacro(XAxisLabelText);
254  vtkSetStringMacro(YAxisLabelText);
255  vtkGetStringMacro(YAxisLabelText);
256  vtkSetStringMacro(ZAxisLabelText);
257  vtkGetStringMacro(ZAxisLabelText);
259 
261 
264  vtkSetMacro(AxisLabels, vtkTypeBool);
265  vtkGetMacro(AxisLabels, vtkTypeBool);
266  vtkBooleanMacro(AxisLabels, vtkTypeBool);
268 
269  enum
270  {
273  USER_DEFINED_SHAFT
274  };
275 
276  enum
277  {
280  USER_DEFINED_TIP
281  };
282 
283 protected:
284  vtkAxesActor();
285  ~vtkAxesActor() override;
286 
291 
295 
299 
300  void UpdateProps();
301 
302  double TotalLength[3];
303  double NormalizedShaftLength[3];
304  double NormalizedTipLength[3];
305  double NormalizedLabelPosition[3];
306 
308  int TipType;
309 
312 
316 
320 
322 
326 
327  double ConeRadius;
328  double SphereRadius;
330 
331 private:
332  vtkAxesActor(const vtkAxesActor&) = delete;
333  void operator=(const vtkAxesActor&) = delete;
334 };
335 
336 VTK_ABI_NAMESPACE_END
337 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:45
vtkCaptionActor2D * GetXAxisCaptionActor2D()
Retrieve handles to the X, Y and Z axis (so that you can set their text properties for example) ...
Definition: vtkAxesActor.h:244
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:40
void SetTotalLength(double v[3])
Set the total length of the axes in 3 dimensions.
Definition: vtkAxesActor.h:123
vtkPolyData * UserDefinedTip
Definition: vtkAxesActor.h:310
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:270
abstract specification for Viewports
Definition: vtkViewport.h:44
represent surface properties of a geometric object
Definition: vtkProperty.h:56
virtual int RenderOpaqueGeometry(vtkViewport *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:213
virtual vtkTypeBool HasTranslucentPolygonalGeometry()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:277
virtual int RenderOverlay(vtkViewport *)
Definition: vtkProp.h:216
vtkCaptionActor2D * GetYAxisCaptionActor2D()
Definition: vtkAxesActor.h:245
vtkCaptionActor2D * GetZAxisCaptionActor2D()
Definition: vtkAxesActor.h:246
int CylinderResolution
Definition: vtkAxesActor.h:325
a 3D axes representation
Definition: vtkAxesActor.h:57
char * ZAxisLabelText
Definition: vtkAxesActor.h:315
abstract specification for renderers
Definition: vtkRenderer.h:61
vtkLineSource * LineSource
Definition: vtkAxesActor.h:288
generate polygonal cone
Definition: vtkConeSource.h:33
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:38
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
vtkSphereSource * SphereSource
Definition: vtkAxesActor.h:290
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:298
window superclass for vtkRenderWindow
Definition: vtkWindow.h:27
create a polygonal sphere centered at the origin
#define VTK_FLOAT_MAX
Definition: vtkType.h:152
char * XAxisLabelText
Definition: vtkAxesActor.h:313
vtkActor * ZAxisShaft
Definition: vtkAxesActor.h:294
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkCaptionActor2D * ZAxisLabel
Definition: vtkAxesActor.h:319
vtkConeSource * ConeSource
Definition: vtkAxesActor.h:289
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkProp3D.
vtkActor * XAxisTip
Definition: vtkAxesActor.h:296
vtkCaptionActor2D * YAxisLabel
Definition: vtkAxesActor.h:318
#define VTK_SIZEHINT(...)
vtkActor * ZAxisTip
Definition: vtkAxesActor.h:298
double SphereRadius
Definition: vtkAxesActor.h:328
create a line defined by two end points
Definition: vtkLineSource.h:52
void SetShaftTypeToUserDefined()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:191
vtkActor * YAxisTip
Definition: vtkAxesActor.h:297
void SetShaftTypeToLine()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:190
double ConeRadius
Definition: vtkAxesActor.h:327
vtkCylinderSource * CylinderSource
Definition: vtkAxesActor.h:287
vtkTypeBool AxisLabels
Definition: vtkAxesActor.h:321
vtkActor * YAxisShaft
Definition: vtkAxesActor.h:293
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:214
void SetTipTypeToCone()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:200
vtkActor * XAxisShaft
Definition: vtkAxesActor.h:292
vtkCaptionActor2D * XAxisLabel
Definition: vtkAxesActor.h:317
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:152
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
char * YAxisLabelText
Definition: vtkAxesActor.h:314
void SetShaftTypeToCylinder()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:189
int SphereResolution
Definition: vtkAxesActor.h:324
void SetNormalizedTipLength(double v[3])
Set the normalized (0-1) length of the tip.
Definition: vtkAxesActor.h:142
double CylinderRadius
Definition: vtkAxesActor.h:329
vtkPolyData * UserDefinedShaft
Definition: vtkAxesActor.h:311
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:56
void SetTipTypeToUserDefined()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:202
void SetTipTypeToSphere()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:201
void SetNormalizedShaftLength(double v[3])
Set the normalized (0-1) length of the shaft.
Definition: vtkAxesActor.h:132