Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Scene2DViewport/OneGesturePointerTracker.h @ 1980:0aac8f552d89
added pixel probe to the Stone Web viewer toolbar
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sun, 30 Oct 2022 10:26:32 +0100 |
parents | 9c0adcc8feec |
children | 07964689cb0b |
rev | line source |
---|---|
700
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
1 /** |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
2 * Stone of Orthanc |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
1871
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
700
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
7 * |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
8 * 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:
1571
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public License |
700
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
10 * as published by the Free Software Foundation, either version 3 of |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
11 * the License, or (at your option) any later version. |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
12 * |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, but |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
14 * 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:
1571
diff
changeset
|
15 * 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:
1571
diff
changeset
|
16 * Lesser General Public License for more details. |
700
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
17 * |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1571
diff
changeset
|
18 * 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:
1571
diff
changeset
|
19 * 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:
1571
diff
changeset
|
20 * <http://www.gnu.org/licenses/>. |
700
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
21 **/ |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
22 |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
23 #pragma once |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
24 |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
25 #include "IFlexiblePointerTracker.h" |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
26 |
1564
e731e62692a9
upgrading Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
27 #include <Compatibility.h> // For ORTHANC_OVERRIDE |
e731e62692a9
upgrading Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
28 |
1305
a5326ce4f24b
Trackers and measuring tools now use the viewport instead of ViewportController, so that proper locks can be used
Benjamin Golinvaux <bgo@osimis.io>
parents:
1270
diff
changeset
|
29 #include <boost/shared_ptr.hpp> |
a5326ce4f24b
Trackers and measuring tools now use the viewport instead of ViewportController, so that proper locks can be used
Benjamin Golinvaux <bgo@osimis.io>
parents:
1270
diff
changeset
|
30 #include <boost/weak_ptr.hpp> |
a5326ce4f24b
Trackers and measuring tools now use the viewport instead of ViewportController, so that proper locks can be used
Benjamin Golinvaux <bgo@osimis.io>
parents:
1270
diff
changeset
|
31 |
700
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
32 namespace OrthancStone |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
33 { |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
34 /** |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
35 This base is class allows to write simple trackers that deal with single |
722
28b9e3a54200
Undo mechanism implemented (not connected to UI yet). Undo stack and measuring
Benjamin Golinvaux <bgo@osimis.io>
parents:
700
diff
changeset
|
36 drag gestures with only one touch. It is *not* suitable for multi-touch and |
28b9e3a54200
Undo mechanism implemented (not connected to UI yet). Undo stack and measuring
Benjamin Golinvaux <bgo@osimis.io>
parents:
700
diff
changeset
|
37 multi-state trackers where various mouse operations need to be handled. |
700
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
38 |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
39 In order to write such a tracker: |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
40 - subclass this class |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
41 - you may store the initial click/touch position in the constructor |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
42 - implement PointerMove to react to pointer/touch events |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
43 - implement Cancel to restore the state at initial tracker creation time |
722
28b9e3a54200
Undo mechanism implemented (not connected to UI yet). Undo stack and measuring
Benjamin Golinvaux <bgo@osimis.io>
parents:
700
diff
changeset
|
44 |
700
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
45 */ |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
46 class OneGesturePointerTracker : public IFlexiblePointerTracker |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
47 { |
1571 | 48 private: |
49 bool alive_; | |
50 int currentTouchCount_; | |
51 | |
52 public: | |
1972
9c0adcc8feec
refactoring to simplify OneGesturePointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
53 explicit OneGesturePointerTracker(); |
1571 | 54 |
1972
9c0adcc8feec
refactoring to simplify OneGesturePointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
55 virtual void PointerUp(const PointerEvent& event, |
9c0adcc8feec
refactoring to simplify OneGesturePointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
56 const Scene2D& scene) ORTHANC_OVERRIDE; |
1571 | 57 |
1972
9c0adcc8feec
refactoring to simplify OneGesturePointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
58 virtual void PointerDown(const PointerEvent& event, |
9c0adcc8feec
refactoring to simplify OneGesturePointerTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
59 const Scene2D& scene) ORTHANC_OVERRIDE; |
1571 | 60 |
61 virtual bool IsAlive() const ORTHANC_OVERRIDE; | |
700
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
62 }; |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
63 } |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
64 |