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 =========================================================================*/
51 #ifndef vtkAxesActor_h
52 #define vtkAxesActor_h
53 
54 #include "vtkProp3D.h"
55 #include "vtkRenderingAnnotationModule.h" // For export macro
56 
57 class vtkActor;
58 class vtkCaptionActor2D;
59 class vtkConeSource;
60 class vtkCylinderSource;
61 class vtkLineSource;
62 class vtkPolyData;
63 class vtkPropCollection;
64 class vtkProperty;
65 class vtkRenderer;
66 class vtkSphereSource;
67 
68 class VTKRENDERINGANNOTATION_EXPORT vtkAxesActor : public vtkProp3D
69 {
70 public:
71  static vtkAxesActor* New();
72  vtkTypeMacro(vtkAxesActor, vtkProp3D);
73  void PrintSelf(ostream& os, vtkIndent indent) override;
74 
80  void GetActors(vtkPropCollection*) override;
81 
83 
86  int RenderOpaqueGeometry(vtkViewport* viewport) override;
87  int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
88  int RenderOverlay(vtkViewport* viewport) override;
90 
95 
99  void ShallowCopy(vtkProp* prop) override;
100 
106  void ReleaseGraphicsResources(vtkWindow*) override;
107 
109 
113  void GetBounds(double bounds[6]);
114  double* GetBounds() VTK_SIZEHINT(6) override;
116 
120  vtkMTimeType GetMTime() override;
121 
128  vtkMTimeType GetRedrawMTime() override;
129 
131 
134  void SetTotalLength(double v[3]) { this->SetTotalLength(v[0], v[1], v[2]); }
135  void SetTotalLength(double x, double y, double z);
136  vtkGetVectorMacro(TotalLength, double, 3);
138 
140 
143  void SetNormalizedShaftLength(double v[3]) { this->SetNormalizedShaftLength(v[0], v[1], v[2]); }
144  void SetNormalizedShaftLength(double x, double y, double z);
145  vtkGetVectorMacro(NormalizedShaftLength, double, 3);
147 
149 
153  void SetNormalizedTipLength(double v[3]) { this->SetNormalizedTipLength(v[0], v[1], v[2]); }
154  void SetNormalizedTipLength(double x, double y, double z);
155  vtkGetVectorMacro(NormalizedTipLength, double, 3);
157 
159 
163  void SetNormalizedLabelPosition(double v[3])
164  {
165  this->SetNormalizedLabelPosition(v[0], v[1], v[2]);
166  }
167  void SetNormalizedLabelPosition(double x, double y, double z);
168  vtkGetVectorMacro(NormalizedLabelPosition, double, 3);
170 
172 
175  vtkSetClampMacro(ConeResolution, int, 3, 128);
176  vtkGetMacro(ConeResolution, int);
177  vtkSetClampMacro(SphereResolution, int, 3, 128);
178  vtkGetMacro(SphereResolution, int);
179  vtkSetClampMacro(CylinderResolution, int, 3, 128);
180  vtkGetMacro(CylinderResolution, int);
182 
184 
187  vtkSetClampMacro(ConeRadius, double, 0, VTK_FLOAT_MAX);
188  vtkGetMacro(ConeRadius, double);
189  vtkSetClampMacro(SphereRadius, double, 0, VTK_FLOAT_MAX);
190  vtkGetMacro(SphereRadius, double);
191  vtkSetClampMacro(CylinderRadius, double, 0, VTK_FLOAT_MAX);
192  vtkGetMacro(CylinderRadius, double);
194 
196 
199  void SetShaftType(int type);
200  void SetShaftTypeToCylinder() { this->SetShaftType(vtkAxesActor::CYLINDER_SHAFT); }
201  void SetShaftTypeToLine() { this->SetShaftType(vtkAxesActor::LINE_SHAFT); }
203  vtkGetMacro(ShaftType, int);
205 
207 
210  void SetTipType(int type);
211  void SetTipTypeToCone() { this->SetTipType(vtkAxesActor::CONE_TIP); }
212  void SetTipTypeToSphere() { this->SetTipType(vtkAxesActor::SPHERE_TIP); }
214  vtkGetMacro(TipType, int);
216 
218 
221  void SetUserDefinedTip(vtkPolyData*);
222  vtkGetObjectMacro(UserDefinedTip, vtkPolyData);
224 
226 
229  void SetUserDefinedShaft(vtkPolyData*);
230  vtkGetObjectMacro(UserDefinedShaft, vtkPolyData);
232 
234 
237  vtkProperty* GetXAxisTipProperty();
238  vtkProperty* GetYAxisTipProperty();
239  vtkProperty* GetZAxisTipProperty();
241 
243 
246  vtkProperty* GetXAxisShaftProperty();
247  vtkProperty* GetYAxisShaftProperty();
248  vtkProperty* GetZAxisShaftProperty();
250 
255  vtkCaptionActor2D* GetXAxisCaptionActor2D() { return this->XAxisLabel; }
256  vtkCaptionActor2D* GetYAxisCaptionActor2D() { return this->YAxisLabel; }
257  vtkCaptionActor2D* GetZAxisCaptionActor2D() { return this->ZAxisLabel; }
258 
260 
263  vtkSetStringMacro(XAxisLabelText);
264  vtkGetStringMacro(XAxisLabelText);
265  vtkSetStringMacro(YAxisLabelText);
266  vtkGetStringMacro(YAxisLabelText);
267  vtkSetStringMacro(ZAxisLabelText);
268  vtkGetStringMacro(ZAxisLabelText);
270 
272 
275  vtkSetMacro(AxisLabels, vtkTypeBool);
276  vtkGetMacro(AxisLabels, vtkTypeBool);
277  vtkBooleanMacro(AxisLabels, vtkTypeBool);
279 
280  enum
281  {
284  USER_DEFINED_SHAFT
285  };
286 
287  enum
288  {
291  USER_DEFINED_TIP
292  };
293 
294 protected:
295  vtkAxesActor();
296  ~vtkAxesActor() override;
297 
302 
306 
310 
311  void UpdateProps();
312 
313  double TotalLength[3];
314  double NormalizedShaftLength[3];
315  double NormalizedTipLength[3];
316  double NormalizedLabelPosition[3];
317 
319  int TipType;
320 
323 
327 
331 
333 
337 
338  double ConeRadius;
339  double SphereRadius;
341 
342 private:
343  vtkAxesActor(const vtkAxesActor&) = delete;
344  void operator=(const vtkAxesActor&) = delete;
345 };
346 
347 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:56
vtkCaptionActor2D * GetXAxisCaptionActor2D()
Retrieve handles to the X, Y and Z axis (so that you can set their text properties for example) ...
Definition: vtkAxesActor.h:255
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
void SetTotalLength(double v[3])
Set the total length of the axes in 3 dimensions.
Definition: vtkAxesActor.h:134
vtkPolyData * UserDefinedTip
Definition: vtkAxesActor.h:321
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:287
abstract specification for Viewports
Definition: vtkViewport.h:55
represent surface properties of a geometric object
Definition: vtkProperty.h:67
virtual int RenderOpaqueGeometry(vtkViewport *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:224
virtual vtkTypeBool HasTranslucentPolygonalGeometry()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:288
virtual int RenderOverlay(vtkViewport *)
Definition: vtkProp.h:227
vtkCaptionActor2D * GetYAxisCaptionActor2D()
Definition: vtkAxesActor.h:256
vtkCaptionActor2D * GetZAxisCaptionActor2D()
Definition: vtkAxesActor.h:257
int CylinderResolution
Definition: vtkAxesActor.h:336
a 3D axes representation
Definition: vtkAxesActor.h:68
char * ZAxisLabelText
Definition: vtkAxesActor.h:326
abstract specification for renderers
Definition: vtkRenderer.h:72
vtkLineSource * LineSource
Definition: vtkAxesActor.h:299
generate polygonal cone
Definition: vtkConeSource.h:44
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:49
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:90
vtkSphereSource * SphereSource
Definition: vtkAxesActor.h:301
an ordered list of Props
int vtkTypeBool
Definition: vtkABI.h:69
virtual void ReleaseGraphicsResources(vtkWindow *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
Definition: vtkProp.h:309
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
create a polygonal sphere centered at the origin
#define VTK_FLOAT_MAX
Definition: vtkType.h:163
char * XAxisLabelText
Definition: vtkAxesActor.h:324
vtkActor * ZAxisShaft
Definition: vtkAxesActor.h:305
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkCaptionActor2D * ZAxisLabel
Definition: vtkAxesActor.h:330
vtkConeSource * ConeSource
Definition: vtkAxesActor.h:300
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkProp3D.
vtkActor * XAxisTip
Definition: vtkAxesActor.h:307
vtkCaptionActor2D * YAxisLabel
Definition: vtkAxesActor.h:329
#define VTK_SIZEHINT(...)
vtkActor * ZAxisTip
Definition: vtkAxesActor.h:309
double SphereRadius
Definition: vtkAxesActor.h:339
create a line defined by two end points
Definition: vtkLineSource.h:63
void SetShaftTypeToUserDefined()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:202
vtkActor * YAxisTip
Definition: vtkAxesActor.h:308
void SetShaftTypeToLine()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:201
double ConeRadius
Definition: vtkAxesActor.h:338
vtkCylinderSource * CylinderSource
Definition: vtkAxesActor.h:298
vtkTypeBool AxisLabels
Definition: vtkAxesActor.h:332
vtkActor * YAxisShaft
Definition: vtkAxesActor.h:304
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:225
void SetTipTypeToCone()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:211
vtkActor * XAxisShaft
Definition: vtkAxesActor.h:303
vtkCaptionActor2D * XAxisLabel
Definition: vtkAxesActor.h:328
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:163
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
char * YAxisLabelText
Definition: vtkAxesActor.h:325
void SetShaftTypeToCylinder()
Set the type of the shaft to a cylinder, line, or user defined geometry.
Definition: vtkAxesActor.h:200
int SphereResolution
Definition: vtkAxesActor.h:335
void SetNormalizedTipLength(double v[3])
Set the normalized (0-1) length of the tip.
Definition: vtkAxesActor.h:153
double CylinderRadius
Definition: vtkAxesActor.h:340
vtkPolyData * UserDefinedShaft
Definition: vtkAxesActor.h:322
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:67
void SetTipTypeToUserDefined()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:213
void SetTipTypeToSphere()
Set the type of the tip to a cone, sphere, or user defined geometry.
Definition: vtkAxesActor.h:212
void SetNormalizedShaftLength(double v[3])
Set the normalized (0-1) length of the shaft.
Definition: vtkAxesActor.h:143