00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00035 #ifndef __vtkGeoInteractorStyle_h
00036 #define __vtkGeoInteractorStyle_h
00037
00038 #include "vtkInteractorStyleTrackballCamera.h"
00039 #include "vtkSmartPointer.h"
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
00075 void RedrawRectangle();
00076
00077
00078 void StartState(int newstate);
00079
00080
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
00121
00122 virtual void Dolly(double);
00123
00124 void OnTimer();
00125
00126 double LastTime;
00127
00128
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
00150 vtkSmartPointer<vtkGeoCamera> GeoCamera;
00151
00152
00153 vtkSmartPointer<vtkCompassWidget> CompassWidget;
00154 vtkSmartPointer<vtkCommand> EventCommand;
00155
00156
00157
00158 private:
00159 vtkGeoInteractorStyle(const vtkGeoInteractorStyle&);
00160 void operator=(const vtkGeoInteractorStyle&);
00161 };
00162
00163 #endif