9 #ifndef CDisplayWindowPlots_H
10 #define CDisplayWindowPlots_H
40 typedef void (* TCallbackMenu) (
int menuID,
float cursor_x,
float cursor_y,
void* userParam);
43 friend class CWindowDialogPlots;
52 template <
typename VECTOR1,
typename VECTOR2>
56 const size_t N1=size_t(x.size());
57 for (
size_t i=0;i<N1;i++) x1[i]=x[i];
58 const size_t N2=size_t(y.size());
59 for (
size_t i=0;i<N2;i++) y1[i]=y[i];
60 this->internal_plot(x1,y1,lineFormat,plotName);
62 template <
typename VECTOR1>
65 const size_t N=size_t(y.size());
67 for (
size_t i=0;i<N;i++) { x1[i]=i; y1[i]=y[i]; }
68 this->internal_plot(x1,y1,lineFormat,plotName);
76 const std::string &windowCaption = std::string(),
77 unsigned int initialWidth = 350,
78 unsigned int initialHeight = 300 );
81 static CDisplayWindowPlotsPtr Create(
82 const std::string &windowCaption,
83 unsigned int initialWindowWidth = 400,
84 unsigned int initialWindowHeight = 300 );
91 virtual bool getLastMousePosition(
int &x,
int &y)
const MRPT_OVERRIDE;
94 virtual void setCursorCross(
bool cursorIsCross)
MRPT_OVERRIDE;
98 void resize(
unsigned int width,
unsigned int height )
MRPT_OVERRIDE;
110 void enableMousePanZoom(
bool enabled );
138 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); }
140 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); }
142 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); }
144 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); }
147 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); }
149 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); }
152 void axis(
float x_min,
float x_max,
float y_min,
float y_max,
bool aspectRatioFix =
false );
155 void axis_equal(
bool enable=
true);
158 void axis_fit(
bool aspectRatioFix=
false);
173 template <
typename T>
178 const float quantiles,
179 const std::string &lineFormat = std::string(
"b-"),
180 const std::string &plotName = std::string(
"plotEllipse"),
181 bool showName =
false);
184 template <
typename T>
189 const float quantiles,
190 const std::string &lineFormat = std::string(
"b-"),
191 const std::string &plotName = std::string(
"plotEllipse"),
192 bool showName =
false);
202 const float &y_bottom,
203 const float &x_width,
204 const float &y_height,
205 const std::string &plotName = std::string(
"image") );
235 void addPopupMenuEntry(
const std::string &label,
int menuID );
241 void setMenuCallback(TCallbackMenu userFunction,
void* userParam = NULL );