Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef MRPT_WX_UTILS_H
00029 #define MRPT_WX_UTILS_H
00030
00031 #include <mrpt/utils/utils_defs.h>
00032 #include <mrpt/utils/CImage.h>
00033 #include <mrpt/utils/CConfigFileBase.h>
00034 #include <mrpt/utils/CConfigFileMemory.h>
00035 #include <mrpt/synch.h>
00036 #include <mrpt/gui/keycodes.h>
00037
00038 #include <mrpt/gui/link_pragmas.h>
00039
00040 #if MRPT_HAS_WXWIDGETS
00041
00042 #include <wx/sizer.h>
00043 #include <wx/statbmp.h>
00044 #include <wx/menu.h>
00045 #include <wx/toolbar.h>
00046 #include <wx/frame.h>
00047 #include <wx/timer.h>
00048 #include <wx/statusbr.h>
00049 #include <wx/msgdlg.h>
00050 #include <wx/artprov.h>
00051 #include <wx/bitmap.h>
00052 #include <wx/intl.h>
00053 #include <wx/image.h>
00054 #include <wx/string.h>
00055 #include <wx/msgdlg.h>
00056 #include <wx/panel.h>
00057 #include <wx/filedlg.h>
00058 #include <wx/progdlg.h>
00059 #include <wx/imaglist.h>
00060 #include <wx/busyinfo.h>
00061 #include <wx/log.h>
00062 #include <wx/textdlg.h>
00063 #include <wx/dirdlg.h>
00064 #include <wx/colordlg.h>
00065 #include <wx/dcmemory.h>
00066 #include <wx/app.h>
00067 #include <wx/pen.h>
00068 #include <wx/spinctrl.h>
00069 #include <wx/sizer.h>
00070 #include <wx/notebook.h>
00071 #include <wx/button.h>
00072 #include <wx/panel.h>
00073 #include <wx/stattext.h>
00074 #include <wx/textctrl.h>
00075 #include <wx/choice.h>
00076 #include <wx/radiobox.h>
00077 #include <wx/settings.h>
00078 #include <wx/checkbox.h>
00079 #include <wx/dc.h>
00080 #include <wx/dcclient.h>
00081
00082 #endif
00083
00084 namespace mrpt
00085 {
00086 namespace gui
00087 {
00088 #if MRPT_HAS_WXWIDGETS
00089
00090
00091 #ifndef _U
00092 # ifdef wxUSE_UNICODE
00093 # define _U(x) wxString::From8BitData(x)
00094 # else
00095 # define _U(x) (x)
00096 # endif
00097 #endif
00098
00099
00100
00101
00102
00103 wxImage GUI_IMPEXP * MRPTImage2wxImage( const mrpt::utils::CImage &img );
00104
00105
00106
00107
00108 wxBitmap GUI_IMPEXP * MRPTImage2wxBitmap( const mrpt::utils::CImage &img );
00109
00110 #if MRPT_HAS_OPENCV
00111
00112
00113
00114 wxImage GUI_IMPEXP * IplImage2wxImage( void* img );
00115 #endif
00116
00117
00118
00119
00120
00121 mrpt::utils::CImage GUI_IMPEXP * wxImage2MRPTImage( const wxImage &img );
00122
00123
00124
00125
00126 mrpt::utils::CImagePtr GUI_IMPEXP wxImage2MRPTImagePtr( const wxImage &img );
00127
00128
00129 mrptKeyModifier keyEventToMrptKeyModifier( const wxKeyEvent &ev );
00130
00131
00132
00133 class GUI_IMPEXP wxMRPTImageControl : public wxPanel
00134 {
00135 protected:
00136 wxBitmap *m_img;
00137 mrpt::synch::CCriticalSection m_img_cs;
00138
00139 wxPoint m_last_mouse_point, m_last_mouse_click;
00140 mrpt::synch::CCriticalSection m_mouse_cs;
00141
00142 public:
00143 wxMRPTImageControl( wxWindow *parent,wxWindowID winID,int x, int y, int width, int height);
00144 virtual ~wxMRPTImageControl();
00145
00146 void AssignImage(wxBitmap *img);
00147 void AssignImage(const mrpt::utils::CImage &img);
00148 void GetBitmap(wxBitmap &bmp);
00149
00150 void OnPaint(wxPaintEvent &ev);
00151 void OnMouseMove(wxMouseEvent& ev);
00152 void OnMouseClick(wxMouseEvent& ev);
00153
00154 void OnEraseBackground(wxEraseEvent &ev) { }
00155 };
00156
00157
00158
00159 class GUI_IMPEXP CPanelCameraSelection: public wxPanel
00160 {
00161 public:
00162
00163 CPanelCameraSelection(wxWindow* parent,wxWindowID id=wxID_ANY);
00164 virtual ~CPanelCameraSelection();
00165
00166 void readConfigIntoVideoSourcePanel(
00167 const std::string §,
00168 const mrpt::utils::CConfigFileBase *cfg ) const;
00169
00170 void writeConfigFromVideoSourcePanel(
00171 const std::string §,
00172 mrpt::utils::CConfigFileBase *cfg ) const;
00173
00174
00175 wxNotebook* pagesCameras;
00176 wxPanel* Panel1;
00177 wxPanel* Panel6;
00178 wxPanel* pnSwissRanger;
00179 wxTextCtrl* edCustomCamConfig;
00180 wxCheckBox* cbSR_chRange;
00181 wxCheckBox* cbSR_chIntensity;
00182 wxTextCtrl* edIPcamURL;
00183 wxCheckBox* cbSR_ch3D;
00184 wxRadioBox* rbSR_usb;
00185 wxStaticText* StaticText1;
00186 wxStaticText* StaticText10;
00187 wxButton* btnBrowseVideo;
00188 wxPanel* Panel2;
00189 wxStaticText* StaticText3;
00190 wxPanel* Panel4;
00191 wxTextCtrl* edRawlogFile;
00192 wxButton* btnBrowseRawlog;
00193 wxChoice* cbOpencvResolution;
00194 wxPanel* Panel5;
00195 wxStaticText* StaticText8;
00196 wxPanel* Panel3;
00197 wxStaticText* StaticText7;
00198 wxCheckBox* cbGrayscale;
00199 wxChoice* cbOpencvCamType;
00200 wxRadioBox* rbBumblebeeSel;
00201 wxTextCtrl* edRawlogLabel;
00202 wxStaticText* StaticText4;
00203 wxCheckBox* cbSR_chConf;
00204 wxStaticText* StaticText5;
00205 wxStaticText* StaticText2;
00206 wxTextCtrl* edSR_IP;
00207 wxStaticText* StaticText6;
00208 wxCheckBox* cbBumblebeeRectif;
00209 wxButton* btnBrowseRawlogDir;
00210 wxTextCtrl* edRawlogImgDir;
00211 wxSpinCtrl* opencvCamIndex;
00212 wxStaticText* StaticText9;
00213 wxStaticText* StaticText11;
00214 wxTextCtrl* edVideoFile;
00215
00216 protected:
00217
00218
00219 static const long ID_STATICTEXT1;
00220 static const long ID_SPINCTRL1;
00221 static const long ID_STATICTEXT3;
00222 static const long ID_CHOICE1;
00223 static const long ID_STATICTEXT6;
00224 static const long ID_CHOICE2;
00225 static const long ID_PANEL2;
00226 static const long ID_STATICTEXT7;
00227 static const long ID_TEXTCTRL1;
00228 static const long ID_PANEL3;
00229 static const long ID_TEXTCTRL6;
00230 static const long ID_PANEL4;
00231 static const long ID_STATICTEXT8;
00232 static const long ID_TEXTCTRL2;
00233 static const long ID_BUTTON7;
00234 static const long ID_PANEL5;
00235 static const long ID_STATICTEXT9;
00236 static const long ID_TEXTCTRL3;
00237 static const long ID_BUTTON8;
00238 static const long ID_STATICTEXT5;
00239 static const long ID_TEXTCTRL7;
00240 static const long ID_BUTTON9;
00241 static const long ID_STATICTEXT10;
00242 static const long ID_TEXTCTRL8;
00243 static const long ID_STATICTEXT11;
00244 static const long ID_PANEL6;
00245 static const long ID_RADIOBOX1;
00246 static const long ID_CHECKBOX1;
00247 static const long ID_STATICTEXT2;
00248 static const long ID_PANEL7;
00249 static const long ID_RADIOBOX2;
00250 static const long ID_STATICTEXT4;
00251 static const long ID_TEXTCTRL4;
00252 static const long ID_CHECKBOX3;
00253 static const long ID_CHECKBOX4;
00254 static const long ID_CHECKBOX5;
00255 static const long ID_CHECKBOX6;
00256 static const long ID_PANEL1;
00257 static const long ID_NOTEBOOK1;
00258 static const long ID_CHECKBOX2;
00259
00260
00261 private:
00262
00263
00264
00265 void OnbtnBrowseVideoClick(wxCommandEvent& event);
00266 void OnbtnBrowseRawlogClick(wxCommandEvent& event);
00267 void OnbtnBrowseRawlogDirClick(wxCommandEvent& event);
00268
00269 DECLARE_EVENT_TABLE()
00270 };
00271
00272
00273
00274 namespace detail
00275 {
00276 struct TReturnAskUserOpenCamera
00277 {
00278 mrpt::utils::CConfigFileMemory selectedConfig;
00279 bool accepted_by_user;
00280 };
00281 }
00282
00283 #endif
00284
00285 }
00286 }
00287
00288 #endif