Mercurial > hg > orthanc-stone
annotate Framework/Radiography/RadiographyWindowingTracker.h @ 1235:e71ee3e88448 broker
WebGLViewportsRegistry in milliseconds, and Clear()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 09 Dec 2019 20:25:22 +0100 |
parents | 08cdcadfab14 |
children | 2d8ab34c8c91 |
rev | line source |
---|---|
415
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Stone of Orthanc |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
439 | 5 * Copyright (C) 2017-2019 Osimis S.A., Belgium |
415
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Affero General Public License |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * the License, or (at your option) any later version. |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * Affero General Public License for more details. |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Affero General Public License |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 **/ |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 #pragma once |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #include "../Toolbox/UndoRedoStack.h" |
732
c35e98d22764
move Deprecated classes to a separate folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
726
diff
changeset
|
25 #include "../Deprecated/Widgets/IWorldSceneMouseTracker.h" |
415
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 #include "RadiographyScene.h" |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 namespace OrthancStone |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 { |
1042
08cdcadfab14
allow using nearest neighbour interpolation while windowing
Alain Mazy <alain@mazy.be>
parents:
732
diff
changeset
|
30 |
08cdcadfab14
allow using nearest neighbour interpolation while windowing
Alain Mazy <alain@mazy.be>
parents:
732
diff
changeset
|
31 class RadiographyWidget; |
08cdcadfab14
allow using nearest neighbour interpolation while windowing
Alain Mazy <alain@mazy.be>
parents:
732
diff
changeset
|
32 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
457
diff
changeset
|
33 class RadiographyWindowingTracker : public Deprecated::IWorldSceneMouseTracker |
415
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 { |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 public: |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 enum Action |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 { |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 Action_IncreaseWidth, |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 Action_DecreaseWidth, |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 Action_IncreaseCenter, |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 Action_DecreaseCenter |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 }; |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 private: |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 class UndoRedoCommand; |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 UndoRedoStack& undoRedoStack_; |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 RadiographyScene& scene_; |
1042
08cdcadfab14
allow using nearest neighbour interpolation while windowing
Alain Mazy <alain@mazy.be>
parents:
732
diff
changeset
|
49 RadiographyWidget& widget_; |
08cdcadfab14
allow using nearest neighbour interpolation while windowing
Alain Mazy <alain@mazy.be>
parents:
732
diff
changeset
|
50 ImageInterpolation initialWidgetInterpolation_; |
415
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 int clickX_; |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 int clickY_; |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 Action leftAction_; |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 Action rightAction_; |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 Action upAction_; |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 Action downAction_; |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 float strength_; |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 float sourceCenter_; |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 float sourceWidth_; |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 static void ComputeAxisEffect(int& deltaCenter, |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 int& deltaWidth, |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 int delta, |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 Action actionNegative, |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 Action actionPositive); |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 public: |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 RadiographyWindowingTracker(UndoRedoStack& undoRedoStack, |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 RadiographyScene& scene, |
1042
08cdcadfab14
allow using nearest neighbour interpolation while windowing
Alain Mazy <alain@mazy.be>
parents:
732
diff
changeset
|
70 RadiographyWidget& widget, |
08cdcadfab14
allow using nearest neighbour interpolation while windowing
Alain Mazy <alain@mazy.be>
parents:
732
diff
changeset
|
71 ImageInterpolation interpolationDuringTracking, |
415
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 int x, |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 int y, |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 Action leftAction, |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 Action rightAction, |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 Action upAction, |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 Action downAction); |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 virtual bool HasRender() const |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 { |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 return false; |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 } |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 virtual void Render(CairoContext& context, |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 double zoom); |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 virtual void MouseUp(); |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 virtual void MouseMove(int displayX, |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 int displayY, |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 double sceneX, |
457
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
92 double sceneY, |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
457
diff
changeset
|
93 const std::vector<Deprecated::Touch>& displayTouches, |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
457
diff
changeset
|
94 const std::vector<Deprecated::Touch>& sceneTouches); |
415
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 }; |
c0589c3173fd
finished reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 } |