annotate Samples/Sdl/FusionMprSdl.h @ 1246:3fe803f65c47 broker

proper initialization of opengl canvas size
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 Jan 2020 12:56:40 +0100
parents eaaa9b574e05
children 2d8ab34c8c91
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
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 858
diff changeset
21 #include "../../Framework/Viewport/SdlViewport.h"
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 858
diff changeset
22
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
23 #include "../../Framework/Messages/IObserver.h"
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
24 #include "../../Framework/Messages/IMessageEmitter.h"
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
25 #include "../../Framework/Oracle/OracleCommandExceptionMessage.h"
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
26 #include "../../Framework/Scene2DViewport/ViewportController.h"
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
27 #include "../../Framework/Volumes/DicomVolumeImage.h"
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
28 #include "../../Framework/Oracle/ThreadedOracle.h"
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
29
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
30 #include <boost/enable_shared_from_this.hpp>
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
31 #include <boost/thread.hpp>
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
32 #include <boost/noncopyable.hpp>
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
33
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
34 #include <SDL.h>
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 namespace OrthancStone
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
37 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
38 class OpenGLCompositor;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
39 class IVolumeSlicer;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
40 class ILayerStyleConfigurator;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
41 class DicomStructureSetLoader;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
42 class IOracle;
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
43 class ThreadedOracle;
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
44 class VolumeSceneLayerSource;
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
45 class NativeFusionMprApplicationContext;
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 858
diff changeset
46 class SdlOpenGLViewport;
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
47
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
48 enum FusionMprGuiTool
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
49 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
50 FusionMprGuiTool_Rotate = 0,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
51 FusionMprGuiTool_Pan,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
52 FusionMprGuiTool_Zoom,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
53 FusionMprGuiTool_LineMeasure,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
54 FusionMprGuiTool_CircleMeasure,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
55 FusionMprGuiTool_AngleMeasure,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
56 FusionMprGuiTool_EllipseMeasure,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
57 FusionMprGuiTool_LAST
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
58 };
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 const char* MeasureToolToString(size_t i);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
61
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
62 static const unsigned int FONT_SIZE_0 = 32;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
63 static const unsigned int FONT_SIZE_1 = 24;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
64
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
65 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
66 class UndoStack;
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
67
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
68 /**
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
69 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
70 can be sent from multiple threads)
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
71 */
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
72 class FusionMprSdlApp : public IObserver
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
73 , public boost::enable_shared_from_this<FusionMprSdlApp>
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
74 , public IMessageEmitter
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
75 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
76 public:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
77 // 12 because.
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
78 FusionMprSdlApp(MessageBroker& broker);
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
79
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
80 void PrepareScene();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
81 void Run();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
82 void SetInfoDisplayMessage(std::string key, std::string value);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
83 void DisableTracker();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
84
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 858
diff changeset
85 Scene2D& GetScene();
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 858
diff changeset
86 const Scene2D& GetScene() const;
827
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 void HandleApplicationEvent(const SDL_Event& event);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
89
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
90 /**
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
91 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
92 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
93 */
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
94 void OnSceneTransformChanged(
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
95 const ViewportController::SceneTransformChanged& message);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
96
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
97
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
98 virtual void EmitMessage(const IObserver& observer,
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
99 const IMessage& message) ORTHANC_OVERRIDE
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 try
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
102 {
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
103 boost::unique_lock<boost::shared_mutex> lock(mutex_);
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
104 oracleObservable_.EmitMessage(observer, message);
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 catch (Orthanc::OrthancException& e)
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
107 {
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
108 LOG(ERROR) << "Exception while emitting a message: " << e.What();
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
109 throw;
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
110 }
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
111 }
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
112
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
113 private:
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
114 #if 1
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
115 // if threaded (not wasm)
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
116 MessageBroker& broker_;
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
117 IObservable oracleObservable_;
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
118 ThreadedOracle oracle_;
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
119 boost::shared_mutex mutex_; // to serialize messages from the ThreadedOracle
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
120 #endif
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
121
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
122 void SelectNextTool();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
123
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
124 /**
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
125 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
126 scene coordinates
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 ScenePoint2D GetRandomPointInScene() const;
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> TrackerHitTest(const PointerEvent& e);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
131
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
132 boost::shared_ptr<IFlexiblePointerTracker> CreateSuitableTracker(
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
133 const SDL_Event& event,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
134 const PointerEvent& e);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
135
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
136 void TakeScreenshot(
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
137 const std::string& target,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
138 unsigned int canvasWidth,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
139 unsigned int canvasHeight);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
140
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 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
143 */
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
144 void Commit(boost::shared_ptr<TrackerCommand> cmd);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
145 void Undo();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
146 void Redo();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
147
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
148
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
149 // TODO private
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
150 void Handle(const DicomVolumeImage::GeometryReadyMessage& message);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
151 void Handle(const OracleCommandExceptionMessage& message);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
152
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
153 void SetVolume1(
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
154 int depth,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
155 const boost::shared_ptr<IVolumeSlicer>& volume,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
156 ILayerStyleConfigurator* style);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
157
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
158 void SetVolume2(
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
159 int depth,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
160 const boost::shared_ptr<IVolumeSlicer>& volume,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
161 ILayerStyleConfigurator* style);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
162
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
163 void SetStructureSet(
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
164 int depth,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
165 const boost::shared_ptr<DicomStructureSetLoader>& volume);
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
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
168
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
169 private:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
170 void DisplayFloatingCtrlInfoText(const PointerEvent& e);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
171 void DisplayInfoText();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
172 void HideInfoText();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
173
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
174 private:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
175 CoordinateSystem3D plane_;
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
176
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
177 boost::shared_ptr<VolumeSceneLayerSource> source1_, source2_, source3_;
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 /**
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
180 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
181 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
182 */
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
183 boost::shared_ptr<ViewportController> controller_;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
184
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
185 std::map<std::string, std::string> infoTextMap_;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
186 boost::shared_ptr<IFlexiblePointerTracker> activeTracker_;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
187
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
188 //static const int LAYER_POSITION = 150;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
189
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
190 int TEXTURE_2x2_1_ZINDEX;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
191 int TEXTURE_1x1_ZINDEX;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
192 int TEXTURE_2x2_2_ZINDEX;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
193 int LINESET_1_ZINDEX;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
194 int LINESET_2_ZINDEX;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
195 int FLOATING_INFOTEXT_LAYER_ZINDEX;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
196 int FIXED_INFOTEXT_LAYER_ZINDEX;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
197
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
198 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
199 boost::shared_ptr<UndoStack> undoStack_;
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 858
diff changeset
200 SdlOpenGLViewport viewport_;
827
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
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
206