VTK  9.0.1
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 =========================================================================*/
48 #ifndef vtkAxesActor_h
49 #define vtkAxesActor_h
50 
51 #include "vtkProp3D.h"
52 #include "vtkRenderingAnnotationModule.h" // For export macro
53 
54 class vtkActor;
55 class vtkCaptionActor2D;
56 class vtkConeSource;
57 class vtkCylinderSource;
58 class vtkLineSource;
59 class vtkPolyData;
60 class vtkPropCollection;
61 class vtkProperty;
62 class vtkRenderer;
63 class vtkSphereSource;
64 
65 class VTKRENDERINGANNOTATION_EXPORT vtkAxesActor : public vtkProp3D
66 {
67 public:
68  static vtkAxesActor* New();
69  vtkTypeMacro(vtkAxesActor, vtkProp3D);
70  void PrintSelf(ostream& os, vtkIndent indent) override;
71 
77  void GetActors(vtkPropCollection*) override;
78 
80 
83  int RenderOpaqueGeometry(vtkViewport* viewport) override;
85  int RenderOverlay(vtkViewport* viewport) override;
87 
92 
96  void ShallowCopy(vtkProp* prop) override;
97 
104 
106 
110  void GetBounds(double bounds[6]);
111  double* GetBounds() VTK_SIZEHINT(6) override;
113 
117  vtkMTimeType GetMTime() override;
118 
125  vtkMTimeType GetRedrawMTime() override;
126 
128 
131  void SetTotalLength(double v[3]) { this->SetTotalLength(v[0], v[1], v[2]); }
132  void SetTotalLength(double x, double y, double z);
133  vtkGetVectorMacro(TotalLength, double, 3);
135 
137 
140  void SetNormalizedShaftLength(double v[3]) { this->SetNormalizedShaftLength(v[0], v[1], v[2]); }
141  void SetNormalizedShaftLength(double x, double y, double z);
142  vtkGetVectorMacro(NormalizedShaftLength, double, 3);
144 
146 
150  void SetNormalizedTipLength(double v[3]) { this->SetNormalizedTipLength(v[0], v[1], v[2]); }
151  void SetNormalizedTipLength(double x, double y, double z);
152  vtkGetVectorMacro(NormalizedTipLength, double, 3);
154 
156 
160  void SetNormalizedLabelPosition(double v[3])
161  {
162  this->SetNormalizedLabelPosition(v[0], v[1], v[2]);
163  }
164  void SetNormalizedLabelPosition(double x, double y, double z);
165  vtkGetVectorMacro(NormalizedLabelPosition, double, 3);
167 
169 
172  vtkSetClampMacro(ConeResolution, int, 3, 128);
173  vtkGetMacro(ConeResolution, int);
174  vtkSetClampMacro(SphereResolution, int, 3, 128);
175  vtkGetMacro(SphereResolution, int);
176  vtkSetClampMacro(CylinderResolution, int, 3, 128);
177  vtkGetMacro(CylinderResolution, int);
179 
181 
184  vtkSetClampMacro(ConeRadius, double, 0, VTK_FLOAT_MAX);
185  vtkGetMacro(ConeRadius, double);
186  vtkSetClampMacro(SphereRadius, double, 0, VTK_FLOAT_MAX);
187  vtkGetMacro(SphereRadius, double);
188  vtkSetClampMacro(CylinderRadius, double, 0, VTK_FLOAT_MAX);
189  vtkGetMacro(CylinderRadius, double);
191 
193 
196  void SetShaftType(int type);
197  void SetShaftTypeToCylinder() { this->SetShaftType(vtkAxesActor::CYLINDER_SHAFT); }
198  void SetShaftTypeToLine() { this->SetShaftType(vtkAxesActor::LINE_SHAFT); }
200  vtkGetMacro(ShaftType, int);
202 
204 
207  void SetTipType(int type);
208  void SetTipTypeToCone() { this->SetTipType(vtkAxesActor::CONE_TIP); }
209  void SetTipTypeToSphere() { this->SetTipType(vtkAxesActor::SPHERE_TIP); }
211  vtkGetMacro(TipType, int);
213 
215 
219  vtkGetObjectMacro(UserDefinedTip, vtkPolyData);
221 
223 
227  vtkGetObjectMacro(UserDefinedShaft, vtkPolyData);
229 
231 
238 
240 
247 
252  vtkCaptionActor2D* GetXAxisCaptionActor2D() { return this->XAxisLabel; }
253  vtkCaptionActor2D* GetYAxisCaptionActor2D() { return this->YAxisLabel; }
254  vtkCaptionActor2D* GetZAxisCaptionActor2D() { return this->ZAxisLabel; }
255 
257 
260  vtkSetStringMacro(XAxisLabelText);
261  vtkGetStringMacro(XAxisLabelText);
262  vtkSetStringMacro(YAxisLabelText);
263  vtkGetStringMacro(YAxisLabelText);
264  vtkSetStringMacro(ZAxisLabelText);
265  vtkGetStringMacro(ZAxisLabelText);
267 
269 
272  vtkSetMacro(AxisLabels, vtkTypeBool);
273  vtkGetMacro(AxisLabels, vtkTypeBool);
274  vtkBooleanMacro(AxisLabels, vtkTypeBool);
276 
277  enum
278  {
281  USER_DEFINED_SHAFT
282  };
283 
284  enum
285  {
288  USER_DEFINED_TIP
289  };
290 
291 protected:
293  ~vtkAxesActor() override;
294 
299 
303 
307 
308  void UpdateProps();
309 
310  double TotalLength[3];
311  double NormalizedShaftLength[3];
312  double NormalizedTipLength[3];
313  double NormalizedLabelPosition[3];
314 
316  int TipType;
317 
320 
324 
328 
330 
334 
335  double ConeRadius;
336  double SphereRadius;
338 
339 private:
340  vtkAxesActor(const vtkAxesActor&) = delete;
341  void operator=(const vtkAxesActor&) = delete;
342 };
343 
344 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:46
a 3D axes representation
Definition: vtkAxesActor.h:66
int SphereResolution
Definition: vtkAxesActor.h:332
vtkActor * XAxisTip
Definition: vtkAxesActor.h:304
void SetTipTypeToSphere()
Definition: vtkAxesActor.h:209
vtkLineSource * LineSource
Definition: vtkAxesActor.h:296
vtkProperty * GetXAxisShaftProperty()
Get the shaft properties.
char * XAxisLabelText
Definition: vtkAxesActor.h:321
void SetShaftTypeToLine()
Definition: vtkAxesActor.h:198
double ConeRadius
Definition: vtkAxesActor.h:335
void SetNormalizedShaftLength(double v[3])
Set the normalized (0-1) length of the shaft.
Definition: vtkAxesActor.h:140
char * ZAxisLabelText
Definition: vtkAxesActor.h:323
vtkPolyData * UserDefinedShaft
Definition: vtkAxesActor.h:319
void SetNormalizedTipLength(double x, double y, double z)
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
vtkSphereSource * SphereSource
Definition: vtkAxesActor.h:298
vtkCylinderSource * CylinderSource
Definition: vtkAxesActor.h:295
void SetNormalizedShaftLength(double x, double y, double z)
vtkProperty * GetYAxisShaftProperty()
void SetShaftType(int type)
Set the type of the shaft to a cylinder, line, or user defined geometry.
static vtkAxesActor * New()
vtkProperty * GetZAxisShaftProperty()
char * YAxisLabelText
Definition: vtkAxesActor.h:322
vtkCaptionActor2D * GetZAxisCaptionActor2D()
Definition: vtkAxesActor.h:254
void SetTotalLength(double v[3])
Set the total length of the axes in 3 dimensions.
Definition: vtkAxesActor.h:131
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:302
vtkActor * YAxisTip
Definition: vtkAxesActor.h:305
void SetTipTypeToUserDefined()
Definition: vtkAxesActor.h:210
void ShallowCopy(vtkProp *prop) override
Shallow copy of an axes actor.
int RenderOverlay(vtkViewport *viewport) override
vtkPolyData * UserDefinedTip
Definition: vtkAxesActor.h:318
~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:252
vtkCaptionActor2D * GetYAxisCaptionActor2D()
Definition: vtkAxesActor.h:253
vtkProperty * GetXAxisTipProperty()
Get the tip properties.
vtkCaptionActor2D * ZAxisLabel
Definition: vtkAxesActor.h:327
double CylinderRadius
Definition: vtkAxesActor.h:337
vtkCaptionActor2D * XAxisLabel
Definition: vtkAxesActor.h:325
vtkConeSource * ConeSource
Definition: vtkAxesActor.h:297
vtkActor * YAxisShaft
Definition: vtkAxesActor.h:301
void SetShaftTypeToCylinder()
Definition: vtkAxesActor.h:197
vtkActor * ZAxisTip
Definition: vtkAxesActor.h:306
void SetTipTypeToCone()
Definition: vtkAxesActor.h:208
vtkCaptionActor2D * YAxisLabel
Definition: vtkAxesActor.h:326
vtkProperty * GetYAxisTipProperty()
void GetBounds(double bounds[6])
Get the bounds for this Actor as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
void SetShaftTypeToUserDefined()
Definition: vtkAxesActor.h:199
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)
void SetNormalizedLabelPosition(double v[3])
Set the normalized (0-1) position of the label along the length of the shaft.
Definition: vtkAxesActor.h:160
vtkActor * XAxisShaft
Definition: vtkAxesActor.h:300
vtkTypeBool AxisLabels
Definition: vtkAxesActor.h:329
void UpdateProps()
int CylinderResolution
Definition: vtkAxesActor.h:333
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
void SetTotalLength(double x, double y, double z)
void SetNormalizedTipLength(double v[3])
Set the normalized (0-1) length of the tip.
Definition: vtkAxesActor.h:150
double * GetBounds() override
Get the bounds for this Prop 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()
double SphereRadius
Definition: vtkAxesActor.h:336
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:39
generate a cylinder centered at origin
a simple class to control print indentation
Definition: vtkIndent.h:34
create a line defined by two end points
Definition: vtkLineSource.h:61
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:44
an ordered list of Props
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:48
represent surface properties of a geometric object
Definition: vtkProperty.h:62
abstract specification for renderers
Definition: vtkRenderer.h:59
create a polygonal sphere centered at the origin
abstract specification for Viewports
Definition: vtkViewport.h:45
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
@ type
Definition: vtkX3D.h:522
int vtkTypeBool
Definition: vtkABI.h:69
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293
#define VTK_FLOAT_MAX
Definition: vtkType.h:163
#define VTK_SIZEHINT(...)