Drake Designer
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
vtkInteractorStyleTerrain2.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkInteractorStyleTerrain2.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 // .NAME vtkInteractorStyleTerrain2 - manipulate camera in scene with natural view up (e.g., terrain)
16 // .SECTION Description
17 // vtkInteractorStyleTerrain2 is used to manipulate a camera which is viewing
18 // a scene with a natural view up, e.g., terrain. The camera in such a
19 // scene is manipulated by specifying azimuth (angle around the view
20 // up vector) and elevation (the angle from the horizon).
21 //
22 // The mouse binding for this class is as follows. Left mouse click followed
23 // rotates the camera around the focal point using both elevation and azimuth
24 // invocations on the camera. Left mouse motion in the horizontal direction
25 // results in azimuth motion; left mouse motion in the vertical direction
26 // results in elevation motion. Therefore, diagonal motion results in a
27 // combination of azimuth and elevation. (If the shift key is held during
28 // motion, then only one of elevation or azimuth is invoked, depending on the
29 // whether the mouse motion is primarily horizontal or vertical.) Middle
30 // mouse button pans the camera across the scene (again the shift key has a
31 // similar effect on limiting the motion to the vertical or horizontal
32 // direction. The right mouse is used to dolly (e.g., a type of zoom) towards
33 // or away from the focal point.
34 //
35 // The class also supports some keypress events. The "r" key resets the
36 // camera. The "e" key invokes the exit callback and by default exits the
37 // program. The "f" key sets a new camera focal point and flys towards that
38 // point. The "u" key invokes the user event. The "3" key toggles between
39 // stereo and non-stero mode. The "l" key toggles on/off a latitude/longitude
40 // markers that can be used to estimate/control position.
41 //
42 
43 // .SECTION See Also
44 // vtkInteractorObserver vtkInteractorStyle vtk3DWidget
45 
46 #ifndef __vtkInteractorStyleTerrain2_h
47 #define __vtkInteractorStyleTerrain2_h
48 
49 #include "vtkInteractorStyle.h"
50 
51 #include <vtkDRCFiltersModule.h>
52 
53 class vtkPolyDataMapper;
54 class vtkSphereSource;
55 class vtkExtractEdges;
56 
57 class VTKDRCFILTERS_EXPORT vtkInteractorStyleTerrain2 : public vtkInteractorStyle
58 {
59 public:
60  // Description:
61  // Instantiate the object.
62  static vtkInteractorStyleTerrain2 *New();
63 
64  vtkTypeMacro(vtkInteractorStyleTerrain2,vtkInteractorStyle);
65  void PrintSelf(ostream& os, vtkIndent indent);
66 
67  // Description:
68  // Event bindings controlling the effects of pressing mouse buttons
69  // or moving the mouse.
70  virtual void OnMouseMove();
71  virtual void OnLeftButtonDown();
72  virtual void OnLeftButtonUp();
73  virtual void OnMiddleButtonDown();
74  virtual void OnMiddleButtonUp();
75  virtual void OnRightButtonDown();
76  virtual void OnRightButtonUp();
77 
78  // Description:
79  // Override the "fly-to" (f keypress) for images.
80  virtual void OnChar();
81 
82  // These methods for the different interactions in different modes
83  // are overridden in subclasses to perform the correct motion.
84  virtual void Rotate();
85  virtual void Pan();
86  virtual void Dolly();
87 
88  // Description:
89  // Turn on/off the latitude/longitude lines.
90  vtkSetMacro(LatLongLines,int);
91  vtkGetMacro(LatLongLines,int);
92  vtkBooleanMacro(LatLongLines,int);
93 
94 protected:
97 
98  // Internal helper attributes
100 
101  vtkSphereSource *LatLongSphere;
102  vtkPolyDataMapper *LatLongMapper;
103  vtkActor *LatLongActor;
104  vtkExtractEdges *LatLongExtractEdges;
105 
106  void SelectRepresentation();
107  void CreateLatLong();
108 
109  double MotionFactor;
110 
111 private:
112  vtkInteractorStyleTerrain2(const vtkInteractorStyleTerrain2&); // Not implemented.
113  void operator=(const vtkInteractorStyleTerrain2&); // Not implemented.
114 
115 };
116 
117 #endif
118 
#define VTKDRCFILTERS_EXPORT