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 "vtkFollower.h"
32 
33 #include "vtkWeakPointer.h" // For vtkWeakPointer
34 
35 // Forward declarations.
36 class vtkAxisActor;
37 class vtkRenderer;
38 
40 {
41 public:
43  virtual void PrintSelf(ostream& os, vtkIndent indent);
44 
46  static vtkAxisFollower *New();
47 
49 
50  virtual void SetAxis(vtkAxisActor*);
51  virtual vtkAxisActor* GetAxis();
53 
55 
58  vtkSetMacro(AutoCenter, int);
59  vtkGetMacro(AutoCenter, int);
60  vtkBooleanMacro(AutoCenter, int);
62 
64 
67  vtkSetMacro(EnableDistanceLOD, int);
68  vtkGetMacro(EnableDistanceLOD, int);
70 
72 
75  vtkSetClampMacro(DistanceLODThreshold, double, 0.0, 1.0);
76  vtkGetMacro(DistanceLODThreshold, double);
78 
80 
82  vtkSetMacro(EnableViewAngleLOD, int);
83  vtkGetMacro(EnableViewAngleLOD, int);
85 
87 
90  vtkSetClampMacro(ViewAngleLODThreshold, double, 0.0, 1.0);
91  vtkGetMacro(ViewAngleLODThreshold, double);
93 
95 
96  vtkSetMacro(ScreenOffset, double);
97  vtkGetMacro(ScreenOffset, double);
99 
101 
104  virtual int RenderOpaqueGeometry(vtkViewport *viewport);
105  virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport);
106  virtual void Render(vtkRenderer *ren);
108 
112  virtual void ComputeTransformMatrix(vtkRenderer *ren);
113 
115  void ShallowCopy(vtkProp *prop);
116 
118 
120  static double AutoScale(vtkViewport *viewport, vtkCamera * camera,
121  double screenSize, double position[3]);
123 
124 protected:
125  vtkAxisFollower();
126  ~vtkAxisFollower();
127 
128  void CalculateOrthogonalVectors(double Rx[3], double Ry[3], double Rz[3],
129  vtkAxisActor *axis1, double *dop,
130  vtkRenderer *ren);
131 
132 
133  void ComputeRotationAndTranlation(vtkRenderer *ren, double translation[3],
134  double Rx[3], double Ry[3], double Rz[3],
135  vtkAxisActor *axis);
136 
137  // \NOTE: Not used as of now.
138  void ComputerAutoCenterTranslation(const double& autoScaleFactor,
139  double translation[3]);
140 
141 
142  int TestDistanceVisibility();
143  void ExecuteViewAngleVisibility(double normal[3]);
144 
146 
149 
152 
153  double ScreenOffset;
154 
156 
157 
158 private:
159 
160  int AxisPointingLeft;
161  int VisibleAtCurrentViewAngle;
162 
163  vtkAxisFollower(const vtkAxisFollower&); // Not implemented.
164  void operator =(const vtkAxisFollower&); // Not implemented.
165 
166  // hide the two parameter Render() method from the user and the compiler.
167  virtual void Render(vtkRenderer *, vtkMapper *) {};
168 
169  //Internal matrices to avoid New/Delete for performance reasons
170  vtkMatrix4x4 *InternalMatrix;
171 
172 };
173 
174 #endif // __vtkAxisFollower_h