VTK
vtkGeoInteractorStyle.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGeoInteractorStyle.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*-------------------------------------------------------------------------
16  Copyright 2008 Sandia Corporation.
17  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18  the U.S. Government retains certain rights in this software.
19 -------------------------------------------------------------------------*/
33 #ifndef vtkGeoInteractorStyle_h
34 #define vtkGeoInteractorStyle_h
35 
36 #include "vtkGeovisCoreModule.h" // For export macro
38 #include "vtkSmartPointer.h" // for SP
39 
40 class vtkCamera;
41 class vtkCommand;
42 class vtkCompassWidget;
43 class vtkGeoCamera;
45 
46 class VTKGEOVISCORE_EXPORT vtkGeoInteractorStyle :
48 {
49 public:
50  static vtkGeoInteractorStyle *New();
51  vtkTypeMacro(vtkGeoInteractorStyle,
53  void PrintSelf(ostream& os, vtkIndent indent);
54 
56 
59  virtual void OnEnter();
60  virtual void OnLeave();
61  virtual void OnMouseMove();
62  virtual void OnLeftButtonUp();
63  virtual void OnMiddleButtonUp();
64  virtual void OnRightButtonUp();
65  virtual void OnLeftButtonDown();
66  virtual void OnMiddleButtonDown();
67  virtual void OnRightButtonDown();
68  virtual void OnChar();
70 
71  virtual void RubberBandZoom();
72  virtual void Pan();
73  virtual void Dolly();
74 
75  // Public for render callback.
76  void RedrawRectangle();
77 
78  // See cxx for description of why we need this method.
79  void StartState(int newstate);
80 
81  // Used for updating the terrain.
82  vtkGeoCamera* GetGeoCamera();
83 
87  void ResetCamera();
88 
90  void WidgetInteraction(vtkObject *caller);
91 
96  virtual void SetInteractor(vtkRenderWindowInteractor *interactor);
97 
98  int ViewportToWorld(double x, double y,
99  double &wx, double &wy, double &wz);
100  void WorldToLongLat(double wx, double wy, double wz,
101  double &lon, double &lat);
102  void ViewportToLongLat(double x, double y,
103  double &lon, double &lat);
104  int GetRayIntersection(double origin[3],
105  double direction[3],
106  double intersection[3]);
107 
111  virtual void SetCurrentRenderer(vtkRenderer*);
112 
114 
117  vtkGetMacro(LockHeading, bool);
118  vtkSetMacro(LockHeading, bool);
119  vtkBooleanMacro(LockHeading, bool);
121 
125  void ResetCameraClippingRange();
126 
127 protected:
130 
131  // To avoid a warning.
132  // We should really inherit directy from vtkInteractorStyle
133  virtual void Dolly(double);
134 
135  void OnTimer();
136  // Used to get a constant speed regardless of frame rate.
137  double LastTime;
138 
139  // Rubberband zoom has a verification stage.
140  int RubberBandExtent[4];
143  void EnableRubberBandRedraw();
144  void DisableRubberBandRedraw();
145  bool InRubberBandRectangle(int x, int y);
146  void DrawRectangle();
147 
148  void KeepCameraAboveGround(vtkCamera* camera);
149  void UpdateLights();
150  void GetPanCenter(double &px, double &py);
151 
152  int StartPosition[2];
153  int EndPosition[2];
155  double MotionFactor;
157  int PixelDims[2];
159 
161 
162  // widget handling members
165 
166 private:
167  vtkGeoInteractorStyle(const vtkGeoInteractorStyle&) VTK_DELETE_FUNCTION;
168  void operator=(const vtkGeoInteractorStyle&) VTK_DELETE_FUNCTION;
169 };
170 
171 #endif
vtkCommand
superclass for callback/observer methods
Definition: vtkCommand.h:341
vtkGeoInteractorStyle::LastTime
double LastTime
Definition: vtkGeoInteractorStyle.h:137
vtkGeoInteractorStyle::GeoCamera
vtkSmartPointer< vtkGeoCamera > GeoCamera
Definition: vtkGeoInteractorStyle.h:160
vtkInteractorStyleTrackballCamera::OnLeftButtonDown
virtual void OnLeftButtonDown()
vtkGeoInteractorStyle::RubberBandExtentEnabled
int RubberBandExtentEnabled
Definition: vtkGeoInteractorStyle.h:141
vtkX3D::direction
Definition: vtkX3D.h:260
vtkInteractorStyleTrackballCamera::New
static vtkInteractorStyleTrackballCamera * New()
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:41
vtkSmartPointer< vtkGeoCamera >
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:59
vtkInteractorStyleTrackballCamera::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkGeoInteractorStyle::PixelArray
vtkUnsignedCharArray * PixelArray
Definition: vtkGeoInteractorStyle.h:156
vtkGeoInteractorStyle::RenderCallbackTag
int RenderCallbackTag
Definition: vtkGeoInteractorStyle.h:142
vtkInteractorStyleTrackballCamera::OnMiddleButtonUp
virtual void OnMiddleButtonUp()
vtkCompassWidget
set a value by manipulating something
Definition: vtkCompassWidget.h:74
vtkInteractorStyleTrackballCamera::OnMouseMove
virtual void OnMouseMove()
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
vtkInteractorStyle::StartState
virtual void StartState(int newstate)
utility routines used by state changes
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkGeoInteractorStyle::MotionFactor
double MotionFactor
Definition: vtkGeoInteractorStyle.h:155
vtkCamera
a virtual camera for 3D rendering
Definition: vtkCamera.h:50
vtkSmartPointer.h
vtkGeoCamera
Geo interface to a camera.
Definition: vtkGeoCamera.h:83
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:78
vtkGeoInteractorStyle::CompassWidget
vtkSmartPointer< vtkCompassWidget > CompassWidget
Definition: vtkGeoInteractorStyle.h:163
vtkInteractorStyleTrackballCamera::Pan
virtual void Pan()
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkGeoInteractorStyle::EventCommand
vtkSmartPointer< vtkCommand > EventCommand
Definition: vtkGeoInteractorStyle.h:164
vtkGeoInteractorStyle::DraggingRubberBandBoxState
int DraggingRubberBandBoxState
Definition: vtkGeoInteractorStyle.h:154
vtkInteractorStyleTrackballCamera
interactive manipulation of the camera
Definition: vtkInteractorStyleTrackballCamera.h:47
vtkInteractorStyleTrackballCamera::OnLeftButtonUp
virtual void OnLeftButtonUp()
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkInteractorStyleTrackballCamera::OnMiddleButtonDown
virtual void OnMiddleButtonDown()
vtkInteractorStyle::OnEnter
virtual void OnEnter()
Definition: vtkInteractorStyle.h:262
vtkInteractorStyle::SetInteractor
virtual void SetInteractor(vtkRenderWindowInteractor *interactor)
Set/Get the Interactor wrapper being controlled by this object.
vtkInteractorStyle::OnChar
virtual void OnChar()
OnChar is triggered when an ASCII key is pressed.
vtkGeoInteractorStyle::LockHeading
bool LockHeading
Definition: vtkGeoInteractorStyle.h:158
vtkInteractorStyle::OnTimer
virtual void OnTimer()
OnTimer calls Rotate, Rotate etc which should be overridden by style subclasses.
vtkInteractorStyleTrackballCamera::OnRightButtonDown
virtual void OnRightButtonDown()
vtkGeoInteractorStyle
Interaction for a globe.
Definition: vtkGeoInteractorStyle.h:46
vtkInteractorStyleTrackballCamera::Dolly
virtual void Dolly()
vtkInteractorObserver::SetCurrentRenderer
virtual void SetCurrentRenderer(vtkRenderer *)
vtkInteractorStyle::OnLeave
virtual void OnLeave()
Definition: vtkInteractorStyle.h:263
vtkInteractorStyleTrackballCamera::OnRightButtonUp
virtual void OnRightButtonUp()
vtkInteractorStyleTrackballCamera.h