-
Notifications
You must be signed in to change notification settings - Fork 0
/
FoamvisInteractorStyle.cpp
114 lines (96 loc) · 2.72 KB
/
FoamvisInteractorStyle.cpp
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
/**
* @file FoamvisInteractorStyle.h
* @author modified from vtkInteractorStyleTrackballCamera by Dan Lipsa
* @date 3 Sept. 2012
*
* Interactor for WidgetVtk
*
*/
#include "FoamvisInteractorStyle.h"
#include "Debug.h"
#include "Settings.h"
vtkStandardNewMacro(FoamvisInteractorStyle);
//----------------------------------------------------------------------------
FoamvisInteractorStyle::FoamvisInteractorStyle()
{
}
//----------------------------------------------------------------------------
FoamvisInteractorStyle::~FoamvisInteractorStyle()
{
}
//----------------------------------------------------------------------------
void FoamvisInteractorStyle::OnLeftButtonDown()
{
this->FindPokedRenderer(this->Interactor->GetEventPosition()[0],
this->Interactor->GetEventPosition()[1]);
if (this->CurrentRenderer == NULL)
{
return;
}
this->GrabFocus(this->EventCallbackCommand);
if (m_settings->GetInteractionObject () != InteractionObject::FOCUS)
return;
switch (m_settings->GetInteractionMode ())
{
case InteractionMode::ROTATE:
if (this->Interactor->GetShiftKey () &&
this->Interactor->GetControlKey ())
this->StartSpin ();
else
this->StartRotate ();
break;
case InteractionMode::SCALE:
this->StartDolly ();
break;
case InteractionMode::TRANSLATE:
this->StartPan ();
break;
case InteractionMode::SELECT:
case InteractionMode::DESELECT:
case InteractionMode::COUNT:
break;
}
}
//----------------------------------------------------------------------------
void FoamvisInteractorStyle::OnLeftButtonUp()
{
switch (this->State)
{
case VTKIS_DOLLY:
this->EndDolly();
break;
case VTKIS_PAN:
this->EndPan();
break;
case VTKIS_SPIN:
this->EndSpin();
break;
case VTKIS_ROTATE:
this->EndRotate();
break;
}
if ( this->Interactor )
{
this->ReleaseFocus();
}
}
//----------------------------------------------------------------------------
void FoamvisInteractorStyle::OnMiddleButtonDown()
{
vtkInteractorStyle::OnMiddleButtonDown ();
}
//----------------------------------------------------------------------------
void FoamvisInteractorStyle::OnMiddleButtonUp()
{
vtkInteractorStyle::OnMiddleButtonUp ();
}
//----------------------------------------------------------------------------
void FoamvisInteractorStyle::OnRightButtonDown()
{
vtkInteractorStyle::OnRightButtonDown ();
}
//----------------------------------------------------------------------------
void FoamvisInteractorStyle::OnRightButtonUp()
{
vtkInteractorStyle::OnRightButtonUp ();
}