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) VTK_OVERRIDE;
54 
56 
59  void OnEnter() VTK_OVERRIDE;
60  void OnLeave() VTK_OVERRIDE;
61  void OnMouseMove() VTK_OVERRIDE;
62  void OnLeftButtonUp() VTK_OVERRIDE;
63  void OnMiddleButtonUp() VTK_OVERRIDE;
64  void OnRightButtonUp() VTK_OVERRIDE;
65  void OnLeftButtonDown() VTK_OVERRIDE;
66  void OnMiddleButtonDown() VTK_OVERRIDE;
67  void OnRightButtonDown() VTK_OVERRIDE;
68  void OnChar() VTK_OVERRIDE;
70 
71  virtual void RubberBandZoom();
72  void Pan() VTK_OVERRIDE;
73  void Dolly() VTK_OVERRIDE;
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) VTK_OVERRIDE;
80 
81  // Used for updating the terrain.
82  vtkGeoCamera* GetGeoCamera();
83 
87  void ResetCamera();
88 
90  void WidgetInteraction(vtkObject *caller);
91 
96  void SetInteractor(vtkRenderWindowInteractor *interactor) VTK_OVERRIDE;
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  void SetCurrentRenderer(vtkRenderer*) VTK_OVERRIDE;
112 
114 
117  vtkGetMacro(LockHeading, bool);
118  vtkSetMacro(LockHeading, bool);
119  vtkBooleanMacro(LockHeading, bool);
121 
125  void ResetCameraClippingRange();
126 
127 protected:
129  ~vtkGeoInteractorStyle() VTK_OVERRIDE;
130 
131  // To avoid a warning.
132  // We should really inherit directy from vtkInteractorStyle
133  void Dolly(double) VTK_OVERRIDE;
134 
135  void OnTimer() VTK_OVERRIDE;
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];
141  int RubberBandExtentEnabled;
142  int RenderCallbackTag;
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];
154  int DraggingRubberBandBoxState;
155  double MotionFactor;
156  vtkUnsignedCharArray *PixelArray;
157  int PixelDims[2];
158  bool LockHeading;
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
abstract base class for most VTK objects
Definition: vtkObject.h:59
Interaction for a globe.
abstract specification for renderers
Definition: vtkRenderer.h:63
Hold a reference to a vtkObjectBase instance.
static vtkInteractorStyleTrackballCamera * New()
virtual void OnEnter()
platform-independent render window interaction including picking and frame rate control.
superclass for callback/observer methods
Definition: vtkCommand.h:354
a simple class to control print indentation
Definition: vtkIndent.h:39
a virtual camera for 3D rendering
Definition: vtkCamera.h:50
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
dynamic, self-adjusting array of unsigned char
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
interactive manipulation of the camera
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
set a value by manipulating something
Geo interface to a camera.
Definition: vtkGeoCamera.h:83