Mercurial > hg > orthanc-stone
annotate Samples/Common/RtViewer.cpp @ 1383:ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 27 Apr 2020 10:01:03 +0200 |
parents | |
children | dfb48f0794b1 |
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 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
21 #include "RtViewer.h" |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
22 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
23 #include <stdio.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
24 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
25 #include <boost/shared_ptr.hpp> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
26 #include <boost/weak_ptr.hpp> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
27 #include <boost/make_shared.hpp> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
28 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
29 #include <Core/Images/Image.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
30 #include <Core/Images/ImageProcessing.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
31 #include <Core/Images/PngWriter.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
32 #include <Core/Logging.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
33 #include <Core/OrthancException.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
34 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
35 #include <Framework/OpenGL/SdlOpenGLContext.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
36 #include <Framework/StoneInitialization.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
37 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
38 #include <Framework/Scene2D/CairoCompositor.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
39 #include <Framework/Scene2D/ColorTextureSceneLayer.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
40 #include <Framework/Scene2D/OpenGLCompositor.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
41 #include <Framework/Scene2D/PanSceneTracker.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
42 #include <Framework/Scene2D/ZoomSceneTracker.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
43 #include <Framework/Scene2D/RotateSceneTracker.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
44 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
45 #include <Framework/Scene2DViewport/UndoStack.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
46 #include <Framework/Scene2DViewport/CreateLineMeasureTracker.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
47 #include <Framework/Scene2DViewport/CreateAngleMeasureTracker.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
48 #include <Framework/Scene2DViewport/IFlexiblePointerTracker.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
49 #include <Framework/Scene2DViewport/MeasureTool.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
50 #include <Framework/Scene2DViewport/PredeclaredTypes.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
51 #include <Framework/Volumes/VolumeSceneLayerSource.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
52 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
53 #include <Framework/Oracle/GetOrthancWebViewerJpegCommand.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
54 #include <Framework/Oracle/ThreadedOracle.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
55 #include <Framework/Scene2D/GrayscaleStyleConfigurator.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
56 #include <Framework/Scene2D/LookupTableStyleConfigurator.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
57 #include <Framework/Volumes/DicomVolumeImageMPRSlicer.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
58 #include <Framework/StoneException.h> |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
59 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
60 namespace OrthancStone |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
61 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
62 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
|
63 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
64 static const char* descs[] = { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
65 "RtViewerGuiTool_Rotate", |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
66 "RtViewerGuiTool_Pan", |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
67 "RtViewerGuiTool_Zoom", |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
68 "RtViewerGuiTool_LineMeasure", |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
69 "RtViewerGuiTool_CircleMeasure", |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
70 "RtViewerGuiTool_AngleMeasure", |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
71 "RtViewerGuiTool_EllipseMeasure", |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
72 "RtViewerGuiTool_LAST" |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
73 }; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
74 if (i >= RtViewerGuiTool_LAST) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
75 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
76 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
|
77 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
78 return descs[i]; |
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 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
81 void RtViewerApp::SelectNextTool() |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
82 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
83 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
|
84 if (currentTool_ == RtViewerGuiTool_LAST) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
85 currentTool_ = static_cast<RtViewerGuiTool>(0);; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
86 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
|
87 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
88 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
89 void RtViewerApp::DisplayInfoText() |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
90 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
91 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
|
92 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
93 Scene2D& scene = controller.GetScene(); |
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 // 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
|
96 OrthancStone::ICompositor& compositor = lock->GetCompositor(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
97 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
98 std::stringstream msg; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
99 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
100 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
|
101 kv != infoTextMap_.end(); ++kv) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
102 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
103 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
|
104 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
105 std::string msgS = msg.str(); |
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 TextSceneLayer* layerP = NULL; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
108 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
|
109 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
110 TextSceneLayer& layer = dynamic_cast<TextSceneLayer&>( |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
111 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
|
112 layerP = &layer; |
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 else |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
115 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
116 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
|
117 layerP = layer.get(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
118 layer->SetColor(0, 255, 0); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
119 layer->SetFontIndex(1); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
120 layer->SetBorder(20); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
121 layer->SetAnchor(BitmapAnchor_TopLeft); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
122 //layer->SetPosition(0,0); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
123 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
|
124 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
125 // 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
|
126 layerP->SetText(msgS.c_str()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
127 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
|
128 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
|
129 scene.GetCanvasToSceneTransform().Apply(cX, cY); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
130 layerP->SetPosition(cX, cY); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
131 lock->Invalidate(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
132 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
133 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
134 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
|
135 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
136 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
|
137 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
138 Scene2D& scene = controller.GetScene(); |
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 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
|
141 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
142 char buf[128]; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
143 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
|
144 p.GetX(), p.GetY(), |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
145 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
|
146 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
147 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
|
148 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
149 TextSceneLayer& layer = |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
150 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
|
151 layer.SetText(buf); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
152 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
|
153 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
154 else |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
155 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
156 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
|
157 layer->SetColor(0, 255, 0); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
158 layer->SetText(buf); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
159 layer->SetBorder(20); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
160 layer->SetAnchor(BitmapAnchor_BottomCenter); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
161 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
|
162 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
|
163 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
164 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
165 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
166 void RtViewerApp::HideInfoText() |
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 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
|
169 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
170 Scene2D& scene = controller.GetScene(); |
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 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
|
173 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
174 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
175 void RtViewerApp::HandleApplicationEvent( |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
176 const SDL_Event& event) |
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 //DisplayInfoText(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
179 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
180 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
|
181 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
182 Scene2D& scene = controller.GetScene(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
183 ICompositor& compositor = lock->GetCompositor(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
184 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
185 if (event.type == SDL_MOUSEMOTION) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
186 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
187 int scancodeCount = 0; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
188 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
|
189 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
190 if (activeTracker_.get() == NULL && |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
191 SDL_SCANCODE_LALT < scancodeCount && |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
192 keyboardState[SDL_SCANCODE_LALT]) |
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 // 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
|
195 // 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
|
196 PointerEvent e; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
197 e.AddPosition(compositor.GetPixelCenterCoordinates( |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
198 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
|
199 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
200 DisplayFloatingCtrlInfoText(e); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
201 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
202 else |
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 HideInfoText(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
205 //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
|
206 if (activeTracker_.get() != NULL) |
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 //LOG(TRACE) << "(activeTracker_.get() != NULL)"; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
209 PointerEvent e; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
210 e.AddPosition(compositor.GetPixelCenterCoordinates( |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
211 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
|
212 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
213 //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
|
214 // "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
|
215 LOG(TRACE) << "activeTracker_->PointerMove(e); " << |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
216 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
|
217 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
218 activeTracker_->PointerMove(e); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
219 if (!activeTracker_->IsAlive()) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
220 activeTracker_.reset(); |
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 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
223 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
224 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
|
225 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
226 if (activeTracker_) |
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 PointerEvent e; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
229 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
|
230 activeTracker_->PointerUp(e); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
231 if (!activeTracker_->IsAlive()) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
232 activeTracker_.reset(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
233 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
234 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
235 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
|
236 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
237 PointerEvent e; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
238 e.AddPosition(compositor.GetPixelCenterCoordinates( |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
239 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
|
240 if (activeTracker_) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
241 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
242 activeTracker_->PointerDown(e); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
243 if (!activeTracker_->IsAlive()) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
244 activeTracker_.reset(); |
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 else |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
247 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
248 // 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
|
249 activeTracker_ = CreateSuitableTracker(event, e); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
250 } |
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 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
|
253 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
|
254 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
255 switch (event.key.keysym.sym) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
256 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
257 case SDLK_ESCAPE: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
258 if (activeTracker_) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
259 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
260 activeTracker_->Cancel(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
261 if (!activeTracker_->IsAlive()) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
262 activeTracker_.reset(); |
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 break; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
265 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
266 case SDLK_t: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
267 if (!activeTracker_) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
268 SelectNextTool(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
269 else |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
270 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
271 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
|
272 " is taking place"; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
273 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
274 break; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
275 case SDLK_s: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
276 compositor.FitContent(scene); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
277 break; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
278 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
279 case SDLK_z: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
280 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
|
281 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
|
282 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
283 if (controller.CanUndo()) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
284 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
285 LOG(TRACE) << "Undoing..."; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
286 controller.Undo(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
287 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
288 else |
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 LOG(WARNING) << "Nothing to undo!!!"; |
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 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
293 break; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
294 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
295 case SDLK_y: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
296 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
|
297 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
|
298 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
299 if (controller.CanRedo()) |
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 LOG(TRACE) << "Redoing..."; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
302 controller.Redo(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
303 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
304 else |
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 LOG(WARNING) << "Nothing to redo!!!"; |
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 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
309 break; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
310 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
311 case SDLK_c: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
312 TakeScreenshot( |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
313 "screenshot.png", |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
314 compositor.GetCanvasWidth(), |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
315 compositor.GetCanvasHeight()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
316 break; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
317 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
318 default: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
319 break; |
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 else if (viewport_->IsRefreshEvent(event)) |
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 viewport_->Paint(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
325 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
326 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
327 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
328 void RtViewerApp::OnSceneTransformChanged( |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
329 const ViewportController::SceneTransformChanged& message) |
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 DisplayInfoText(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
332 } |
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 void RtViewerApp::RetrieveGeometry() |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
335 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
336 ORTHANC_ASSERT(geometryProvider_.get() != NULL); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
337 ORTHANC_ASSERT(geometryProvider_->HasGeometry()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
338 const VolumeImageGeometry& geometry = geometryProvider_->GetImageGeometry(); |
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 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
|
341 currentPlane_ = depth / 2; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
342 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
343 planes_.resize(depth); |
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 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
|
346 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
347 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
|
348 } |
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 UpdateLayers(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
351 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
352 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
|
353 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
|
354 lock->Invalidate(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
355 } |
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 void RtViewerApp::FitContent() |
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 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
|
360 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
|
361 lock->Invalidate(); |
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 void RtViewerApp::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<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 if ((planes_.size() == 0) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
368 && (geometryProvider_.get() != NULL) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
369 && (geometryProvider_->HasGeometry())) |
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 RetrieveGeometry(); |
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 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
374 if (currentPlane_ < planes_.size()) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
375 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
376 if (ctVolumeLayerSource_.get() != NULL) |
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 ctVolumeLayerSource_->Update(planes_[currentPlane_]); |
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 if (doseVolumeLayerSource_.get() != NULL) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
381 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
382 doseVolumeLayerSource_->Update(planes_[currentPlane_]); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
383 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
384 if (structLayerSource_.get() != NULL) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
385 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
386 structLayerSource_->Update(planes_[currentPlane_]); |
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 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
389 lock->Invalidate(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
390 } |
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 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
|
393 const SDL_Event& event, |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
394 const PointerEvent& e) |
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 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
|
397 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
398 Scene2D& scene = controller.GetScene(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
399 ICompositor& compositor = lock->GetCompositor(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
400 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
401 using namespace Orthanc; |
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 switch (event.button.button) |
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 case SDL_BUTTON_MIDDLE: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
406 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
|
407 (viewport_, e)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
408 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
409 case SDL_BUTTON_RIGHT: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
410 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
|
411 (viewport_, e, compositor.GetCanvasHeight())); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
412 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
413 case SDL_BUTTON_LEFT: |
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 //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
|
416 // 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
|
417 // 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
|
418 // 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
|
419 // a "measuring tool creation" tracker |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
420 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
421 // 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
|
422 // 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
|
423 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
|
424 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
425 if (hitTestTracker != NULL) |
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 //LOG(TRACE) << "hitTestTracker != NULL"; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
428 return hitTestTracker; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
429 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
430 else |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
431 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
432 switch (currentTool_) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
433 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
434 case RtViewerGuiTool_Rotate: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
435 //LOG(TRACE) << "Creating RotateSceneTracker"; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
436 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
|
437 case RtViewerGuiTool_Pan: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
438 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
|
439 case RtViewerGuiTool_Zoom: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
440 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
|
441 //case GuiTool_AngleMeasure: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
442 // return new AngleMeasureTracker(GetScene(), e); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
443 //case GuiTool_CircleMeasure: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
444 // return new CircleMeasureTracker(GetScene(), e); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
445 //case GuiTool_EllipseMeasure: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
446 // return new EllipseMeasureTracker(GetScene(), e); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
447 case RtViewerGuiTool_LineMeasure: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
448 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
|
449 case RtViewerGuiTool_AngleMeasure: |
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 CreateAngleMeasureTracker(viewport_, e)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
451 case RtViewerGuiTool_CircleMeasure: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
452 LOG(ERROR) << "Not implemented yet!"; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
453 return boost::shared_ptr<IFlexiblePointerTracker>(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
454 case RtViewerGuiTool_EllipseMeasure: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
455 LOG(ERROR) << "Not implemented yet!"; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
456 return boost::shared_ptr<IFlexiblePointerTracker>(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
457 default: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
458 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
|
459 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
460 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
461 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
462 default: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
463 return boost::shared_ptr<IFlexiblePointerTracker>(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
464 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
465 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
466 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
467 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
468 RtViewerApp::RtViewerApp() |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
469 : oracle_(*this) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
470 , currentTool_(RtViewerGuiTool_Rotate) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
471 , undoStack_(new UndoStack) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
472 , currentPlane_(0) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
473 , projection_(VolumeProjection_Coronal) |
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 loadersContext_.reset(new GenericLoadersContext(1, 4, 1)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
476 loadersContext_->StartOracle(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
477 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
478 // 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
|
479 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
|
480 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
481 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
|
482 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
483 Scene2D& scene = controller.GetScene(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
484 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
485 //oracleObservable.RegisterObserverCallback |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
486 //(new Callable |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
487 // <RtViewerApp, SleepOracleCommand::TimeoutMessage>(*this, &RtViewerApp::Handle)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
488 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
489 //oracleObservable.RegisterObserverCallback |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
490 //(new Callable |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
491 // <Toto, GetOrthancImageCommand::SuccessMessage>(*this, &RtViewerApp::Handle)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
492 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
493 //oracleObservable.RegisterObserverCallback |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
494 //(new Callable |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
495 // <RtViewerApp, GetOrthancWebViewerJpegCommand::SuccessMessage>(*this, &ToRtViewerAppto::Handle)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
496 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
497 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
498 TEXTURE_2x2_1_ZINDEX = 1; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
499 TEXTURE_1x1_ZINDEX = 2; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
500 TEXTURE_2x2_2_ZINDEX = 3; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
501 LINESET_1_ZINDEX = 4; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
502 LINESET_2_ZINDEX = 5; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
503 FLOATING_INFOTEXT_LAYER_ZINDEX = 6; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
504 FIXED_INFOTEXT_LAYER_ZINDEX = 7; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
505 } |
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 void RtViewerApp::RegisterMessages() |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
508 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
509 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
|
510 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
511 Scene2D& scene = controller.GetScene(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
512 Register<OracleCommandExceptionMessage>(oracleObservable_, &RtViewerApp::Handle); |
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 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
523 void RtViewerApp::PrepareScene() |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
524 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
525 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
|
526 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
527 Scene2D& scene = controller.GetScene(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
528 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
529 // Texture of 2x2 size |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
530 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
531 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
|
532 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
533 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
|
534 p[0] = 255; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
535 p[1] = 0; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
536 p[2] = 0; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
537 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
538 p[3] = 0; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
539 p[4] = 255; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
540 p[5] = 0; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
541 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
542 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
|
543 p[0] = 0; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
544 p[1] = 0; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
545 p[2] = 255; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
546 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
547 p[3] = 255; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
548 p[4] = 0; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
549 p[5] = 0; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
550 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
551 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
|
552 } |
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 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
555 void RtViewerApp::DisableTracker() |
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 if (activeTracker_) |
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 activeTracker_->Cancel(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
560 activeTracker_.reset(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
561 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
562 } |
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 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
|
565 unsigned int canvasWidth, |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
566 unsigned int canvasHeight) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
567 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
568 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
|
569 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
570 Scene2D& scene = controller.GetScene(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
571 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
572 CairoCompositor compositor(canvasWidth, canvasHeight); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
573 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
|
574 compositor.Refresh(scene); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
575 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
576 Orthanc::ImageAccessor canvas; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
577 compositor.GetCanvas().GetReadOnlyAccessor(canvas); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
578 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
579 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
|
580 Orthanc::ImageProcessing::Convert(png, canvas); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
581 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
582 Orthanc::PngWriter writer; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
583 writer.WriteToFile(target, png); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
584 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
585 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
586 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
|
587 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
588 // 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
|
589 return boost::shared_ptr<IFlexiblePointerTracker>(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
590 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
591 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
592 static void GLAPIENTRY |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
593 OpenGLMessageCallback(GLenum source, |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
594 GLenum type, |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
595 GLuint id, |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
596 GLenum severity, |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
597 GLsizei length, |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
598 const GLchar* message, |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
599 const void* userParam) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
600 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
601 if (severity != GL_DEBUG_SEVERITY_NOTIFICATION) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
602 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
603 fprintf(stderr, "GL CALLBACK: %s type = 0x%x, severity = 0x%x, message = %s\n", |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
604 (type == GL_DEBUG_TYPE_ERROR ? "** GL ERROR **" : ""), |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
605 type, severity, message); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
606 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
607 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
608 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
609 static bool g_stopApplication = false; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
610 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
611 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
612 void RtViewerApp::Handle(const DicomVolumeImage::GeometryReadyMessage& message) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
613 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
614 RetrieveGeometry(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
615 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
616 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
617 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
618 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
|
619 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
620 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
|
621 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
622 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
|
623 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
624 switch (command.GetType()) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
625 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
626 case IOracleCommand::Type_GetOrthancWebViewerJpeg: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
627 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
|
628 break; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
629 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
630 default: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
631 break; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
632 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
633 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
634 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
635 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
636 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
|
637 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
638 UpdateLayers(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
639 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
640 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
641 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
|
642 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
643 UpdateLayers(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
644 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
645 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
646 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
|
647 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
648 //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
|
649 UpdateLayers(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
650 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
651 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
652 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
|
653 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
654 UpdateLayers(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
655 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
656 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
657 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
|
658 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
659 UpdateLayers(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
660 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
661 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
662 void RtViewerApp::SetCtVolume(int depth, |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
663 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
|
664 OrthancStone::ILayerStyleConfigurator* style) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
665 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
666 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
|
667 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
668 Scene2D& scene = controller.GetScene(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
669 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
670 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
|
671 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
672 if (style != NULL) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
673 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
674 ctVolumeLayerSource_->SetConfigurator(style); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
675 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
676 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
677 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
678 void RtViewerApp::SetDoseVolume(int depth, |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
679 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
|
680 OrthancStone::ILayerStyleConfigurator* style) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
681 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
682 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
|
683 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
684 Scene2D& scene = controller.GetScene(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
685 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
686 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
|
687 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
688 if (style != NULL) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
689 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
690 doseVolumeLayerSource_->SetConfigurator(style); |
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 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
693 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
694 void RtViewerApp::SetStructureSet(int depth, |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
695 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
|
696 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
697 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
|
698 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
699 Scene2D& scene = controller.GetScene(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
700 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
701 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
|
702 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
703 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
704 void RtViewerApp::Run() |
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 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
707 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
|
708 ViewportController& controller = lock->GetController(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
709 Scene2D& scene = controller.GetScene(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
710 ICompositor& compositor = lock->GetCompositor(); |
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 // False means we do NOT let Windows treat this as a legacy application |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
713 // that needs to be scaled |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
714 controller.FitContent(compositor.GetCanvasWidth(), compositor.GetCanvasHeight()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
715 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
716 glEnable(GL_DEBUG_OUTPUT); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
717 glDebugMessageCallback(OpenGLMessageCallback, 0); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
718 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
719 compositor.SetFont(0, Orthanc::EmbeddedResources::UBUNTU_FONT, |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
720 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
|
721 compositor.SetFont(1, Orthanc::EmbeddedResources::UBUNTU_FONT, |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
722 FONT_SIZE_1, Orthanc::Encoding_Latin1); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
723 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
724 //////// from loader |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
725 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
726 Orthanc::WebServiceParameters p; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
727 //p.SetUrl("http://localhost:8043/"); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
728 p.SetCredentials("orthanc", "orthanc"); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
729 oracle_.SetOrthancParameters(p); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
730 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
731 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
732 //////// from Run |
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 boost::shared_ptr<DicomVolumeImage> ctVolume(new DicomVolumeImage); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
735 boost::shared_ptr<DicomVolumeImage> doseVolume(new DicomVolumeImage); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
736 |
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 boost::shared_ptr<OrthancSeriesVolumeProgressiveLoader> ctLoader; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
739 boost::shared_ptr<OrthancMultiframeVolumeLoader> doseLoader; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
740 boost::shared_ptr<DicomStructureSetLoader> rtstructLoader; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
741 |
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 // "true" means use progressive quality (jpeg 50 --> jpeg 90 --> 16-bit raw) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
744 ctLoader = OrthancSeriesVolumeProgressiveLoader::Create(*loadersContext_, ctVolume, false); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
745 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
746 // we need to store the CT loader to ask from geometry details later on when geometry is loaded |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
747 geometryProvider_ = ctLoader; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
748 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
749 doseLoader = OrthancMultiframeVolumeLoader::Create(*loadersContext_, doseVolume); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
750 rtstructLoader = DicomStructureSetLoader::Create(*loadersContext_); |
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 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
753 Register<DicomVolumeImage::GeometryReadyMessage>(*ctLoader, &RtViewerApp::Handle); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
754 Register<OrthancSeriesVolumeProgressiveLoader::VolumeImageReadyInHighQuality>(*ctLoader, &RtViewerApp::HandleCTLoaded); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
755 Register<DicomVolumeImage::ContentUpdatedMessage>(*ctLoader, &RtViewerApp::HandleCTContentUpdated); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
756 Register<DicomVolumeImage::ContentUpdatedMessage>(*doseLoader, &RtViewerApp::HandleDoseLoaded); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
757 Register<DicomStructureSetLoader::StructuresReady>(*rtstructLoader, &RtViewerApp::HandleStructuresReady); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
758 Register<DicomStructureSetLoader::StructuresUpdated>(*rtstructLoader, &RtViewerApp::HandleStructuresUpdated); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
759 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
760 std::auto_ptr<GrayscaleStyleConfigurator> style(new GrayscaleStyleConfigurator); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
761 style->SetLinearInterpolation(true); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
762 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
763 this->SetCtVolume(LAYER_POSITION + 0, ctLoader, style.release()); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
764 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
765 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
766 std::unique_ptr<LookupTableStyleConfigurator> config(new LookupTableStyleConfigurator); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
767 config->SetLookupTable(Orthanc::EmbeddedResources::COLORMAP_HOT); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
768 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
769 boost::shared_ptr<DicomVolumeImageMPRSlicer> tmp(new DicomVolumeImageMPRSlicer(doseVolume)); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
770 this->SetDoseVolume(LAYER_POSITION + 1, tmp, config.release()); |
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 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
773 this->SetStructureSet(LAYER_POSITION + 2, rtstructLoader); |
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 #if 1 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
776 /* |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
777 BGO data |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
778 http://localhost:8042/twiga-orthanc-viewer-demo/twiga-orthanc-viewer-demo.html?ct-series=a04ecf01-79b2fc33-58239f7e-ad9db983-28e81afa |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
779 & |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
780 dose-instance=830a69ff-8e4b5ee3-b7f966c8-bccc20fb-d322dceb |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
781 & |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
782 struct-instance=54460695-ba3885ee-ddf61ac0-f028e31d-a6e474d9 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
783 */ |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
784 ctLoader->LoadSeries("a04ecf01-79b2fc33-58239f7e-ad9db983-28e81afa"); // CT |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
785 doseLoader->LoadInstance("830a69ff-8e4b5ee3-b7f966c8-bccc20fb-d322dceb"); // RT-DOSE |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
786 rtstructLoader->LoadInstance("54460695-ba3885ee-ddf61ac0-f028e31d-a6e474d9"); // RT-STRUCT |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
787 #else |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
788 //ctLoader->LoadSeries("cb3ea4d1-d08f3856-ad7b6314-74d88d77-60b05618"); // CT |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
789 //doseLoader->LoadInstance("41029085-71718346-811efac4-420e2c15-d39f99b6"); // RT-DOSE |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
790 //rtstructLoader->LoadInstance("83d9c0c3-913a7fee-610097d7-cbf0522d-fd75bee6"); // RT-STRUCT |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
791 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
792 // 2017-05-16 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
793 ctLoader->LoadSeries("a04ecf01-79b2fc33-58239f7e-ad9db983-28e81afa"); // CT |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
794 doseLoader->LoadInstance("eac822ef-a395f94e-e8121fe0-8411fef8-1f7bffad"); // RT-DOSE |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
795 rtstructLoader->LoadInstance("54460695-ba3885ee-ddf61ac0-f028e31d-a6e474d9"); // RT-STRUCT |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
796 #endif |
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 oracle_.Start(); |
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 //// END from loader |
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 while (!g_stopApplication) |
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 //compositor.Refresh(scene); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
805 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
806 //////// from loader |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
807 //// END from loader |
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 SDL_Event event; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
810 while (!g_stopApplication && SDL_PollEvent(&event)) |
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 if (event.type == SDL_QUIT) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
813 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
814 g_stopApplication = true; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
815 break; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
816 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
817 else if (event.type == SDL_WINDOWEVENT && |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
818 event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) |
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 DisableTracker(); // was: tracker.reset(NULL); |
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 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
|
823 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
|
824 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
825 switch (event.key.keysym.sym) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
826 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
827 case SDLK_f: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
828 // TODO: implement GetWindow!!! |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
829 // viewport_->GetContext()->GetWindow().ToggleMaximize(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
830 ORTHANC_ASSERT(false, "Please implement GetWindow()"); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
831 break; |
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 case SDLK_r: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
834 break; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
835 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
836 case SDLK_s: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
837 FitContent(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
838 break; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
839 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
840 case SDLK_q: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
841 g_stopApplication = true; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
842 break; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
843 default: |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
844 break; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
845 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
846 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
847 HandleApplicationEvent(event); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
848 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
849 SDL_Delay(1); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
850 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
851 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
852 //// from loader |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
853 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
854 //Orthanc::SystemToolbox::ServerBarrier(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
855 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
856 /** |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
857 * WARNING => The oracle must be stopped BEFORE the objects using |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
858 * it are destroyed!!! This forces to wait for the completion of |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
859 * the running callback methods. Otherwise, the callbacks methods |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
860 * might still be running while their parent object is destroyed, |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
861 * resulting in crashes. This is very visible if adding a sleep(), |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
862 * as in (*). |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
863 **/ |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
864 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
865 oracle_.Stop(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
866 //// END from loader |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
867 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
868 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
869 void RtViewerApp::SetInfoDisplayMessage( |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
870 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
|
871 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
872 if (value == "") |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
873 infoTextMap_.erase(key); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
874 else |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
875 infoTextMap_[key] = value; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
876 DisplayInfoText(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
877 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
878 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
879 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
880 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
881 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
882 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
|
883 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
884 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
|
885 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
886 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
|
887 if (app) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
888 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
889 app->SetInfoDisplayMessage(key, value); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
890 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
891 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
892 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
893 /** |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
894 * 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
|
895 * 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
|
896 * 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
|
897 **/ |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
898 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
|
899 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
900 using namespace OrthancStone; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
901 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
902 StoneInitialize(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
903 Orthanc::Logging::EnableInfoLevel(true); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
904 //Orthanc::Logging::EnableTraceLevel(true); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
905 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
906 try |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
907 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
908 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
|
909 g_app = app; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
910 //app->PrepareScene(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
911 app->Run(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
912 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
913 catch (Orthanc::OrthancException& e) |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
914 { |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
915 LOG(ERROR) << "EXCEPTION: " << e.What(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
916 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
917 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
918 StoneFinalize(); |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
919 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
920 return 0; |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
921 } |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
922 |
ab871499ed30
SingleFrameViewer: refactored file locations + names to share files for RtViewer
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
923 |