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) An auxiliary global object used just to launch a final request to the wxSubsystem for shutdown: ...
std::map< long, long > m_ID2ID
wxIDs to user IDs for submenus.
static void pushPendingWxRequest(TRequestToWxMainThread *data)
Thread-safe method to insert a new pending request (The memory must be dinamically allocated with "ne...
void * voidPtr
Parameters, depending on OPCODE.
void OnMenuAbout(wxCommandEvent &event)
static TRequestToWxMainThread * popPendingWxRequest()
Thread-safe method to return the next pending request, or nullptr if there is none (After usage...
void OnClose(wxCloseEvent &event)
mrpt::gui::CDisplayWindow3D * source3D
Only one of source* can be non-nullptr, indicating the class that generated the request.
void OnMenuSave(wxCommandEvent &event)
friend class gui::CMyGLCanvas_DisplayWindow3D
void OnResize(wxSizeEvent &event)
The data structure for each inter-thread request:
~CAuxWxSubsystemShutdowner()
static std::mutex cs_windowCount
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)
Create a GUI window and display plots with MATLAB-like interfaces and commands.
static int notifyWindowCreation()
Atomically increments the number of windows created with the main frame as parent.
void AssignImage(wxBitmap *img)
Assigns this image.
void OnTimerProcessRequests(wxTimerEvent &event)
This method processes the pending requests from the main MRPT application thread. ...
static std::mutex * cs_listPendingWxRequests
std::thread m_wxMainThreadId
The thread ID of wxMainThread, or 0 if it is not running.
void GetBitmap(wxBitmap &bmp)
void OnMenuClose(wxCommandEvent &event)
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction...
The wx dialog for gui::CDisplayWindowPlots.
void OnMenuClose(wxCommandEvent &event)
virtual ~wxMRPTImageControl()
void OnMouseClick(wxMouseEvent &ev)
wxPoint m_last_mouse_point
In pixels.
static wxBitmap getMRPTDefaultIcon()
std::promise< void > m_done
virtual ~C3DWindowDialog()
CDisplayWindow3D * m_win3D
static volatile CWXMainFrame * oneInstance
C3DWindowDialog(CDisplayWindow3D *win3D, WxSubsystem::CWXMainFrame *parent, wxWindowID id=-1, const std::string &caption=std::string("[MRPT-CDisplayWindow3D]"), wxSize initialSize=wxDefaultSize)
std::mutex m_csWxMainThreadId
The critical section for accessing "m_wxMainThreadId".
static TWxMainThreadData & GetWxMainThreadInstance()
wxPoint m_last_mouse_point
wxMRPTImageControl(wxWindow *parent, wxWindowID winID, int x, int y, int width, int height)
void OnResize(wxSizeEvent &event)
WxSubsystem::CWXMainFrame * m_mainFrame
int OPCODE
Valid codes are: For CDisplayWindow:
GLubyte GLubyte GLubyte GLubyte w
void OnChar(wxKeyEvent &event)
static std::queue< TRequestToWxMainThread * > * listPendingWxRequests
Do not access directly to this, use the thread-safe functions.
static const long ID_MENUITEM1
CWindowDialogPlots(CDisplayWindowPlots *winPlots, WxSubsystem::CWXMainFrame *parent, wxWindowID id=-1, const std::string &caption=std::string("[MRPT-CDisplayWindowPlots]"), wxSize initialSize=wxDefaultSize)
wxMRPTImageControl * m_image
CDisplayWindowPlots * m_winPlots
static const long ID_PLOT
void OnKeyDown(wxKeyEvent &event)
void OnMouseDown(wxMouseEvent &event)
void OnMenuClose(wxCommandEvent &event)
void OnMenuSelected(wxCommandEvent &ev)
CWXMainFrame(wxWindow *parent, wxWindowID id=-1)
A custom control to display the bitmap and avoid flicker.
mrpt::math::TPoint2D m_curCursorPos
In graph coords.
void OnChar(wxKeyEvent &ev)
TOpenGLFont
Existing fonts for 2D texts in mrpt::opengl methods.
std::promise< void > m_semWxMainThreadReady
This is signaled when wxMainThread is ready.
TOpenGLFontStyle
Different style for vectorized font rendering.
This class creates a window as a graphical user interface (GUI) for displaying images to the user...
void plot(const mrpt::math::CVectorFloat &x, const mrpt::math::CVectorFloat &y, const std::string &lineFormat, const std::string &plotName)
Redirected from CDisplayWindowPlots::plot.
mrpt::math::CVectorFloat vector_y
The main frame of the wxWidgets application.
void OnPaint(wxPaintEvent &ev)
The wx dialog for gui::CDisplayWindow.
bool sourceCameraSelectDialog
Only one of source* can be non-nullptr, indicating the class that generated the request.
void OnMouseMove(wxMouseEvent &event)
static void wxMainThread()
This will be the "MAIN" of wxWidgets: It starts an application object and does not end until all the ...
GLsizei const GLchar ** string
void image(void *theWxImage, const float &x0, const float &y0, const float &w, const float &h, const std::string &plotName)
Redirected from CDisplayWindowPlots::image.
void OnChar(wxKeyEvent &event)
void OnMouseMove(wxMouseEvent &event)
static void waitWxShutdownsIfNoWindows()
This method must be called in the destructor of the user class FROM THE MAIN THREAD, in order to wait for the shutdown of the wx thread if this was the last open window.
virtual ~CWindowDialogPlots()
static const long ID_MENU_PRINT
WxSubsystem::CWXMainFrame * m_mainFrame
void OnResize(wxSizeEvent &event)
This class implements the GUI thread required for the wxWidgets-based GUI.
void OnClose(wxCloseEvent &event)
void OnMenuAbout(wxCommandEvent &event)
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.
A RGB color - floats in the range [0,1].
CAuxWxSubsystemShutdowner()
static const long ID_IMAGE_BITMAP
void OnMouseDown(wxMouseEvent &event)
CWindowDialog(CDisplayWindow *win2D, WxSubsystem::CWXMainFrame *parent, wxWindowID id=-1, const std::string &caption=std::string("[MRPT-CDisplayWindow]"), wxSize initialSize=wxDefaultSize)
static CAuxWxSubsystemShutdowner global_wxsubsystem_shutdown
mrpt::gui::CDisplayWindowPlots * sourcePlots
Only one of source* can be non-nullptr, indicating the class that generated the request.
static bool isConsoleApp()
Will be set to true at runtime if it's not detected a running wxApp instance.
void OnClose(wxCloseEvent &event)
Classes for creating GUI windows for 2D and 3D visualization.
void OnMenuPrint(wxCommandEvent &event)
mrpt::math::CVectorFloat vector_x
mrpt::gui::CDisplayWindow * source2D
Only one of source* can be non-nullptr, indicating the class that generated the request.
void OnMouseMove(wxMouseEvent &ev)
void OnMenuAbout(wxCommandEvent &event)
GLenum GLsizei GLsizei height
void OnChar(wxKeyEvent &event)
std::string str
Parameters, depending on OPCODE.
WxSubsystem::CWXMainFrame * m_mainFrame
GLsizei GLsizei GLenum GLenum const GLvoid * data
static const long ID_MENUITEM2
void OnEraseBackground(wxEraseEvent &ev)
static bool createOneInstanceMainThread()
Thread-safe method to create one single instance of the main wxWidgets thread: it will create the thr...
static int notifyWindowDestruction()
Atomically decrements the number of windows created with the main frame as parent.
CMyGLCanvas_DisplayWindow3D * m_canvas
wxPoint m_last_mouse_click
A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.
bool m_firstSubmenu
to know whether to insert a separator the first time.