VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkGeoInteractorStyle.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 -------------------------------------------------------------------------*/ 00035 #ifndef __vtkGeoInteractorStyle_h 00036 #define __vtkGeoInteractorStyle_h 00037 00038 #include "vtkGeovisCoreModule.h" // For export macro 00039 #include "vtkInteractorStyleTrackballCamera.h" 00040 #include "vtkSmartPointer.h" // for SP 00041 00042 class vtkCamera; 00043 class vtkCommand; 00044 class vtkCompassWidget; 00045 class vtkGeoCamera; 00046 class vtkUnsignedCharArray; 00047 00048 class VTKGEOVISCORE_EXPORT vtkGeoInteractorStyle : 00049 public vtkInteractorStyleTrackballCamera 00050 { 00051 public: 00052 static vtkGeoInteractorStyle *New(); 00053 vtkTypeMacro(vtkGeoInteractorStyle, 00054 vtkInteractorStyleTrackballCamera); 00055 void PrintSelf(ostream& os, vtkIndent indent); 00056 00058 00059 virtual void OnEnter(); 00060 virtual void OnLeave(); 00061 virtual void OnMouseMove(); 00062 virtual void OnLeftButtonUp(); 00063 virtual void OnMiddleButtonUp(); 00064 virtual void OnRightButtonUp(); 00065 virtual void OnLeftButtonDown(); 00066 virtual void OnMiddleButtonDown(); 00067 virtual void OnRightButtonDown(); 00068 virtual void OnChar(); 00070 00071 virtual void RubberBandZoom(); 00072 virtual void Pan(); 00073 virtual void Dolly(); 00074 00075 // Public for render callback. 00076 void RedrawRectangle(); 00077 00078 // See cxx for description of why we need this method. 00079 void StartState(int newstate); 00080 00081 // Used for updating the terrain. 00082 vtkGeoCamera* GetGeoCamera(); 00083 00085 void ResetCamera(); 00086 00088 void WidgetInteraction(vtkObject *caller); 00089 00092 virtual void SetInteractor(vtkRenderWindowInteractor *interactor); 00093 00094 int ViewportToWorld(double x, double y, 00095 double &wx, double &wy, double &wz); 00096 void WorldToLongLat(double wx, double wy, double wz, 00097 double &lon, double &lat); 00098 void ViewportToLongLat(double x, double y, 00099 double &lon, double &lat); 00100 int GetRayIntersection(double origin[3], 00101 double direction[3], 00102 double intersection[3]); 00103 00105 virtual void SetCurrentRenderer(vtkRenderer*); 00106 00108 00109 vtkGetMacro(LockHeading, bool); 00110 vtkSetMacro(LockHeading, bool); 00111 vtkBooleanMacro(LockHeading, bool); 00113 00115 void ResetCameraClippingRange(); 00116 00117 protected: 00118 vtkGeoInteractorStyle(); 00119 ~vtkGeoInteractorStyle(); 00120 00121 // To avoid a warning. 00122 // We should really inherit directy from vtkInteractorStyle 00123 virtual void Dolly(double); 00124 00125 void OnTimer(); 00126 // Used to get a constant speed regardless of frame rate. 00127 double LastTime; 00128 00129 // Rubberband zoom has a verification stage. 00130 int RubberBandExtent[4]; 00131 int RubberBandExtentEnabled; 00132 int RenderCallbackTag; 00133 void EnableRubberBandRedraw(); 00134 void DisableRubberBandRedraw(); 00135 bool InRubberBandRectangle(int x, int y); 00136 void DrawRectangle(); 00137 00138 void KeepCameraAboveGround(vtkCamera* camera); 00139 void UpdateLights(); 00140 void GetPanCenter(double &px, double &py); 00141 00142 int StartPosition[2]; 00143 int EndPosition[2]; 00144 int DraggingRubberBandBoxState; 00145 double MotionFactor; 00146 vtkUnsignedCharArray *PixelArray; 00147 int PixelDims[2]; 00148 bool LockHeading; 00149 00150 //BTX 00151 vtkSmartPointer<vtkGeoCamera> GeoCamera; 00152 00153 // widget handling members 00154 vtkSmartPointer<vtkCompassWidget> CompassWidget; 00155 vtkSmartPointer<vtkCommand> EventCommand; 00156 00157 //ETX 00158 00159 private: 00160 vtkGeoInteractorStyle(const vtkGeoInteractorStyle&); // Not implemented. 00161 void operator=(const vtkGeoInteractorStyle&); // Not implemented. 00162 }; 00163 00164 #endif