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 CDisplayWindow_H
00029 #define CDisplayWindow_H
00030
00031 #include <mrpt/utils/CSerializable.h>
00032 #include <mrpt/config.h>
00033 #include <mrpt/synch.h>
00034 #include <mrpt/vision/CFeature.h>
00035
00036 #include <mrpt/utils/safe_pointers.h>
00037
00038 namespace mrpt
00039 {
00040 namespace utils
00041 {
00042 class CMRPTImage;
00043 class CMRPTImageFloat;
00044 }
00045
00047 namespace gui
00048 {
00049 using namespace mrpt::utils;
00050
00051 DEFINE_SERIALIZABLE_PRE(CDisplayWindow)
00052
00053 class CWindowDialog;
00054
00058 class MRPTDLLIMPEXP CDisplayWindow : public mrpt::utils::CSerializable
00059 {
00060
00061 DEFINE_SERIALIZABLE( CDisplayWindow )
00062 friend class CWindowDialog;
00063
00064 public:
00067 synch::CSemaphore m_semThreadReady;
00068
00071 synch::CSemaphore m_semWindowDestroyed;
00072
00073
00076 void * getWxObject() { return m_hwnd.get(); }
00077
00080 void notifyChildWindowDestruction();
00081
00082 protected:
00085 std::string m_caption;
00086
00089 void_ptr_noncopy m_hwnd;
00090
00092 volatile bool m_keyPushed;
00093 volatile int m_keyPushedCode;
00094
00097 bool m_enableCursorCoordinates;
00098
00099 public:
00102 CDisplayWindow( const std::string &windowCaption = std::string() );
00103
00106 ~CDisplayWindow();
00107
00111 void showImageAndPoints( const CMRPTImage &img, const vector_float &x, const vector_float &y, unsigned int color = 0xFF0000 );
00112
00116 void showImageAndPoints( const CMRPTImageFloat &img, const vector_float &x, const vector_float &y, unsigned int color = 0xFF0000 );
00117
00121 void showImageAndPoints( const CMRPTImage &img, const mrpt::vision::CFeatureList &list, unsigned int color = 0xFF0000 );
00122
00126 void showImage( const CMRPTImage &img );
00127
00131 void showImage( const CMRPTImageFloat &img );
00132
00135 bool isOpen();
00136
00139 void resize( unsigned int width, unsigned int height );
00140
00143 void setPos( int x, int y );
00144
00148 int waitForKey( );
00149
00153 bool keyHit() const
00154 {
00155 return m_keyPushed;
00156 }
00157
00161 void clearKeyHitFlag()
00162 {
00163 m_keyPushed = false;
00164 }
00165
00166
00169 void enableCursorCoordinatesVisualization(bool enable)
00170 {
00171 m_enableCursorCoordinates = enable;
00172 }
00173
00176 void setWindowTitle( const std::string &str );
00177
00178
00179 };
00180
00181 }
00182
00183 }
00184
00185 #endif