annotate Samples/Sdl/FusionMprSdl.cpp @ 1254:7a0460c5e98e broker

don't follow redirections if contacting the Orthanc REST API
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 08 Jan 2020 14:01:36 +0100
parents efc5b62b9539
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
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
21 #include "FusionMprSdl.h"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
22
1047
efc5b62b9539 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 938
diff changeset
23 #include "../../Framework/OpenGL/SdlOpenGLContext.h"
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
24
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
25 #include "../../Framework/StoneInitialization.h"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
26
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
27 #include "../../Framework/Scene2D/CairoCompositor.h"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
28 #include "../../Framework/Scene2D/ColorTextureSceneLayer.h"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
29 #include "../../Framework/Scene2D/OpenGLCompositor.h"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
30 #include "../../Framework/Scene2D/PanSceneTracker.h"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
31 #include "../../Framework/Scene2D/ZoomSceneTracker.h"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
32 #include "../../Framework/Scene2D/RotateSceneTracker.h"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
33
858
e3c56d4f863f GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents: 841
diff changeset
34 #include "../../Framework/Scene2DViewport/UndoStack.h"
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
35 #include "../../Framework/Scene2DViewport/CreateLineMeasureTracker.h"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
36 #include "../../Framework/Scene2DViewport/CreateAngleMeasureTracker.h"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
37 #include "../../Framework/Scene2DViewport/IFlexiblePointerTracker.h"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
38 #include "../../Framework/Scene2DViewport/MeasureTool.h"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
39 #include "../../Framework/Scene2DViewport/PredeclaredTypes.h"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
40
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
41 #include "../../Framework/Volumes/VolumeSceneLayerSource.h"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
42
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
43 #include <Core/Images/Image.h>
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
44 #include <Core/Images/ImageProcessing.h>
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
45 #include <Core/Images/PngWriter.h>
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
46 #include <Core/Logging.h>
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
47 #include <Core/OrthancException.h>
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
48
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
49 #include <boost/shared_ptr.hpp>
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
50 #include <boost/weak_ptr.hpp>
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
51 #include <boost/make_shared.hpp>
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
52
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
53 #include <stdio.h>
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
54 #include "../../Framework/Oracle/GetOrthancWebViewerJpegCommand.h"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
55 #include "../../Framework/Oracle/ThreadedOracle.h"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
56 #include "../../Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.h"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
57 #include "../../Framework/Loaders/OrthancMultiframeVolumeLoader.h"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
58 #include "../../Framework/Loaders/DicomStructureSetLoader.h"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
59 #include "../../Framework/Scene2D/GrayscaleStyleConfigurator.h"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
60 #include "../../Framework/Scene2D/LookupTableStyleConfigurator.h"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
61 #include "../../Framework/Volumes/DicomVolumeImageMPRSlicer.h"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
62 #include "Core/SystemToolbox.h"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
63
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
64 namespace OrthancStone
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
65 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
66 const char* FusionMprMeasureToolToString(size_t i)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
67 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
68 static const char* descs[] = {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
69 "FusionMprGuiTool_Rotate",
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
70 "FusionMprGuiTool_Pan",
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
71 "FusionMprGuiTool_Zoom",
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
72 "FusionMprGuiTool_LineMeasure",
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
73 "FusionMprGuiTool_CircleMeasure",
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
74 "FusionMprGuiTool_AngleMeasure",
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
75 "FusionMprGuiTool_EllipseMeasure",
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
76 "FusionMprGuiTool_LAST"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
77 };
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
78 if (i >= FusionMprGuiTool_LAST)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
79 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
80 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, "Wrong tool index");
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
81 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
82 return descs[i];
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
83 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
84
893
0c5201499af8 Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents: 891
diff changeset
85 Scene2D& FusionMprSdlApp::GetScene()
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
86 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
87 return controller_->GetScene();
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
893
0c5201499af8 Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents: 891
diff changeset
90 const Scene2D& FusionMprSdlApp::GetScene() const
827
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 return controller_->GetScene();
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
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
95 void FusionMprSdlApp::SelectNextTool()
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
96 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
97 currentTool_ = static_cast<FusionMprGuiTool>(currentTool_ + 1);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
98 if (currentTool_ == FusionMprGuiTool_LAST)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
99 currentTool_ = static_cast<FusionMprGuiTool>(0);;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
100 printf("Current tool is now: %s\n", FusionMprMeasureToolToString(currentTool_));
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
101 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
102
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
103 void FusionMprSdlApp::DisplayInfoText()
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
104 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
105 // do not try to use stuff too early!
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
106 ICompositor* pCompositor = &(viewport_.GetCompositor());
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
107 if (pCompositor == NULL)
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
108 return;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
109
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
110 std::stringstream msg;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
111
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
112 for (std::map<std::string, std::string>::const_iterator kv = infoTextMap_.begin();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
113 kv != infoTextMap_.end(); ++kv)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
114 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
115 msg << kv->first << " : " << kv->second << std::endl;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
116 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
117 std::string msgS = msg.str();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
118
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
119 TextSceneLayer* layerP = NULL;
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
120 if (GetScene().HasLayer(FIXED_INFOTEXT_LAYER_ZINDEX))
827
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 TextSceneLayer& layer = dynamic_cast<TextSceneLayer&>(
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
123 GetScene().GetLayer(FIXED_INFOTEXT_LAYER_ZINDEX));
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
124 layerP = &layer;
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 else
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 std::auto_ptr<TextSceneLayer> layer(new TextSceneLayer);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
129 layerP = layer.get();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
130 layer->SetColor(0, 255, 0);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
131 layer->SetFontIndex(1);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
132 layer->SetBorder(20);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
133 layer->SetAnchor(BitmapAnchor_TopLeft);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
134 //layer->SetPosition(0,0);
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
135 GetScene().SetLayer(FIXED_INFOTEXT_LAYER_ZINDEX, layer.release());
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
136 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
137 // position the fixed info text in the upper right corner
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
138 layerP->SetText(msgS.c_str());
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
139 double cX = viewport_.GetCompositor().GetCanvasWidth() * (-0.5);
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
140 double cY = viewport_.GetCompositor().GetCanvasHeight() * (-0.5);
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
141 GetScene().GetCanvasToSceneTransform().Apply(cX,cY);
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
142 layerP->SetPosition(cX, cY);
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
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
145 void FusionMprSdlApp::DisplayFloatingCtrlInfoText(const PointerEvent& e)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
146 {
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
147 ScenePoint2D p = e.GetMainPosition().Apply(GetScene().GetCanvasToSceneTransform());
827
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 char buf[128];
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
150 sprintf(buf, "S:(%0.02f,%0.02f) C:(%0.02f,%0.02f)",
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
151 p.GetX(), p.GetY(),
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
152 e.GetMainPosition().GetX(), e.GetMainPosition().GetY());
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
153
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
154 if (GetScene().HasLayer(FLOATING_INFOTEXT_LAYER_ZINDEX))
827
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 TextSceneLayer& layer =
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
157 dynamic_cast<TextSceneLayer&>(GetScene().GetLayer(FLOATING_INFOTEXT_LAYER_ZINDEX));
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
158 layer.SetText(buf);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
159 layer.SetPosition(p.GetX(), p.GetY());
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 else
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 std::auto_ptr<TextSceneLayer> layer(new TextSceneLayer);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
164 layer->SetColor(0, 255, 0);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
165 layer->SetText(buf);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
166 layer->SetBorder(20);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
167 layer->SetAnchor(BitmapAnchor_BottomCenter);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
168 layer->SetPosition(p.GetX(), p.GetY());
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
169 GetScene().SetLayer(FLOATING_INFOTEXT_LAYER_ZINDEX, layer.release());
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
170 }
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
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
173 void FusionMprSdlApp::HideInfoText()
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
174 {
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
175 GetScene().DeleteLayer(FLOATING_INFOTEXT_LAYER_ZINDEX);
827
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
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
178 void FusionMprSdlApp::HandleApplicationEvent(
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
179 const SDL_Event & event)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
180 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
181 DisplayInfoText();
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 if (event.type == SDL_MOUSEMOTION)
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 int scancodeCount = 0;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
186 const uint8_t* keyboardState = SDL_GetKeyboardState(&scancodeCount);
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 if (activeTracker_.get() == NULL &&
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
189 SDL_SCANCODE_LALT < scancodeCount &&
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
190 keyboardState[SDL_SCANCODE_LALT])
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
191 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
192 // The "left-ctrl" key is down, while no tracker is present
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
193 // Let's display the info text
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
194 PointerEvent e;
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
195 e.AddPosition(controller_->GetViewport().GetPixelCenterCoordinates(
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
196 event.button.x, event.button.y));
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 DisplayFloatingCtrlInfoText(e);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
199 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
200 else
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 HideInfoText();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
203 //LOG(TRACE) << "(event.type == SDL_MOUSEMOTION)";
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
204 if (activeTracker_.get() != NULL)
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 //LOG(TRACE) << "(activeTracker_.get() != NULL)";
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
207 PointerEvent e;
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
208 e.AddPosition(controller_->GetViewport().GetPixelCenterCoordinates(
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
209 event.button.x, event.button.y));
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
210
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
211 //LOG(TRACE) << "event.button.x = " << event.button.x << " " <<
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
212 // "event.button.y = " << event.button.y;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
213 LOG(TRACE) << "activeTracker_->PointerMove(e); " <<
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
214 e.GetMainPosition().GetX() << " " << e.GetMainPosition().GetY();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
215
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
216 activeTracker_->PointerMove(e);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
217 if (!activeTracker_->IsAlive())
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
218 activeTracker_.reset();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
219 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
220 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
221 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
222 else if (event.type == SDL_MOUSEBUTTONUP)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
223 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
224 if (activeTracker_)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
225 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
226 PointerEvent e;
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
227 e.AddPosition(controller_->GetViewport().GetPixelCenterCoordinates(event.button.x, event.button.y));
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
228 activeTracker_->PointerUp(e);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
229 if (!activeTracker_->IsAlive())
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
230 activeTracker_.reset();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
231 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
232 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
233 else if (event.type == SDL_MOUSEBUTTONDOWN)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
234 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
235 PointerEvent e;
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
236 e.AddPosition(controller_->GetViewport().GetPixelCenterCoordinates(
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
237 event.button.x, event.button.y));
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
238 if (activeTracker_)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
239 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
240 activeTracker_->PointerDown(e);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
241 if (!activeTracker_->IsAlive())
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
242 activeTracker_.reset();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
243 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
244 else
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
245 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
246 // we ATTEMPT to create a tracker if need be
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
247 activeTracker_ = CreateSuitableTracker(event, e);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
248 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
249 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
250 else if (event.type == SDL_KEYDOWN &&
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
251 event.key.repeat == 0 /* Ignore key bounce */)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
252 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
253 switch (event.key.keysym.sym)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
254 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
255 case SDLK_ESCAPE:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
256 if (activeTracker_)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
257 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
258 activeTracker_->Cancel();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
259 if (!activeTracker_->IsAlive())
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
260 activeTracker_.reset();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
261 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
262 break;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
263
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
264 case SDLK_t:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
265 if (!activeTracker_)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
266 SelectNextTool();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
267 else
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
268 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
269 LOG(WARNING) << "You cannot change the active tool when an interaction"
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
270 " is taking place";
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
271 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
272 break;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
273 case SDLK_s:
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
274 controller_->FitContent(viewport_.GetCompositor().GetCanvasWidth(),
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
275 viewport_.GetCompositor().GetCanvasHeight());
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
276 break;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
277
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
278 case SDLK_z:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
279 LOG(TRACE) << "SDLK_z has been pressed. event.key.keysym.mod == " << event.key.keysym.mod;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
280 if (event.key.keysym.mod & KMOD_CTRL)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
281 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
282 if (controller_->CanUndo())
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
283 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
284 LOG(TRACE) << "Undoing...";
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
285 controller_->Undo();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
286 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
287 else
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
288 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
289 LOG(WARNING) << "Nothing to undo!!!";
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
290 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
291 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
292 break;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
293
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
294 case SDLK_y:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
295 LOG(TRACE) << "SDLK_y has been pressed. event.key.keysym.mod == " << event.key.keysym.mod;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
296 if (event.key.keysym.mod & KMOD_CTRL)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
297 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
298 if (controller_->CanRedo())
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
299 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
300 LOG(TRACE) << "Redoing...";
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
301 controller_->Redo();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
302 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
303 else
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
304 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
305 LOG(WARNING) << "Nothing to redo!!!";
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
306 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
307 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
308 break;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
309
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
310 case SDLK_c:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
311 TakeScreenshot(
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
312 "screenshot.png",
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
313 viewport_.GetCompositor().GetCanvasWidth(),
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
314 viewport_.GetCompositor().GetCanvasHeight());
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
315 break;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
316
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
317 default:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
318 break;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
319 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
320 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
321 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
322
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
323
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
324 void FusionMprSdlApp::OnSceneTransformChanged(
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
325 const ViewportController::SceneTransformChanged& message)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
326 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
327 DisplayInfoText();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
328 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
329
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
330 boost::shared_ptr<IFlexiblePointerTracker> FusionMprSdlApp::CreateSuitableTracker(
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
331 const SDL_Event & event,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
332 const PointerEvent & e)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
333 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
334 using namespace Orthanc;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
335
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
336 switch (event.button.button)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
337 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
338 case SDL_BUTTON_MIDDLE:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
339 return boost::shared_ptr<IFlexiblePointerTracker>(new PanSceneTracker
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
340 (controller_, e));
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
341
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
342 case SDL_BUTTON_RIGHT:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
343 return boost::shared_ptr<IFlexiblePointerTracker>(new ZoomSceneTracker
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
344 (controller_, e, viewport_.GetCompositor().GetCanvasHeight()));
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
345
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
346 case SDL_BUTTON_LEFT:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
347 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
348 //LOG(TRACE) << "CreateSuitableTracker: case SDL_BUTTON_LEFT:";
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
349 // TODO: we need to iterate on the set of measuring tool and perform
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
350 // a hit test to check if a tracker needs to be created for edition.
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
351 // Otherwise, depending upon the active tool, we might want to create
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
352 // a "measuring tool creation" tracker
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
353
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
354 // TODO: if there are conflicts, we should prefer a tracker that
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
355 // pertains to the type of measuring tool currently selected (TBD?)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
356 boost::shared_ptr<IFlexiblePointerTracker> hitTestTracker = TrackerHitTest(e);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
357
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
358 if (hitTestTracker != NULL)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
359 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
360 //LOG(TRACE) << "hitTestTracker != NULL";
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
361 return hitTestTracker;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
362 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
363 else
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
364 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
365 switch (currentTool_)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
366 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
367 case FusionMprGuiTool_Rotate:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
368 //LOG(TRACE) << "Creating RotateSceneTracker";
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
369 return boost::shared_ptr<IFlexiblePointerTracker>(new RotateSceneTracker(
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
370 controller_, e));
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
371 case FusionMprGuiTool_Pan:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
372 return boost::shared_ptr<IFlexiblePointerTracker>(new PanSceneTracker(
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
373 controller_, e));
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
374 case FusionMprGuiTool_Zoom:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
375 return boost::shared_ptr<IFlexiblePointerTracker>(new ZoomSceneTracker(
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
376 controller_, e, viewport_.GetCompositor().GetCanvasHeight()));
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
377 //case GuiTool_AngleMeasure:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
378 // return new AngleMeasureTracker(GetScene(), e);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
379 //case GuiTool_CircleMeasure:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
380 // return new CircleMeasureTracker(GetScene(), e);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
381 //case GuiTool_EllipseMeasure:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
382 // return new EllipseMeasureTracker(GetScene(), e);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
383 case FusionMprGuiTool_LineMeasure:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
384 return boost::shared_ptr<IFlexiblePointerTracker>(new CreateLineMeasureTracker(
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
385 IObserver::GetBroker(), controller_, e));
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
386 case FusionMprGuiTool_AngleMeasure:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
387 return boost::shared_ptr<IFlexiblePointerTracker>(new CreateAngleMeasureTracker(
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
388 IObserver::GetBroker(), controller_, e));
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
389 case FusionMprGuiTool_CircleMeasure:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
390 LOG(ERROR) << "Not implemented yet!";
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
391 return boost::shared_ptr<IFlexiblePointerTracker>();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
392 case FusionMprGuiTool_EllipseMeasure:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
393 LOG(ERROR) << "Not implemented yet!";
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
394 return boost::shared_ptr<IFlexiblePointerTracker>();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
395 default:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
396 throw OrthancException(ErrorCode_InternalError, "Wrong tool!");
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
397 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
398 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
399 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
400 default:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
401 return boost::shared_ptr<IFlexiblePointerTracker>();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
402 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
403 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
404
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
405
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
406 FusionMprSdlApp::FusionMprSdlApp(MessageBroker& broker)
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
407 : IObserver(broker)
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
408 , broker_(broker)
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
409 , oracleObservable_(broker)
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
410 , oracle_(*this)
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
411 , currentTool_(FusionMprGuiTool_Rotate)
858
e3c56d4f863f GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents: 841
diff changeset
412 , undoStack_(new UndoStack)
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
413 , viewport_("Hello", 1024, 1024, false) // False means we do NOT let Windows treat this as a legacy application that needs to be scaled
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
414 {
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
415 //oracleObservable.RegisterObserverCallback
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
416 //(new Callable
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
417 // <FusionMprSdlApp, SleepOracleCommand::TimeoutMessage>(*this, &FusionMprSdlApp::Handle));
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
418
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
419 //oracleObservable.RegisterObserverCallback
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
420 //(new Callable
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
421 // <Toto, GetOrthancImageCommand::SuccessMessage>(*this, &FusionMprSdlApp::Handle));
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
422
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
423 //oracleObservable.RegisterObserverCallback
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
424 //(new Callable
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
425 // <FusionMprSdlApp, GetOrthancWebViewerJpegCommand::SuccessMessage>(*this, &ToFusionMprSdlAppto::Handle));
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
426
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
427 oracleObservable_.RegisterObserverCallback
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
428 (new Callable
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
429 <FusionMprSdlApp, OracleCommandExceptionMessage>(*this, &FusionMprSdlApp::Handle));
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
430
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
431 controller_ = boost::shared_ptr<ViewportController>(
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
432 new ViewportController(undoStack_, broker_, viewport_));
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
433
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
434 controller_->RegisterObserverCallback(
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
435 new Callable<FusionMprSdlApp, ViewportController::SceneTransformChanged>
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
436 (*this, &FusionMprSdlApp::OnSceneTransformChanged));
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
437
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
438 TEXTURE_2x2_1_ZINDEX = 1;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
439 TEXTURE_1x1_ZINDEX = 2;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
440 TEXTURE_2x2_2_ZINDEX = 3;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
441 LINESET_1_ZINDEX = 4;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
442 LINESET_2_ZINDEX = 5;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
443 FLOATING_INFOTEXT_LAYER_ZINDEX = 6;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
444 FIXED_INFOTEXT_LAYER_ZINDEX = 7;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
445 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
446
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
447 void FusionMprSdlApp::PrepareScene()
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
448 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
449 // Texture of 2x2 size
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
450 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
451 Orthanc::Image i(Orthanc::PixelFormat_RGB24, 2, 2, false);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
452
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
453 uint8_t* p = reinterpret_cast<uint8_t*>(i.GetRow(0));
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
454 p[0] = 255;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
455 p[1] = 0;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
456 p[2] = 0;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
457
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
458 p[3] = 0;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
459 p[4] = 255;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
460 p[5] = 0;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
461
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
462 p = reinterpret_cast<uint8_t*>(i.GetRow(1));
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
463 p[0] = 0;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
464 p[1] = 0;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
465 p[2] = 255;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
466
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
467 p[3] = 255;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
468 p[4] = 0;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
469 p[5] = 0;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
470
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
471 GetScene().SetLayer(TEXTURE_2x2_1_ZINDEX, new ColorTextureSceneLayer(i));
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
472 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
473 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
474
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
475 void FusionMprSdlApp::DisableTracker()
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
476 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
477 if (activeTracker_)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
478 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
479 activeTracker_->Cancel();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
480 activeTracker_.reset();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
481 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
482 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
483
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
484 void FusionMprSdlApp::TakeScreenshot(const std::string& target,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
485 unsigned int canvasWidth,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
486 unsigned int canvasHeight)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
487 {
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
488 CairoCompositor compositor(GetScene(), canvasWidth, canvasHeight);
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
489 compositor.SetFont(0, Orthanc::EmbeddedResources::UBUNTU_FONT, FONT_SIZE_0, Orthanc::Encoding_Latin1);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
490 compositor.Refresh();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
491
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
492 Orthanc::ImageAccessor canvas;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
493 compositor.GetCanvas().GetReadOnlyAccessor(canvas);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
494
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
495 Orthanc::Image png(Orthanc::PixelFormat_RGB24, canvas.GetWidth(), canvas.GetHeight(), false);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
496 Orthanc::ImageProcessing::Convert(png, canvas);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
497
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
498 Orthanc::PngWriter writer;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
499 writer.WriteToFile(target, png);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
500 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
501
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
502
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
503 boost::shared_ptr<IFlexiblePointerTracker> FusionMprSdlApp::TrackerHitTest(const PointerEvent & e)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
504 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
505 // std::vector<boost::shared_ptr<MeasureTool>> measureTools_;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
506 return boost::shared_ptr<IFlexiblePointerTracker>();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
507 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
508
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
509 static void GLAPIENTRY
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
510 OpenGLMessageCallback(GLenum source,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
511 GLenum type,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
512 GLuint id,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
513 GLenum severity,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
514 GLsizei length,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
515 const GLchar* message,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
516 const void* userParam)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
517 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
518 if (severity != GL_DEBUG_SEVERITY_NOTIFICATION)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
519 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
520 fprintf(stderr, "GL CALLBACK: %s type = 0x%x, severity = 0x%x, message = %s\n",
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
521 (type == GL_DEBUG_TYPE_ERROR ? "** GL ERROR **" : ""),
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
522 type, severity, message);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
523 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
524 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
525
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
526 static bool g_stopApplication = false;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
527
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
528
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
529 void FusionMprSdlApp::Handle(const DicomVolumeImage::GeometryReadyMessage& message)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
530 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
531 printf("Geometry ready\n");
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
532
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
533 //plane_ = message.GetOrigin().GetGeometry().GetSagittalGeometry();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
534 //plane_ = message.GetOrigin().GetGeometry().GetAxialGeometry();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
535 plane_ = message.GetOrigin().GetGeometry().GetCoronalGeometry();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
536 plane_.SetOrigin(message.GetOrigin().GetGeometry().GetCoordinates(0.5f, 0.5f, 0.5f));
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
537
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
538 //Refresh();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
539 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
540
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
541
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
542 void FusionMprSdlApp::Handle(const OracleCommandExceptionMessage& message)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
543 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
544 printf("EXCEPTION: [%s] on command type %d\n", message.GetException().What(), message.GetCommand().GetType());
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
545
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
546 switch (message.GetCommand().GetType())
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
547 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
548 case IOracleCommand::Type_GetOrthancWebViewerJpeg:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
549 printf("URI: [%s]\n", dynamic_cast<const GetOrthancWebViewerJpegCommand&>
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
550 (message.GetCommand()).GetUri().c_str());
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
551 break;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
552
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
553 default:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
554 break;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
555 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
556 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
557
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
558 void FusionMprSdlApp::SetVolume1(int depth,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
559 const boost::shared_ptr<OrthancStone::IVolumeSlicer>& volume,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
560 OrthancStone::ILayerStyleConfigurator* style)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
561 {
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
562 source1_.reset(new OrthancStone::VolumeSceneLayerSource(controller_->GetScene(), depth, volume));
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
563
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
564 if (style != NULL)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
565 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
566 source1_->SetConfigurator(style);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
567 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
568 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
569
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
570 void FusionMprSdlApp::SetVolume2(int depth,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
571 const boost::shared_ptr<OrthancStone::IVolumeSlicer>& volume,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
572 OrthancStone::ILayerStyleConfigurator* style)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
573 {
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
574 source2_.reset(new OrthancStone::VolumeSceneLayerSource(controller_->GetScene(), depth, volume));
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
575
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
576 if (style != NULL)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
577 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
578 source2_->SetConfigurator(style);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
579 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
580 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
581
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
582 void FusionMprSdlApp::SetStructureSet(int depth,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
583 const boost::shared_ptr<OrthancStone::DicomStructureSetLoader>& volume)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
584 {
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
585 source3_.reset(new OrthancStone::VolumeSceneLayerSource(controller_->GetScene(), depth, volume));
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
586 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
587
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
588 void FusionMprSdlApp::Run()
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
589 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
590 // False means we do NOT let Windows treat this as a legacy application
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
591 // that needs to be scaled
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
592 controller_->FitContent(viewport_.GetCanvasWidth(), viewport_.GetCanvasHeight());
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
593
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
594 glEnable(GL_DEBUG_OUTPUT);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
595 glDebugMessageCallback(OpenGLMessageCallback, 0);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
596
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
597 viewport_.GetCompositor().SetFont(0, Orthanc::EmbeddedResources::UBUNTU_FONT,
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
598 FONT_SIZE_0, Orthanc::Encoding_Latin1);
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
599 viewport_.GetCompositor().SetFont(1, Orthanc::EmbeddedResources::UBUNTU_FONT,
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
600 FONT_SIZE_1, Orthanc::Encoding_Latin1);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
601
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
602
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
603 //////// from loader
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
604 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
605 Orthanc::WebServiceParameters p;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
606 //p.SetUrl("http://localhost:8043/");
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
607 p.SetCredentials("orthanc", "orthanc");
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
608 oracle_.SetOrthancParameters(p);
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
609 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
610
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
611 //////// from Run
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
612
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
613 boost::shared_ptr<DicomVolumeImage> ct(new DicomVolumeImage);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
614 boost::shared_ptr<DicomVolumeImage> dose(new DicomVolumeImage);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
615
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
616
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
617 boost::shared_ptr<OrthancSeriesVolumeProgressiveLoader> ctLoader;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
618 boost::shared_ptr<OrthancMultiframeVolumeLoader> doseLoader;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
619 boost::shared_ptr<DicomStructureSetLoader> rtstructLoader;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
620
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
621 {
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
622 ctLoader.reset(new OrthancSeriesVolumeProgressiveLoader(ct, oracle_, oracleObservable_));
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
623 doseLoader.reset(new OrthancMultiframeVolumeLoader(dose, oracle_, oracleObservable_));
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
624 rtstructLoader.reset(new DicomStructureSetLoader(oracle_, oracleObservable_));
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
625 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
626
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
627 //toto->SetReferenceLoader(*ctLoader);
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
628 //doseLoader->RegisterObserverCallback
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
629 //(new Callable
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
630 // <FusionMprSdlApp, DicomVolumeImage::GeometryReadyMessage>(*this, &FusionMprSdlApp::Handle));
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
631 ctLoader->RegisterObserverCallback
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
632 (new Callable
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
633 <FusionMprSdlApp, DicomVolumeImage::GeometryReadyMessage>(*this, &FusionMprSdlApp::Handle));
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
634
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
635 this->SetVolume1(0, ctLoader, new GrayscaleStyleConfigurator);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
636
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
637 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
638 std::auto_ptr<LookupTableStyleConfigurator> config(new LookupTableStyleConfigurator);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
639 config->SetLookupTable(Orthanc::EmbeddedResources::COLORMAP_HOT);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
640
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
641 boost::shared_ptr<DicomVolumeImageMPRSlicer> tmp(new DicomVolumeImageMPRSlicer(dose));
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
642 this->SetVolume2(1, tmp, config.release());
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
643 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
644
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
645 this->SetStructureSet(2, rtstructLoader);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
646
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
647 #if 1
839
c47031d9f6b1 Added dose struct load in (ongoing) FusionMprSample + doc change
Benjamin Golinvaux <bgo@osimis.io>
parents: 828
diff changeset
648 /*
c47031d9f6b1 Added dose struct load in (ongoing) FusionMprSample + doc change
Benjamin Golinvaux <bgo@osimis.io>
parents: 828
diff changeset
649 BGO data
c47031d9f6b1 Added dose struct load in (ongoing) FusionMprSample + doc change
Benjamin Golinvaux <bgo@osimis.io>
parents: 828
diff changeset
650 http://localhost:8042/twiga-orthanc-viewer-demo/twiga-orthanc-viewer-demo.html?ct-series=a04ecf01-79b2fc33-58239f7e-ad9db983-28e81afa
c47031d9f6b1 Added dose struct load in (ongoing) FusionMprSample + doc change
Benjamin Golinvaux <bgo@osimis.io>
parents: 828
diff changeset
651 &
c47031d9f6b1 Added dose struct load in (ongoing) FusionMprSample + doc change
Benjamin Golinvaux <bgo@osimis.io>
parents: 828
diff changeset
652 dose-instance=830a69ff-8e4b5ee3-b7f966c8-bccc20fb-d322dceb
c47031d9f6b1 Added dose struct load in (ongoing) FusionMprSample + doc change
Benjamin Golinvaux <bgo@osimis.io>
parents: 828
diff changeset
653 &
c47031d9f6b1 Added dose struct load in (ongoing) FusionMprSample + doc change
Benjamin Golinvaux <bgo@osimis.io>
parents: 828
diff changeset
654 struct-instance=54460695-ba3885ee-ddf61ac0-f028e31d-a6e474d9
c47031d9f6b1 Added dose struct load in (ongoing) FusionMprSample + doc change
Benjamin Golinvaux <bgo@osimis.io>
parents: 828
diff changeset
655 */
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
656 ctLoader->LoadSeries("a04ecf01-79b2fc33-58239f7e-ad9db983-28e81afa"); // CT
839
c47031d9f6b1 Added dose struct load in (ongoing) FusionMprSample + doc change
Benjamin Golinvaux <bgo@osimis.io>
parents: 828
diff changeset
657 doseLoader->LoadInstance("830a69ff-8e4b5ee3-b7f966c8-bccc20fb-d322dceb"); // RT-DOSE
c47031d9f6b1 Added dose struct load in (ongoing) FusionMprSample + doc change
Benjamin Golinvaux <bgo@osimis.io>
parents: 828
diff changeset
658 rtstructLoader->LoadInstance("54460695-ba3885ee-ddf61ac0-f028e31d-a6e474d9"); // RT-STRUCT
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
659 #else
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
660 //ctLoader->LoadSeries("cb3ea4d1-d08f3856-ad7b6314-74d88d77-60b05618"); // CT
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
661 //doseLoader->LoadInstance("41029085-71718346-811efac4-420e2c15-d39f99b6"); // RT-DOSE
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
662 //rtstructLoader->LoadInstance("83d9c0c3-913a7fee-610097d7-cbf0522d-fd75bee6"); // RT-STRUCT
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
663
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
664 // 2017-05-16
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
665 ctLoader->LoadSeries("a04ecf01-79b2fc33-58239f7e-ad9db983-28e81afa"); // CT
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
666 doseLoader->LoadInstance("eac822ef-a395f94e-e8121fe0-8411fef8-1f7bffad"); // RT-DOSE
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
667 rtstructLoader->LoadInstance("54460695-ba3885ee-ddf61ac0-f028e31d-a6e474d9"); // RT-STRUCT
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
668 #endif
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
669
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
670 oracle_.Start();
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
671
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
672 //// END from loader
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
673
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
674 while (!g_stopApplication)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
675 {
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
676 viewport_.GetCompositor().Refresh();
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
677
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
678 //////// from loader
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
679 if (source1_.get() != NULL)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
680 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
681 source1_->Update(plane_);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
682 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
683
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
684 if (source2_.get() != NULL)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
685 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
686 source2_->Update(plane_);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
687 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
688
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
689 if (source3_.get() != NULL)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
690 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
691 source3_->Update(plane_);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
692 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
693 //// END from loader
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
694
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
695 SDL_Event event;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
696 while (!g_stopApplication && SDL_PollEvent(&event))
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
697 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
698 if (event.type == SDL_QUIT)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
699 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
700 g_stopApplication = true;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
701 break;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
702 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
703 else if (event.type == SDL_WINDOWEVENT &&
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
704 event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
705 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
706 DisableTracker(); // was: tracker.reset(NULL);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
707 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
708 else if (event.type == SDL_KEYDOWN &&
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
709 event.key.repeat == 0 /* Ignore key bounce */)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
710 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
711 switch (event.key.keysym.sym)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
712 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
713 case SDLK_f:
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
714 viewport_.GetWindow().ToggleMaximize();
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
715 break;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
716
841
266e2b0b9abc better error reporting in DicomStructureSetLoader + fixed POST request logic
Benjamin Golinvaux <bgo@osimis.io>
parents: 839
diff changeset
717 case SDLK_s:
938
eaaa9b574e05 Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents: 900
diff changeset
718 controller_->FitContent(viewport_.GetCanvasWidth(), viewport_.GetCanvasHeight());
841
266e2b0b9abc better error reporting in DicomStructureSetLoader + fixed POST request logic
Benjamin Golinvaux <bgo@osimis.io>
parents: 839
diff changeset
719 break;
266e2b0b9abc better error reporting in DicomStructureSetLoader + fixed POST request logic
Benjamin Golinvaux <bgo@osimis.io>
parents: 839
diff changeset
720
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
721 case SDLK_q:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
722 g_stopApplication = true;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
723 break;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
724 default:
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
725 break;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
726 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
727 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
728 HandleApplicationEvent(event);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
729 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
730 SDL_Delay(1);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
731 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
732
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
733 //// from loader
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
734
841
266e2b0b9abc better error reporting in DicomStructureSetLoader + fixed POST request logic
Benjamin Golinvaux <bgo@osimis.io>
parents: 839
diff changeset
735 //Orthanc::SystemToolbox::ServerBarrier();
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
736
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
737 /**
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
738 * WARNING => The oracle must be stopped BEFORE the objects using
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
739 * it are destroyed!!! This forces to wait for the completion of
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
740 * the running callback methods. Otherwise, the callbacks methods
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
741 * might still be running while their parent object is destroyed,
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
742 * resulting in crashes. This is very visible if adding a sleep(),
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
743 * as in (*).
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
744 **/
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
745
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
746 oracle_.Stop();
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
747 //// END from loader
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
748 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
749
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
750 void FusionMprSdlApp::SetInfoDisplayMessage(
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
751 std::string key, std::string value)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
752 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
753 if (value == "")
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
754 infoTextMap_.erase(key);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
755 else
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
756 infoTextMap_[key] = value;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
757 DisplayInfoText();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
758 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
759
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
760 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
761
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
762
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
763 boost::weak_ptr<OrthancStone::FusionMprSdlApp> g_app;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
764
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
765 void FusionMprSdl_SetInfoDisplayMessage(std::string key, std::string value)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
766 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
767 boost::shared_ptr<OrthancStone::FusionMprSdlApp> app = g_app.lock();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
768 if (app)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
769 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
770 app->SetInfoDisplayMessage(key, value);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
771 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
772 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
773
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
774 /**
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
775 * IMPORTANT: The full arguments to "main()" are needed for SDL on
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
776 * Windows. Otherwise, one gets the linking error "undefined reference
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
777 * to `SDL_main'". https://wiki.libsdl.org/FAQWindows
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
778 **/
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
779 int main(int argc, char* argv[])
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
780 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
781 using namespace OrthancStone;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
782
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
783 StoneInitialize();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
784 Orthanc::Logging::EnableInfoLevel(true);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
785 // Orthanc::Logging::EnableTraceLevel(true);
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
786
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
787 try
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
788 {
828
28f99af358fa Merge + FusionMprSdl
Benjamin Golinvaux <bgo@osimis.io>
parents: 827
diff changeset
789 OrthancStone::MessageBroker broker;
827
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
790 boost::shared_ptr<FusionMprSdlApp> app(new FusionMprSdlApp(broker));
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
791 g_app = app;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
792 app->PrepareScene();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
793 app->Run();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
794 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
795 catch (Orthanc::OrthancException& e)
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
796 {
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
797 LOG(ERROR) << "EXCEPTION: " << e.What();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
798 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
799
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
800 StoneFinalize();
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
801
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
802 return 0;
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
803 }
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
804
2fd96a637a59 Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
805