1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: $RCSfile: vtkInteractorStyleTerrain.h,v $
6 Date: $Date: 2002/05/06 21:13:53 $
7 Version: $Revision: 1.1 $
9 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
11 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notice for more information.
17 =========================================================================*/
18 // .NAME vtkInteractorStyleTerrain - manipulate camera in scene with natural view up (e.g., terrain)
19 // .SECTION Description
20 // vtkInteractorStyleTerrain is used to manipulate a camera which is viewing
21 // a scene with a natural view up, e.g., terrain. The camera in such a
22 // scene is manipulated by specifying azimuth (angle around the view
23 // up vector) and elevation (the angle from the horizon).
25 // The mouse binding for this class is as follows. Left mouse click followed
26 // rotates the camera around the focal point using both elevation and azimuth
27 // invocations on the camera. Left mouse motion in the horizontal direction
28 // results in azimuth motion; left mouse motion in the vertical direction
29 // results in elevation motion. Therefore, diagonal motion results in a
30 // combination of azimuth and elevation. (If the shift key is held during
31 // motion, then only one of elevation or azimuth is invoked, depending on the
32 // whether the mouse motion is primarily horizontal or vertical.) Middle
33 // mouse button pans the camera across the scene (again the shift key has a
34 // similar effect on limiting the motion to the vertical or horizontal
35 // direction. The right mouse is used to dolly (e.g., a type of zoom) towards
36 // or away from the focal point.
38 // The class also supports some keypress events. The "r" key resets the
39 // camera. The "e" key invokes the exit callback and by default exits the
40 // program. The "f" key sets a new camera focal point and flys towards that
41 // point. The "u" key invokes the user event. The "3" key toggles between
42 // stereo and non-stero mode. The "l" key toggles on/off a latitude/longitude
43 // markers that can be used to estimate/control position.
47 // vtkInteractorObserver vtkInteractorStyle vtk3DWidget
49 #ifndef __vtkInteractorStyleTerrain_h
50 #define __vtkInteractorStyleTerrain_h
52 #include "vtkInteractorStyle.h"
54 class vtkPolyDataMapper;
55 class vtkSphereSource;
56 class vtkExtractEdges;
58 class VTK_RENDERING_EXPORT vtkInteractorStyleTerrain : public vtkInteractorStyle
62 // Instantiate the object.
63 static vtkInteractorStyleTerrain *New();
65 vtkTypeRevisionMacro(vtkInteractorStyleTerrain,vtkInteractorStyle);
66 void PrintSelf(ostream& os, vtkIndent indent);
69 // Event bindings controlling the effects of pressing mouse buttons
70 // or moving the mouse.
71 virtual void OnMouseMove();
72 virtual void OnLeftButtonDown();
73 virtual void OnLeftButtonUp();
74 virtual void OnMiddleButtonDown();
75 virtual void OnMiddleButtonUp();
76 virtual void OnRightButtonDown();
77 virtual void OnRightButtonUp();
80 // Override the "fly-to" (f keypress) for images.
81 virtual void OnChar();
83 // These methods for the different interactions in different modes
84 // are overridden in subclasses to perform the correct motion.
85 virtual void Rotate();
90 // Turn on/off the latitude/longitude lines.
91 vtkSetMacro(LatLongLines,int);
92 vtkGetMacro(LatLongLines,int);
93 vtkBooleanMacro(LatLongLines,int);
96 vtkInteractorStyleTerrain();
97 ~vtkInteractorStyleTerrain();
99 // Internal helper attributes
102 vtkSphereSource *LatLongSphere;
103 vtkPolyDataMapper *LatLongMapper;
104 vtkActor *LatLongActor;
105 vtkExtractEdges *LatLongExtractEdges;
107 void SelectRepresentation();
108 void CreateLatLong();
113 vtkInteractorStyleTerrain(const vtkInteractorStyleTerrain&); // Not implemented.
114 void operator=(const vtkInteractorStyleTerrain&); // Not implemented.