Main MRPT website > C++ reference for MRPT 1.9.9
WxSubsystem.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
12 #include <mrpt/config.h>
14 #include <mrpt/math/types_math.h>
15 #include <mrpt/gui/gui_frwds.h>
16 #include <mutex>
17 #include <queue>
18 #include <map>
19 #include <thread>
20 #include <future>
21 
22 #if MRPT_HAS_WXWIDGETS
23 
24 #include <wx/sizer.h>
25 #include <wx/statbmp.h>
26 #include <wx/menu.h>
27 #include <wx/toolbar.h>
28 #include <wx/frame.h>
29 #include <wx/timer.h>
30 #include <wx/statusbr.h>
31 #include <wx/msgdlg.h>
32 #include <wx/artprov.h>
33 #include <wx/bitmap.h>
34 #include <wx/intl.h>
35 #include <wx/image.h>
36 #include <wx/string.h>
37 #include <wx/msgdlg.h>
38 #include <wx/filedlg.h>
39 #include <wx/progdlg.h>
40 #include <wx/imaglist.h>
41 #include <wx/busyinfo.h>
42 #include <wx/log.h>
43 #include <wx/textdlg.h>
44 #include <wx/dirdlg.h>
45 #include <wx/colordlg.h>
46 #include <wx/dcmemory.h>
47 #include <wx/app.h>
48 #include <wx/pen.h>
49 
50 // The wxMathPlot library
51 #include <mrpt/otherlibs/mathplot/mathplot.h>
52 
53 #if 0
54 // The wxFreeChart library
55 #include <wx/chartpanel.h>
56 #include <wx/bars/barplot.h>
57 
58 #include <wx/axis/numberaxis.h>
59 #include <wx/axis/categoryaxis.h>
60 #include <wx/axis/dateaxis.h>
61 
62 #include <wx/xy/xyhistorenderer.h>
63 #include <wx/xy/xydataset.h>
64 #include <wx/xy/xylinerenderer.h>
65 #include <wx/xy/xyplot.h>
66 #include <wx/xy/xysimpledataset.h>
67 
68 #include <wx/xyz/xyzdataset.h>
69 #include <wx/xyz/bubbleplot.h>
70 
71 #include <wx/category/categorydataset.h>
72 #include <wx/category/categorysimpledataset.h>
73 #endif
74 
75 #endif
76 #include <mrpt/gui/gui_frwds.h>
77 
78 namespace mrpt
79 {
80 namespace gui
81 {
82 /** This class implements the GUI thread required for the wxWidgets-based GUI.
83  * This system is employed internally by gui::CDisplayWindow and
84  * gui::CDisplayWindow3D, and must be not used in any way directly by the MRPT
85  * user.
86  *
87  * The system works by creating a invisible wxFrame that process timer events
88  * where it checks a queue of requests sent from the main MRPT thread. The
89  * requests include the creation, deletion,... of windows (2D/3D). In that
90  * way, just one thread is required for all the GUI windows, and the wxWidgets
91  * is initialized and clean-up correctly.
92  *
93  * This header should be included just from the implementation files of
94  * CDisplayWindow and CDisplayWindow3D, since it uses wxWidgets classes.
95  *
96  * \sa gui::CDisplayWindow, gui::CDisplayWindow3D
97  * \ingroup mrpt_gui_grp
98  */
100 {
101 #if MRPT_HAS_WXWIDGETS
102 
103  public:
104  /** This method must be called in the destructor of the user class FROM THE
105  * MAIN THREAD, in order to wait for the shutdown of the wx thread if this
106  * was the last open window.
107  */
108  static void waitWxShutdownsIfNoWindows();
109 
110  /** Will be set to true at runtime if it's not detected a running wxApp
111  * instance.
112  * For console apps, we'll create a new thread and run wxEntry from there.
113  * For GUI apps (MRPT-based Windows are a part of a user wxWidget apps),
114  * we must leave the control of
115  * message dispatching to the current main loop, so we cannot create a
116  * different threads, making things a little different (hence this
117  * variable).
118  */
119  static bool isConsoleApp();
120 
121  /** An auxiliary global object used just to launch a final request to the
122  * wxSubsystem for shutdown:
123  */
125  {
126  public:
129  };
130 
132 
133  /** The main frame of the wxWidgets application
134  */
135  class CWXMainFrame : public wxFrame
136  {
138 
139  public:
140  CWXMainFrame(wxWindow* parent, wxWindowID id = -1);
141  virtual ~CWXMainFrame();
142 
143  /** Atomically increments the number of windows created with the main
144  * frame as parent.
145  * \return The updated number of windows.
146  */
147  static int notifyWindowCreation();
148 
149  /** Atomically decrements the number of windows created with the main
150  * frame as parent.
151  * \return The updated number of windows (0 if the calling was the last
152  * one).
153  */
154  static int notifyWindowDestruction();
155 
156  static volatile CWXMainFrame* oneInstance;
157 
158  private:
159  static std::mutex cs_windowCount;
160  static int m_windowCount;
161 
162  wxTimer* m_theTimer;
163 
164  void OnTimerProcessRequests(wxTimerEvent& event);
165 
166  DECLARE_EVENT_TABLE()
167 
168  }; // end class CWXMainFrame
169 
171  {
172  /** The thread ID of wxMainThread, or 0 if it is not running. */
173  std::thread m_wxMainThreadId;
174  /** This is signaled when wxMainThread is ready. */
175  std::promise<void> m_semWxMainThreadReady;
176  std::promise<void> m_done;
177  /** The critical section for accessing "m_wxMainThreadId" */
178  std::mutex m_csWxMainThreadId;
179  };
180 
182 
183  /** This will be the "MAIN" of wxWidgets: It starts an application object
184  * and does not end until all the windows are closed.
185  * Only one instance of this thread can be running at a given instant, no
186  * matter how many windows are open.
187  */
188  static void wxMainThread();
189 
190  /** The data structure for each inter-thread request:
191  */
193  {
195  : source2D(nullptr),
196  source3D(nullptr),
197  sourcePlots(nullptr),
199  voidPtr(nullptr),
200  voidPtr2(nullptr),
201  x(400),
202  y(400),
203  boolVal(false)
204  {
205  }
206 
207  /** Only one of source* can be non-nullptr, indicating the class that
208  * generated the request. */
210 
211  /** Only one of source* can be non-nullptr, indicating the class that
212  * generated the request. */
214 
215  /** Only one of source* can be non-nullptr, indicating the class that
216  * generated the request. */
218 
219  /** Only one of source* can be non-nullptr, indicating the class that
220  * generated the request. */
222 
223  /** Parameters, depending on OPCODE.
224  */
226 
227  /** Parameters, depending on OPCODE.
228  */
229  void *voidPtr, *voidPtr2;
230  int x, y;
231  bool boolVal;
234 
235  /** Valid codes are:
236  * For CDisplayWindow:
237  * - 200: Create a new 2D window, with caption "str" and initial
238  *size "x" & "y", and save the "wxFrame*" in the "void**" passed in
239  *voidPtr.
240  * - 201: Updates the image shown in the window, from a "wxImage*"
241  *passed in voidPtr2. The wxImage object will be freed with delete
242  *after that. voidPtr must be a "wxFrame*", a "CWindowDialog*"
243  *actually.
244  * - 202: Set position to x,y
245  * - 203: Change size to x,y
246  * - 204: Change title to "str"
247  * - 299: Delete the window associated with this source object.
248  *
249  * For CDisplayWindow3D:
250  * - 300: Create a new 3D window, with caption "str" and initial
251  *size "x" & "y", and save the "wxFrame*" in the "void**" passed in
252  *voidPtr.
253  * - 302: Set position to x,y
254  * - 303: Change size to x,y
255  * - 304: Change title to "str"
256  * - 350: Force refresh
257  * - 360: Add a 2D text message: vector_x: [0]:x, [1]:y, [2,3,4]:R
258  *G
259  *B, "x": enum of desired font. "y": unique index, "str": String.
260  * - 361: Clear all 2D text messages.
261  * - 362: Add a 2D text message (vectorized fonts)
262  * - 370: Change min/max range: min=vector_x[0], max=vector_x[1]
263  * - 399: Delete the window associated with this source object.
264  *
265  * For CDisplayWindowPlots:
266  * - 400: Create a new Plots window, with caption "str" and initial
267  *size "x" & "y",and save the "wxFrame*" in the "void**" passed in
268  *voidPtr.
269  * - 402: Set position to x,y
270  * - 403: Change size to x,y
271  * - 404: Change title to "str"
272  * - 499: Delete the window associated with this source object.
273  * - 410: Depending on "boolVal", enable/disable the mouse-zoom &
274  *pan
275  * - 411: Depending on "boolVal", enable/disable the aspect ratio
276  *fix
277  * - 412: Zoom over a rectangle vectorx[0-1] & vectory[0-1]
278  * - 413: Axis fit, with aspect ratio fix to boolVal.
279  * - 414: Clear all plot objects.
280  * - 420: Add/update a 2D line/points plot: x/y data=
281  *vector_x/vector_y, format string=str, plot name =plotName.
282  * - 421: Add/update a 2D ellipse: format string=str, plot name
283  *=plotName, vector_x[0,1]:X/Y center, vector_x[2]:quantiles,
284  *vector_y[0,1,2]: Covariance matrix entries 00,11,01,
285  *boolVal=showName?
286  * - 422: Add/update a bitmap: plot name =plotName,
287  *vector_x[0,1]:X/Y
288  *corner, vector_x[2,3]: X/Y widths, voidPtr2: pointer to a newly
289  *created wxImage with the bitmap.
290  * - 440: Insert submenu in the popup menu. plotName=menu label,
291  *x=user-defined ID.
292  * - 700: Shows a camera-pick-dialog and wait for user selection.
293  *"voidPtr" must point to a CSemaphore, which will be signaled twice
294  *(1st upon construction, 2nd upon dialog close); voidPtr2 must point
295  *to a "mrpt::gui::CPanelCameraSelection*" which will be filled with
296  *the selection (the panel must be deleted by the caller)
297  *
298  */
299  int OPCODE;
300  };
301 
302  /** Thread-safe method to return the next pending request, or nullptr if
303  * there is none (After usage, FREE the memory!)
304  */
306 
307  /** Thread-safe method to insert a new pending request (The memory must be
308  * dinamically allocated with "new T[1]", will be freed by receiver.)
309  */
311 
312  /** Thread-safe method to create one single instance of the main wxWidgets
313  * thread: it will create the thread only if it is not running yet.
314  */
315  static bool createOneInstanceMainThread();
316 
317  static wxBitmap getMRPTDefaultIcon();
318 
319  private:
320  /** Do not access directly to this, use the thread-safe functions
321  */
322  static std::queue<TRequestToWxMainThread*>* listPendingWxRequests;
323  static std::mutex* cs_listPendingWxRequests;
324 #endif
325 }; // End of class def.
326 
327 #if MRPT_HAS_WXWIDGETS
328 
329 /** The wx dialog for gui::CDisplayWindow
330  */
331 class CWindowDialog : public wxFrame
332 {
333  public:
334  /** A custom control to display the bitmap and avoid flicker
335  */
336  class wxMRPTImageControl : public wxPanel
337  {
338  protected:
339  wxBitmap* m_img;
340  std::mutex m_img_cs;
342 
343  public:
345  wxWindow* parent, wxWindowID winID, int x, int y, int width,
346  int height);
347  virtual ~wxMRPTImageControl();
348 
350  // std::mutex m_mouse_cs;
351 
352  /** Assigns this image. This object has the ownship of the image and
353  * will delete it when appropriate. */
354  void AssignImage(wxBitmap* img);
355  void GetBitmap(wxBitmap& bmp);
356 
357  void OnPaint(wxPaintEvent& ev);
358  void OnMouseMove(wxMouseEvent& ev);
359  void OnMouseClick(wxMouseEvent& ev);
360  void OnChar(wxKeyEvent& ev);
361 
362  void OnEraseBackground(wxEraseEvent& ev) { /* Do nothing */}
363  };
364 
365  public:
368  wxWindowID id = -1,
369  const std::string& caption = std::string("[MRPT-CDisplayWindow]"),
370  wxSize initialSize = wxDefaultSize);
371  virtual ~CWindowDialog();
372 
375 
376  // wxStaticBitmap *m_image;
378 
379  static const long ID_IMAGE_BITMAP;
380 
381  private:
382  void OnClose(wxCloseEvent& event);
383  void OnMenuClose(wxCommandEvent& event);
384  void OnMenuAbout(wxCommandEvent& event);
385  void OnMenuSave(wxCommandEvent& event);
386  void OnChar(wxKeyEvent& event);
387  void OnKeyDown(wxKeyEvent& event);
388  void OnResize(wxSizeEvent& event);
389  void OnMouseDown(wxMouseEvent& event);
390  void OnMouseMove(wxMouseEvent& event);
391 
392  DECLARE_EVENT_TABLE()
393 }; // end class CWindowDialog
394 
395 class C3DWindowDialog : public wxFrame
396 {
398 
399  public:
402  wxWindowID id = -1,
403  const std::string& caption = std::string("[MRPT-CDisplayWindow3D]"),
404  wxSize initialSize = wxDefaultSize);
405  virtual ~C3DWindowDialog();
406 
409 
410  CMyGLCanvas_DisplayWindow3D* m_canvas;
411 
412  void clearTextMessages();
413  void addTextMessage(
414  const double x_frac, const double y_frac, const std::string& text,
415  const mrpt::img::TColorf& color, const size_t unique_index,
416  const mrpt::opengl::TOpenGLFont font);
417  void addTextMessage(
418  const double x_frac, const double y_frac, const std::string& text,
419  const mrpt::img::TColorf& color, const std::string& font_name,
420  const double font_size, const mrpt::opengl::TOpenGLFontStyle font_style,
421  const size_t unique_index, const double font_spacing,
422  const double font_kerning, const bool has_shadow,
423  const mrpt::img::TColorf& shadow_color);
424 
425  private:
426  void OnClose(wxCloseEvent& event);
427  void OnMenuClose(wxCommandEvent& event);
428  void OnMenuAbout(wxCommandEvent& event);
429  void OnChar(wxKeyEvent& event);
430  void OnResize(wxSizeEvent& event);
431 
432  static const long ID_MENUITEM1;
433  static const long ID_MENUITEM2;
434 
435  DECLARE_EVENT_TABLE()
436 };
437 
438 /** The wx dialog for gui::CDisplayWindowPlots
439  */
440 class CWindowDialogPlots : public wxFrame
441 {
442  public:
445  wxWindowID id = -1,
446  const std::string& caption = std::string("[MRPT-CDisplayWindowPlots]"),
447  wxSize initialSize = wxDefaultSize);
448  virtual ~CWindowDialogPlots();
449 
452 
453  mpWindow* m_plot;
454  // wxChartPanel *m_chartPanel;
455  static const long ID_PLOT;
456  static const long ID_MENU_PRINT;
457  /** to know whether to insert a separator the first time. */
459  /** wxIDs to user IDs for submenus. */
460  std::map<long, long> m_ID2ID;
461  /** In graph coords */
463  /** In pixels */
465 
466  void OnMenuSelected(wxCommandEvent& ev);
467  void OnMouseMove(wxMouseEvent& event);
468 
469  /** Redirected from CDisplayWindowPlots::plot
470  */
471  void plot(
473  const std::string& lineFormat, const std::string& plotName);
474 
475  /** Redirected from CDisplayWindowPlots::plotEllipse
476  */
477  void plotEllipse(
479  const std::string& lineFormat, const std::string& plotName,
480  bool showName = false);
481 
482  /** Redirected from CDisplayWindowPlots::image
483  */
484  void image(
485  void* theWxImage, const float& x0, const float& y0, const float& w,
486  const float& h, const std::string& plotName);
487 
488  private:
489  void OnClose(wxCloseEvent& event);
490  void OnMenuPrint(wxCommandEvent& event);
491  void OnMenuClose(wxCommandEvent& event);
492  void OnMenuAbout(wxCommandEvent& event);
493  void OnChar(wxKeyEvent& event);
494  void OnResize(wxSizeEvent& event);
495  void OnMouseDown(wxMouseEvent& event);
496 
497  DECLARE_EVENT_TABLE()
498 }; // end class CWindowDialog
499 
500 #ifndef _U
501 #ifdef wxUSE_UNICODE
502 #define _U(x) wxString((x), wxConvUTF8)
503 #define _UU(x, y) wxString((x), y)
504 #else
505 #define _U(x) (x)
506 #define _UU(x, y) (x)
507 #endif
508 #endif
509 
510 #endif
511 
512 } // namespace gui
513 } // namespace mrpt
mrpt::opengl::TOpenGLFont
TOpenGLFont
Existing fonts for 2D texts in mrpt::opengl methods.
Definition: opengl_fonts.h:25
mrpt::gui::WxSubsystem::TRequestToWxMainThread::sourcePlots
mrpt::gui::CDisplayWindowPlots * sourcePlots
Only one of source* can be non-nullptr, indicating the class that generated the request.
Definition: WxSubsystem.h:217
mrpt::gui::WxSubsystem::TRequestToWxMainThread::voidPtr
void * voidPtr
Parameters, depending on OPCODE.
Definition: WxSubsystem.h:229
mrpt::gui::CWindowDialog::wxMRPTImageControl::m_last_mouse_point
wxPoint m_last_mouse_point
Definition: WxSubsystem.h:349
mrpt::gui::C3DWindowDialog::ID_MENUITEM1
static const long ID_MENUITEM1
Definition: WxSubsystem.h:432
mrpt::gui::CWindowDialog::m_mainFrame
WxSubsystem::CWXMainFrame * m_mainFrame
Definition: WxSubsystem.h:374
mrpt::gui::WxSubsystem::TRequestToWxMainThread::TRequestToWxMainThread
TRequestToWxMainThread()
Definition: WxSubsystem.h:194
mrpt::gui::WxSubsystem::createOneInstanceMainThread
static bool createOneInstanceMainThread()
Thread-safe method to create one single instance of the main wxWidgets thread: it will create the thr...
Definition: WxSubsystem.cpp:1096
mrpt::gui::CWindowDialogPlots::m_curCursorPos
mrpt::math::TPoint2D m_curCursorPos
In graph coords.
Definition: WxSubsystem.h:462
mrpt::gui::CWindowDialog
The wx dialog for gui::CDisplayWindow.
Definition: WxSubsystem.h:331
gui_frwds.h
mrpt::gui::CWindowDialogPlots::ID_PLOT
static const long ID_PLOT
Definition: WxSubsystem.h:455
mrpt::opengl::TOpenGLFontStyle
TOpenGLFontStyle
Different style for vectorized font rendering.
Definition: opengl_fonts.h:36
mrpt::gui::CWindowDialog::OnClose
void OnClose(wxCloseEvent &event)
Definition: CDisplayWindow.cpp:210
mrpt::gui::WxSubsystem::pushPendingWxRequest
static void pushPendingWxRequest(TRequestToWxMainThread *data)
Thread-safe method to insert a new pending request (The memory must be dinamically allocated with "ne...
Definition: WxSubsystem.cpp:259
mrpt::math::dynamic_vector
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction.
Definition: eigen_frwds.h:44
mrpt::gui::C3DWindowDialog::OnMenuAbout
void OnMenuAbout(wxCommandEvent &event)
Definition: CDisplayWindow3D.cpp:360
mrpt::gui::CWindowDialogPlots::m_last_mouse_point
wxPoint m_last_mouse_point
In pixels.
Definition: WxSubsystem.h:464
mrpt::gui::C3DWindowDialog::CMyGLCanvas_DisplayWindow3D
friend class gui::CMyGLCanvas_DisplayWindow3D
Definition: WxSubsystem.h:397
mrpt::gui::C3DWindowDialog::ID_MENUITEM2
static const long ID_MENUITEM2
Definition: WxSubsystem.h:433
mrpt::gui::CWindowDialog::OnMenuClose
void OnMenuClose(wxCommandEvent &event)
Definition: CDisplayWindow.cpp:322
mrpt::gui::CWindowDialog::wxMRPTImageControl::GetBitmap
void GetBitmap(wxBitmap &bmp)
Definition: CDisplayWindow.cpp:114
mrpt::gui::CWindowDialogPlots::OnResize
void OnResize(wxSizeEvent &event)
Definition: CDisplayWindowPlots.cpp:219
mrpt::gui::CWindowDialog::OnResize
void OnResize(wxSizeEvent &event)
Definition: CDisplayWindow.cpp:264
mrpt::gui::CWindowDialog::wxMRPTImageControl
A custom control to display the bitmap and avoid flicker.
Definition: WxSubsystem.h:336
mrpt::gui::CWindowDialogPlots::OnChar
void OnChar(wxKeyEvent &event)
Definition: CDisplayWindowPlots.cpp:196
mrpt::gui::WxSubsystem::CWXMainFrame::CWXMainFrame
CWXMainFrame(wxWindow *parent, wxWindowID id=-1)
Definition: WxSubsystem.cpp:159
mrpt::gui::C3DWindowDialog::OnClose
void OnClose(wxCloseEvent &event)
Definition: CDisplayWindow3D.cpp:329
mrpt::gui::WxSubsystem::CWXMainFrame::m_windowCount
static int m_windowCount
Definition: WxSubsystem.h:160
mrpt::gui::CWindowDialogPlots::plotEllipse
void plotEllipse(const mrpt::math::CVectorFloat &x, const mrpt::math::CVectorFloat &y, const std::string &lineFormat, const std::string &plotName, bool showName=false)
Redirected from CDisplayWindowPlots::plotEllipse.
Definition: CDisplayWindowPlots.cpp:469
mrpt::gui::WxSubsystem::listPendingWxRequests
static std::queue< TRequestToWxMainThread * > * listPendingWxRequests
Do not access directly to this, use the thread-safe functions.
Definition: WxSubsystem.h:322
mrpt::gui::CWindowDialogPlots::OnMenuSelected
void OnMenuSelected(wxCommandEvent &ev)
Definition: CDisplayWindowPlots.cpp:273
mrpt::gui::C3DWindowDialog::C3DWindowDialog
C3DWindowDialog(CDisplayWindow3D *win3D, WxSubsystem::CWXMainFrame *parent, wxWindowID id=-1, const std::string &caption=std::string("[MRPT-CDisplayWindow3D]"), wxSize initialSize=wxDefaultSize)
Definition: CDisplayWindow3D.cpp:282
mrpt::gui::CWindowDialogPlots::OnMenuClose
void OnMenuClose(wxCommandEvent &event)
Definition: CDisplayWindowPlots.cpp:258
mrpt::gui::CWindowDialogPlots::plot
void plot(const mrpt::math::CVectorFloat &x, const mrpt::math::CVectorFloat &y, const std::string &lineFormat, const std::string &plotName)
Redirected from CDisplayWindowPlots::plot.
Definition: CDisplayWindowPlots.cpp:313
mrpt::gui::WxSubsystem::CAuxWxSubsystemShutdowner
An auxiliary global object used just to launch a final request to the wxSubsystem for shutdown:
Definition: WxSubsystem.h:124
mrpt::gui::CWindowDialogPlots::~CWindowDialogPlots
virtual ~CWindowDialogPlots()
Definition: CDisplayWindowPlots.cpp:167
mrpt::gui::C3DWindowDialog::m_canvas
CMyGLCanvas_DisplayWindow3D * m_canvas
Definition: WxSubsystem.h:410
mrpt::gui::WxSubsystem::TWxMainThreadData::m_done
std::promise< void > m_done
Definition: WxSubsystem.h:176
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
w
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:4178
mrpt::gui::CWindowDialogPlots::OnMenuPrint
void OnMenuPrint(wxCommandEvent &event)
Definition: CDisplayWindowPlots.cpp:260
mrpt::gui::C3DWindowDialog::OnResize
void OnResize(wxSizeEvent &event)
Definition: CDisplayWindow3D.cpp:374
mrpt::gui::CWindowDialogPlots::OnMouseMove
void OnMouseMove(wxMouseEvent &event)
Definition: CDisplayWindowPlots.cpp:285
mrpt::gui::CWindowDialog::wxMRPTImageControl::m_img
wxBitmap * m_img
Definition: WxSubsystem.h:339
mrpt::gui::CWindowDialogPlots::m_firstSubmenu
bool m_firstSubmenu
to know whether to insert a separator the first time.
Definition: WxSubsystem.h:458
mrpt::gui::WxSubsystem::wxMainThread
static void wxMainThread()
This will be the "MAIN" of wxWidgets: It starts an application object and does not end until all the ...
Definition: WxSubsystem.cpp:1017
mrpt::gui::WxSubsystem::isConsoleApp
static bool isConsoleApp()
Will be set to true at runtime if it's not detected a running wxApp instance.
Definition: WxSubsystem.cpp:53
mrpt::gui::WxSubsystem::TWxMainThreadData::m_semWxMainThreadReady
std::promise< void > m_semWxMainThreadReady
This is signaled when wxMainThread is ready.
Definition: WxSubsystem.h:175
mrpt::gui::WxSubsystem
This class implements the GUI thread required for the wxWidgets-based GUI.
Definition: WxSubsystem.h:99
mrpt::gui::WxSubsystem::GetWxMainThreadInstance
static TWxMainThreadData & GetWxMainThreadInstance()
Definition: WxSubsystem.cpp:1078
lightweight_geom_data.h
mrpt::gui::WxSubsystem::TRequestToWxMainThread::vector_x
mrpt::math::CVectorFloat vector_x
Definition: WxSubsystem.h:232
mrpt::gui::C3DWindowDialog::addTextMessage
void addTextMessage(const double x_frac, const double y_frac, const std::string &text, const mrpt::img::TColorf &color, const size_t unique_index, const mrpt::opengl::TOpenGLFont font)
Definition: CDisplayWindow3D.cpp:402
mrpt::gui::CWindowDialog::wxMRPTImageControl::OnPaint
void OnPaint(wxPaintEvent &ev)
Definition: CDisplayWindow.cpp:100
mrpt::gui::WxSubsystem::getMRPTDefaultIcon
static wxBitmap getMRPTDefaultIcon()
Definition: WxSubsystem.cpp:846
mrpt::gui::WxSubsystem::CWXMainFrame::notifyWindowCreation
static int notifyWindowCreation()
Atomically increments the number of windows created with the main frame as parent.
Definition: WxSubsystem.cpp:198
mrpt::gui::CWindowDialog::wxMRPTImageControl::OnEraseBackground
void OnEraseBackground(wxEraseEvent &ev)
Definition: WxSubsystem.h:362
mrpt::gui::C3DWindowDialog::OnMenuClose
void OnMenuClose(wxCommandEvent &event)
Definition: CDisplayWindow3D.cpp:358
mrpt::gui::WxSubsystem::TRequestToWxMainThread::source2D
mrpt::gui::CDisplayWindow * source2D
Only one of source* can be non-nullptr, indicating the class that generated the request.
Definition: WxSubsystem.h:209
mrpt::gui::C3DWindowDialog::m_mainFrame
WxSubsystem::CWXMainFrame * m_mainFrame
Definition: WxSubsystem.h:408
mrpt::gui::WxSubsystem::CWXMainFrame::notifyWindowDestruction
static int notifyWindowDestruction()
Atomically decrements the number of windows created with the main frame as parent.
Definition: WxSubsystem.cpp:204
mrpt::gui::WxSubsystem::CAuxWxSubsystemShutdowner::~CAuxWxSubsystemShutdowner
~CAuxWxSubsystemShutdowner()
Definition: WxSubsystem.cpp:58
mrpt::gui::WxSubsystem::TRequestToWxMainThread::str
std::string str
Parameters, depending on OPCODE.
Definition: WxSubsystem.h:225
mrpt::gui::CWindowDialog::wxMRPTImageControl::OnChar
void OnChar(wxKeyEvent &ev)
Definition: CDisplayWindow.cpp:87
data
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:3547
mrpt::gui::WxSubsystem::TRequestToWxMainThread
The data structure for each inter-thread request:
Definition: WxSubsystem.h:192
mrpt::gui::CWindowDialogPlots::m_ID2ID
std::map< long, long > m_ID2ID
wxIDs to user IDs for submenus.
Definition: WxSubsystem.h:460
mrpt::gui::WxSubsystem::TWxMainThreadData
Definition: WxSubsystem.h:170
mrpt::gui::WxSubsystem::TRequestToWxMainThread::boolVal
bool boolVal
Definition: WxSubsystem.h:231
mrpt::gui::WxSubsystem::CAuxWxSubsystemShutdowner::CAuxWxSubsystemShutdowner
CAuxWxSubsystemShutdowner()
Definition: WxSubsystem.cpp:57
opengl_fonts.h
mrpt::gui::CWindowDialog::m_image
wxMRPTImageControl * m_image
Definition: WxSubsystem.h:377
mrpt::gui::WxSubsystem::popPendingWxRequest
static TRequestToWxMainThread * popPendingWxRequest()
Thread-safe method to return the next pending request, or nullptr if there is none (After usage,...
Definition: WxSubsystem.cpp:237
mrpt::gui::WxSubsystem::CWXMainFrame::OnTimerProcessRequests
void OnTimerProcessRequests(wxTimerEvent &event)
This method processes the pending requests from the main MRPT application thread.
Definition: WxSubsystem.cpp:287
mrpt::gui::CWindowDialogPlots::OnClose
void OnClose(wxCloseEvent &event)
Definition: CDisplayWindowPlots.cpp:169
mrpt::gui::WxSubsystem::TRequestToWxMainThread::OPCODE
int OPCODE
Valid codes are: For CDisplayWindow:
Definition: WxSubsystem.h:299
mrpt::gui::CWindowDialog::wxMRPTImageControl::wxMRPTImageControl
wxMRPTImageControl(wxWindow *parent, wxWindowID winID, int x, int y, int width, int height)
Definition: CDisplayWindow.cpp:38
mrpt::gui::CWindowDialogPlots::OnMenuAbout
void OnMenuAbout(wxCommandEvent &event)
Definition: CDisplayWindowPlots.cpp:265
mrpt::gui::WxSubsystem::global_wxsubsystem_shutdown
static CAuxWxSubsystemShutdowner global_wxsubsystem_shutdown
Definition: WxSubsystem.h:131
mrpt::gui::C3DWindowDialog
Definition: WxSubsystem.h:395
mrpt::gui::WxSubsystem::TRequestToWxMainThread::y
int y
Definition: WxSubsystem.h:230
mrpt::img::TColorf
A RGB color - floats in the range [0,1].
Definition: TColor.h:79
mrpt::gui::WxSubsystem::TRequestToWxMainThread::plotName
std::string plotName
Definition: WxSubsystem.h:233
mrpt::gui::WxSubsystem::TWxMainThreadData::m_csWxMainThreadId
std::mutex m_csWxMainThreadId
The critical section for accessing "m_wxMainThreadId".
Definition: WxSubsystem.h:178
color
GLuint color
Definition: glext.h:8300
mrpt::gui::CWindowDialog::wxMRPTImageControl::OnMouseMove
void OnMouseMove(wxMouseEvent &ev)
Definition: CDisplayWindow.cpp:75
mrpt::gui::CWindowDialog::OnChar
void OnChar(wxKeyEvent &event)
Definition: CDisplayWindow.cpp:241
mrpt::gui::WxSubsystem::cs_listPendingWxRequests
static std::mutex * cs_listPendingWxRequests
Definition: WxSubsystem.h:323
mrpt::math::TPoint2D
Lightweight 2D point.
Definition: lightweight_geom_data.h:42
mrpt::gui::CWindowDialog::wxMRPTImageControl::m_last_mouse_click
wxPoint m_last_mouse_click
Definition: WxSubsystem.h:349
mrpt::gui::CWindowDialog::CWindowDialog
CWindowDialog(CDisplayWindow *win2D, WxSubsystem::CWXMainFrame *parent, wxWindowID id=-1, const std::string &caption=std::string("[MRPT-CDisplayWindow]"), wxSize initialSize=wxDefaultSize)
Definition: CDisplayWindow.cpp:121
mrpt::gui::CWindowDialog::wxMRPTImageControl::AssignImage
void AssignImage(wxBitmap *img)
Assigns this image.
Definition: CDisplayWindow.cpp:88
mrpt::gui::CDisplayWindow
This class creates a window as a graphical user interface (GUI) for displaying images to the user.
Definition: CDisplayWindow.h:30
mrpt::gui::CWindowDialog::m_win2D
CDisplayWindow * m_win2D
Definition: WxSubsystem.h:373
mrpt::gui::WxSubsystem::CWXMainFrame
The main frame of the wxWidgets application.
Definition: WxSubsystem.h:135
height
GLenum GLsizei GLsizei height
Definition: glext.h:3554
mrpt::gui::CWindowDialog::OnMenuSave
void OnMenuSave(wxCommandEvent &event)
Definition: CDisplayWindow.cpp:332
mrpt::gui::CWindowDialogPlots::CWindowDialogPlots
CWindowDialogPlots(CDisplayWindowPlots *winPlots, WxSubsystem::CWXMainFrame *parent, wxWindowID id=-1, const std::string &caption=std::string("[MRPT-CDisplayWindowPlots]"), wxSize initialSize=wxDefaultSize)
Definition: CDisplayWindowPlots.cpp:39
mrpt::gui::CWindowDialogPlots::m_winPlots
CDisplayWindowPlots * m_winPlots
Definition: WxSubsystem.h:450
mrpt::gui::CWindowDialog::OnMouseMove
void OnMouseMove(wxMouseEvent &event)
Definition: CDisplayWindow.cpp:302
mrpt::gui::CDisplayWindowPlots
Create a GUI window and display plots with MATLAB-like interfaces and commands.
Definition: CDisplayWindowPlots.h:31
mrpt::gui::C3DWindowDialog::m_win3D
CDisplayWindow3D * m_win3D
Definition: WxSubsystem.h:407
mrpt::gui::CWindowDialog::wxMRPTImageControl::m_img_cs
std::mutex m_img_cs
Definition: WxSubsystem.h:340
mrpt::gui::C3DWindowDialog::~C3DWindowDialog
virtual ~C3DWindowDialog()
Definition: CDisplayWindow3D.cpp:323
mrpt::gui::WxSubsystem::TRequestToWxMainThread::sourceCameraSelectDialog
bool sourceCameraSelectDialog
Only one of source* can be non-nullptr, indicating the class that generated the request.
Definition: WxSubsystem.h:221
mrpt::gui::CWindowDialog::ID_IMAGE_BITMAP
static const long ID_IMAGE_BITMAP
Definition: WxSubsystem.h:379
mrpt::gui::CWindowDialog::OnMouseDown
void OnMouseDown(wxMouseEvent &event)
Definition: CDisplayWindow.cpp:283
mrpt::gui::WxSubsystem::waitWxShutdownsIfNoWindows
static void waitWxShutdownsIfNoWindows()
This method must be called in the destructor of the user class FROM THE MAIN THREAD,...
Definition: WxSubsystem.cpp:913
mrpt::gui::CWindowDialog::~CWindowDialog
virtual ~CWindowDialog()
Definition: CDisplayWindow.cpp:208
img
GLint GLvoid * img
Definition: glext.h:3763
mrpt::gui::CWindowDialog::wxMRPTImageControl::m_win2D
CDisplayWindow * m_win2D
Definition: WxSubsystem.h:341
mrpt::gui::WxSubsystem::CWXMainFrame::cs_windowCount
static std::mutex cs_windowCount
Definition: WxSubsystem.h:159
width
GLenum GLsizei width
Definition: glext.h:3531
mrpt::gui::CWindowDialogPlots::m_mainFrame
WxSubsystem::CWXMainFrame * m_mainFrame
Definition: WxSubsystem.h:451
mrpt::gui::CWindowDialogPlots::m_plot
mpWindow * m_plot
Definition: WxSubsystem.h:453
mrpt::gui::WxSubsystem::CWXMainFrame::m_theTimer
wxTimer * m_theTimer
Definition: WxSubsystem.h:162
mrpt::gui::CWindowDialog::wxMRPTImageControl::OnMouseClick
void OnMouseClick(wxMouseEvent &ev)
Definition: CDisplayWindow.cpp:81
mrpt::gui::WxSubsystem::TRequestToWxMainThread::x
int x
Definition: WxSubsystem.h:230
mrpt::gui::CWindowDialog::wxMRPTImageControl::~wxMRPTImageControl
virtual ~wxMRPTImageControl()
Definition: CDisplayWindow.cpp:65
mrpt::gui::WxSubsystem::TRequestToWxMainThread::vector_y
mrpt::math::CVectorFloat vector_y
Definition: WxSubsystem.h:232
mrpt::gui::CWindowDialogPlots::OnMouseDown
void OnMouseDown(wxMouseEvent &event)
Definition: CDisplayWindowPlots.cpp:238
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::gui::C3DWindowDialog::clearTextMessages
void clearTextMessages()
Definition: CDisplayWindow3D.cpp:395
mrpt::gui::CWindowDialogPlots::image
void image(void *theWxImage, const float &x0, const float &y0, const float &w, const float &h, const std::string &plotName)
Redirected from CDisplayWindowPlots::image.
Definition: CDisplayWindowPlots.cpp:627
mrpt::gui::C3DWindowDialog::OnChar
void OnChar(wxKeyEvent &event)
Definition: CDisplayWindow3D.cpp:367
mrpt::gui::WxSubsystem::TRequestToWxMainThread::source3D
mrpt::gui::CDisplayWindow3D * source3D
Only one of source* can be non-nullptr, indicating the class that generated the request.
Definition: WxSubsystem.h:213
mrpt::gui::CWindowDialog::OnMenuAbout
void OnMenuAbout(wxCommandEvent &event)
Definition: CDisplayWindow.cpp:324
mrpt::gui::WxSubsystem::CWXMainFrame::oneInstance
static volatile CWXMainFrame * oneInstance
Definition: WxSubsystem.h:156
mrpt::gui::CWindowDialogPlots
The wx dialog for gui::CDisplayWindowPlots.
Definition: WxSubsystem.h:440
mrpt::gui::CWindowDialogPlots::ID_MENU_PRINT
static const long ID_MENU_PRINT
Definition: WxSubsystem.h:456
y
GLenum GLint GLint y
Definition: glext.h:3538
mrpt::gui::WxSubsystem::CWXMainFrame::~CWXMainFrame
virtual ~CWXMainFrame()
Definition: WxSubsystem.cpp:185
mrpt::gui::CDisplayWindow3D
A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.
Definition: CDisplayWindow3D.h:117
mrpt::gui::CWindowDialog::OnKeyDown
void OnKeyDown(wxKeyEvent &event)
Definition: CDisplayWindow.cpp:236
types_math.h
x
GLenum GLint x
Definition: glext.h:3538
mrpt::gui::WxSubsystem::TRequestToWxMainThread::voidPtr2
void * voidPtr2
Definition: WxSubsystem.h:229
mrpt::gui::WxSubsystem::TWxMainThreadData::m_wxMainThreadId
std::thread m_wxMainThreadId
The thread ID of wxMainThread, or 0 if it is not running.
Definition: WxSubsystem.h:173



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST