VTK
dox/Geovis/vtkGeoCamera.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkGeoCamera.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 =========================================================================*/
00015 /*-------------------------------------------------------------------------
00016   Copyright 2008 Sandia Corporation.
00017   Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00018   the U.S. Government retains certain rights in this software.
00019 -------------------------------------------------------------------------*/
00071 #ifndef __vtkGeoCamera_h
00072 #define __vtkGeoCamera_h
00073 
00074 #include "vtkObject.h"
00075 #include "vtkSmartPointer.h" // for SP
00076 
00077 class vtkCamera;
00078 class vtkGeoTerrainNode;
00079 class vtkTransform;
00080 
00081 class VTK_GEOVIS_EXPORT vtkGeoCamera : public vtkObject
00082 {
00083 public:
00084   static vtkGeoCamera *New();
00085   vtkTypeMacro(vtkGeoCamera, vtkObject);
00086   void PrintSelf(ostream& os, vtkIndent indent);
00087 
00089 
00090   vtkGetVector3Macro(Position, double);
00092 
00094 
00096   void SetLongitude(double longitude);
00097   vtkGetMacro(Longitude,double);
00099 
00101 
00103   void SetLatitude(double latitude);
00104   vtkGetMacro(Latitude,double);
00106 
00108 
00111   void SetDistance(double Distance);
00112   vtkGetMacro(Distance,double);
00114 
00116 
00120   void SetHeading(double heading);
00121   vtkGetMacro(Heading,double);
00123 
00125 
00127   void SetTilt(double tilt);
00128   vtkGetMacro(Tilt,double);
00130   
00133   vtkCamera* GetVTKCamera();
00134 
00138   void InitializeNodeAnalysis(int rendererSize[2]);
00139 
00142   double GetNodeCoverage(vtkGeoTerrainNode* node);
00143   
00145 
00147   vtkGetMacro(LockHeading, bool);
00148   vtkSetMacro(LockHeading, bool);
00149   vtkBooleanMacro(LockHeading, bool);
00151   
00153 
00154   void SetOriginLatitude(double oLat);
00155   vtkGetMacro(OriginLatitude, double);
00156   void SetOriginLongitude(double oLat);
00157   vtkGetMacro(OriginLongitude, double);
00159 
00161 
00163   vtkGetVector3Macro(Origin, double);
00164   void SetOrigin( double ox, double oy, double oz ) {
00165     this->Origin[0] = ox; this->Origin[1] = oy; this->Origin[2] = oz;
00166     this->UpdateVTKCamera();
00167   }
00169   
00170 protected:
00171   vtkGeoCamera();
00172   ~vtkGeoCamera();
00173 
00174   void UpdateVTKCamera();
00175   void UpdateAngleRanges();
00176   
00177 //BTX
00178   vtkSmartPointer<vtkCamera> VTKCamera;
00179   vtkSmartPointer<vtkTransform> Transform;
00180 //ETX
00181   
00182   // This point is shifted to 0,0,0 to avoid openGL issues.
00183   double OriginLatitude;
00184   double OriginLongitude;
00185   double Origin[3];
00186   void ComputeRectilinearOrigin();
00187   
00188   double Longitude;
00189   double Latitude;
00190   double Distance;
00191   double Heading;
00192   double Tilt;  
00193   bool   LockHeading;
00194 
00195   // Values precomputed to make updating terrain mode efficient.
00196   // The vislibility of many terrain nodes is analyzed every render.
00197   double ForwardNormal[3];
00198   double RightNormal[3];
00199   double UpNormal[3];
00200   double Aspect[2];
00201   
00202   // Frustum planes is better than other options for culling spheres.
00203   double LeftPlaneNormal[3];
00204   double RightPlaneNormal[3];
00205   double DownPlaneNormal[3];
00206   double UpPlaneNormal[3];
00207   
00208   double Position[3];
00209   
00210 private:
00211   vtkGeoCamera(const vtkGeoCamera&);  // Not implemented.
00212   void operator=(const vtkGeoCamera&);  // Not implemented.
00213 };
00214 
00215 #endif