VTK
|
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 "vtkRenderingAnnotationModule.h" // For export macro 00032 #include "vtkFollower.h" 00033 00034 #include "vtkWeakPointer.h" // For vtkWeakPointer 00035 00036 // Forward declarations. 00037 class vtkAxisActor; 00038 class vtkRenderer; 00039 00040 class VTKRENDERINGANNOTATION_EXPORT vtkAxisFollower : public vtkFollower 00041 { 00042 public: 00043 vtkTypeMacro(vtkAxisFollower,vtkFollower); 00044 virtual void PrintSelf(ostream& os, vtkIndent indent); 00045 00047 static vtkAxisFollower *New(); 00048 00050 00051 virtual void SetAxis(vtkAxisActor*); 00052 virtual vtkAxisActor* GetAxis(); 00054 00056 00059 vtkSetMacro(AutoCenter, int); 00060 vtkGetMacro(AutoCenter, int); 00061 vtkBooleanMacro(AutoCenter, int); 00063 00065 00068 vtkSetMacro(EnableDistanceLOD, int); 00069 vtkGetMacro(EnableDistanceLOD, int); 00071 00073 00076 vtkSetClampMacro(DistanceLODThreshold, double, 0.0, 1.0); 00077 vtkGetMacro(DistanceLODThreshold, double); 00079 00081 00083 vtkSetMacro(EnableViewAngleLOD, int); 00084 vtkGetMacro(EnableViewAngleLOD, int); 00086 00088 00091 vtkSetClampMacro(ViewAngleLODThreshold, double, 0.0, 1.0); 00092 vtkGetMacro(ViewAngleLODThreshold, double); 00094 00096 00097 vtkSetMacro(ScreenOffset, double); 00098 vtkGetMacro(ScreenOffset, double); 00100 00102 00105 virtual int RenderOpaqueGeometry(vtkViewport *viewport); 00106 virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport); 00107 virtual void Render(vtkRenderer *ren); 00109 00113 virtual void ComputeTransformMatrix(vtkRenderer *ren); 00114 00116 void ShallowCopy(vtkProp *prop); 00117 00119 00121 static double AutoScale(vtkViewport *viewport, vtkCamera * camera, 00122 double screenSize, double position[3]); 00124 00125 protected: 00126 vtkAxisFollower(); 00127 ~vtkAxisFollower(); 00128 00129 void CalculateOrthogonalVectors(double Rx[3], double Ry[3], double Rz[3], 00130 vtkAxisActor *axis1, double *dop, 00131 vtkRenderer *ren); 00132 00133 00134 void ComputeRotationAndTranlation(vtkRenderer *ren, double translation[3], 00135 double Rx[3], double Ry[3], double Rz[3], 00136 vtkAxisActor *axis); 00137 00138 // \NOTE: Not used as of now. 00139 void ComputerAutoCenterTranslation(const double& autoScaleFactor, 00140 double translation[3]); 00141 00142 00143 int TestDistanceVisibility(); 00144 void ExecuteViewAngleVisibility(double normal[3]); 00145 00146 bool IsTextUpsideDown(double* a, double* b); 00147 00148 int AutoCenter; 00149 00150 int EnableDistanceLOD; 00151 double DistanceLODThreshold; 00152 00153 int EnableViewAngleLOD; 00154 double ViewAngleLODThreshold; 00155 00156 double ScreenOffset; 00157 00158 vtkWeakPointer<vtkAxisActor> Axis; 00159 00160 00161 private: 00162 00163 int TextUpsideDown; 00164 int VisibleAtCurrentViewAngle; 00165 00166 vtkAxisFollower(const vtkAxisFollower&); // Not implemented. 00167 void operator =(const vtkAxisFollower&); // Not implemented. 00168 00169 // hide the two parameter Render() method from the user and the compiler. 00170 virtual void Render(vtkRenderer *, vtkMapper *) {} 00171 00172 //Internal matrices to avoid New/Delete for performance reasons 00173 vtkMatrix4x4 *InternalMatrix; 00174 00175 }; 00176 00177 #endif // __vtkAxisFollower_h