Mercurial > hg > orthanc-stone
comparison Resources/Graveyard/Deprecated/Samples/Qt/Scene2DInteractor.cpp @ 1503:553084468225
moving /Deprecated/ to /Resources/Graveyard/Deprecated/
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 30 Jun 2020 11:38:13 +0200 |
parents | Deprecated/Samples/Qt/Scene2DInteractor.cpp@182bf3106ee2 |
children |
comparison
equal
deleted
inserted
replaced
1502:e5729dab3f67 | 1503:553084468225 |
---|---|
1 /** | |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #include "Scene2DInteractor.h" | |
23 | |
24 #include "../../Framework/Scene2D/PanSceneTracker.h" | |
25 #include "../../Framework/Scene2D/ZoomSceneTracker.h" | |
26 #include "../../Framework/Scene2D/RotateSceneTracker.h" | |
27 | |
28 | |
29 namespace OrthancStone | |
30 { | |
31 | |
32 } | |
33 | |
34 using namespace OrthancStone; | |
35 | |
36 | |
37 bool BasicScene2DInteractor::OnMouseEvent(const GuiAdapterMouseEvent& event, const PointerEvent& pointerEvent) | |
38 { | |
39 if (currentTracker_.get() != NULL) | |
40 { | |
41 switch (event.type) | |
42 { | |
43 case GUIADAPTER_EVENT_MOUSEUP: | |
44 { | |
45 currentTracker_->PointerUp(pointerEvent); | |
46 if (!currentTracker_->IsAlive()) | |
47 { | |
48 currentTracker_.reset(); | |
49 } | |
50 };break; | |
51 case GUIADAPTER_EVENT_MOUSEMOVE: | |
52 { | |
53 currentTracker_->PointerMove(pointerEvent); | |
54 };break; | |
55 } | |
56 return true; | |
57 } | |
58 else | |
59 { | |
60 if (event.button == GUIADAPTER_MOUSEBUTTON_LEFT) | |
61 { | |
62 currentTracker_.reset(new RotateSceneTracker(viewportController_, pointerEvent)); | |
63 } | |
64 else if (event.button == GUIADAPTER_MOUSEBUTTON_MIDDLE) | |
65 { | |
66 currentTracker_.reset(new PanSceneTracker(viewportController_, pointerEvent)); | |
67 } | |
68 else if (event.button == GUIADAPTER_MOUSEBUTTON_RIGHT && compositor_.get() != NULL) | |
69 { | |
70 currentTracker_.reset(new ZoomSceneTracker(viewportController_, pointerEvent, compositor_->GetHeight())); | |
71 } | |
72 return true; | |
73 } | |
74 return false; | |
75 } | |
76 | |
77 bool BasicScene2DInteractor::OnKeyboardEvent(const GuiAdapterKeyboardEvent& guiEvent) | |
78 { | |
79 switch (guiEvent.sym[0]) | |
80 { | |
81 case 's': | |
82 { | |
83 viewportController_->FitContent(compositor_->GetWidth(), compositor_->GetHeight()); | |
84 return true; | |
85 }; | |
86 } | |
87 return false; | |
88 } | |
89 | |
90 bool BasicScene2DInteractor::OnWheelEvent(const GuiAdapterWheelEvent& guiEvent) | |
91 { | |
92 return false; | |
93 } |