Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Scene2DViewport/ViewportController.h @ 1773:34eb41352dff
added missing Scene2D/CopyStyleConfigurator.cpp
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 12 May 2021 17:40:38 +0200 |
parents | 9ac2a65d4172 |
children | 462d7a0e064e |
rev | line source |
---|---|
698
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
1 /** |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
2 * Stone of Orthanc |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
1739
9ac2a65d4172
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
698
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
6 * |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
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 |
698
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
10 * the License, or (at your option) any later version. |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
11 * |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
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:
1571
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/>. |
698
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
20 **/ |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
21 |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
22 #pragma once |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
23 |
818
e42b491f1fb2
Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents:
774
diff
changeset
|
24 #include "PredeclaredTypes.h" |
698
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
25 |
1215
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1214
diff
changeset
|
26 #include "../Messages/IObservable.h" |
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1214
diff
changeset
|
27 #include "../Scene2D/Scene2D.h" |
736
c0fcb2757b0a
enforce relative includes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
722
diff
changeset
|
28 #include "../Scene2DViewport/IFlexiblePointerTracker.h" |
1557 | 29 #include "../Viewport/IViewportInteractor.h" |
698
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
30 |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1331
diff
changeset
|
31 #include <Compatibility.h> |
1299
c38c89684d83
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1279
diff
changeset
|
32 |
1208
00e6bff9ea39
handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1203
diff
changeset
|
33 #include <boost/enable_shared_from_this.hpp> |
722
28b9e3a54200
Undo mechanism implemented (not connected to UI yet). Undo stack and measuring
Benjamin Golinvaux <bgo@osimis.io>
parents:
721
diff
changeset
|
34 #include <stack> |
28b9e3a54200
Undo mechanism implemented (not connected to UI yet). Undo stack and measuring
Benjamin Golinvaux <bgo@osimis.io>
parents:
721
diff
changeset
|
35 |
698
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
36 namespace OrthancStone |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
37 { |
858
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
842
diff
changeset
|
38 class UndoStack; |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
842
diff
changeset
|
39 |
774
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
40 const double ARC_RADIUS_CANVAS_COORD = 30.0; |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
41 const double TEXT_CENTER_DISTANCE_CANVAS_COORD = 90; |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
42 |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
43 const double HANDLE_SIDE_LENGTH_CANVAS_COORD = 10.0; |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
44 const double HIT_TEST_MAX_DISTANCE_CANVAS_COORD = 15.0; |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
45 |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
46 const uint8_t TEXT_COLOR_RED = 0; |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
47 const uint8_t TEXT_COLOR_GREEN = 223; |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
48 const uint8_t TEXT_COLOR_BLUE = 81; |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
49 |
865
a29c13497557
Added operators to ScenePoint2D + highlight support on MouseOver for measuring tools
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
50 const uint8_t TOOL_ANGLE_LINES_COLOR_RED = 0; |
a29c13497557
Added operators to ScenePoint2D + highlight support on MouseOver for measuring tools
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
51 const uint8_t TOOL_ANGLE_LINES_COLOR_GREEN = 183; |
a29c13497557
Added operators to ScenePoint2D + highlight support on MouseOver for measuring tools
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
52 const uint8_t TOOL_ANGLE_LINES_COLOR_BLUE = 17; |
a29c13497557
Added operators to ScenePoint2D + highlight support on MouseOver for measuring tools
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
53 |
a29c13497557
Added operators to ScenePoint2D + highlight support on MouseOver for measuring tools
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
54 const uint8_t TOOL_ANGLE_LINES_HL_COLOR_RED = 0; |
a29c13497557
Added operators to ScenePoint2D + highlight support on MouseOver for measuring tools
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
55 const uint8_t TOOL_ANGLE_LINES_HL_COLOR_GREEN = 17; |
a29c13497557
Added operators to ScenePoint2D + highlight support on MouseOver for measuring tools
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
56 const uint8_t TOOL_ANGLE_LINES_HL_COLOR_BLUE = 183; |
a29c13497557
Added operators to ScenePoint2D + highlight support on MouseOver for measuring tools
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
57 |
774
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
58 const uint8_t TOOL_LINES_COLOR_RED = 0; |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
59 const uint8_t TOOL_LINES_COLOR_GREEN = 223; |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
60 const uint8_t TOOL_LINES_COLOR_BLUE = 21; |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
61 |
865
a29c13497557
Added operators to ScenePoint2D + highlight support on MouseOver for measuring tools
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
62 const uint8_t TOOL_LINES_HL_COLOR_RED = 0; |
a29c13497557
Added operators to ScenePoint2D + highlight support on MouseOver for measuring tools
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
63 const uint8_t TOOL_LINES_HL_COLOR_GREEN = 21; |
a29c13497557
Added operators to ScenePoint2D + highlight support on MouseOver for measuring tools
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
64 const uint8_t TOOL_LINES_HL_COLOR_BLUE = 223; |
774
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
65 |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
66 const uint8_t TEXT_OUTLINE_COLOR_RED = 0; |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
67 const uint8_t TEXT_OUTLINE_COLOR_GREEN = 56; |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
68 const uint8_t TEXT_OUTLINE_COLOR_BLUE = 21; |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
69 |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
70 /** |
698
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
71 This object is responsible for hosting a scene, responding to messages from |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
72 the model and updating the scene accordingly. |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
73 |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
74 It contains the list of active measuring tools as well as the stack |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
75 where measuring tool commands are stored. |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
76 |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
77 The active tracker is also stored in the viewport controller. |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
78 |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
79 Each canvas or other GUI area where we want to display a 2D image, either |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
80 directly or through slicing must be assigned a ViewportController. |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
81 */ |
1208
00e6bff9ea39
handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1203
diff
changeset
|
82 class ViewportController : |
00e6bff9ea39
handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1203
diff
changeset
|
83 public IObservable, |
00e6bff9ea39
handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1203
diff
changeset
|
84 public boost::enable_shared_from_this<ViewportController> |
698
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
85 { |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
86 public: |
700
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
698
diff
changeset
|
87 ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, \ |
1331
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
88 SceneTransformChanged, \ |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
89 ViewportController); |
700
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
698
diff
changeset
|
90 |
1721
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
91 class GrayscaleWindowingChanged : public OriginMessage<ViewportController> |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
92 { |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
93 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
94 |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
95 private: |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
96 double windowingCenter_; |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
97 double windowingWidth_; |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
98 |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
99 public: |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
100 GrayscaleWindowingChanged(const ViewportController& origin, |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
101 double windowingCenter, |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
102 double windowingWidth) : |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
103 OriginMessage(origin), |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
104 windowingCenter_(windowingCenter), |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
105 windowingWidth_(windowingWidth) |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
106 { |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
107 } |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
108 |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
109 double GetWindowingCenter() const |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
110 { |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
111 return windowingCenter_; |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
112 } |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
113 |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
114 double GetWindowingWidth() const |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
115 { |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
116 return windowingWidth_; |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
117 } |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
118 }; |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
119 |
1606
874e178f34e9
- ViewportController now has weak ptr to Viewport
Benjamin Golinvaux <bgo@osimis.io>
parents:
1598
diff
changeset
|
120 explicit ViewportController(boost::weak_ptr<IViewport> viewport); |
1020
ac88989817e3
TrackerCommand --> MeasureCommand + fuse against exception in MeasureTool dtor
Benjamin Golinvaux <bgo@osimis.io>
parents:
942
diff
changeset
|
121 |
ac88989817e3
TrackerCommand --> MeasureCommand + fuse against exception in MeasureTool dtor
Benjamin Golinvaux <bgo@osimis.io>
parents:
942
diff
changeset
|
122 ~ViewportController(); |
ac88989817e3
TrackerCommand --> MeasureCommand + fuse against exception in MeasureTool dtor
Benjamin Golinvaux <bgo@osimis.io>
parents:
942
diff
changeset
|
123 |
698
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
124 /** |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
125 This method returns the list of measure tools containing the supplied point |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
126 (in scene coords). A tracker can then be requested from the chosen |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
127 measure tool, if needed |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
128 */ |
1331
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
129 std::vector<boost::shared_ptr<MeasureTool> > HitTestMeasureTools( |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
130 ScenePoint2D p); |
698
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
131 |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
132 /** |
865
a29c13497557
Added operators to ScenePoint2D + highlight support on MouseOver for measuring tools
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
133 This function will traverse the measuring tools and will clear their |
a29c13497557
Added operators to ScenePoint2D + highlight support on MouseOver for measuring tools
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
134 highlighted state |
a29c13497557
Added operators to ScenePoint2D + highlight support on MouseOver for measuring tools
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
135 */ |
a29c13497557
Added operators to ScenePoint2D + highlight support on MouseOver for measuring tools
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
136 void ResetMeasuringToolsHighlight(); |
a29c13497557
Added operators to ScenePoint2D + highlight support on MouseOver for measuring tools
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
137 |
a29c13497557
Added operators to ScenePoint2D + highlight support on MouseOver for measuring tools
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
138 /** |
698
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
139 With this method, the object takes ownership of the supplied tracker and |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
140 updates it according to user interaction |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
141 */ |
1208
00e6bff9ea39
handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1203
diff
changeset
|
142 void AcquireActiveTracker(IFlexiblePointerTracker* tracker); |
698
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
143 |
700
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
698
diff
changeset
|
144 /** Forwarded to the underlying scene */ |
1203
f3bb9a6dd949
locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1059
diff
changeset
|
145 AffineTransform2D GetCanvasToSceneTransform() const; |
700
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
698
diff
changeset
|
146 |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
698
diff
changeset
|
147 /** Forwarded to the underlying scene */ |
1203
f3bb9a6dd949
locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1059
diff
changeset
|
148 AffineTransform2D GetSceneToCanvasTransform() const; |
700
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
698
diff
changeset
|
149 |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
698
diff
changeset
|
150 /** Forwarded to the underlying scene, and broadcasted to the observers */ |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
698
diff
changeset
|
151 void SetSceneToCanvasTransform(const AffineTransform2D& transform); |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
698
diff
changeset
|
152 |
1721
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
153 /** Info broadcasted to the observers */ |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
154 void BroadcastGrayscaleWindowingChanged(double windowingCenter, |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
155 double windowingWidth); |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
156 |
721
af0aa0c149fa
FitContent is now wrapped by the controller (for observability)
Benjamin Golinvaux <bgo@osimis.io>
parents:
700
diff
changeset
|
157 /** Forwarded to the underlying scene, and broadcasted to the observers */ |
1215
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1214
diff
changeset
|
158 void FitContent(unsigned int viewportWidth, |
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1214
diff
changeset
|
159 unsigned int viewportHeight); |
700
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
698
diff
changeset
|
160 |
722
28b9e3a54200
Undo mechanism implemented (not connected to UI yet). Undo stack and measuring
Benjamin Golinvaux <bgo@osimis.io>
parents:
721
diff
changeset
|
161 /** Adds a new measure tool */ |
818
e42b491f1fb2
Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents:
774
diff
changeset
|
162 void AddMeasureTool(boost::shared_ptr<MeasureTool> measureTool); |
722
28b9e3a54200
Undo mechanism implemented (not connected to UI yet). Undo stack and measuring
Benjamin Golinvaux <bgo@osimis.io>
parents:
721
diff
changeset
|
163 |
28b9e3a54200
Undo mechanism implemented (not connected to UI yet). Undo stack and measuring
Benjamin Golinvaux <bgo@osimis.io>
parents:
721
diff
changeset
|
164 /** Removes a measure tool or throws if it cannot be found */ |
818
e42b491f1fb2
Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents:
774
diff
changeset
|
165 void RemoveMeasureTool(boost::shared_ptr<MeasureTool> measureTool); |
722
28b9e3a54200
Undo mechanism implemented (not connected to UI yet). Undo stack and measuring
Benjamin Golinvaux <bgo@osimis.io>
parents:
721
diff
changeset
|
166 |
774
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
167 /** |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
168 The square handle side length in *scene* coordinates |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
169 */ |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
170 double GetHandleSideLengthS() const; |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
171 |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
172 /** |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
173 The angle measure too arc radius in *scene* coordinates |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
174 |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
175 Note: you might wonder why this is not part of the AngleMeasureTool itself, |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
176 but we prefer to put all such constants in the same location, to ease |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
177 */ |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
178 double GetAngleToolArcRadiusS() const; |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
179 |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
180 /** |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
181 The hit test maximum distance in *scene* coordinates. |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
182 If a pointer event is less than GetHandleSideLengthS() to a GUI element, |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
183 the hit test for this GUI element is seen as true |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
184 */ |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
185 double GetHitTestMaximumDistanceS() const; |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
186 |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
187 /** |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
188 Distance between the top of the angle measuring tool and the center of |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
189 the label showing the actual measure, in *scene* coordinates |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
190 */ |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
191 double GetAngleTopTextLabelDistanceS() const; |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
192 |
858
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
842
diff
changeset
|
193 |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
842
diff
changeset
|
194 /** forwarded to the UndoStack */ |
1020
ac88989817e3
TrackerCommand --> MeasureCommand + fuse against exception in MeasureTool dtor
Benjamin Golinvaux <bgo@osimis.io>
parents:
942
diff
changeset
|
195 void PushCommand(boost::shared_ptr<MeasureCommand> command); |
858
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
842
diff
changeset
|
196 |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
842
diff
changeset
|
197 /** forwarded to the UndoStack */ |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
842
diff
changeset
|
198 void Undo(); |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
842
diff
changeset
|
199 |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
842
diff
changeset
|
200 /** forwarded to the UndoStack */ |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
842
diff
changeset
|
201 void Redo(); |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
842
diff
changeset
|
202 |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
842
diff
changeset
|
203 /** forwarded to the UndoStack */ |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
842
diff
changeset
|
204 bool CanUndo() const; |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
842
diff
changeset
|
205 |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
842
diff
changeset
|
206 /** forwarded to the UndoStack */ |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
842
diff
changeset
|
207 bool CanRedo() const; |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
842
diff
changeset
|
208 |
1208
00e6bff9ea39
handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1203
diff
changeset
|
209 |
00e6bff9ea39
handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1203
diff
changeset
|
210 // Must be expressed in canvas coordinates |
1215
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1214
diff
changeset
|
211 void HandleMousePress(IViewportInteractor& interactor, |
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1214
diff
changeset
|
212 const PointerEvent& event, |
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1214
diff
changeset
|
213 unsigned int viewportWidth, |
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1214
diff
changeset
|
214 unsigned int viewportHeight); |
1208
00e6bff9ea39
handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1203
diff
changeset
|
215 |
1249
964c89e15e7e
ViewportController::HandleMouseMove() returning a Boolean for invalidation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
216 // Must be expressed in canvas coordinates. Returns "true" if the |
964c89e15e7e
ViewportController::HandleMouseMove() returning a Boolean for invalidation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
217 // state has changed, so that "Invalidate()" can be called. |
964c89e15e7e
ViewportController::HandleMouseMove() returning a Boolean for invalidation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
218 bool HandleMouseMove(const PointerEvent& event); |
1208
00e6bff9ea39
handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1203
diff
changeset
|
219 |
00e6bff9ea39
handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1203
diff
changeset
|
220 // Must be expressed in canvas coordinates |
00e6bff9ea39
handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1203
diff
changeset
|
221 void HandleMouseRelease(const PointerEvent& event); |
891
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
865
diff
changeset
|
222 |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
865
diff
changeset
|
223 const Scene2D& GetScene() const |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
865
diff
changeset
|
224 { |
1232
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
225 return *scene_; |
1213
86a8266b8888
moving the scene from IViewport to ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1210
diff
changeset
|
226 } |
86a8266b8888
moving the scene from IViewport to ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1210
diff
changeset
|
227 |
86a8266b8888
moving the scene from IViewport to ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1210
diff
changeset
|
228 Scene2D& GetScene() |
86a8266b8888
moving the scene from IViewport to ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1210
diff
changeset
|
229 { |
1232
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
230 return *scene_; |
1213
86a8266b8888
moving the scene from IViewport to ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1210
diff
changeset
|
231 } |
86a8266b8888
moving the scene from IViewport to ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1210
diff
changeset
|
232 |
1331
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
233 /** |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
234 This method is used in a move pattern: when the ownership of the scene |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
235 managed by this viewport controller must be transferred to another |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
236 controller. |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
237 */ |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
238 Scene2D* ReleaseScene() |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
239 { |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
240 return scene_.release(); |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
241 } |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
242 |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
243 /** |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
244 This method is used when one wishes to replace the scene that is currently |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
245 managed by the controller. The previous scene is deleted and the controller |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
246 now has ownership of the new one. |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
247 */ |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
248 void AcquireScene(Scene2D* scene) |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
249 { |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
250 scene_.reset(scene); |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
251 } |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
252 |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
253 /** |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
254 Sets the undo stack that is used by PushCommand, Undo... |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
255 */ |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
256 void SetUndoStack(boost::weak_ptr<UndoStack> undoStackW) |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
257 { |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
258 undoStackW_ = undoStackW; |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
259 } |
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1308
diff
changeset
|
260 |
1218
6f3f1ef347a3
fix OneGesturePointerTracker if mouse release is outside the canvas
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1216
diff
changeset
|
261 bool HasActiveTracker() const |
6f3f1ef347a3
fix OneGesturePointerTracker if mouse release is outside the canvas
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1216
diff
changeset
|
262 { |
6f3f1ef347a3
fix OneGesturePointerTracker if mouse release is outside the canvas
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1216
diff
changeset
|
263 return activeTracker_.get() != NULL; |
891
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
865
diff
changeset
|
264 } |
858
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
842
diff
changeset
|
265 |
698
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
266 private: |
774
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
267 double GetCanvasToSceneFactor() const; |
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
268 |
1684
fb62c1522193
Scene2D must be built first and deleted last!
Benjamin Golinvaux <bgo@osimis.io>
parents:
1606
diff
changeset
|
269 // The scene can be used by the higher-level objects (including the |
fb62c1522193
Scene2D must be built first and deleted last!
Benjamin Golinvaux <bgo@osimis.io>
parents:
1606
diff
changeset
|
270 // measuring tools), possibly in their destructor, and so it must be |
fb62c1522193
Scene2D must be built first and deleted last!
Benjamin Golinvaux <bgo@osimis.io>
parents:
1606
diff
changeset
|
271 // deleted last (and, thus, constructed first) |
fb62c1522193
Scene2D must be built first and deleted last!
Benjamin Golinvaux <bgo@osimis.io>
parents:
1606
diff
changeset
|
272 std::unique_ptr<Scene2D> scene_; |
fb62c1522193
Scene2D must be built first and deleted last!
Benjamin Golinvaux <bgo@osimis.io>
parents:
1606
diff
changeset
|
273 |
1606
874e178f34e9
- ViewportController now has weak ptr to Viewport
Benjamin Golinvaux <bgo@osimis.io>
parents:
1598
diff
changeset
|
274 boost::weak_ptr<IViewport> viewport_; |
1684
fb62c1522193
Scene2D must be built first and deleted last!
Benjamin Golinvaux <bgo@osimis.io>
parents:
1606
diff
changeset
|
275 |
1208
00e6bff9ea39
handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1203
diff
changeset
|
276 boost::weak_ptr<UndoStack> undoStackW_; // Global stack, possibly shared by all viewports |
00e6bff9ea39
handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1203
diff
changeset
|
277 std::vector<boost::shared_ptr<MeasureTool> > measureTools_; |
1299
c38c89684d83
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1279
diff
changeset
|
278 boost::shared_ptr<IFlexiblePointerTracker> activeTracker_; // TODO - Couldn't this be a "std::unique_ptr"? |
858
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
842
diff
changeset
|
279 |
1213
86a8266b8888
moving the scene from IViewport to ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1210
diff
changeset
|
280 |
774
66ac7a2d1e3a
A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents:
736
diff
changeset
|
281 // this is cached |
1208
00e6bff9ea39
handling of mouse interactions in ViewportController
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1203
diff
changeset
|
282 double canvasToSceneFactor_; |
698
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
283 }; |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
284 } |