28 #ifndef CDisplayWindowPlots_H
29 #define CDisplayWindowPlots_H
43 using namespace mrpt::utils;
44 using namespace mrpt::math;
46 class CWindowDialogPlots;
63 typedef
void (* TCallbackMenu) (
int menuID,
float cursor_x,
float cursor_y,
void* userParam);
66 friend class CWindowDialogPlots;
69 bool m_holdon_just_disabled;
70 uint32_t m_holdon_cnt;
71 TCallbackMenu m_callback;
72 void *m_callback_param;
75 template <typename VECTOR1,typename VECTOR2>
76 void internal_plot_interface(const VECTOR1 &x,const VECTOR2 &y,const std::
string &lineFormat,const std::
string &plotName)
79 const size_t N1=size_t(x.size());
80 for (
size_t i=0;i<N1;i++) x1[i]=x[i];
81 const size_t N2=size_t(y.size());
82 for (
size_t i=0;i<N2;i++) y1[i]=y[i];
83 this->internal_plot(x1,y1,lineFormat,plotName);
85 template <
typename VECTOR1>
86 void internal_plot_interface(
const VECTOR1 &y,
const std::string &lineFormat,
const std::string &plotName)
88 const size_t N=size_t(y.size());
90 for (
size_t i=0;i<N;i++) { x1[i]=i; y1[i]=y[i]; }
91 this->internal_plot(x1,y1,lineFormat,plotName);
99 const std::string &windowCaption = std::string(),
100 unsigned int initialWidth = 350,
101 unsigned int initialHeight = 300 );
105 const std::string &windowCaption = std::string(),
106 unsigned int initialWindowWidth = 400,
107 unsigned int initialWindowHeight = 300 )
117 virtual bool getLastMousePosition(
int &x,
int &y)
const;
120 virtual void setCursorCross(
bool cursorIsCross);
124 void resize(
unsigned int width,
unsigned int height );
128 void setPos(
int x,
int y );
132 void setWindowTitle(
const std::string &str );
136 void enableMousePanZoom(
bool enabled );
164 template <
typename T1,
typename T2>
inline void plot(
const std::vector<T1> &x,
const std::vector<T2> &y,
const std::string &lineFormat = std::string(
"b-"),
const std::string &plotName = std::string(
"plotXY") ) { this->internal_plot_interface(x,y,lineFormat,plotName); }
166 template <
typename T1,
typename Derived2>
inline void plot(
const std::vector<T1> &x,
const Eigen::MatrixBase<Derived2> &y,
const std::string &lineFormat = std::string(
"b-"),
const std::string &plotName = std::string(
"plotXY") ) { this->internal_plot_interface(x,y,lineFormat,plotName); }
168 template <
typename Derived1,
typename T2>
inline void plot(
const Eigen::MatrixBase<Derived1> &x,
const std::vector<T2> &y,
const std::string &lineFormat = std::string(
"b-"),
const std::string &plotName = std::string(
"plotXY") ) { this->internal_plot_interface(x,y,lineFormat,plotName); }
170 template <
typename Derived1,
typename Derived2>
inline void plot(
const Eigen::MatrixBase<Derived1> &x,
const Eigen::MatrixBase<Derived2> &y,
const std::string &lineFormat = std::string(
"b-"),
const std::string &plotName = std::string(
"plotXY") ) { this->internal_plot_interface(x,y,lineFormat,plotName); }
173 template <
typename T>
void plot(
const std::vector<T> &y,
const std::string &lineFormat = std::string(
"b-"),
const std::string &plotName = std::string(
"plotXY") ) { this->internal_plot_interface(y,lineFormat,plotName); }
175 template <
typename Derived>
void plot(
const Eigen::MatrixBase<Derived> &y,
const std::string &lineFormat = std::string(
"b-"),
const std::string &plotName = std::string(
"plotXY") ) { this->internal_plot_interface(y,lineFormat,plotName); }
178 void axis(
float x_min,
float x_max,
float y_min,
float y_max,
bool aspectRatioFix =
false );
181 void axis_equal(
bool enable=
true);
184 void axis_fit(
bool aspectRatioFix=
false);
199 template <
typename T>
204 const float quantiles,
205 const std::string &lineFormat = std::string(
"b-"),
206 const std::string &plotName = std::string(
"plotEllipse"),
207 bool showName =
false);
210 template <
typename T>
215 const float quantiles,
216 const std::string &lineFormat = std::string(
"b-"),
217 const std::string &plotName = std::string(
"plotEllipse"),
218 bool showName =
false);
228 const float &y_bottom,
229 const float &x_width,
230 const float &y_height,
231 const std::string &plotName = std::string(
"image") );
261 void addPopupMenuEntry(
const std::string &label,
int menuID );
267 void setMenuCallback(TCallbackMenu userFunction,
void* userParam = NULL );