VTK
dox/Geovis/Core/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 "vtkGeovisCoreModule.h" // For export macro
00075 #include "vtkObject.h"
00076 #include "vtkSmartPointer.h" // for SP
00077 
00078 class vtkCamera;
00079 class vtkGeoTerrainNode;
00080 class vtkTransform;
00081 
00082 class VTKGEOVISCORE_EXPORT vtkGeoCamera : public vtkObject
00083 {
00084 public:
00085   static vtkGeoCamera *New();
00086   vtkTypeMacro(vtkGeoCamera, vtkObject);
00087   void PrintSelf(ostream& os, vtkIndent indent);
00088 
00090 
00091   vtkGetVector3Macro(Position, double);
00093 
00095 
00097   void SetLongitude(double longitude);
00098   vtkGetMacro(Longitude,double);
00100 
00102 
00104   void SetLatitude(double latitude);
00105   vtkGetMacro(Latitude,double);
00107 
00109 
00112   void SetDistance(double Distance);
00113   vtkGetMacro(Distance,double);
00115 
00117 
00121   void SetHeading(double heading);
00122   vtkGetMacro(Heading,double);
00124 
00126 
00128   void SetTilt(double tilt);
00129   vtkGetMacro(Tilt,double);
00131 
00134   vtkCamera* GetVTKCamera();
00135 
00139   void InitializeNodeAnalysis(int rendererSize[2]);
00140 
00143   double GetNodeCoverage(vtkGeoTerrainNode* node);
00144 
00146 
00148   vtkGetMacro(LockHeading, bool);
00149   vtkSetMacro(LockHeading, bool);
00150   vtkBooleanMacro(LockHeading, bool);
00152 
00154 
00155   void SetOriginLatitude(double oLat);
00156   vtkGetMacro(OriginLatitude, double);
00157   void SetOriginLongitude(double oLat);
00158   vtkGetMacro(OriginLongitude, double);
00160 
00162 
00164   vtkGetVector3Macro(Origin, double);
00165   void SetOrigin( double ox, double oy, double oz ) {
00166     this->Origin[0] = ox; this->Origin[1] = oy; this->Origin[2] = oz;
00167     this->UpdateVTKCamera();
00168   }
00170 
00171 protected:
00172   vtkGeoCamera();
00173   ~vtkGeoCamera();
00174 
00175   void UpdateVTKCamera();
00176   void UpdateAngleRanges();
00177 
00178 //BTX
00179   vtkSmartPointer<vtkCamera> VTKCamera;
00180   vtkSmartPointer<vtkTransform> Transform;
00181 //ETX
00182 
00183   // This point is shifted to 0,0,0 to avoid openGL issues.
00184   double OriginLatitude;
00185   double OriginLongitude;
00186   double Origin[3];
00187   void ComputeRectilinearOrigin();
00188 
00189   double Longitude;
00190   double Latitude;
00191   double Distance;
00192   double Heading;
00193   double Tilt;
00194   bool   LockHeading;
00195 
00196   // Values precomputed to make updating terrain mode efficient.
00197   // The vislibility of many terrain nodes is analyzed every render.
00198   double ForwardNormal[3];
00199   double RightNormal[3];
00200   double UpNormal[3];
00201   double Aspect[2];
00202 
00203   // Frustum planes is better than other options for culling spheres.
00204   double LeftPlaneNormal[3];
00205   double RightPlaneNormal[3];
00206   double DownPlaneNormal[3];
00207   double UpPlaneNormal[3];
00208 
00209   double Position[3];
00210 
00211 private:
00212   vtkGeoCamera(const vtkGeoCamera&);  // Not implemented.
00213   void operator=(const vtkGeoCamera&);  // Not implemented.
00214 };
00215 
00216 #endif