MRPT  1.9.9
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
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...
mrpt::system::CTicTac m_tim_show_end
The basic event type for the observer-observable pattern in MRPT.
Definition: mrptEvent.h:31
A high-performance stopwatch, with typical resolution of nanoseconds.
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...
void registerKeystroke(const std::string key_str, const std::string key_desc)
Make new keystrokes available in the help message box.
SLAM methods related to graphs of pose constraints.
Inherit from this class to get notified about events from any CObservable object after subscribing to...
Definition: CObserver.h:34
mrpt::system::CTicTac m_tim_show_start
Monitor events in the visualization window.
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...



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: c7a3bec24 Sun Mar 29 18:33:13 2020 +0200 at dom mar 29 18:50:38 CEST 2020