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