VTK
dox/Hybrid/vtkAxisFollower.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkAxisFollower.cxx
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00028 #ifndef __vtkAxisFollower_h
00029 #define __vtkAxisFollower_h
00030 
00031 #include "vtkFollower.h"
00032 
00033 #include "vtkWeakPointer.h" // For vtkWeakPointer
00034 
00035 // Forward declarations.
00036 class vtkAxisActor;
00037 class vtkRenderer;
00038 
00039 class VTK_HYBRID_EXPORT vtkAxisFollower : public vtkFollower
00040 {
00041 public:
00042  vtkTypeMacro(vtkAxisFollower,vtkFollower);
00043  virtual void PrintSelf(ostream& os, vtkIndent indent);
00044 
00046  static vtkAxisFollower *New();
00047 
00049 
00050  virtual void SetAxis(vtkAxisActor*);
00051  virtual vtkAxisActor* GetAxis();
00053 
00055 
00058  vtkSetMacro(AutoCenter, int);
00059  vtkGetMacro(AutoCenter, int);
00060  vtkBooleanMacro(AutoCenter, int);
00062 
00064 
00067  vtkSetMacro(EnableDistanceLOD, int);
00068  vtkGetMacro(EnableDistanceLOD, int);
00070 
00072 
00075  vtkSetClampMacro(DistanceLODThreshold, double, 0.0, 1.0);
00076  vtkGetMacro(DistanceLODThreshold, double);
00078 
00080 
00082  vtkSetMacro(EnableViewAngleLOD, int);
00083  vtkGetMacro(EnableViewAngleLOD, int);
00085 
00087 
00090  vtkSetClampMacro(ViewAngleLODThreshold, double, 0.0, 1.0);
00091  vtkGetMacro(ViewAngleLODThreshold, double);
00093 
00095 
00096  vtkSetMacro(ScreenOffset, double);
00097  vtkGetMacro(ScreenOffset, double);
00099 
00101 
00104  virtual int RenderOpaqueGeometry(vtkViewport *viewport);
00105  virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport);
00106  virtual void Render(vtkRenderer *ren);
00108 
00112  virtual void ComputeTransformMatrix(vtkRenderer *ren);
00113 
00115  void ShallowCopy(vtkProp *prop);
00116 
00118 
00120  static double AutoScale(vtkViewport *viewport, vtkCamera * camera,
00121                          double screenSize, double position[3]);
00123 
00124 protected:
00125  vtkAxisFollower();
00126  ~vtkAxisFollower();
00127 
00128  void CalculateOrthogonalVectors(double Rx[3], double Ry[3], double Rz[3],
00129                                  vtkAxisActor *axis1, double *dop,
00130                                  vtkRenderer *ren);
00131 
00132 
00133  void ComputeRotationAndTranlation(vtkRenderer *ren, double translation[3],
00134                                    double Rx[3], double Ry[3], double Rz[3],
00135                                    vtkAxisActor *axis);
00136 
00137  // \NOTE: Not used as of now.
00138  void ComputerAutoCenterTranslation(const double& autoScaleFactor,
00139                                     double translation[3]);
00140 
00141 
00142  int  TestDistanceVisibility();
00143  void ExecuteViewAngleVisibility(double normal[3]);
00144 
00145  int          AutoCenter;
00146 
00147  int          EnableDistanceLOD;
00148  double       DistanceLODThreshold;
00149 
00150  int          EnableViewAngleLOD;
00151  double       ViewAngleLODThreshold;
00152 
00153  double       ScreenOffset;
00154 
00155  vtkWeakPointer<vtkAxisActor> Axis;
00156 
00157 
00158 private:
00159 
00160  int AxisPointingLeft;
00161  int VisibleAtCurrentViewAngle;
00162 
00163  vtkAxisFollower(const vtkAxisFollower&);  // Not implemented.
00164  void operator =(const vtkAxisFollower&);  // Not implemented.
00165 
00166  // hide the two parameter Render() method from the user and the compiler.
00167  virtual void Render(vtkRenderer *, vtkMapper *) {};
00168 
00169  //Internal matrices to avoid New/Delete for performance reasons
00170  vtkMatrix4x4 *InternalMatrix;
00171 
00172 };
00173 
00174 #endif // __vtkAxisFollower_h