Mercurial > hg > orthanc-stone
comparison Samples/Sdl/TrackerSampleApp.h @ 660:cb3b76d16234
Added info display map to the app + global logging function + fixed bisecting
algo to display angle measure text label
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 14 May 2019 19:38:51 +0200 |
parents | 002d9562c8f5 |
children | 8b6adfb62a2f |
comparison
equal
deleted
inserted
replaced
659:68b5688241d5 | 660:cb3b76d16234 |
---|---|
26 | 26 |
27 #include <SDL.h> | 27 #include <SDL.h> |
28 | 28 |
29 #include <boost/make_shared.hpp> | 29 #include <boost/make_shared.hpp> |
30 #include <boost/shared_ptr.hpp> | 30 #include <boost/shared_ptr.hpp> |
31 #include <boost/enable_shared_from_this.hpp> | |
31 | 32 |
32 namespace OrthancStone | 33 namespace OrthancStone |
33 { | 34 { |
34 class TrackerCommand; | 35 class TrackerCommand; |
35 typedef boost::shared_ptr<TrackerCommand> TrackerCommandPtr; | 36 typedef boost::shared_ptr<TrackerCommand> TrackerCommandPtr; |
52 static const unsigned int FONT_SIZE_1 = 24; | 53 static const unsigned int FONT_SIZE_1 = 24; |
53 | 54 |
54 class Scene2D; | 55 class Scene2D; |
55 | 56 |
56 class TrackerSampleApp : public IObserver | 57 class TrackerSampleApp : public IObserver |
58 , public boost::enable_shared_from_this<TrackerSampleApp> | |
57 { | 59 { |
58 public: | 60 public: |
59 // 12 because. | 61 // 12 because. |
60 TrackerSampleApp(MessageBroker& broker) | 62 TrackerSampleApp(MessageBroker& broker); |
61 : IObserver(broker) | |
62 , currentTool_(GuiTool_Rotate) | |
63 , scene_(broker) | |
64 { | |
65 scene_.RegisterObserverCallback( | |
66 new Callable<TrackerSampleApp, Scene2D::SceneTransformChanged> | |
67 (*this, &TrackerSampleApp::OnSceneTransformChanged)); | |
68 | |
69 TEXTURE_2x2_1_ZINDEX = 1; | |
70 TEXTURE_1x1_ZINDEX = 2; | |
71 TEXTURE_2x2_2_ZINDEX = 3; | |
72 LINESET_1_ZINDEX = 4; | |
73 LINESET_2_ZINDEX = 5; | |
74 FLOATING_INFOTEXT_LAYER_ZINDEX = 6; | |
75 FIXED_INFOTEXT_LAYER_ZINDEX = 7; | |
76 } | |
77 void PrepareScene(); | 63 void PrepareScene(); |
78 void Run(); | 64 void Run(); |
79 | 65 void SetInfoDisplayMessage(std::string key, std::string value); |
80 void DisableTracker(); | 66 void DisableTracker(); |
81 | 67 |
82 Scene2D& GetScene(); | 68 Scene2D& GetScene(); |
83 | 69 |
84 void HandleApplicationEvent(const SDL_Event& event); | 70 void HandleApplicationEvent(const SDL_Event& event); |
122 WARNING: the measuring tools do store a reference to the scene, and it | 108 WARNING: the measuring tools do store a reference to the scene, and it |
123 paramount that the scene gets destroyed AFTER the measurement tools. | 109 paramount that the scene gets destroyed AFTER the measurement tools. |
124 */ | 110 */ |
125 Scene2D scene_; | 111 Scene2D scene_; |
126 | 112 |
113 std::map<std::string, std::string> infoTextMap_; | |
127 FlexiblePointerTrackerPtr activeTracker_; | 114 FlexiblePointerTrackerPtr activeTracker_; |
128 std::vector<TrackerCommandPtr> undoStack_; | 115 std::vector<TrackerCommandPtr> undoStack_; |
129 | 116 |
130 // we store the measure tools here so that they don't get deleted | 117 // we store the measure tools here so that they don't get deleted |
131 std::vector<MeasureToolPtr> measureTools_; | 118 std::vector<MeasureToolPtr> measureTools_; |