forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvtkGeoInteractorStyle.h
171 lines (141 loc) · 4.94 KB
/
vtkGeoInteractorStyle.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/*=========================================================================
Program: Visualization Toolkit
Module: vtkGeoInteractorStyle.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*-------------------------------------------------------------------------
Copyright 2008 Sandia Corporation.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------*/
/**
* @class vtkGeoInteractorStyle
* @brief Interaction for a globe
*
*
* vtkGeoInteractorStyle contains interaction capabilities for a geographic
* view including orbit, zoom, and tilt. It also includes a compass widget
* for changing view parameters.
*
* @sa
* vtkCompassWidget vtkInteractorStyle
*/
#ifndef vtkGeoInteractorStyle_h
#define vtkGeoInteractorStyle_h
#include "vtkGeovisCoreModule.h" // For export macro
#include "vtkInteractorStyleTrackballCamera.h"
#include "vtkSmartPointer.h" // for SP
class vtkCamera;
class vtkCommand;
class vtkCompassWidget;
class vtkGeoCamera;
class vtkUnsignedCharArray;
class VTKGEOVISCORE_EXPORT vtkGeoInteractorStyle :
public vtkInteractorStyleTrackballCamera
{
public:
static vtkGeoInteractorStyle *New();
vtkTypeMacro(vtkGeoInteractorStyle,
vtkInteractorStyleTrackballCamera);
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
//@{
/**
* Event bindings
*/
void OnEnter() VTK_OVERRIDE;
void OnLeave() VTK_OVERRIDE;
void OnMouseMove() VTK_OVERRIDE;
void OnLeftButtonUp() VTK_OVERRIDE;
void OnMiddleButtonUp() VTK_OVERRIDE;
void OnRightButtonUp() VTK_OVERRIDE;
void OnLeftButtonDown() VTK_OVERRIDE;
void OnMiddleButtonDown() VTK_OVERRIDE;
void OnRightButtonDown() VTK_OVERRIDE;
void OnChar() VTK_OVERRIDE;
//@}
virtual void RubberBandZoom();
void Pan() VTK_OVERRIDE;
void Dolly() VTK_OVERRIDE;
// Public for render callback.
void RedrawRectangle();
// See cxx for description of why we need this method.
void StartState(int newstate) VTK_OVERRIDE;
// Used for updating the terrain.
vtkGeoCamera* GetGeoCamera();
/**
* This can be used to set the camera to the standard view of the earth.
*/
void ResetCamera();
//! Called when the sub widgets have an interaction
void WidgetInteraction(vtkObject *caller);
/**
* Set/Get the Interactor wrapper being controlled by this object.
* (Satisfy superclass API.)
*/
void SetInteractor(vtkRenderWindowInteractor *interactor) VTK_OVERRIDE;
int ViewportToWorld(double x, double y,
double &wx, double &wy, double &wz);
void WorldToLongLat(double wx, double wy, double wz,
double &lon, double &lat);
void ViewportToLongLat(double x, double y,
double &lon, double &lat);
int GetRayIntersection(double origin[3],
double direction[3],
double intersection[3]);
/**
* Override to make the renderer use this camera subclass
*/
void SetCurrentRenderer(vtkRenderer*) VTK_OVERRIDE;
//@{
/**
* Whether to lock the heading a particular value during pan.
*/
vtkGetMacro(LockHeading, bool);
vtkSetMacro(LockHeading, bool);
vtkBooleanMacro(LockHeading, bool);
//@}
/**
* Called after camera properties are modified
*/
void ResetCameraClippingRange();
protected:
vtkGeoInteractorStyle();
~vtkGeoInteractorStyle() VTK_OVERRIDE;
// To avoid a warning.
// We should really inherit directy from vtkInteractorStyle
void Dolly(double) VTK_OVERRIDE;
void OnTimer() VTK_OVERRIDE;
// Used to get a constant speed regardless of frame rate.
double LastTime;
// Rubberband zoom has a verification stage.
int RubberBandExtent[4];
int RubberBandExtentEnabled;
int RenderCallbackTag;
void EnableRubberBandRedraw();
void DisableRubberBandRedraw();
bool InRubberBandRectangle(int x, int y);
void DrawRectangle();
void KeepCameraAboveGround(vtkCamera* camera);
void UpdateLights();
void GetPanCenter(double &px, double &py);
int StartPosition[2];
int EndPosition[2];
int DraggingRubberBandBoxState;
double MotionFactor;
vtkUnsignedCharArray *PixelArray;
int PixelDims[2];
bool LockHeading;
vtkSmartPointer<vtkGeoCamera> GeoCamera;
// widget handling members
vtkSmartPointer<vtkCompassWidget> CompassWidget;
vtkSmartPointer<vtkCommand> EventCommand;
private:
vtkGeoInteractorStyle(const vtkGeoInteractorStyle&) VTK_DELETE_FUNCTION;
void operator=(const vtkGeoInteractorStyle&) VTK_DELETE_FUNCTION;
};
#endif