annotate Samples/Sdl/FusionMprSdl.h @ 872:733c6db3e5a3 am-dev

limiting the size of the cache
author Alain Mazy <alain@mazy.be>
date Mon, 01 Jul 2019 13:36:51 +0200
parents e3c56d4f863f
children eaaa9b574e05
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
1 /**
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
2 * Stone of Orthanc
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
6 *
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
10 * the License, or (at your option) any later version.
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
11 *
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
15 * Affero General Public License for more details.
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
16 *
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
19 **/
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
20
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
21 #include "../../Framework/Messages/IObserver.h"
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
22 #include "../../Framework/Messages/IMessageEmitter.h"
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
23 #include "../../Framework/Oracle/OracleCommandExceptionMessage.h"
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
24 #include "../../Framework/Scene2DViewport/ViewportController.h"
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
25 #include "../../Framework/Volumes/DicomVolumeImage.h"
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
26 #include "../../Framework/Oracle/ThreadedOracle.h"
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
27
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
28 #include <boost/enable_shared_from_this.hpp>
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
29 #include <boost/thread.hpp>
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
30 #include <boost/noncopyable.hpp>
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
31
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
32 #include <SDL.h>
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
33
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
34 namespace OrthancStone
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
35 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
36 class OpenGLCompositor;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
37 class IVolumeSlicer;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
38 class ILayerStyleConfigurator;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
39 class DicomStructureSetLoader;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
40 class IOracle;
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
41 class ThreadedOracle;
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
42 class VolumeSceneLayerSource;
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
43 class NativeFusionMprApplicationContext;
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
44
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
45
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
46 enum FusionMprGuiTool
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
47 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
48 FusionMprGuiTool_Rotate = 0,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
49 FusionMprGuiTool_Pan,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
50 FusionMprGuiTool_Zoom,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
51 FusionMprGuiTool_LineMeasure,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
52 FusionMprGuiTool_CircleMeasure,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
53 FusionMprGuiTool_AngleMeasure,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
54 FusionMprGuiTool_EllipseMeasure,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
55 FusionMprGuiTool_LAST
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
56 };
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
57
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
58 const char* MeasureToolToString(size_t i);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
59
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
60 static const unsigned int FONT_SIZE_0 = 32;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
61 static const unsigned int FONT_SIZE_1 = 24;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
62
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
63 class Scene2D;
858
e3c56d4f863f GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents: 828
diff changeset
64 class UndoStack;
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
65
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
66 /**
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
67 This application subclasses IMessageEmitter to use a mutex before forwarding Oracle messages (that
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
68 can be sent from multiple threads)
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
69 */
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
70 class FusionMprSdlApp : public IObserver
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
71 , public boost::enable_shared_from_this<FusionMprSdlApp>
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
72 , public IMessageEmitter
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
73 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
74 public:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
75 // 12 because.
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
76 FusionMprSdlApp(MessageBroker& broker);
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
77
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
78 void PrepareScene();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
79 void Run();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
80 void SetInfoDisplayMessage(std::string key, std::string value);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
81 void DisableTracker();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
82
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
83 boost::shared_ptr<Scene2D> GetScene();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
84 boost::shared_ptr<const Scene2D> GetScene() const;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
85
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
86 void HandleApplicationEvent(const SDL_Event& event);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
87
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
88 /**
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
89 This method is called when the scene transform changes. It allows to
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
90 recompute the visual elements whose content depend upon the scene transform
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
91 */
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
92 void OnSceneTransformChanged(
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
93 const ViewportController::SceneTransformChanged& message);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
94
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
95
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
96 virtual void EmitMessage(const IObserver& observer,
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
97 const IMessage& message) ORTHANC_OVERRIDE
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
98 {
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
99 try
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
100 {
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
101 boost::unique_lock<boost::shared_mutex> lock(mutex_);
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
102 oracleObservable_.EmitMessage(observer, message);
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
103 }
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
104 catch (Orthanc::OrthancException& e)
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
105 {
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
106 LOG(ERROR) << "Exception while emitting a message: " << e.What();
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
107 throw;
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
108 }
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
109 }
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
110
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
111 private:
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
112 #if 1
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
113 // if threaded (not wasm)
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
114 MessageBroker& broker_;
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
115 IObservable oracleObservable_;
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
116 ThreadedOracle oracle_;
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
117 boost::shared_mutex mutex_; // to serialize messages from the ThreadedOracle
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
118 #endif
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
119
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
120 void SelectNextTool();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
121
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
122 /**
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
123 This returns a random point in the canvas part of the scene, but in
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
124 scene coordinates
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
125 */
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
126 ScenePoint2D GetRandomPointInScene() const;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
127
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
128 boost::shared_ptr<IFlexiblePointerTracker> TrackerHitTest(const PointerEvent& e);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
129
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
130 boost::shared_ptr<IFlexiblePointerTracker> CreateSuitableTracker(
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
131 const SDL_Event& event,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
132 const PointerEvent& e);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
133
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
134 void TakeScreenshot(
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
135 const std::string& target,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
136 unsigned int canvasWidth,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
137 unsigned int canvasHeight);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
138
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
139 /**
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
140 This adds the command at the top of the undo stack
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
141 */
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
142 void Commit(boost::shared_ptr<TrackerCommand> cmd);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
143 void Undo();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
144 void Redo();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
145
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
146
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
147 // TODO private
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
148 void Handle(const DicomVolumeImage::GeometryReadyMessage& message);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
149 void Handle(const OracleCommandExceptionMessage& message);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
150
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
151 void SetVolume1(
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
152 int depth,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
153 const boost::shared_ptr<IVolumeSlicer>& volume,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
154 ILayerStyleConfigurator* style);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
155
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
156 void SetVolume2(
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
157 int depth,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
158 const boost::shared_ptr<IVolumeSlicer>& volume,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
159 ILayerStyleConfigurator* style);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
160
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
161 void SetStructureSet(
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
162 int depth,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
163 const boost::shared_ptr<DicomStructureSetLoader>& volume);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
164
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
165
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
166
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
167 private:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
168 void DisplayFloatingCtrlInfoText(const PointerEvent& e);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
169 void DisplayInfoText();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
170 void HideInfoText();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
171
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
172 private:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
173 CoordinateSystem3D plane_;
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
174
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
175 boost::shared_ptr<VolumeSceneLayerSource> source1_, source2_, source3_;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
176
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
177 std::auto_ptr<OpenGLCompositor> compositor_;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
178 /**
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
179 WARNING: the measuring tools do store a reference to the scene, and it
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
180 paramount that the scene gets destroyed AFTER the measurement tools.
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
181 */
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
182 boost::shared_ptr<ViewportController> controller_;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
183
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
184 std::map<std::string, std::string> infoTextMap_;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
185 boost::shared_ptr<IFlexiblePointerTracker> activeTracker_;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
186
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
187 //static const int LAYER_POSITION = 150;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
188
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
189 int TEXTURE_2x2_1_ZINDEX;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
190 int TEXTURE_1x1_ZINDEX;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
191 int TEXTURE_2x2_2_ZINDEX;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
192 int LINESET_1_ZINDEX;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
193 int LINESET_2_ZINDEX;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
194 int FLOATING_INFOTEXT_LAYER_ZINDEX;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
195 int FIXED_INFOTEXT_LAYER_ZINDEX;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
196
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
197 FusionMprGuiTool currentTool_;
858
e3c56d4f863f GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents: 828
diff changeset
198 boost::shared_ptr<UndoStack> undoStack_;
e3c56d4f863f GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents: 828
diff changeset
199
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
200 };
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
201
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
202 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
203
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
204
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
205