annotate OrthancStone/Sources/Scene2D/PointerEvent.h @ 1807:634ff8993f6a

Stone Web viewer: Patient birth date is now displayed in the overlays
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 20 May 2021 17:17:56 +0200
parents 9ac2a65d4172
children 3889ae96d2e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
596
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
1739
9ac2a65d4172 upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium
596
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
8 * modify it under the terms of the GNU Lesser General Public License
596
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
15 * Lesser General Public License for more details.
1596
4fb8fdf03314 removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
16 *
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
18 * License along with this program. If not, see
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
19 * <http://www.gnu.org/licenses/>.
596
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 **/
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 #pragma once
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #include "ScenePoint2D.h"
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #include <boost/noncopyable.hpp>
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 #include <stdint.h>
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 namespace OrthancStone
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 {
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 class PointerEvent : public boost::noncopyable
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 {
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 private:
1208
00e6bff9ea39 handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 617
diff changeset
35 MouseButton button_;
596
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 std::vector<ScenePoint2D> positions_;
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 bool hasAltModifier_;
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 bool hasControlModifier_;
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 bool hasShiftModifier_;
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 public:
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 PointerEvent();
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 ScenePoint2D GetMainPosition() const;
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
617
7efa2543699d simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 596
diff changeset
46 void AddPosition(const ScenePoint2D& p)
7efa2543699d simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 596
diff changeset
47 {
7efa2543699d simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 596
diff changeset
48 positions_.push_back(p);
7efa2543699d simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 596
diff changeset
49 }
7efa2543699d simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 596
diff changeset
50
596
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 void AddPosition(double x,
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 double y)
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 {
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 positions_.push_back(ScenePoint2D(x, y));
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 }
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 size_t GetPositionsCount() const
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 {
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 return positions_.size();
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 }
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 ScenePoint2D GetPosition(size_t index) const;
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 void SetAltModifier(bool value)
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 {
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 hasAltModifier_ = value;
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 }
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 bool HasAltModifier() const
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 {
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 return hasAltModifier_;
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 }
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 void SetControlModifier(bool value)
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 {
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 hasControlModifier_ = value;
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 }
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 bool HasControlModifier() const
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 {
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 return hasControlModifier_;
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 }
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 void SetShiftModifier(bool value)
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 {
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 hasShiftModifier_ = value;
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 }
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 bool HasShiftModifier() const
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 {
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 return hasShiftModifier_;
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 }
1208
00e6bff9ea39 handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 617
diff changeset
93
00e6bff9ea39 handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 617
diff changeset
94 void SetMouseButton(MouseButton button)
00e6bff9ea39 handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 617
diff changeset
95 {
00e6bff9ea39 handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 617
diff changeset
96 button_ = button;
00e6bff9ea39 handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 617
diff changeset
97 }
00e6bff9ea39 handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 617
diff changeset
98
00e6bff9ea39 handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 617
diff changeset
99 MouseButton GetMouseButton() const
00e6bff9ea39 handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 617
diff changeset
100 {
00e6bff9ea39 handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 617
diff changeset
101 return button_;
00e6bff9ea39 handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 617
diff changeset
102 }
596
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 };
b716763571ad IPointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 }