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