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 DEFINE_SERIALIZABLE_PRE(CDisplayWindowPlots)
00049
00050
00053 class MRPTDLLIMPEXP CDisplayWindowPlots : public mrpt::utils::CSerializable
00054 {
00055
00056 DEFINE_SERIALIZABLE( CDisplayWindowPlots )
00057
00058 public:
00061 synch::CSemaphore m_semThreadReady;
00062
00065 synch::CSemaphore m_semWindowDestroyed;
00066
00067
00070 void * getWxObject() { return m_hwnd.get(); }
00071
00074 void notifyChildWindowDestruction();
00075
00076 protected:
00079 std::string m_caption;
00080
00083 void_ptr_noncopy m_hwnd;
00084
00087 volatile int m_keyPushed;
00088
00089 public:
00092 CDisplayWindowPlots(
00093 const std::string &windowCaption = std::string(),
00094 unsigned int initialWidth = 350,
00095 unsigned int initialHeight = 300 );
00096
00099 ~CDisplayWindowPlots();
00100
00103 bool isOpen();
00104
00107 void resize( unsigned int width, unsigned int height );
00108
00111 void setPos( int x, int y );
00112
00115 int waitForKey( );
00116
00118 void setPushedKey(int k);
00119
00122 void setWindowTitle( const std::string &str );
00123
00126 void enableMousePanZoom( bool enabled );
00127
00150 void plot(
00151 const vector_float &x,
00152 const vector_float &y,
00153 const std::string &lineFormat,
00154 const std::string &plotName = std::string("plotXY") );
00155
00178 void plot(
00179 const vector_double &x,
00180 const vector_double &y,
00181 const std::string &lineFormat = std::string("b-"),
00182 const std::string &plotName = std::string("plotXY") );
00183
00184
00207 void plot(
00208 const vector_float &y,
00209 const std::string &lineFormat = std::string("b-"),
00210 const std::string &plotName = std::string("plotXY") );
00211 void plot(
00212 const vector_double &y,
00213 const std::string &lineFormat = std::string("b-"),
00214 const std::string &plotName = std::string("plotXY") );
00215
00216
00219 void axis( float x_min, float x_max, float y_min, float y_max, bool aspectRatioFix = false );
00220
00223 void axis_equal(bool enable=true);
00224
00227 void axis_fit(bool aspectRatioFix=false);
00228
00239 void plotEllipse(
00240 const float &mean_x,
00241 const float &mean_y,
00242 const CMatrixFloat &cov22,
00243 const float &quantiles,
00244 const std::string &lineFormat = std::string("b-"),
00245 const std::string &plotName = std::string("plotEllipse") );
00246
00247
00253 void image(
00254 const utils::CMRPTImage &img,
00255 const float &x_left,
00256 const float &y_bottom,
00257 const float &x_width,
00258 const float &y_height,
00259 const std::string &plotName = std::string("plotEllipse") );
00260
00261
00262 };
00263 }
00264
00265 }
00266
00267 #endif