12 #include <mrpt/config.h>
22 #if MRPT_HAS_WXWIDGETS
25 #include <wx/statbmp.h>
27 #include <wx/toolbar.h>
30 #include <wx/statusbr.h>
31 #include <wx/msgdlg.h>
32 #include <wx/artprov.h>
33 #include <wx/bitmap.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>
43 #include <wx/textdlg.h>
44 #include <wx/dirdlg.h>
45 #include <wx/colordlg.h>
46 #include <wx/dcmemory.h>
51 #include <mrpt/otherlibs/mathplot/mathplot.h>
55 #include <wx/chartpanel.h>
56 #include <wx/bars/barplot.h>
58 #include <wx/axis/numberaxis.h>
59 #include <wx/axis/categoryaxis.h>
60 #include <wx/axis/dateaxis.h>
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>
68 #include <wx/xyz/xyzdataset.h>
69 #include <wx/xyz/bubbleplot.h>
71 #include <wx/category/categorydataset.h>
72 #include <wx/category/categorysimpledataset.h>
99 #if MRPT_HAS_WXWIDGETS
164 DECLARE_EVENT_TABLE()
325 #if MRPT_HAS_WXWIDGETS
343 wxWindow* parent, wxWindowID winID,
int x,
int y,
int width,
355 void OnPaint(wxPaintEvent& ev);
358 void OnChar(wxKeyEvent& ev);
368 wxSize initialSize = wxDefaultSize);
380 void OnClose(wxCloseEvent& event);
384 void OnChar(wxKeyEvent& event);
390 DECLARE_EVENT_TABLE()
402 wxSize initialSize = wxDefaultSize);
412 const double x_frac,
const double y_frac,
const std::string& text,
416 const double x_frac,
const double y_frac,
const std::string& text,
419 const size_t unique_index,
const double font_spacing,
420 const double font_kerning,
const bool has_shadow,
424 void OnClose(wxCloseEvent& event);
427 void OnChar(wxKeyEvent& event);
433 DECLARE_EVENT_TABLE()
445 wxSize initialSize = wxDefaultSize);
478 bool showName =
false);
483 void* theWxImage,
const float& x0,
const float& y0,
const float&
w,
487 void OnClose(wxCloseEvent& event);
491 void OnChar(wxKeyEvent& event);
495 DECLARE_EVENT_TABLE()
500 #define _U(x) wxString((x), wxConvUTF8)
501 #define _UU(x, y) wxString((x), y)
504 #define _UU(x, y) (x)
void OnMenuClose(wxCommandEvent &event)
friend class gui::CMyGLCanvas_DisplayWindow3D
static const long ID_MENUITEM1
virtual ~C3DWindowDialog()
void OnClose(wxCloseEvent &event)
WxSubsystem::CWXMainFrame * m_mainFrame
C3DWindowDialog(CDisplayWindow3D *win3D, WxSubsystem::CWXMainFrame *parent, wxWindowID id=-1, const std::string &caption=std::string("[MRPT-CDisplayWindow3D]"), wxSize initialSize=wxDefaultSize)
CMyGLCanvas_DisplayWindow3D * m_canvas
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)
void OnResize(wxSizeEvent &event)
void OnChar(wxKeyEvent &event)
static const long ID_MENUITEM2
CDisplayWindow3D * m_win3D
void OnMenuAbout(wxCommandEvent &event)
A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.
This class creates a window as a graphical user interface (GUI) for displaying images to the user.
Create a GUI window and display plots with MATLAB-like interfaces and commands.
A custom control to display the bitmap and avoid flicker.
virtual ~wxMRPTImageControl()
void OnMouseMove(wxMouseEvent &ev)
wxPoint m_last_mouse_point
void OnEraseBackground(wxEraseEvent &ev)
void OnPaint(wxPaintEvent &ev)
void GetBitmap(wxBitmap &bmp)
void OnChar(wxKeyEvent &ev)
void AssignImage(wxBitmap *img)
Assigns this image.
wxMRPTImageControl(wxWindow *parent, wxWindowID winID, int x, int y, int width, int height)
wxPoint m_last_mouse_click
void OnMouseClick(wxMouseEvent &ev)
The wx dialog for gui::CDisplayWindow.
WxSubsystem::CWXMainFrame * m_mainFrame
void OnResize(wxSizeEvent &event)
void OnKeyDown(wxKeyEvent &event)
CWindowDialog(CDisplayWindow *win2D, WxSubsystem::CWXMainFrame *parent, wxWindowID id=-1, const std::string &caption=std::string("[MRPT-CDisplayWindow]"), wxSize initialSize=wxDefaultSize)
void OnChar(wxKeyEvent &event)
void OnMenuClose(wxCommandEvent &event)
void OnMenuAbout(wxCommandEvent &event)
void OnMouseMove(wxMouseEvent &event)
void OnMouseDown(wxMouseEvent &event)
wxMRPTImageControl * m_image
static const long ID_IMAGE_BITMAP
void OnMenuSave(wxCommandEvent &event)
void OnClose(wxCloseEvent &event)
The wx dialog for gui::CDisplayWindowPlots.
void OnResize(wxSizeEvent &event)
void OnMouseMove(wxMouseEvent &event)
static const long ID_PLOT
void OnMenuAbout(wxCommandEvent &event)
wxPoint m_last_mouse_point
In pixels.
void image(void *theWxImage, const float &x0, const float &y0, const float &w, const float &h, const std::string &plotName)
Redirected from CDisplayWindowPlots::image.
static const long ID_MENU_PRINT
void OnClose(wxCloseEvent &event)
void OnMenuPrint(wxCommandEvent &event)
void OnMouseDown(wxMouseEvent &event)
CWindowDialogPlots(CDisplayWindowPlots *winPlots, WxSubsystem::CWXMainFrame *parent, wxWindowID id=-1, const std::string &caption=std::string("[MRPT-CDisplayWindowPlots]"), wxSize initialSize=wxDefaultSize)
void OnMenuClose(wxCommandEvent &event)
CDisplayWindowPlots * m_winPlots
virtual ~CWindowDialogPlots()
void plot(const mrpt::math::CVectorFloat &x, const mrpt::math::CVectorFloat &y, const std::string &lineFormat, const std::string &plotName)
Redirected from CDisplayWindowPlots::plot.
WxSubsystem::CWXMainFrame * m_mainFrame
std::map< long, long > m_ID2ID
wxIDs to user IDs for submenus.
void OnChar(wxKeyEvent &event)
bool m_firstSubmenu
to know whether to insert a separator the first time.
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.
mrpt::math::TPoint2D m_curCursorPos
In graph coords.
void OnMenuSelected(wxCommandEvent &ev)
An auxiliary global object used just to launch a final request to the wxSubsystem for shutdown:
CAuxWxSubsystemShutdowner()
~CAuxWxSubsystemShutdowner()
The main frame of the wxWidgets application.
CWXMainFrame(wxWindow *parent, wxWindowID id=-1)
void OnTimerProcessRequests(wxTimerEvent &event)
This method processes the pending requests from the main MRPT application thread.
static volatile CWXMainFrame * oneInstance
static int notifyWindowCreation()
Atomically increments the number of windows created with the main frame as parent.
static int notifyWindowDestruction()
Atomically decrements the number of windows created with the main frame as parent.
static std::mutex cs_windowCount
This class implements the GUI thread required for the wxWidgets-based GUI.
static bool createOneInstanceMainThread()
Thread-safe method to create one single instance of the main wxWidgets thread: it will create the thr...
static TWxMainThreadData & GetWxMainThreadInstance()
static void pushPendingWxRequest(TRequestToWxMainThread *data)
Thread-safe method to insert a new pending request (The memory must be dinamically allocated with "ne...
static TRequestToWxMainThread * popPendingWxRequest()
Thread-safe method to return the next pending request, or nullptr if there is none (After usage,...
static std::mutex * cs_listPendingWxRequests
static CAuxWxSubsystemShutdowner global_wxsubsystem_shutdown
static void waitWxShutdownsIfNoWindows()
This method must be called in the destructor of the user class FROM THE MAIN THREAD,...
static std::queue< TRequestToWxMainThread * > * listPendingWxRequests
Do not access directly to this, use the thread-safe functions.
static void wxMainThread()
This will be the "MAIN" of wxWidgets: It starts an application object and does not end until all the ...
static bool isConsoleApp()
Will be set to true at runtime if it's not detected a running wxApp instance.
static wxBitmap getMRPTDefaultIcon()
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction.
GLubyte GLubyte GLubyte GLubyte w
GLsizei GLsizei GLenum GLenum const GLvoid * data
GLenum GLsizei GLsizei height
GLsizei const GLchar ** string
TOpenGLFont
Existing fonts for 2D texts in mrpt::opengl methods.
Classes for creating GUI windows for 2D and 3D visualization.
TOpenGLFontStyle
Different style for vectorized font rendering.
The data structure for each inter-thread request:
bool sourceCameraSelectDialog
Only one of source* can be non-nullptr, indicating the class that generated the request.
int OPCODE
Valid codes are: For CDisplayWindow:
mrpt::math::CVectorFloat vector_x
mrpt::gui::CDisplayWindowPlots * sourcePlots
Only one of source* can be non-nullptr, indicating the class that generated the request.
mrpt::math::CVectorFloat vector_y
mrpt::gui::CDisplayWindow3D * source3D
Only one of source* can be non-nullptr, indicating the class that generated the request.
void * voidPtr
Parameters, depending on OPCODE.
mrpt::gui::CDisplayWindow * source2D
Only one of source* can be non-nullptr, indicating the class that generated the request.
std::string str
Parameters, depending on OPCODE.
std::promise< void > m_semWxMainThreadReady
This is signaled when wxMainThread is ready.
std::thread m_wxMainThreadId
The thread ID of wxMainThread, or 0 if it is not running.
std::promise< void > m_done
std::mutex m_csWxMainThreadId
The critical section for accessing "m_wxMainThreadId".
A RGB color - floats in the range [0,1].