Mercurial > hg > orthanc-stone
annotate Deprecated/Samples/Sdl/TrackerSampleApp.cpp @ 1452:ce167e076be4 loader-injection-feature
Work is done
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 02 Jun 2020 17:10:40 +0200 |
parents | 65e1e4b08302 |
children |
rev | line source |
---|---|
644 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
1270
2d8ab34c8c91
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1047
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
644 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 #include "TrackerSampleApp.h" | |
22 | |
1047 | 23 #include "../../Framework/OpenGL/SdlOpenGLContext.h" |
737 | 24 #include "../../Framework/Scene2D/CairoCompositor.h" |
25 #include "../../Framework/Scene2D/ColorTextureSceneLayer.h" | |
26 #include "../../Framework/Scene2D/OpenGLCompositor.h" | |
27 #include "../../Framework/Scene2D/PanSceneTracker.h" | |
28 #include "../../Framework/Scene2D/RotateSceneTracker.h" | |
29 #include "../../Framework/Scene2D/Scene2D.h" | |
30 #include "../../Framework/Scene2D/ZoomSceneTracker.h" | |
858
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
818
diff
changeset
|
31 #include "../../Framework/Scene2DViewport/UndoStack.h" |
737 | 32 #include "../../Framework/Scene2DViewport/CreateAngleMeasureTracker.h" |
33 #include "../../Framework/Scene2DViewport/CreateLineMeasureTracker.h" | |
34 #include "../../Framework/StoneInitialization.h" | |
698
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
660
diff
changeset
|
35 |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
660
diff
changeset
|
36 // From Orthanc framework |
644 | 37 #include <Core/Logging.h> |
38 #include <Core/OrthancException.h> | |
39 #include <Core/Images/Image.h> | |
40 #include <Core/Images/ImageProcessing.h> | |
41 #include <Core/Images/PngWriter.h> | |
42 | |
787
1a28fce57ff3
Fixed Visual Studio 2008 build
Benjamin Golinvaux <bgo@osimis.io>
parents:
761
diff
changeset
|
43 #include <boost/ref.hpp> |
1a28fce57ff3
Fixed Visual Studio 2008 build
Benjamin Golinvaux <bgo@osimis.io>
parents:
761
diff
changeset
|
44 #include <boost/make_shared.hpp> |
644 | 45 #include <SDL.h> |
787
1a28fce57ff3
Fixed Visual Studio 2008 build
Benjamin Golinvaux <bgo@osimis.io>
parents:
761
diff
changeset
|
46 |
644 | 47 #include <stdio.h> |
48 | |
49 namespace OrthancStone | |
50 { | |
51 const char* MeasureToolToString(size_t i) | |
52 { | |
53 static const char* descs[] = { | |
54 "GuiTool_Rotate", | |
55 "GuiTool_Pan", | |
56 "GuiTool_Zoom", | |
57 "GuiTool_LineMeasure", | |
58 "GuiTool_CircleMeasure", | |
59 "GuiTool_AngleMeasure", | |
60 "GuiTool_EllipseMeasure", | |
61 "GuiTool_LAST" | |
62 }; | |
63 if (i >= GuiTool_LAST) | |
64 { | |
65 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, "Wrong tool index"); | |
66 } | |
67 return descs[i]; | |
68 } | |
69 | |
70 void TrackerSampleApp::SelectNextTool() | |
71 { | |
72 currentTool_ = static_cast<GuiTool>(currentTool_ + 1); | |
73 if (currentTool_ == GuiTool_LAST) | |
74 currentTool_ = static_cast<GuiTool>(0);; | |
75 printf("Current tool is now: %s\n", MeasureToolToString(currentTool_)); | |
76 } | |
77 | |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
78 void TrackerSampleApp::DisplayInfoText() |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
79 { |
660
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
80 // do not try to use stuff too early! |
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
81 std::stringstream msg; |
706
ef07304d4423
Fixed C++ code to be C++03 compatible
Benjamin Golinvaux <bgo@osimis.io>
parents:
700
diff
changeset
|
82 |
ef07304d4423
Fixed C++ code to be C++03 compatible
Benjamin Golinvaux <bgo@osimis.io>
parents:
700
diff
changeset
|
83 for (std::map<std::string, std::string>::const_iterator kv = infoTextMap_.begin(); |
ef07304d4423
Fixed C++ code to be C++03 compatible
Benjamin Golinvaux <bgo@osimis.io>
parents:
700
diff
changeset
|
84 kv != infoTextMap_.end(); ++kv) |
660
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
85 { |
706
ef07304d4423
Fixed C++ code to be C++03 compatible
Benjamin Golinvaux <bgo@osimis.io>
parents:
700
diff
changeset
|
86 msg << kv->first << " : " << kv->second << std::endl; |
660
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
87 } |
706
ef07304d4423
Fixed C++ code to be C++03 compatible
Benjamin Golinvaux <bgo@osimis.io>
parents:
700
diff
changeset
|
88 std::string msgS = msg.str(); |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
89 |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
90 TextSceneLayer* layerP = NULL; |
891
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
890
diff
changeset
|
91 if (controller_->GetScene().HasLayer(FIXED_INFOTEXT_LAYER_ZINDEX)) |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
92 { |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
93 TextSceneLayer& layer = dynamic_cast<TextSceneLayer&>( |
891
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
890
diff
changeset
|
94 controller_->GetScene().GetLayer(FIXED_INFOTEXT_LAYER_ZINDEX)); |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
95 layerP = &layer; |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
96 } |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
97 else |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
98 { |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
99 std::unique_ptr<TextSceneLayer> layer(new TextSceneLayer); |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
100 layerP = layer.get(); |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
101 layer->SetColor(0, 255, 0); |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
102 layer->SetFontIndex(1); |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
103 layer->SetBorder(20); |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
104 layer->SetAnchor(BitmapAnchor_TopLeft); |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
105 //layer->SetPosition(0,0); |
891
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
890
diff
changeset
|
106 controller_->GetScene().SetLayer(FIXED_INFOTEXT_LAYER_ZINDEX, layer.release()); |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
107 } |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
108 // position the fixed info text in the upper right corner |
660
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
109 layerP->SetText(msgS.c_str()); |
893
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
110 double cX = GetCompositor().GetCanvasWidth() * (-0.5); |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
111 double cY = GetCompositor().GetCanvasHeight() * (-0.5); |
891
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
890
diff
changeset
|
112 controller_->GetScene().GetCanvasToSceneTransform().Apply(cX,cY); |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
113 layerP->SetPosition(cX, cY); |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
114 } |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
115 |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
116 void TrackerSampleApp::DisplayFloatingCtrlInfoText(const PointerEvent& e) |
644 | 117 { |
891
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
890
diff
changeset
|
118 ScenePoint2D p = e.GetMainPosition().Apply(controller_->GetScene().GetCanvasToSceneTransform()); |
644 | 119 |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
120 char buf[128]; |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
121 sprintf(buf, "S:(%0.02f,%0.02f) C:(%0.02f,%0.02f)", |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
122 p.GetX(), p.GetY(), |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
123 e.GetMainPosition().GetX(), e.GetMainPosition().GetY()); |
644 | 124 |
891
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
890
diff
changeset
|
125 if (controller_->GetScene().HasLayer(FLOATING_INFOTEXT_LAYER_ZINDEX)) |
644 | 126 { |
127 TextSceneLayer& layer = | |
891
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
890
diff
changeset
|
128 dynamic_cast<TextSceneLayer&>(controller_->GetScene().GetLayer(FLOATING_INFOTEXT_LAYER_ZINDEX)); |
644 | 129 layer.SetText(buf); |
130 layer.SetPosition(p.GetX(), p.GetY()); | |
131 } | |
132 else | |
133 { | |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
134 std::unique_ptr<TextSceneLayer> layer(new TextSceneLayer); |
644 | 135 layer->SetColor(0, 255, 0); |
136 layer->SetText(buf); | |
137 layer->SetBorder(20); | |
138 layer->SetAnchor(BitmapAnchor_BottomCenter); | |
139 layer->SetPosition(p.GetX(), p.GetY()); | |
891
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
890
diff
changeset
|
140 controller_->GetScene().SetLayer(FLOATING_INFOTEXT_LAYER_ZINDEX, layer.release()); |
644 | 141 } |
142 } | |
143 | |
144 void TrackerSampleApp::HideInfoText() | |
145 { | |
891
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
890
diff
changeset
|
146 controller_->GetScene().DeleteLayer(FLOATING_INFOTEXT_LAYER_ZINDEX); |
644 | 147 } |
148 | |
761
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
149 ScenePoint2D TrackerSampleApp::GetRandomPointInScene() const |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
150 { |
893
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
151 unsigned int w = GetCompositor().GetCanvasWidth(); |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
152 LOG(TRACE) << "GetCompositor().GetCanvasWidth() = " << |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
153 GetCompositor().GetCanvasWidth(); |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
154 unsigned int h = GetCompositor().GetCanvasHeight(); |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
155 LOG(TRACE) << "GetCompositor().GetCanvasHeight() = " << |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
156 GetCompositor().GetCanvasHeight(); |
761
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
157 |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
158 if ((w >= RAND_MAX) || (h >= RAND_MAX)) |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
159 LOG(WARNING) << "Canvas is too big : tools will not be randomly placed"; |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
160 |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
161 int x = rand() % w; |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
162 int y = rand() % h; |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
163 LOG(TRACE) << "random x = " << x << "random y = " << y; |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
164 |
893
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
165 ScenePoint2D p = controller_->GetViewport().GetPixelCenterCoordinates(x, y); |
761
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
166 LOG(TRACE) << "--> p.GetX() = " << p.GetX() << " p.GetY() = " << p.GetY(); |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
167 |
891
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
890
diff
changeset
|
168 ScenePoint2D r = p.Apply(controller_->GetScene().GetCanvasToSceneTransform()); |
761
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
169 LOG(TRACE) << "--> r.GetX() = " << r.GetX() << " r.GetY() = " << r.GetY(); |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
170 return r; |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
171 } |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
172 |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
173 void TrackerSampleApp::CreateRandomMeasureTool() |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
174 { |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
175 static bool srandCalled = false; |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
176 if (!srandCalled) |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
177 { |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
178 srand(42); |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
179 srandCalled = true; |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
180 } |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
181 |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
182 int i = rand() % 2; |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
183 LOG(TRACE) << "random i = " << i; |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
184 switch (i) |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
185 { |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
186 case 0: |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
187 // line measure |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
188 { |
818
e42b491f1fb2
Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents:
804
diff
changeset
|
189 boost::shared_ptr<CreateLineMeasureCommand> cmd = |
761
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
190 boost::make_shared<CreateLineMeasureCommand>( |
787
1a28fce57ff3
Fixed Visual Studio 2008 build
Benjamin Golinvaux <bgo@osimis.io>
parents:
761
diff
changeset
|
191 boost::ref(IObserver::GetBroker()), |
761
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
192 controller_, |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
193 GetRandomPointInScene()); |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
194 cmd->SetEnd(GetRandomPointInScene()); |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
195 controller_->PushCommand(cmd); |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
196 } |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
197 break; |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
198 case 1: |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
199 // angle measure |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
200 { |
818
e42b491f1fb2
Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents:
804
diff
changeset
|
201 boost::shared_ptr<CreateAngleMeasureCommand> cmd = |
761
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
202 boost::make_shared<CreateAngleMeasureCommand>( |
787
1a28fce57ff3
Fixed Visual Studio 2008 build
Benjamin Golinvaux <bgo@osimis.io>
parents:
761
diff
changeset
|
203 boost::ref(IObserver::GetBroker()), |
761
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
204 controller_, |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
205 GetRandomPointInScene()); |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
206 cmd->SetCenter(GetRandomPointInScene()); |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
207 cmd->SetSide2End(GetRandomPointInScene()); |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
208 controller_->PushCommand(cmd); |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
209 } |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
210 break; |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
211 } |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
212 } |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
213 |
644 | 214 void TrackerSampleApp::HandleApplicationEvent( |
215 const SDL_Event & event) | |
216 { | |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
217 DisplayInfoText(); |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
218 |
644 | 219 if (event.type == SDL_MOUSEMOTION) |
220 { | |
221 int scancodeCount = 0; | |
222 const uint8_t* keyboardState = SDL_GetKeyboardState(&scancodeCount); | |
223 | |
224 if (activeTracker_.get() == NULL && | |
750 | 225 SDL_SCANCODE_LALT < scancodeCount && |
226 keyboardState[SDL_SCANCODE_LALT]) | |
644 | 227 { |
228 // The "left-ctrl" key is down, while no tracker is present | |
229 // Let's display the info text | |
230 PointerEvent e; | |
893
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
231 e.AddPosition(controller_->GetViewport().GetPixelCenterCoordinates( |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
232 event.button.x, event.button.y)); |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
233 |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
234 DisplayFloatingCtrlInfoText(e); |
644 | 235 } |
871
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
236 else if (activeTracker_.get() != NULL) |
644 | 237 { |
238 HideInfoText(); | |
239 //LOG(TRACE) << "(event.type == SDL_MOUSEMOTION)"; | |
240 if (activeTracker_.get() != NULL) | |
241 { | |
242 //LOG(TRACE) << "(activeTracker_.get() != NULL)"; | |
243 PointerEvent e; | |
893
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
244 e.AddPosition(controller_->GetViewport().GetPixelCenterCoordinates( |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
245 event.button.x, event.button.y)); |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
246 |
644 | 247 //LOG(TRACE) << "event.button.x = " << event.button.x << " " << |
248 // "event.button.y = " << event.button.y; | |
761
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
249 LOG(TRACE) << "activeTracker_->PointerMove(e); " << |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
250 e.GetMainPosition().GetX() << " " << e.GetMainPosition().GetY(); |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
251 |
644 | 252 activeTracker_->PointerMove(e); |
700
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
699
diff
changeset
|
253 if (!activeTracker_->IsAlive()) |
706
ef07304d4423
Fixed C++ code to be C++03 compatible
Benjamin Golinvaux <bgo@osimis.io>
parents:
700
diff
changeset
|
254 activeTracker_.reset(); |
644 | 255 } |
256 } | |
871
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
257 else |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
258 { |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
259 HideInfoText(); |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
260 |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
261 PointerEvent e; |
893
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
262 e.AddPosition(controller_->GetViewport().GetPixelCenterCoordinates(event.button.x, event.button.y)); |
871
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
263 |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
264 ScenePoint2D scenePos = e.GetMainPosition().Apply( |
891
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
890
diff
changeset
|
265 controller_->GetScene().GetCanvasToSceneTransform()); |
871
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
266 //auto measureTools = GetController()->HitTestMeasureTools(scenePos); |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
267 //LOG(TRACE) << "# of hit tests: " << measureTools.size(); |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
268 |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
269 // this returns the collection of measuring tools where hit test is true |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
270 std::vector<boost::shared_ptr<MeasureTool> > measureTools = controller_->HitTestMeasureTools(scenePos); |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
271 |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
272 // let's refresh the measuring tools highlighted state |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
273 // first let's tag them as "unhighlighted" |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
274 controller_->ResetMeasuringToolsHighlight(); |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
275 |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
276 // then immediately take the first one and ask it to highlight the |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
277 // measuring tool UI part that is hot |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
278 if (measureTools.size() > 0) |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
279 { |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
280 measureTools[0]->Highlight(scenePos); |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
281 } |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
282 } |
644 | 283 } |
284 else if (event.type == SDL_MOUSEBUTTONUP) | |
285 { | |
286 if (activeTracker_) | |
287 { | |
288 PointerEvent e; | |
893
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
289 e.AddPosition(controller_->GetViewport().GetPixelCenterCoordinates(event.button.x, event.button.y)); |
644 | 290 activeTracker_->PointerUp(e); |
700
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
699
diff
changeset
|
291 if (!activeTracker_->IsAlive()) |
706
ef07304d4423
Fixed C++ code to be C++03 compatible
Benjamin Golinvaux <bgo@osimis.io>
parents:
700
diff
changeset
|
292 activeTracker_.reset(); |
644 | 293 } |
294 } | |
295 else if (event.type == SDL_MOUSEBUTTONDOWN) | |
296 { | |
297 PointerEvent e; | |
893
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
298 e.AddPosition(controller_->GetViewport().GetPixelCenterCoordinates( |
651
62f6ff016085
Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents:
644
diff
changeset
|
299 event.button.x, event.button.y)); |
644 | 300 if (activeTracker_) |
301 { | |
302 activeTracker_->PointerDown(e); | |
700
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
699
diff
changeset
|
303 if (!activeTracker_->IsAlive()) |
706
ef07304d4423
Fixed C++ code to be C++03 compatible
Benjamin Golinvaux <bgo@osimis.io>
parents:
700
diff
changeset
|
304 activeTracker_.reset(); |
644 | 305 } |
306 else | |
307 { | |
308 // we ATTEMPT to create a tracker if need be | |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
309 activeTracker_ = CreateSuitableTracker(event, e); |
644 | 310 } |
311 } | |
312 else if (event.type == SDL_KEYDOWN && | |
313 event.key.repeat == 0 /* Ignore key bounce */) | |
314 { | |
315 switch (event.key.keysym.sym) | |
316 { | |
317 case SDLK_ESCAPE: | |
318 if (activeTracker_) | |
319 { | |
320 activeTracker_->Cancel(); | |
700
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
699
diff
changeset
|
321 if (!activeTracker_->IsAlive()) |
706
ef07304d4423
Fixed C++ code to be C++03 compatible
Benjamin Golinvaux <bgo@osimis.io>
parents:
700
diff
changeset
|
322 activeTracker_.reset(); |
644 | 323 } |
324 break; | |
325 | |
326 case SDLK_t: | |
327 if (!activeTracker_) | |
328 SelectNextTool(); | |
329 else | |
330 { | |
331 LOG(WARNING) << "You cannot change the active tool when an interaction" | |
332 " is taking place"; | |
333 } | |
334 break; | |
335 | |
753 | 336 case SDLK_m: |
761
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
337 CreateRandomMeasureTool(); |
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
338 break; |
644 | 339 case SDLK_s: |
893
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
340 controller_->FitContent(GetCompositor().GetCanvasWidth(), |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
341 GetCompositor().GetCanvasHeight()); |
644 | 342 break; |
343 | |
750 | 344 case SDLK_z: |
761
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
345 LOG(TRACE) << "SDLK_z has been pressed. event.key.keysym.mod == " << event.key.keysym.mod; |
750 | 346 if (event.key.keysym.mod & KMOD_CTRL) |
347 { | |
348 if (controller_->CanUndo()) | |
349 { | |
761
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
350 LOG(TRACE) << "Undoing..."; |
750 | 351 controller_->Undo(); |
352 } | |
353 else | |
354 { | |
355 LOG(WARNING) << "Nothing to undo!!!"; | |
356 } | |
357 } | |
358 break; | |
359 | |
360 case SDLK_y: | |
761
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
361 LOG(TRACE) << "SDLK_y has been pressed. event.key.keysym.mod == " << event.key.keysym.mod; |
750 | 362 if (event.key.keysym.mod & KMOD_CTRL) |
363 { | |
364 if (controller_->CanRedo()) | |
365 { | |
761
07adcffba38c
truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents:
754
diff
changeset
|
366 LOG(TRACE) << "Redoing..."; |
750 | 367 controller_->Redo(); |
368 } | |
369 else | |
370 { | |
371 LOG(WARNING) << "Nothing to redo!!!"; | |
372 } | |
373 } | |
374 break; | |
375 | |
644 | 376 case SDLK_c: |
377 TakeScreenshot( | |
378 "screenshot.png", | |
893
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
379 GetCompositor().GetCanvasWidth(), |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
380 GetCompositor().GetCanvasHeight()); |
644 | 381 break; |
382 | |
383 default: | |
384 break; | |
385 } | |
386 } | |
387 } | |
388 | |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
389 |
700
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
699
diff
changeset
|
390 void TrackerSampleApp::OnSceneTransformChanged( |
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
699
diff
changeset
|
391 const ViewportController::SceneTransformChanged& message) |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
392 { |
660
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
393 DisplayInfoText(); |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
394 } |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
395 |
818
e42b491f1fb2
Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents:
804
diff
changeset
|
396 boost::shared_ptr<IFlexiblePointerTracker> TrackerSampleApp::CreateSuitableTracker( |
644 | 397 const SDL_Event & event, |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
398 const PointerEvent & e) |
644 | 399 { |
818
e42b491f1fb2
Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents:
804
diff
changeset
|
400 using namespace Orthanc; |
e42b491f1fb2
Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents:
804
diff
changeset
|
401 |
644 | 402 switch (event.button.button) |
403 { | |
404 case SDL_BUTTON_MIDDLE: | |
818
e42b491f1fb2
Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents:
804
diff
changeset
|
405 return boost::shared_ptr<IFlexiblePointerTracker>(new PanSceneTracker |
700
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
699
diff
changeset
|
406 (controller_, e)); |
644 | 407 |
408 case SDL_BUTTON_RIGHT: | |
818
e42b491f1fb2
Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents:
804
diff
changeset
|
409 return boost::shared_ptr<IFlexiblePointerTracker>(new ZoomSceneTracker |
893
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
410 (controller_, e, GetCompositor().GetCanvasHeight())); |
644 | 411 |
412 case SDL_BUTTON_LEFT: | |
413 { | |
414 //LOG(TRACE) << "CreateSuitableTracker: case SDL_BUTTON_LEFT:"; | |
415 // TODO: we need to iterate on the set of measuring tool and perform | |
416 // a hit test to check if a tracker needs to be created for edition. | |
417 // Otherwise, depending upon the active tool, we might want to create | |
418 // a "measuring tool creation" tracker | |
419 | |
420 // TODO: if there are conflicts, we should prefer a tracker that | |
421 // pertains to the type of measuring tool currently selected (TBD?) | |
818
e42b491f1fb2
Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents:
804
diff
changeset
|
422 boost::shared_ptr<IFlexiblePointerTracker> hitTestTracker = TrackerHitTest(e); |
644 | 423 |
424 if (hitTestTracker != NULL) | |
425 { | |
426 //LOG(TRACE) << "hitTestTracker != NULL"; | |
427 return hitTestTracker; | |
428 } | |
429 else | |
430 { | |
431 switch (currentTool_) | |
432 { | |
433 case GuiTool_Rotate: | |
434 //LOG(TRACE) << "Creating RotateSceneTracker"; | |
818
e42b491f1fb2
Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents:
804
diff
changeset
|
435 return boost::shared_ptr<IFlexiblePointerTracker>(new RotateSceneTracker( |
700
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
699
diff
changeset
|
436 controller_, e)); |
644 | 437 case GuiTool_Pan: |
818
e42b491f1fb2
Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents:
804
diff
changeset
|
438 return boost::shared_ptr<IFlexiblePointerTracker>(new PanSceneTracker( |
700
059e1fd05fd6
Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents:
699
diff
changeset
|
439 controller_, e)); |
644 | 440 case GuiTool_Zoom: |
818
e42b491f1fb2
Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents:
804
diff
changeset
|
441 return boost::shared_ptr<IFlexiblePointerTracker>(new ZoomSceneTracker( |
893
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
442 controller_, e, GetCompositor().GetCanvasHeight())); |
644 | 443 //case GuiTool_AngleMeasure: |
722
28b9e3a54200
Undo mechanism implemented (not connected to UI yet). Undo stack and measuring
Benjamin Golinvaux <bgo@osimis.io>
parents:
721
diff
changeset
|
444 // return new AngleMeasureTracker(GetScene(), e); |
644 | 445 //case GuiTool_CircleMeasure: |
722
28b9e3a54200
Undo mechanism implemented (not connected to UI yet). Undo stack and measuring
Benjamin Golinvaux <bgo@osimis.io>
parents:
721
diff
changeset
|
446 // return new CircleMeasureTracker(GetScene(), e); |
644 | 447 //case GuiTool_EllipseMeasure: |
722
28b9e3a54200
Undo mechanism implemented (not connected to UI yet). Undo stack and measuring
Benjamin Golinvaux <bgo@osimis.io>
parents:
721
diff
changeset
|
448 // return new EllipseMeasureTracker(GetScene(), e); |
651
62f6ff016085
Iteration in angle measuring tool. Text label is not ok and handles and arcs
Benjamin Golinvaux <bgo@osimis.io>
parents:
644
diff
changeset
|
449 case GuiTool_LineMeasure: |
818
e42b491f1fb2
Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents:
804
diff
changeset
|
450 return boost::shared_ptr<IFlexiblePointerTracker>(new CreateLineMeasureTracker( |
722
28b9e3a54200
Undo mechanism implemented (not connected to UI yet). Undo stack and measuring
Benjamin Golinvaux <bgo@osimis.io>
parents:
721
diff
changeset
|
451 IObserver::GetBroker(), controller_, e)); |
644 | 452 case GuiTool_AngleMeasure: |
818
e42b491f1fb2
Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents:
804
diff
changeset
|
453 return boost::shared_ptr<IFlexiblePointerTracker>(new CreateAngleMeasureTracker( |
722
28b9e3a54200
Undo mechanism implemented (not connected to UI yet). Undo stack and measuring
Benjamin Golinvaux <bgo@osimis.io>
parents:
721
diff
changeset
|
454 IObserver::GetBroker(), controller_, e)); |
644 | 455 case GuiTool_CircleMeasure: |
456 LOG(ERROR) << "Not implemented yet!"; | |
818
e42b491f1fb2
Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents:
804
diff
changeset
|
457 return boost::shared_ptr<IFlexiblePointerTracker>(); |
644 | 458 case GuiTool_EllipseMeasure: |
459 LOG(ERROR) << "Not implemented yet!"; | |
818
e42b491f1fb2
Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents:
804
diff
changeset
|
460 return boost::shared_ptr<IFlexiblePointerTracker>(); |
644 | 461 default: |
462 throw OrthancException(ErrorCode_InternalError, "Wrong tool!"); | |
463 } | |
464 } | |
465 } | |
466 default: | |
818
e42b491f1fb2
Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents:
804
diff
changeset
|
467 return boost::shared_ptr<IFlexiblePointerTracker>(); |
644 | 468 } |
469 } | |
470 | |
471 | |
660
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
472 TrackerSampleApp::TrackerSampleApp(MessageBroker& broker) : IObserver(broker) |
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
473 , currentTool_(GuiTool_Rotate) |
858
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
818
diff
changeset
|
474 , undoStack_(new UndoStack) |
893
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
475 , viewport_("Hello", 1024, 1024, false) // False means we do NOT let Windows treat this as a legacy application that needs to be scaled |
660
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
476 { |
858
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
818
diff
changeset
|
477 controller_ = boost::shared_ptr<ViewportController>( |
893
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
478 new ViewportController(undoStack_, broker, viewport_)); |
698
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
660
diff
changeset
|
479 |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
660
diff
changeset
|
480 controller_->RegisterObserverCallback( |
8b6adfb62a2f
Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
660
diff
changeset
|
481 new Callable<TrackerSampleApp, ViewportController::SceneTransformChanged> |
660
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
482 (*this, &TrackerSampleApp::OnSceneTransformChanged)); |
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
483 |
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
484 TEXTURE_2x2_1_ZINDEX = 1; |
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
485 TEXTURE_1x1_ZINDEX = 2; |
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
486 TEXTURE_2x2_2_ZINDEX = 3; |
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
487 LINESET_1_ZINDEX = 4; |
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
488 LINESET_2_ZINDEX = 5; |
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
489 FLOATING_INFOTEXT_LAYER_ZINDEX = 6; |
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
490 FIXED_INFOTEXT_LAYER_ZINDEX = 7; |
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
491 } |
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
492 |
644 | 493 void TrackerSampleApp::PrepareScene() |
494 { | |
495 // Texture of 2x2 size | |
496 { | |
497 Orthanc::Image i(Orthanc::PixelFormat_RGB24, 2, 2, false); | |
498 | |
499 uint8_t* p = reinterpret_cast<uint8_t*>(i.GetRow(0)); | |
500 p[0] = 255; | |
501 p[1] = 0; | |
502 p[2] = 0; | |
503 | |
504 p[3] = 0; | |
505 p[4] = 255; | |
506 p[5] = 0; | |
507 | |
508 p = reinterpret_cast<uint8_t*>(i.GetRow(1)); | |
509 p[0] = 0; | |
510 p[1] = 0; | |
511 p[2] = 255; | |
512 | |
513 p[3] = 255; | |
514 p[4] = 0; | |
515 p[5] = 0; | |
516 | |
891
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
890
diff
changeset
|
517 controller_->GetScene().SetLayer(TEXTURE_2x2_1_ZINDEX, new ColorTextureSceneLayer(i)); |
644 | 518 |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
519 std::unique_ptr<ColorTextureSceneLayer> l(new ColorTextureSceneLayer(i)); |
644 | 520 l->SetOrigin(-3, 2); |
521 l->SetPixelSpacing(1.5, 1); | |
522 l->SetAngle(20.0 / 180.0 * M_PI); | |
891
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
890
diff
changeset
|
523 controller_->GetScene().SetLayer(TEXTURE_2x2_2_ZINDEX, l.release()); |
644 | 524 } |
525 | |
526 // Texture of 1x1 size | |
527 { | |
528 Orthanc::Image i(Orthanc::PixelFormat_RGB24, 1, 1, false); | |
529 | |
530 uint8_t* p = reinterpret_cast<uint8_t*>(i.GetRow(0)); | |
531 p[0] = 255; | |
532 p[1] = 0; | |
533 p[2] = 0; | |
534 | |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
535 std::unique_ptr<ColorTextureSceneLayer> l(new ColorTextureSceneLayer(i)); |
644 | 536 l->SetOrigin(-2, 1); |
537 l->SetAngle(20.0 / 180.0 * M_PI); | |
891
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
890
diff
changeset
|
538 controller_->GetScene().SetLayer(TEXTURE_1x1_ZINDEX, l.release()); |
644 | 539 } |
540 | |
541 // Some lines | |
542 { | |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
543 std::unique_ptr<PolylineSceneLayer> layer(new PolylineSceneLayer); |
644 | 544 |
545 layer->SetThickness(1); | |
546 | |
547 PolylineSceneLayer::Chain chain; | |
548 chain.push_back(ScenePoint2D(0 - 0.5, 0 - 0.5)); | |
549 chain.push_back(ScenePoint2D(0 - 0.5, 2 - 0.5)); | |
550 chain.push_back(ScenePoint2D(2 - 0.5, 2 - 0.5)); | |
551 chain.push_back(ScenePoint2D(2 - 0.5, 0 - 0.5)); | |
804
61ba4b504e9a
PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
787
diff
changeset
|
552 layer->AddChain(chain, true, 255, 0, 0); |
644 | 553 |
554 chain.clear(); | |
555 chain.push_back(ScenePoint2D(-5, -5)); | |
556 chain.push_back(ScenePoint2D(5, -5)); | |
557 chain.push_back(ScenePoint2D(5, 5)); | |
558 chain.push_back(ScenePoint2D(-5, 5)); | |
804
61ba4b504e9a
PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
787
diff
changeset
|
559 layer->AddChain(chain, true, 0, 255, 0); |
644 | 560 |
561 double dy = 1.01; | |
562 chain.clear(); | |
563 chain.push_back(ScenePoint2D(-4, -4)); | |
564 chain.push_back(ScenePoint2D(4, -4 + dy)); | |
565 chain.push_back(ScenePoint2D(-4, -4 + 2.0 * dy)); | |
566 chain.push_back(ScenePoint2D(4, 2)); | |
804
61ba4b504e9a
PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
787
diff
changeset
|
567 layer->AddChain(chain, false, 0, 0, 255); |
644 | 568 |
891
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
890
diff
changeset
|
569 controller_->GetScene().SetLayer(LINESET_1_ZINDEX, layer.release()); |
644 | 570 } |
571 | |
572 // Some text | |
573 { | |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
574 std::unique_ptr<TextSceneLayer> layer(new TextSceneLayer); |
644 | 575 layer->SetText("Hello"); |
891
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
890
diff
changeset
|
576 controller_->GetScene().SetLayer(LINESET_2_ZINDEX, layer.release()); |
644 | 577 } |
578 } | |
579 | |
580 | |
581 void TrackerSampleApp::DisableTracker() | |
582 { | |
583 if (activeTracker_) | |
584 { | |
585 activeTracker_->Cancel(); | |
706
ef07304d4423
Fixed C++ code to be C++03 compatible
Benjamin Golinvaux <bgo@osimis.io>
parents:
700
diff
changeset
|
586 activeTracker_.reset(); |
644 | 587 } |
588 } | |
589 | |
590 void TrackerSampleApp::TakeScreenshot(const std::string& target, | |
591 unsigned int canvasWidth, | |
592 unsigned int canvasHeight) | |
593 { | |
893
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
594 CairoCompositor compositor(controller_->GetScene(), canvasWidth, canvasHeight); |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
595 compositor.SetFont(0, Orthanc::EmbeddedResources::UBUNTU_FONT, FONT_SIZE_0, Orthanc::Encoding_Latin1); |
644 | 596 compositor.Refresh(); |
597 | |
598 Orthanc::ImageAccessor canvas; | |
599 compositor.GetCanvas().GetReadOnlyAccessor(canvas); | |
600 | |
601 Orthanc::Image png(Orthanc::PixelFormat_RGB24, canvas.GetWidth(), canvas.GetHeight(), false); | |
602 Orthanc::ImageProcessing::Convert(png, canvas); | |
603 | |
604 Orthanc::PngWriter writer; | |
605 writer.WriteToFile(target, png); | |
606 } | |
607 | |
608 | |
818
e42b491f1fb2
Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents:
804
diff
changeset
|
609 boost::shared_ptr<IFlexiblePointerTracker> TrackerSampleApp::TrackerHitTest(const PointerEvent & e) |
644 | 610 { |
818
e42b491f1fb2
Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents:
804
diff
changeset
|
611 // std::vector<boost::shared_ptr<MeasureTool>> measureTools_; |
871
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
612 ScenePoint2D scenePos = e.GetMainPosition().Apply( |
891
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
890
diff
changeset
|
613 controller_->GetScene().GetCanvasToSceneTransform()); |
871
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
614 |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
615 std::vector<boost::shared_ptr<MeasureTool> > measureTools = controller_->HitTestMeasureTools(scenePos); |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
616 |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
617 if (measureTools.size() > 0) |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
618 { |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
619 return measureTools[0]->CreateEditionTracker(e); |
4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
620 } |
818
e42b491f1fb2
Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents:
804
diff
changeset
|
621 return boost::shared_ptr<IFlexiblePointerTracker>(); |
644 | 622 } |
623 | |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
624 static void GLAPIENTRY |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
625 OpenGLMessageCallback(GLenum source, |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
626 GLenum type, |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
627 GLuint id, |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
628 GLenum severity, |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
629 GLsizei length, |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
630 const GLchar* message, |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
631 const void* userParam) |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
632 { |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
633 if (severity != GL_DEBUG_SEVERITY_NOTIFICATION) |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
634 { |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
635 fprintf(stderr, "GL CALLBACK: %s type = 0x%x, severity = 0x%x, message = %s\n", |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
636 (type == GL_DEBUG_TYPE_ERROR ? "** GL ERROR **" : ""), |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
637 type, severity, message); |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
638 } |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
639 } |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
640 |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
641 static bool g_stopApplication = false; |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
642 |
938
eaaa9b574e05
Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
900
diff
changeset
|
643 ICompositor& TrackerSampleApp::GetCompositor() |
893
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
644 { |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
645 using namespace Orthanc; |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
646 try |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
647 { |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
648 SdlViewport& viewport = dynamic_cast<SdlViewport&>(viewport_); |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
649 return viewport.GetCompositor(); |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
650 } |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
651 catch (std::bad_cast e) |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
652 { |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
653 throw OrthancException(ErrorCode_InternalError, "Wrong viewport type!"); |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
654 } |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
655 } |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
656 |
938
eaaa9b574e05
Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
900
diff
changeset
|
657 const ICompositor& TrackerSampleApp::GetCompositor() const |
893
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
658 { |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
659 using namespace Orthanc; |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
660 try |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
661 { |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
662 SdlViewport& viewport = const_cast<SdlViewport&>(dynamic_cast<const SdlViewport&>(viewport_)); |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
663 return viewport.GetCompositor(); |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
664 } |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
665 catch (std::bad_cast e) |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
666 { |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
667 throw OrthancException(ErrorCode_InternalError, "Wrong viewport type!"); |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
668 } |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
669 } |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
670 |
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
671 |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
672 void TrackerSampleApp::Run() |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
673 { |
893
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
674 controller_->FitContent(viewport_.GetCanvasWidth(), viewport_.GetCanvasHeight()); |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
675 |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
676 glEnable(GL_DEBUG_OUTPUT); |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
677 glDebugMessageCallback(OpenGLMessageCallback, 0); |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
678 |
893
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
679 GetCompositor().SetFont(0, Orthanc::EmbeddedResources::UBUNTU_FONT, |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
680 FONT_SIZE_0, Orthanc::Encoding_Latin1); |
893
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
681 GetCompositor().SetFont(1, Orthanc::EmbeddedResources::UBUNTU_FONT, |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
682 FONT_SIZE_1, Orthanc::Encoding_Latin1); |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
683 |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
684 while (!g_stopApplication) |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
685 { |
893
0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents:
891
diff
changeset
|
686 GetCompositor().Refresh(); |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
687 |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
688 SDL_Event event; |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
689 while (!g_stopApplication && SDL_PollEvent(&event)) |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
690 { |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
691 if (event.type == SDL_QUIT) |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
692 { |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
693 g_stopApplication = true; |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
694 break; |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
695 } |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
696 else if (event.type == SDL_WINDOWEVENT && |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
697 event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
698 { |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
699 DisableTracker(); // was: tracker.reset(NULL); |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
700 } |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
701 else if (event.type == SDL_KEYDOWN && |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
702 event.key.repeat == 0 /* Ignore key bounce */) |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
703 { |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
704 switch (event.key.keysym.sym) |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
705 { |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
706 case SDLK_f: |
938
eaaa9b574e05
Fixed the Stone samples wrt the recent API changes (SdlOpenGLViewport, ICompositor...)
Benjamin Golinvaux <bgo@osimis.io>
parents:
900
diff
changeset
|
707 viewport_.GetWindow().ToggleMaximize(); |
656
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
708 break; |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
709 |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
710 case SDLK_q: |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
711 g_stopApplication = true; |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
712 break; |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
713 default: |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
714 break; |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
715 } |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
716 } |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
717 HandleApplicationEvent(event); |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
718 } |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
719 SDL_Delay(1); |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
720 } |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
721 } |
002d9562c8f5
Added support to DISABLE legacy scaling in SDL Windows (only in WIN32... this
Benjamin Golinvaux <bgo@osimis.io>
parents:
654
diff
changeset
|
722 |
660
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
723 void TrackerSampleApp::SetInfoDisplayMessage( |
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
724 std::string key, std::string value) |
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
725 { |
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
726 if (value == "") |
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
727 infoTextMap_.erase(key); |
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
728 else |
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
729 infoTextMap_[key] = value; |
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
730 DisplayInfoText(); |
cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
Benjamin Golinvaux <bgo@osimis.io>
parents:
656
diff
changeset
|
731 } |
644 | 732 |
733 } |