VTK
vtkAxisFollower.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAxisFollower.cxx
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 =========================================================================*/
28 #ifndef __vtkAxisFollower_h
29 #define __vtkAxisFollower_h
30 
31 #include "vtkRenderingAnnotationModule.h" // For export macro
32 #include "vtkFollower.h"
33 
34 #include "vtkWeakPointer.h" // For vtkWeakPointer
35 
36 // Forward declarations.
37 class vtkAxisActor;
38 class vtkRenderer;
39 
40 class VTKRENDERINGANNOTATION_EXPORT vtkAxisFollower : public vtkFollower
41 {
42 public:
44  virtual void PrintSelf(ostream& os, vtkIndent indent);
45 
47  static vtkAxisFollower *New();
48 
50 
51  virtual void SetAxis(vtkAxisActor*);
52  virtual vtkAxisActor* GetAxis();
54 
56 
59  vtkSetMacro(AutoCenter, int);
60  vtkGetMacro(AutoCenter, int);
61  vtkBooleanMacro(AutoCenter, int);
63 
65 
68  vtkSetMacro(EnableDistanceLOD, int);
69  vtkGetMacro(EnableDistanceLOD, int);
71 
73 
76  vtkSetClampMacro(DistanceLODThreshold, double, 0.0, 1.0);
77  vtkGetMacro(DistanceLODThreshold, double);
79 
81 
83  vtkSetMacro(EnableViewAngleLOD, int);
84  vtkGetMacro(EnableViewAngleLOD, int);
86 
88 
91  vtkSetClampMacro(ViewAngleLODThreshold, double, 0.0, 1.0);
92  vtkGetMacro(ViewAngleLODThreshold, double);
94 
96 
97  vtkSetMacro(ScreenOffset, double);
98  vtkGetMacro(ScreenOffset, double);
100 
102 
105  virtual int RenderOpaqueGeometry(vtkViewport *viewport);
106  virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport);
107  virtual void Render(vtkRenderer *ren);
109 
113  virtual void ComputeTransformMatrix(vtkRenderer *ren);
114 
116  void ShallowCopy(vtkProp *prop);
117 
119 
121  static double AutoScale(vtkViewport *viewport, vtkCamera * camera,
122  double screenSize, double position[3]);
124 
125 protected:
126  vtkAxisFollower();
127  ~vtkAxisFollower();
128 
129  void CalculateOrthogonalVectors(double Rx[3], double Ry[3], double Rz[3],
130  vtkAxisActor *axis1, double *dop,
131  vtkRenderer *ren);
132 
133 
134  void ComputeRotationAndTranlation(vtkRenderer *ren, double translation[3],
135  double Rx[3], double Ry[3], double Rz[3],
136  vtkAxisActor *axis);
137 
138  // \NOTE: Not used as of now.
139  void ComputerAutoCenterTranslation(const double& autoScaleFactor,
140  double translation[3]);
141 
142 
143  int TestDistanceVisibility();
144  void ExecuteViewAngleVisibility(double normal[3]);
145 
147 
150 
153 
154  double ScreenOffset;
155 
157 
158 
159 private:
160 
161  int AxisPointingLeft;
162  int VisibleAtCurrentViewAngle;
163 
164  vtkAxisFollower(const vtkAxisFollower&); // Not implemented.
165  void operator =(const vtkAxisFollower&); // Not implemented.
166 
167  // hide the two parameter Render() method from the user and the compiler.
168  virtual void Render(vtkRenderer *, vtkMapper *) {};
169 
170  //Internal matrices to avoid New/Delete for performance reasons
171  vtkMatrix4x4 *InternalMatrix;
172 
173 };
174 
175 #endif // __vtkAxisFollower_h