Mercurial > hg > orthanc-stone
annotate Samples/Common/RtViewer.cpp @ 1389:5c83be3a6be5
split SDL / common + RtViewer rename + html test file
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 28 Apr 2020 08:58:41 +0200 |
parents | dfb48f0794b1 |
children | ffdb82850e98 |
rev | line source |
---|---|
1383
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
1 /** |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
2 * Stone of Orthanc |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
6 * |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Affero General Public License |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
10 * the License, or (at your option) any later version. |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
11 * |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
15 * Affero General Public License for more details. |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
16 * |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Affero General Public License |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
19 **/ |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
20 |
1386
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
21 // Sample app |
1383
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
22 #include "RtViewer.h" |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
23 |
1386
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
24 // Stone of Orthanc |
1383
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
25 #include <Framework/OpenGL/SdlOpenGLContext.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
26 #include <Framework/StoneInitialization.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
27 #include <Framework/Scene2D/CairoCompositor.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
28 #include <Framework/Scene2D/ColorTextureSceneLayer.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
29 #include <Framework/Scene2D/OpenGLCompositor.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
30 #include <Framework/Scene2D/PanSceneTracker.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
31 #include <Framework/Scene2D/ZoomSceneTracker.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
32 #include <Framework/Scene2D/RotateSceneTracker.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
33 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
34 #include <Framework/Scene2DViewport/UndoStack.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
35 #include <Framework/Scene2DViewport/CreateLineMeasureTracker.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
36 #include <Framework/Scene2DViewport/CreateAngleMeasureTracker.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
37 #include <Framework/Scene2DViewport/IFlexiblePointerTracker.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
38 #include <Framework/Scene2DViewport/MeasureTool.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
39 #include <Framework/Scene2DViewport/PredeclaredTypes.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
40 #include <Framework/Volumes/VolumeSceneLayerSource.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
41 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
42 #include <Framework/Oracle/GetOrthancWebViewerJpegCommand.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
43 #include <Framework/Oracle/ThreadedOracle.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
44 #include <Framework/Scene2D/GrayscaleStyleConfigurator.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
45 #include <Framework/Scene2D/LookupTableStyleConfigurator.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
46 #include <Framework/Volumes/DicomVolumeImageMPRSlicer.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
47 #include <Framework/StoneException.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
48 |
1386
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
49 // Orthanc |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
50 #include <Core/Images/Image.h> |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
51 #include <Core/Images/ImageProcessing.h> |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
52 #include <Core/Images/PngWriter.h> |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
53 #include <Core/Logging.h> |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
54 #include <Core/OrthancException.h> |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
55 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
56 // System |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
57 #include <boost/shared_ptr.hpp> |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
58 #include <boost/weak_ptr.hpp> |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
59 #include <boost/make_shared.hpp> |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
60 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
61 #include <stdio.h> |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
62 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
63 |
1383
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
64 namespace OrthancStone |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
65 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
66 const char* RtViewerGuiToolToString(size_t i) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
67 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
68 static const char* descs[] = { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
69 "RtViewerGuiTool_Rotate", |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
70 "RtViewerGuiTool_Pan", |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
71 "RtViewerGuiTool_Zoom", |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
72 "RtViewerGuiTool_LineMeasure", |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
73 "RtViewerGuiTool_CircleMeasure", |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
74 "RtViewerGuiTool_AngleMeasure", |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
75 "RtViewerGuiTool_EllipseMeasure", |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
76 "RtViewerGuiTool_LAST" |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
77 }; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
78 if (i >= RtViewerGuiTool_LAST) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
79 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
80 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, "Wrong tool index"); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
81 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
82 return descs[i]; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
83 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
84 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
85 void RtViewerApp::SelectNextTool() |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
86 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
87 currentTool_ = static_cast<RtViewerGuiTool>(currentTool_ + 1); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
88 if (currentTool_ == RtViewerGuiTool_LAST) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
89 currentTool_ = static_cast<RtViewerGuiTool>(0);; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
90 printf("Current tool is now: %s\n", RtViewerGuiToolToString(currentTool_)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
91 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
92 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
93 void RtViewerApp::DisplayInfoText() |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
94 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
95 std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
96 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
97 Scene2D& scene = controller.GetScene(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
98 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
99 // do not try to use stuff too early! |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
100 OrthancStone::ICompositor& compositor = lock->GetCompositor(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
101 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
102 std::stringstream msg; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
103 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
104 for (std::map<std::string, std::string>::const_iterator kv = infoTextMap_.begin(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
105 kv != infoTextMap_.end(); ++kv) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
106 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
107 msg << kv->first << " : " << kv->second << std::endl; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
108 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
109 std::string msgS = msg.str(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
110 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
111 TextSceneLayer* layerP = NULL; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
112 if (scene.HasLayer(FIXED_INFOTEXT_LAYER_ZINDEX)) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
113 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
114 TextSceneLayer& layer = dynamic_cast<TextSceneLayer&>( |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
115 scene.GetLayer(FIXED_INFOTEXT_LAYER_ZINDEX)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
116 layerP = &layer; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
117 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
118 else |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
119 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
120 std::unique_ptr<TextSceneLayer> layer(new TextSceneLayer); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
121 layerP = layer.get(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
122 layer->SetColor(0, 255, 0); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
123 layer->SetFontIndex(1); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
124 layer->SetBorder(20); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
125 layer->SetAnchor(BitmapAnchor_TopLeft); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
126 //layer->SetPosition(0,0); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
127 scene.SetLayer(FIXED_INFOTEXT_LAYER_ZINDEX, layer.release()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
128 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
129 // position the fixed info text in the upper right corner |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
130 layerP->SetText(msgS.c_str()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
131 double cX = compositor.GetCanvasWidth() * (-0.5); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
132 double cY = compositor.GetCanvasHeight() * (-0.5); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
133 scene.GetCanvasToSceneTransform().Apply(cX, cY); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
134 layerP->SetPosition(cX, cY); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
135 lock->Invalidate(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
136 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
137 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
138 void RtViewerApp::DisplayFloatingCtrlInfoText(const PointerEvent& e) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
139 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
140 std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
141 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
142 Scene2D& scene = controller.GetScene(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
143 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
144 ScenePoint2D p = e.GetMainPosition().Apply(scene.GetCanvasToSceneTransform()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
145 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
146 char buf[128]; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
147 sprintf(buf, "S:(%0.02f,%0.02f) C:(%0.02f,%0.02f)", |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
148 p.GetX(), p.GetY(), |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
149 e.GetMainPosition().GetX(), e.GetMainPosition().GetY()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
150 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
151 if (scene.HasLayer(FLOATING_INFOTEXT_LAYER_ZINDEX)) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
152 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
153 TextSceneLayer& layer = |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
154 dynamic_cast<TextSceneLayer&>(scene.GetLayer(FLOATING_INFOTEXT_LAYER_ZINDEX)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
155 layer.SetText(buf); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
156 layer.SetPosition(p.GetX(), p.GetY()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
157 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
158 else |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
159 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
160 std::unique_ptr<TextSceneLayer> layer(new TextSceneLayer); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
161 layer->SetColor(0, 255, 0); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
162 layer->SetText(buf); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
163 layer->SetBorder(20); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
164 layer->SetAnchor(BitmapAnchor_BottomCenter); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
165 layer->SetPosition(p.GetX(), p.GetY()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
166 scene.SetLayer(FLOATING_INFOTEXT_LAYER_ZINDEX, layer.release()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
167 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
168 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
169 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
170 void RtViewerApp::HideInfoText() |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
171 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
172 std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
173 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
174 Scene2D& scene = controller.GetScene(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
175 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
176 scene.DeleteLayer(FLOATING_INFOTEXT_LAYER_ZINDEX); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
177 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
178 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
179 void RtViewerApp::HandleApplicationEvent( |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
180 const SDL_Event& event) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
181 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
182 //DisplayInfoText(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
183 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
184 std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
185 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
186 Scene2D& scene = controller.GetScene(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
187 ICompositor& compositor = lock->GetCompositor(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
188 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
189 if (event.type == SDL_MOUSEMOTION) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
190 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
191 int scancodeCount = 0; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
192 const uint8_t* keyboardState = SDL_GetKeyboardState(&scancodeCount); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
193 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
194 if (activeTracker_.get() == NULL && |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
195 SDL_SCANCODE_LALT < scancodeCount && |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
196 keyboardState[SDL_SCANCODE_LALT]) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
197 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
198 // The "left-ctrl" key is down, while no tracker is present |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
199 // Let's display the info text |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
200 PointerEvent e; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
201 e.AddPosition(compositor.GetPixelCenterCoordinates( |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
202 event.button.x, event.button.y)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
203 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
204 DisplayFloatingCtrlInfoText(e); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
205 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
206 else |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
207 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
208 HideInfoText(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
209 //LOG(TRACE) << "(event.type == SDL_MOUSEMOTION)"; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
210 if (activeTracker_.get() != NULL) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
211 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
212 //LOG(TRACE) << "(activeTracker_.get() != NULL)"; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
213 PointerEvent e; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
214 e.AddPosition(compositor.GetPixelCenterCoordinates( |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
215 event.button.x, event.button.y)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
216 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
217 //LOG(TRACE) << "event.button.x = " << event.button.x << " " << |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
218 // "event.button.y = " << event.button.y; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
219 LOG(TRACE) << "activeTracker_->PointerMove(e); " << |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
220 e.GetMainPosition().GetX() << " " << e.GetMainPosition().GetY(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
221 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
222 activeTracker_->PointerMove(e); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
223 if (!activeTracker_->IsAlive()) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
224 activeTracker_.reset(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
225 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
226 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
227 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
228 else if (event.type == SDL_MOUSEBUTTONUP) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
229 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
230 if (activeTracker_) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
231 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
232 PointerEvent e; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
233 e.AddPosition(compositor.GetPixelCenterCoordinates(event.button.x, event.button.y)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
234 activeTracker_->PointerUp(e); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
235 if (!activeTracker_->IsAlive()) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
236 activeTracker_.reset(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
237 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
238 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
239 else if (event.type == SDL_MOUSEBUTTONDOWN) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
240 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
241 PointerEvent e; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
242 e.AddPosition(compositor.GetPixelCenterCoordinates( |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
243 event.button.x, event.button.y)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
244 if (activeTracker_) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
245 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
246 activeTracker_->PointerDown(e); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
247 if (!activeTracker_->IsAlive()) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
248 activeTracker_.reset(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
249 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
250 else |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
251 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
252 // we ATTEMPT to create a tracker if need be |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
253 activeTracker_ = CreateSuitableTracker(event, e); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
254 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
255 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
256 else if (event.type == SDL_KEYDOWN && |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
257 event.key.repeat == 0 /* Ignore key bounce */) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
258 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
259 switch (event.key.keysym.sym) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
260 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
261 case SDLK_ESCAPE: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
262 if (activeTracker_) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
263 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
264 activeTracker_->Cancel(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
265 if (!activeTracker_->IsAlive()) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
266 activeTracker_.reset(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
267 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
268 break; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
269 |
1386
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
270 case SDLK_r: |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
271 UpdateLayers(); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
272 { |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
273 std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
274 lock->Invalidate(); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
275 } |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
276 break; |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
277 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
278 case SDLK_s: |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
279 compositor.FitContent(scene); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
280 break; |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
281 |
1383
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
282 case SDLK_t: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
283 if (!activeTracker_) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
284 SelectNextTool(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
285 else |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
286 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
287 LOG(WARNING) << "You cannot change the active tool when an interaction" |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
288 " is taking place"; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
289 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
290 break; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
291 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
292 case SDLK_z: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
293 LOG(TRACE) << "SDLK_z has been pressed. event.key.keysym.mod == " << event.key.keysym.mod; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
294 if (event.key.keysym.mod & KMOD_CTRL) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
295 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
296 if (controller.CanUndo()) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
297 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
298 LOG(TRACE) << "Undoing..."; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
299 controller.Undo(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
300 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
301 else |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
302 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
303 LOG(WARNING) << "Nothing to undo!!!"; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
304 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
305 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
306 break; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
307 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
308 case SDLK_y: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
309 LOG(TRACE) << "SDLK_y has been pressed. event.key.keysym.mod == " << event.key.keysym.mod; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
310 if (event.key.keysym.mod & KMOD_CTRL) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
311 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
312 if (controller.CanRedo()) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
313 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
314 LOG(TRACE) << "Redoing..."; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
315 controller.Redo(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
316 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
317 else |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
318 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
319 LOG(WARNING) << "Nothing to redo!!!"; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
320 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
321 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
322 break; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
323 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
324 case SDLK_c: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
325 TakeScreenshot( |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
326 "screenshot.png", |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
327 compositor.GetCanvasWidth(), |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
328 compositor.GetCanvasHeight()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
329 break; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
330 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
331 default: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
332 break; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
333 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
334 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
335 else if (viewport_->IsRefreshEvent(event)) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
336 { |
1389
5c83be3a6be5
split SDL / common + RtViewer rename + html test file
Benjamin Golinvaux <bgo@osimis.io>
parents:
1386
diff
changeset
|
337 // the viewport has been invalidated and requires repaint |
1383
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
338 viewport_->Paint(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
339 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
340 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
341 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
342 void RtViewerApp::OnSceneTransformChanged( |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
343 const ViewportController::SceneTransformChanged& message) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
344 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
345 DisplayInfoText(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
346 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
347 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
348 void RtViewerApp::RetrieveGeometry() |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
349 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
350 ORTHANC_ASSERT(geometryProvider_.get() != NULL); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
351 ORTHANC_ASSERT(geometryProvider_->HasGeometry()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
352 const VolumeImageGeometry& geometry = geometryProvider_->GetImageGeometry(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
353 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
354 const unsigned int depth = geometry.GetProjectionDepth(projection_); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
355 currentPlane_ = depth / 2; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
356 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
357 planes_.resize(depth); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
358 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
359 for (unsigned int z = 0; z < depth; z++) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
360 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
361 planes_[z] = geometry.GetProjectionSlice(projection_, z); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
362 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
363 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
364 UpdateLayers(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
365 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
366 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport_->Lock()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
367 lock->GetCompositor().FitContent(lock->GetController().GetScene()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
368 lock->Invalidate(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
369 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
370 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
371 void RtViewerApp::FitContent() |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
372 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
373 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport_->Lock()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
374 lock->GetCompositor().FitContent(lock->GetController().GetScene()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
375 lock->Invalidate(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
376 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
377 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
378 void RtViewerApp::UpdateLayers() |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
379 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
380 std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
381 if ((planes_.size() == 0) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
382 && (geometryProvider_.get() != NULL) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
383 && (geometryProvider_->HasGeometry())) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
384 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
385 RetrieveGeometry(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
386 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
387 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
388 if (currentPlane_ < planes_.size()) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
389 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
390 if (ctVolumeLayerSource_.get() != NULL) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
391 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
392 ctVolumeLayerSource_->Update(planes_[currentPlane_]); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
393 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
394 if (doseVolumeLayerSource_.get() != NULL) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
395 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
396 doseVolumeLayerSource_->Update(planes_[currentPlane_]); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
397 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
398 if (structLayerSource_.get() != NULL) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
399 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
400 structLayerSource_->Update(planes_[currentPlane_]); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
401 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
402 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
403 lock->Invalidate(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
404 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
405 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
406 boost::shared_ptr<IFlexiblePointerTracker> RtViewerApp::CreateSuitableTracker( |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
407 const SDL_Event& event, |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
408 const PointerEvent& e) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
409 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
410 std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
411 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
412 Scene2D& scene = controller.GetScene(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
413 ICompositor& compositor = lock->GetCompositor(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
414 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
415 using namespace Orthanc; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
416 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
417 switch (event.button.button) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
418 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
419 case SDL_BUTTON_MIDDLE: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
420 return boost::shared_ptr<IFlexiblePointerTracker>(new PanSceneTracker |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
421 (viewport_, e)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
422 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
423 case SDL_BUTTON_RIGHT: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
424 return boost::shared_ptr<IFlexiblePointerTracker>(new ZoomSceneTracker |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
425 (viewport_, e, compositor.GetCanvasHeight())); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
426 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
427 case SDL_BUTTON_LEFT: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
428 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
429 //LOG(TRACE) << "CreateSuitableTracker: case SDL_BUTTON_LEFT:"; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
430 // TODO: we need to iterate on the set of measuring tool and perform |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
431 // a hit test to check if a tracker needs to be created for edition. |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
432 // Otherwise, depending upon the active tool, we might want to create |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
433 // a "measuring tool creation" tracker |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
434 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
435 // TODO: if there are conflicts, we should prefer a tracker that |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
436 // pertains to the type of measuring tool currently selected (TBD?) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
437 boost::shared_ptr<IFlexiblePointerTracker> hitTestTracker = TrackerHitTest(e); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
438 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
439 if (hitTestTracker != NULL) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
440 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
441 //LOG(TRACE) << "hitTestTracker != NULL"; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
442 return hitTestTracker; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
443 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
444 else |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
445 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
446 switch (currentTool_) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
447 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
448 case RtViewerGuiTool_Rotate: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
449 //LOG(TRACE) << "Creating RotateSceneTracker"; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
450 return boost::shared_ptr<IFlexiblePointerTracker>(new RotateSceneTracker(viewport_, e)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
451 case RtViewerGuiTool_Pan: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
452 return boost::shared_ptr<IFlexiblePointerTracker>(new PanSceneTracker(viewport_, e)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
453 case RtViewerGuiTool_Zoom: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
454 return boost::shared_ptr<IFlexiblePointerTracker>(new ZoomSceneTracker(viewport_, e, compositor.GetCanvasHeight())); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
455 //case GuiTool_AngleMeasure: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
456 // return new AngleMeasureTracker(GetScene(), e); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
457 //case GuiTool_CircleMeasure: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
458 // return new CircleMeasureTracker(GetScene(), e); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
459 //case GuiTool_EllipseMeasure: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
460 // return new EllipseMeasureTracker(GetScene(), e); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
461 case RtViewerGuiTool_LineMeasure: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
462 return boost::shared_ptr<IFlexiblePointerTracker>(new CreateLineMeasureTracker(viewport_, e)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
463 case RtViewerGuiTool_AngleMeasure: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
464 return boost::shared_ptr<IFlexiblePointerTracker>(new CreateAngleMeasureTracker(viewport_, e)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
465 case RtViewerGuiTool_CircleMeasure: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
466 LOG(ERROR) << "Not implemented yet!"; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
467 return boost::shared_ptr<IFlexiblePointerTracker>(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
468 case RtViewerGuiTool_EllipseMeasure: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
469 LOG(ERROR) << "Not implemented yet!"; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
470 return boost::shared_ptr<IFlexiblePointerTracker>(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
471 default: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
472 throw OrthancException(ErrorCode_InternalError, "Wrong tool!"); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
473 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
474 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
475 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
476 default: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
477 return boost::shared_ptr<IFlexiblePointerTracker>(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
478 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
479 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
480 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
481 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
482 RtViewerApp::RtViewerApp() |
1386
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
483 : currentTool_(RtViewerGuiTool_Rotate) |
1383
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
484 , undoStack_(new UndoStack) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
485 , currentPlane_(0) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
486 , projection_(VolumeProjection_Coronal) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
487 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
488 // False means we do NOT let Windows treat this as a legacy application that needs to be scaled |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
489 viewport_ = SdlOpenGLViewport::Create("CT RTDOSE RTSTRUCT viewer", 1024, 1024, false); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
490 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
491 std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
492 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
493 Scene2D& scene = controller.GetScene(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
494 |
1386
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
495 // Create the volumes that will be filled later on |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
496 ctVolume_ = boost::make_shared<DicomVolumeImage>(); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
497 doseVolume_ = boost::make_shared<DicomVolumeImage>(); |
1383
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
498 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
499 TEXTURE_2x2_1_ZINDEX = 1; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
500 TEXTURE_1x1_ZINDEX = 2; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
501 TEXTURE_2x2_2_ZINDEX = 3; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
502 LINESET_1_ZINDEX = 4; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
503 LINESET_2_ZINDEX = 5; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
504 FLOATING_INFOTEXT_LAYER_ZINDEX = 6; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
505 FIXED_INFOTEXT_LAYER_ZINDEX = 7; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
506 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
507 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
508 void RtViewerApp::RegisterMessages() |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
509 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
510 std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
511 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
512 Scene2D& scene = controller.GetScene(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
513 Register<ViewportController::SceneTransformChanged>(controller, &RtViewerApp::OnSceneTransformChanged); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
514 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
515 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
516 boost::shared_ptr<RtViewerApp> RtViewerApp::Create() |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
517 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
518 boost::shared_ptr<RtViewerApp> thisOne(new RtViewerApp()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
519 thisOne->RegisterMessages(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
520 return thisOne; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
521 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
522 |
1386
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
523 #if 0 |
1383
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
524 void RtViewerApp::PrepareScene() |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
525 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
526 std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
527 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
528 Scene2D& scene = controller.GetScene(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
529 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
530 // Texture of 2x2 size |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
531 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
532 Orthanc::Image i(Orthanc::PixelFormat_RGB24, 2, 2, false); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
533 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
534 uint8_t* p = reinterpret_cast<uint8_t*>(i.GetRow(0)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
535 p[0] = 255; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
536 p[1] = 0; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
537 p[2] = 0; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
538 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
539 p[3] = 0; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
540 p[4] = 255; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
541 p[5] = 0; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
542 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
543 p = reinterpret_cast<uint8_t*>(i.GetRow(1)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
544 p[0] = 0; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
545 p[1] = 0; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
546 p[2] = 255; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
547 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
548 p[3] = 255; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
549 p[4] = 0; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
550 p[5] = 0; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
551 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
552 scene.SetLayer(TEXTURE_2x2_1_ZINDEX, new ColorTextureSceneLayer(i)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
553 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
554 } |
1386
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
555 #endif |
1383
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
556 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
557 void RtViewerApp::DisableTracker() |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
558 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
559 if (activeTracker_) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
560 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
561 activeTracker_->Cancel(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
562 activeTracker_.reset(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
563 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
564 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
565 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
566 void RtViewerApp::TakeScreenshot(const std::string& target, |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
567 unsigned int canvasWidth, |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
568 unsigned int canvasHeight) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
569 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
570 std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
571 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
572 Scene2D& scene = controller.GetScene(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
573 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
574 CairoCompositor compositor(canvasWidth, canvasHeight); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
575 compositor.SetFont(0, Orthanc::EmbeddedResources::UBUNTU_FONT, FONT_SIZE_0, Orthanc::Encoding_Latin1); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
576 compositor.Refresh(scene); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
577 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
578 Orthanc::ImageAccessor canvas; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
579 compositor.GetCanvas().GetReadOnlyAccessor(canvas); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
580 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
581 Orthanc::Image png(Orthanc::PixelFormat_RGB24, canvas.GetWidth(), canvas.GetHeight(), false); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
582 Orthanc::ImageProcessing::Convert(png, canvas); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
583 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
584 Orthanc::PngWriter writer; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
585 writer.WriteToFile(target, png); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
586 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
587 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
588 boost::shared_ptr<IFlexiblePointerTracker> RtViewerApp::TrackerHitTest(const PointerEvent& e) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
589 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
590 // std::vector<boost::shared_ptr<MeasureTool>> measureTools_; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
591 return boost::shared_ptr<IFlexiblePointerTracker>(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
592 } |
1386
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
593 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
594 void RtViewerApp::PrepareLoadersAndSlicers() |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
595 { |
1383
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
596 |
1386
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
597 //{ |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
598 // Orthanc::WebServiceParameters p; |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
599 // //p.SetUrl("http://localhost:8043/"); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
600 // p.SetCredentials("orthanc", "orthanc"); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
601 // oracle_.SetOrthancParameters(p); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
602 //} |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
603 |
1383
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
604 { |
1386
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
605 // "true" means use progressive quality (jpeg 50 --> jpeg 90 --> 16-bit raw) |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
606 // "false" means only using hi quality |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
607 // TODO: add flag for quality |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
608 ctLoader_ = OrthancSeriesVolumeProgressiveLoader::Create(*loadersContext_, ctVolume_, false); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
609 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
610 // we need to store the CT loader to ask from geometry details later on when geometry is loaded |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
611 geometryProvider_ = ctLoader_; |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
612 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
613 doseLoader_ = OrthancMultiframeVolumeLoader::Create(*loadersContext_, doseVolume_); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
614 rtstructLoader_ = DicomStructureSetLoader::Create(*loadersContext_); |
1383
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
615 } |
1386
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
616 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
617 /** |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
618 Register for notifications issued by the loaders |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
619 */ |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
620 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
621 Register<DicomVolumeImage::GeometryReadyMessage> |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
622 (*ctLoader_, &RtViewerApp::HandleGeometryReady); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
623 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
624 Register<OrthancSeriesVolumeProgressiveLoader::VolumeImageReadyInHighQuality> |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
625 (*ctLoader_, &RtViewerApp::HandleCTLoaded); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
626 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
627 Register<DicomVolumeImage::ContentUpdatedMessage> |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
628 (*ctLoader_, &RtViewerApp::HandleCTContentUpdated); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
629 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
630 Register<DicomVolumeImage::ContentUpdatedMessage> |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
631 (*doseLoader_, &RtViewerApp::HandleDoseLoaded); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
632 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
633 Register<DicomStructureSetLoader::StructuresReady> |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
634 (*rtstructLoader_, &RtViewerApp::HandleStructuresReady); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
635 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
636 Register<DicomStructureSetLoader::StructuresUpdated> |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
637 (*rtstructLoader_, &RtViewerApp::HandleStructuresUpdated); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
638 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
639 /** |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
640 Configure the CT |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
641 */ |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
642 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
643 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
644 std::auto_ptr<GrayscaleStyleConfigurator> style(new GrayscaleStyleConfigurator); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
645 style->SetLinearInterpolation(true); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
646 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
647 this->SetCtVolumeSlicer(LAYER_POSITION + 0, ctLoader_, style.release()); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
648 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
649 { |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
650 std::unique_ptr<LookupTableStyleConfigurator> config(new LookupTableStyleConfigurator); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
651 config->SetLookupTable(Orthanc::EmbeddedResources::COLORMAP_HOT); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
652 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
653 boost::shared_ptr<DicomVolumeImageMPRSlicer> tmp(new DicomVolumeImageMPRSlicer(doseVolume_)); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
654 this->SetDoseVolumeSlicer(LAYER_POSITION + 1, tmp, config.release()); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
655 } |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
656 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
657 this->SetStructureSet(LAYER_POSITION + 2, rtstructLoader_); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
658 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
659 #if 1 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
660 LOG(INFO) << "About to load:"; |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
661 LOG(INFO) << " CT : " << ctSeriesId_;; |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
662 LOG(INFO) << " RTDOSE : " << doseInstanceId_; |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
663 LOG(INFO) << " RTSTRUCT : " << rtStructInstanceId_; |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
664 ctLoader_->LoadSeries(ctSeriesId_); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
665 doseLoader_->LoadInstance(doseInstanceId_); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
666 rtstructLoader_->LoadInstanceFullVisibility(rtStructInstanceId_); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
667 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
668 #elif 0 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
669 /* |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
670 BGO data |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
671 http://localhost:8042/twiga-orthanc-viewer-demo/twiga-orthanc-viewer-demo.html?ct-series=a04ecf01-79b2fc33-58239f7e-ad9db983-28e81afa |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
672 & |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
673 dose-instance=830a69ff-8e4b5ee3-b7f966c8-bccc20fb-d322dceb |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
674 & |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
675 struct-instance=54460695-ba3885ee-ddf61ac0-f028e31d-a6e474d9 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
676 */ |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
677 ctLoader_->LoadSeries("a04ecf01-79b2fc33-58239f7e-ad9db983-28e81afa"); // CT |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
678 doseLoader_->LoadInstance("830a69ff-8e4b5ee3-b7f966c8-bccc20fb-d322dceb"); // RT-DOSE |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
679 rtstructLoader_->LoadInstanceFullVisibility("54460695-ba3885ee-ddf61ac0-f028e31d-a6e474d9"); // RT-STRUCT |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
680 #else |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
681 //SJO data |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
682 //ctLoader->LoadSeries("cb3ea4d1-d08f3856-ad7b6314-74d88d77-60b05618"); // CT |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
683 //doseLoader->LoadInstance("41029085-71718346-811efac4-420e2c15-d39f99b6"); // RT-DOSE |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
684 //rtstructLoader->LoadInstanceFullVisibility("83d9c0c3-913a7fee-610097d7-cbf0522d-fd75bee6"); // RT-STRUCT |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
685 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
686 // 2017-05-16 |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
687 ctLoader_->LoadSeries("a04ecf01-79b2fc33-58239f7e-ad9db983-28e81afa"); // CT |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
688 doseLoader_->LoadInstance("eac822ef-a395f94e-e8121fe0-8411fef8-1f7bffad"); // RT-DOSE |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
689 rtstructLoader_->LoadInstanceFullVisibility("54460695-ba3885ee-ddf61ac0-f028e31d-a6e474d9"); // RT-STRUCT |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
690 #endif |
1383
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
691 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
692 |
1386
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
693 #if 0 |
1383
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
694 void RtViewerApp::Handle(const OracleCommandExceptionMessage& message) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
695 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
696 const OracleCommandBase& command = dynamic_cast<const OracleCommandBase&>(message.GetOrigin()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
697 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
698 printf("EXCEPTION: [%s] on command type %d\n", message.GetException().What(), command.GetType()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
699 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
700 switch (command.GetType()) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
701 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
702 case IOracleCommand::Type_GetOrthancWebViewerJpeg: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
703 printf("URI: [%s]\n", dynamic_cast<const GetOrthancWebViewerJpegCommand&>(command).GetUri().c_str()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
704 break; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
705 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
706 default: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
707 break; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
708 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
709 } |
1386
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
710 #endif |
1383
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
711 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
712 |
1386
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
713 void RtViewerApp::HandleGeometryReady(const DicomVolumeImage::GeometryReadyMessage& message) |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
714 { |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
715 RetrieveGeometry(); |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
716 } |
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
717 |
1383
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
718 void RtViewerApp::HandleCTLoaded(const OrthancSeriesVolumeProgressiveLoader::VolumeImageReadyInHighQuality& message) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
719 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
720 UpdateLayers(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
721 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
722 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
723 void RtViewerApp::HandleCTContentUpdated(const DicomVolumeImage::ContentUpdatedMessage& message) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
724 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
725 UpdateLayers(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
726 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
727 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
728 void RtViewerApp::HandleDoseLoaded(const DicomVolumeImage::ContentUpdatedMessage& message) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
729 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
730 //TODO: compute dose extent, with outlier rejection |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
731 UpdateLayers(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
732 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
733 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
734 void RtViewerApp::HandleStructuresReady(const DicomStructureSetLoader::StructuresReady& message) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
735 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
736 UpdateLayers(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
737 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
738 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
739 void RtViewerApp::HandleStructuresUpdated(const DicomStructureSetLoader::StructuresUpdated& message) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
740 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
741 UpdateLayers(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
742 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
743 |
1386
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
744 void RtViewerApp::SetCtVolumeSlicer(int depth, |
1383
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
745 const boost::shared_ptr<OrthancStone::IVolumeSlicer>& volume, |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
746 OrthancStone::ILayerStyleConfigurator* style) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
747 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
748 std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
749 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
750 Scene2D& scene = controller.GetScene(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
751 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
752 ctVolumeLayerSource_.reset(new OrthancStone::VolumeSceneLayerSource(scene, depth, volume)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
753 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
754 if (style != NULL) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
755 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
756 ctVolumeLayerSource_->SetConfigurator(style); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
757 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
758 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
759 |
1386
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
760 void RtViewerApp::SetDoseVolumeSlicer(int depth, |
1383
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
761 const boost::shared_ptr<OrthancStone::IVolumeSlicer>& volume, |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
762 OrthancStone::ILayerStyleConfigurator* style) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
763 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
764 std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
765 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
766 Scene2D& scene = controller.GetScene(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
767 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
768 doseVolumeLayerSource_.reset(new OrthancStone::VolumeSceneLayerSource(scene, depth, volume)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
769 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
770 if (style != NULL) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
771 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
772 doseVolumeLayerSource_->SetConfigurator(style); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
773 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
774 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
775 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
776 void RtViewerApp::SetStructureSet(int depth, |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
777 const boost::shared_ptr<OrthancStone::DicomStructureSetLoader>& volume) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
778 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
779 std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
780 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
781 Scene2D& scene = controller.GetScene(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
782 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
783 structLayerSource_.reset(new OrthancStone::VolumeSceneLayerSource(scene, depth, volume)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
784 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
785 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
786 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
787 void RtViewerApp::SetInfoDisplayMessage( |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
788 std::string key, std::string value) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
789 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
790 if (value == "") |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
791 infoTextMap_.erase(key); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
792 else |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
793 infoTextMap_[key] = value; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
794 DisplayInfoText(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
795 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
796 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
797 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
798 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
799 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
800 boost::weak_ptr<OrthancStone::RtViewerApp> g_app; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
801 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
802 void RtViewer_SetInfoDisplayMessage(std::string key, std::string value) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
803 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
804 boost::shared_ptr<OrthancStone::RtViewerApp> app = g_app.lock(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
805 if (app) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
806 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
807 app->SetInfoDisplayMessage(key, value); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
808 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
809 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
810 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
811 /** |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
812 * IMPORTANT: The full arguments to "main()" are needed for SDL on |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
813 * Windows. Otherwise, one gets the linking error "undefined reference |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
814 * to `SDL_main'". https://wiki.libsdl.org/FAQWindows |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
815 **/ |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
816 int main(int argc, char* argv[]) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
817 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
818 using namespace OrthancStone; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
819 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
820 StoneInitialize(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
821 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
822 try |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
823 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
824 boost::shared_ptr<RtViewerApp> app = RtViewerApp::Create(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
825 g_app = app; |
1386
dfb48f0794b1
Ongoing splitting SDL vs WASM (preparing RtViewer WASM)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1383
diff
changeset
|
826 app->RunSdl(argc,argv); |
1383
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
827 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
828 catch (Orthanc::OrthancException& e) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
829 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
830 LOG(ERROR) << "EXCEPTION: " << e.What(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
831 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
832 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
833 StoneFinalize(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
834 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
835 return 0; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
836 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
837 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
838 |