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 =========================================================================*/
29 #ifndef vtkAxisFollower_h
30 #define vtkAxisFollower_h
31 
32 #include "vtkRenderingAnnotationModule.h" // For export macro
33 #include "vtkFollower.h"
34 
35 #include "vtkWeakPointer.h" // For vtkWeakPointer
36 
37 // Forward declarations.
38 class vtkAxisActor;
39 class vtkRenderer;
40 
41 class VTKRENDERINGANNOTATION_EXPORT vtkAxisFollower : public vtkFollower
42 {
43 public:
45  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
46 
50  static vtkAxisFollower *New();
51 
53 
56  virtual void SetAxis(vtkAxisActor*);
57  virtual vtkAxisActor* GetAxis();
59 
61 
66  vtkSetMacro(AutoCenter, int);
67  vtkGetMacro(AutoCenter, int);
68  vtkBooleanMacro(AutoCenter, int);
70 
72 
77  vtkSetMacro(EnableDistanceLOD, int);
78  vtkGetMacro(EnableDistanceLOD, int);
80 
82 
87  vtkSetClampMacro(DistanceLODThreshold, double, 0.0, 1.0);
88  vtkGetMacro(DistanceLODThreshold, double);
90 
92 
97  vtkSetMacro(EnableViewAngleLOD, int);
98  vtkGetMacro(EnableViewAngleLOD, int);
100 
102 
107  vtkSetClampMacro(ViewAngleLODThreshold, double, 0.0, 1.0);
108  vtkGetMacro(ViewAngleLODThreshold, double);
110 
112 
116  double GetScreenOffset();
117  void SetScreenOffset(double offset);
119 
121 
125  vtkSetVector2Macro(ScreenOffsetVector, double);
126  vtkGetVector2Macro(ScreenOffsetVector, double);
128 
130 
135  virtual int RenderOpaqueGeometry(vtkViewport *viewport);
136  virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport);
137  virtual void Render(vtkRenderer *ren);
139 
144  virtual void ComputeTransformMatrix(vtkRenderer *ren);
145 
149  void ShallowCopy(vtkProp *prop);
150 
155  static double AutoScale(vtkViewport *viewport, vtkCamera * camera,
156  double screenSize, double position[3]);
157 
158 protected:
159  vtkAxisFollower();
160  ~vtkAxisFollower();
161 
162  void CalculateOrthogonalVectors(double Rx[3], double Ry[3], double Rz[3],
163  vtkAxisActor *axis1, double *dop,
164  vtkRenderer *ren);
165 
166  void ComputeRotationAndTranlation(vtkRenderer *ren, double translation[3],
167  double Rx[3], double Ry[3], double Rz[3],
168  vtkAxisActor *axis);
169 
170  // \NOTE: Not used as of now.
171  void ComputerAutoCenterTranslation(const double& autoScaleFactor,
172  double translation[3]);
173 
174  int TestDistanceVisibility();
175  void ExecuteViewAngleVisibility(double normal[3]);
176 
177  bool IsTextUpsideDown(double* a, double* b);
178 
180 
183 
186 
187  double ScreenOffsetVector[2];
188 
190 
191 private:
192 
193  int TextUpsideDown;
194  int VisibleAtCurrentViewAngle;
195 
196  vtkAxisFollower(const vtkAxisFollower&) VTK_DELETE_FUNCTION;
197  void operator =(const vtkAxisFollower&) VTK_DELETE_FUNCTION;
198 
199  // hide the two parameter Render() method from the user and the compiler.
200  virtual void Render(vtkRenderer *, vtkMapper *) {}
201 
202  //Internal matrices to avoid New/Delete for performance reasons
203  vtkMatrix4x4 *InternalMatrix;
204 
205 };
206 
207 #endif // vtkAxisFollower_h
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:50
vtkWeakPointer< vtkAxisActor > Axis
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
abstract specification for Viewports
Definition: vtkViewport.h:47
virtual void Render(vtkRenderer *ren)
This causes the actor to be rendered.
Create an axis with tick marks and labels.
Definition: vtkAxisActor.h:74
abstract specification for renderers
Definition: vtkRenderer.h:63
void ShallowCopy(vtkProp *prop)
Shallow copy of a follower.
a simple class to control print indentation
Definition: vtkIndent.h:39
a virtual camera for 3D rendering
Definition: vtkCamera.h:50
double ViewAngleLODThreshold
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
virtual int RenderOpaqueGeometry(vtkViewport *viewport)
This causes the actor to be rendered.
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:91
a subclass of vtkFollower that ensures that data is always parallel to the axis defined by a vtkAxisA...
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
a subclass of actor that always faces the camera
Definition: vtkFollower.h:46
static vtkFollower * New()
Creates a follower with no camera set.
double DistanceLODThreshold
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport)
This causes the actor to be rendered.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.