MRPT  2.0.3
CWindowObserver.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #pragma once
11 
12 #include <mrpt/system/CObserver.h>
13 #include <mrpt/system/CTicTac.h>
14 
15 #include <map>
16 #include <string>
17 
18 namespace mrpt::graphslam
19 {
20 /**\brief Monitor events in the visualization window.
21  *
22  * \ingroup mrpt_graphslam_grp
23  */
25 {
26  public:
28  /**\brief Return a map of key code to a boolean indicating whether it was
29  * pressed since the previous time the class was quarried.
30  *
31  * \note By default the codes are reset every time the method is invoked,
32  * unless <em>reset_keypresses<\em> is set to False
33  */
34  void returnEventsStruct(
35  std::map<std::string, bool>* codes_to_pressed,
36  bool reset_keypresses = true);
37  /**\brief Make new keystrokes available in the help message box.
38  *
39  * Classes with access to the CWindowObserver can use this method to add
40  * keystrokes according to their needs
41  */
42  void registerKeystroke(
43  const std::string key_str, const std::string key_desc);
44 
45  protected:
46  void OnEvent(const mrpt::system::mrptEvent& e) override;
47 
48  private:
49  bool m_showing_help = false;
50  bool m_hiding_help = false;
51 
52  std::string m_help_msg;
53 
54  /**\brief Map from registered char_code (std::string to support <C-c>) to
55  * boolean
56  * true/false indicating whether it has been pressed since previous time
57  * checked
58  */
59  std::map<std::string, bool> m_key_codes_to_pressed;
61 };
62 } // namespace mrpt::graphslam
mrpt::system::mrptEvent
The basic event type for the observer-observable pattern in MRPT.
Definition: mrptEvent.h:31
mrpt::graphslam::CWindowObserver::m_key_codes_to_pressed
std::map< std::string, bool > m_key_codes_to_pressed
Map from registered char_code (std::string to support <C-c>) to boolean true/false indicating whether...
Definition: CWindowObserver.h:59
mrpt::graphslam::CWindowObserver::returnEventsStruct
void returnEventsStruct(std::map< std::string, bool > *codes_to_pressed, bool reset_keypresses=true)
Return a map of key code to a boolean indicating whether it was pressed since the previous time the c...
Definition: CWindowObserver.cpp:35
mrpt::system::CTicTac
A high-performance stopwatch, with typical resolution of nanoseconds.
Definition: system/CTicTac.h:17
mrpt::graphslam::CWindowObserver::m_help_msg
std::string m_help_msg
Definition: CWindowObserver.h:52
mrpt::graphslam::CWindowObserver::m_tim_show_start
mrpt::system::CTicTac m_tim_show_start
Definition: CWindowObserver.h:60
mrpt::graphslam::CWindowObserver
Monitor events in the visualization window.
Definition: CWindowObserver.h:24
mrpt::graphslam::CWindowObserver::registerKeystroke
void registerKeystroke(const std::string key_str, const std::string key_desc)
Make new keystrokes available in the help message box.
Definition: CWindowObserver.cpp:51
mrpt::graphslam::CWindowObserver::CWindowObserver
CWindowObserver()
Definition: CWindowObserver.cpp:19
mrpt::graphslam
SLAM methods related to graphs of pose constraints.
Definition: TUserOptionsChecker.h:30
mrpt::graphslam::CWindowObserver::m_tim_show_end
mrpt::system::CTicTac m_tim_show_end
Definition: CWindowObserver.h:60
mrpt::graphslam::CWindowObserver::m_hiding_help
bool m_hiding_help
Definition: CWindowObserver.h:50
CObserver.h
mrpt::graphslam::CWindowObserver::m_showing_help
bool m_showing_help
Definition: CWindowObserver.h:49
mrpt::system::CObserver
Inherit from this class to get notified about events from any CObservable object after subscribing to...
Definition: CObserver.h:34
CTicTac.h
mrpt::graphslam::CWindowObserver::OnEvent
void OnEvent(const mrpt::system::mrptEvent &e) override
This virtual function will be called upon receive of any event after starting listening at any CObser...
Definition: CWindowObserver.cpp:60



Page generated by Doxygen 1.8.17 for MRPT 2.0.3 at Fri May 15 15:49:54 UTC 2020