VTK
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 =========================================================================*/
53 #ifndef __vtkAxesActor_h
54 #define __vtkAxesActor_h
55 
56 #include "vtkRenderingAnnotationModule.h" // For export macro
57 #include "vtkProp3D.h"
58 
59 class vtkActor;
60 class vtkCaptionActor2D;
61 class vtkConeSource;
62 class vtkCylinderSource;
63 class vtkLineSource;
64 class vtkPolyData;
65 class vtkPropCollection;
66 class vtkProperty;
67 class vtkRenderer;
68 class vtkSphereSource;
69 
70 class VTKRENDERINGANNOTATION_EXPORT vtkAxesActor : public vtkProp3D
71 {
72 public:
73  static vtkAxesActor *New();
74  vtkTypeMacro(vtkAxesActor,vtkProp3D);
75  void PrintSelf(ostream& os, vtkIndent indent);
76 
80  virtual void GetActors(vtkPropCollection *);
81 
83 
84  virtual int RenderOpaqueGeometry(vtkViewport *viewport);
85  virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport);
86  virtual int RenderOverlay(vtkViewport *viewport);
88 
90  virtual int HasTranslucentPolygonalGeometry();
91 
93  void ShallowCopy(vtkProp *prop);
94 
99 
101 
104  void GetBounds(double bounds[6]);
105  double *GetBounds();
107 
109  unsigned long int GetMTime();
110 
115  virtual unsigned long GetRedrawMTime();
116 
118 
119  void SetTotalLength( double v[3] )
120  { this->SetTotalLength( v[0], v[1], v[2] ); }
121  void SetTotalLength( double x, double y, double z );
122  vtkGetVectorMacro( TotalLength, double, 3 );
124 
126 
127  void SetNormalizedShaftLength( double v[3] )
128  { this->SetNormalizedShaftLength( v[0], v[1], v[2] ); }
129  void SetNormalizedShaftLength( double x, double y, double z );
130  vtkGetVectorMacro( NormalizedShaftLength, double, 3 );
132 
134 
136  void SetNormalizedTipLength( double v[3] )
137  { this->SetNormalizedTipLength( v[0], v[1], v[2] ); }
138  void SetNormalizedTipLength( double x, double y, double z );
139  vtkGetVectorMacro( NormalizedTipLength, double, 3 );
141 
143 
145  void SetNormalizedLabelPosition( double v[3] )
146  { this->SetNormalizedLabelPosition( v[0], v[1], v[2] ); }
147  void SetNormalizedLabelPosition( double x, double y, double z );
148  vtkGetVectorMacro( NormalizedLabelPosition, double, 3 );
150 
152 
153  vtkSetClampMacro(ConeResolution, int, 3, 128);
154  vtkGetMacro(ConeResolution, int);
155  vtkSetClampMacro(SphereResolution, int, 3, 128);
156  vtkGetMacro(SphereResolution, int);
157  vtkSetClampMacro(CylinderResolution, int, 3, 128);
158  vtkGetMacro(CylinderResolution, int);
160 
162 
163  vtkSetClampMacro(ConeRadius, double, 0, VTK_LARGE_FLOAT);
164  vtkGetMacro(ConeRadius, double);
165  vtkSetClampMacro(SphereRadius, double, 0, VTK_LARGE_FLOAT);
166  vtkGetMacro(SphereRadius, double);
167  vtkSetClampMacro(CylinderRadius, double, 0, VTK_LARGE_FLOAT);
168  vtkGetMacro(CylinderRadius, double);
170 
172 
174  void SetShaftType( int type );
175  void SetShaftTypeToCylinder()
176  { this->SetShaftType( vtkAxesActor::CYLINDER_SHAFT ); }
177  void SetShaftTypeToLine()
178  { this->SetShaftType( vtkAxesActor::LINE_SHAFT ); }
179  void SetShaftTypeToUserDefined()
180  { this->SetShaftType( vtkAxesActor::USER_DEFINED_SHAFT ); }
181  vtkGetMacro(ShaftType, int);
183 
185 
186  void SetTipType( int type );
187  void SetTipTypeToCone()
188  { this->SetTipType( vtkAxesActor::CONE_TIP ); }
189  void SetTipTypeToSphere()
190  { this->SetTipType( vtkAxesActor::SPHERE_TIP ); }
191  void SetTipTypeToUserDefined()
192  { this->SetTipType( vtkAxesActor::USER_DEFINED_TIP ); }
193  vtkGetMacro(TipType, int);
195 
197 
198  void SetUserDefinedTip( vtkPolyData * );
199  vtkGetObjectMacro( UserDefinedTip, vtkPolyData );
201 
203 
204  void SetUserDefinedShaft( vtkPolyData * );
205  vtkGetObjectMacro( UserDefinedShaft, vtkPolyData );
207 
209 
210  vtkProperty *GetXAxisTipProperty();
211  vtkProperty *GetYAxisTipProperty();
212  vtkProperty *GetZAxisTipProperty();
214 
216 
217  vtkProperty *GetXAxisShaftProperty();
218  vtkProperty *GetYAxisShaftProperty();
219  vtkProperty *GetZAxisShaftProperty();
221 
223 
225  vtkCaptionActor2D *GetXAxisCaptionActor2D()
226  {return this->XAxisLabel;}
227  vtkCaptionActor2D *GetYAxisCaptionActor2D()
228  {return this->YAxisLabel;}
229  vtkCaptionActor2D *GetZAxisCaptionActor2D()
230  {return this->ZAxisLabel;}
232 
234 
235  vtkSetStringMacro( XAxisLabelText );
236  vtkGetStringMacro( XAxisLabelText );
237  vtkSetStringMacro( YAxisLabelText );
238  vtkGetStringMacro( YAxisLabelText );
239  vtkSetStringMacro( ZAxisLabelText );
240  vtkGetStringMacro( ZAxisLabelText );
242 
244 
245  vtkSetMacro(AxisLabels, int);
246  vtkGetMacro(AxisLabels, int);
247  vtkBooleanMacro(AxisLabels, int);
249 
250 //BTX
251  enum
252  {
255  USER_DEFINED_SHAFT
256  };
257 
258  enum
259  {
262  USER_DEFINED_TIP
263  };
264 //ETX
265 
266 protected:
267  vtkAxesActor();
268  ~vtkAxesActor();
269 
274 
278 
282 
283  void UpdateProps();
284 
285  double TotalLength[3];
286  double NormalizedShaftLength[3];
287  double NormalizedTipLength[3];
288  double NormalizedLabelPosition[3];
289 
291  int TipType;
292 
295 
299 
303 
305 
306 
310 
311  double ConeRadius;
312  double SphereRadius;
314 
315 private:
316  vtkAxesActor(const vtkAxesActor&); // Not implemented.
317  void operator=(const vtkAxesActor&); // Not implemented.
318 };
319 
320 #endif
321