VTK
dox/Rendering/Annotation/vtkProp3DAxisFollower.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkProp3DAxisFollower.h
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 __vtkProp3DAxisFollower_h
00029 #define __vtkProp3DAxisFollower_h
00030 
00031 #include "vtkRenderingAnnotationModule.h" // For export macro
00032 #include "vtkProp3DFollower.h"
00033 #include "vtkWeakPointer.h" // For vtkWeakPointer
00034 
00035 class vtkAxisActor;
00036 class vtkViewport;
00037 
00038 class VTKRENDERINGANNOTATION_EXPORT vtkProp3DAxisFollower
00039   : public vtkProp3DFollower
00040 {
00041  public:
00043   static vtkProp3DAxisFollower *New();
00044 
00046 
00047   vtkTypeMacro(vtkProp3DAxisFollower,vtkProp3DFollower);
00048   void PrintSelf(ostream& os, vtkIndent indent);
00050 
00052 
00053  virtual void SetAxis(vtkAxisActor*);
00054  virtual vtkAxisActor* GetAxis();
00056 
00058 
00061  vtkSetMacro(AutoCenter, int);
00062  vtkGetMacro(AutoCenter, int);
00063  vtkBooleanMacro(AutoCenter, int);
00065 
00067 
00070  vtkSetMacro(EnableDistanceLOD, int);
00071  vtkGetMacro(EnableDistanceLOD, int);
00073 
00075 
00078  vtkSetClampMacro(DistanceLODThreshold, double, 0.0, 1.0);
00079  vtkGetMacro(DistanceLODThreshold, double);
00081 
00083 
00085  vtkSetMacro(EnableViewAngleLOD, int);
00086  vtkGetMacro(EnableViewAngleLOD, int);
00088 
00090 
00093  vtkSetClampMacro(ViewAngleLODThreshold, double, 0.0, 1.0);
00094  vtkGetMacro(ViewAngleLODThreshold, double);
00096 
00098 
00099  vtkSetMacro(ScreenOffset, double);
00100  vtkGetMacro(ScreenOffset, double);
00102 
00106   virtual void ComputeMatrix();
00107 
00109   void ShallowCopy(vtkProp *prop);
00110 
00112 
00114  static double AutoScale(vtkViewport *viewport, vtkCamera * camera,
00115                          double screenSize, double position[3]);
00117 
00119 
00122   virtual int RenderOpaqueGeometry(vtkViewport *viewport);
00123   virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport);
00124   virtual int RenderVolumetricGeometry(vtkViewport *viewport);
00126 
00127   virtual void SetViewport(vtkViewport* viewport);
00128   virtual vtkViewport* GetViewport();
00129 
00130 protected:
00131   vtkProp3DAxisFollower();
00132   ~vtkProp3DAxisFollower();
00133 
00134  void CalculateOrthogonalVectors(double Rx[3], double Ry[3], double Rz[3],
00135                                  vtkAxisActor *axis1, double *dop,
00136                                  vtkViewport *ren);
00137 
00138 
00139  void ComputeRotationAndTranlation(vtkViewport *ren, double translation[3],
00140                                    double Rx[3], double Ry[3], double Rz[3],
00141                                    vtkAxisActor *axis);
00142 
00143  // \NOTE: Not used as of now.
00144  void ComputerAutoCenterTranslation(const double& autoScaleFactor,
00145                                     double translation[3]);
00146 
00147 
00148   int  TestDistanceVisibility();
00149   void ExecuteViewAngleVisibility(double normal[3]);
00150 
00151   bool IsTextUpsideDown(double* a, double* b);
00152 
00153   int          AutoCenter;
00154 
00155   int          EnableDistanceLOD;
00156   double       DistanceLODThreshold;
00157 
00158   int          EnableViewAngleLOD;
00159   double       ViewAngleLODThreshold;
00160 
00161   double       ScreenOffset;
00162 
00163   vtkWeakPointer<vtkAxisActor> Axis;
00164   vtkWeakPointer<vtkViewport> Viewport;
00165 private:
00166   vtkProp3DAxisFollower(const vtkProp3DAxisFollower&);  // Not implemented.
00167   void operator=(const vtkProp3DAxisFollower&);  // Not implemented.
00168 
00169   int TextUpsideDown;
00170   int VisibleAtCurrentViewAngle;
00171 
00172 };
00173 
00174 #endif