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 CDisplayWindowPlots_H
00029 #define CDisplayWindowPlots_H
00030
00031 #include <mrpt/utils/CSerializable.h>
00032 #include <mrpt/config.h>
00033 #include <mrpt/synch.h>
00034 #include <mrpt/math/CMatrixTemplateNumeric.h>
00035 #include <mrpt/utils/safe_pointers.h>
00036 #include <mrpt/utils/CMRPTImage.h>
00037
00038
00039
00040
00041 namespace mrpt
00042 {
00043 namespace gui
00044 {
00045 using namespace mrpt::utils;
00046 using namespace mrpt::math;
00047
00048 class CWindowDialogPlots;
00049
00050 DEFINE_SERIALIZABLE_PRE(CDisplayWindowPlots)
00051
00052
00055 class MRPTDLLIMPEXP CDisplayWindowPlots : public mrpt::utils::CSerializable
00056 {
00057
00058 DEFINE_SERIALIZABLE( CDisplayWindowPlots )
00059
00060 friend class CWindowDialogPlots;
00061
00062 public:
00065 synch::CSemaphore m_semThreadReady;
00066
00069 synch::CSemaphore m_semWindowDestroyed;
00070
00071
00074 void * getWxObject() { return m_hwnd.get(); }
00075
00078 void notifyChildWindowDestruction();
00079
00080 protected:
00083 std::string m_caption;
00084
00087 void_ptr_noncopy m_hwnd;
00088
00091 volatile int m_keyPushed;
00092 volatile int m_keyPushedCode;
00093
00094 public:
00097 CDisplayWindowPlots(
00098 const std::string &windowCaption = std::string(),
00099 unsigned int initialWidth = 350,
00100 unsigned int initialHeight = 300 );
00101
00104 ~CDisplayWindowPlots();
00105
00108 bool isOpen();
00109
00112 void resize( unsigned int width, unsigned int height );
00113
00116 void setPos( int x, int y );
00117
00121 int waitForKey( );
00122
00126 bool keyHit() const
00127 {
00128 return m_keyPushed;
00129 }
00130
00134 void clearKeyHitFlag()
00135 {
00136 m_keyPushed = false;
00137 }
00138
00139
00140
00143 void setWindowTitle( const std::string &str );
00144
00147 void enableMousePanZoom( bool enabled );
00148
00171 void plot(
00172 const vector_float &x,
00173 const vector_float &y,
00174 const std::string &lineFormat,
00175 const std::string &plotName = std::string("plotXY") );
00176
00199 void plot(
00200 const vector_double &x,
00201 const vector_double &y,
00202 const std::string &lineFormat = std::string("b-"),
00203 const std::string &plotName = std::string("plotXY") );
00204
00205
00228 void plot(
00229 const vector_float &y,
00230 const std::string &lineFormat = std::string("b-"),
00231 const std::string &plotName = std::string("plotXY") );
00232 void plot(
00233 const vector_double &y,
00234 const std::string &lineFormat = std::string("b-"),
00235 const std::string &plotName = std::string("plotXY") );
00236
00237
00240 void axis( float x_min, float x_max, float y_min, float y_max, bool aspectRatioFix = false );
00241
00244 void axis_equal(bool enable=true);
00245
00248 void axis_fit(bool aspectRatioFix=false);
00249
00260 void plotEllipse(
00261 const float &mean_x,
00262 const float &mean_y,
00263 const CMatrixFloat &cov22,
00264 const float &quantiles,
00265 const std::string &lineFormat = std::string("b-"),
00266 const std::string &plotName = std::string("plotEllipse") );
00267
00268
00274 void image(
00275 const utils::CMRPTImage &img,
00276 const float &x_left,
00277 const float &y_bottom,
00278 const float &x_width,
00279 const float &y_height,
00280 const std::string &plotName = std::string("plotEllipse") );
00281
00282
00283 };
00284 }
00285
00286 }
00287
00288 #endif