9 #ifndef CDisplayWindowPlots_H
10 #define CDisplayWindowPlots_H
27 class CWindowDialogPlots;
44 typedef
void (* TCallbackMenu) (
int menuID,
float cursor_x,
float cursor_y,
void* userParam);
47 friend class CWindowDialogPlots;
50 bool m_holdon_just_disabled;
51 uint32_t m_holdon_cnt;
52 TCallbackMenu m_callback;
53 void *m_callback_param;
56 template <typename VECTOR1,typename VECTOR2>
57 void internal_plot_interface(const VECTOR1 &x,const VECTOR2 &y,const
std::
string &lineFormat,const
std::
string &plotName)
60 const size_t N1=size_t(x.size());
61 for (
size_t i=0;i<N1;i++) x1[i]=x[i];
62 const size_t N2=size_t(y.size());
63 for (
size_t i=0;i<N2;i++) y1[i]=y[i];
64 this->internal_plot(x1,y1,lineFormat,plotName);
66 template <
typename VECTOR1>
69 const size_t N=size_t(y.size());
71 for (
size_t i=0;i<N;i++) { x1[i]=i; y1[i]=y[i]; }
72 this->internal_plot(x1,y1,lineFormat,plotName);
80 const std::string &windowCaption = std::string(),
81 unsigned int initialWidth = 350,
82 unsigned int initialHeight = 300 );
85 static CDisplayWindowPlotsPtr Create(
86 const std::string &windowCaption,
87 unsigned int initialWindowWidth = 400,
88 unsigned int initialWindowHeight = 300 );
95 virtual bool getLastMousePosition(
int &x,
int &y)
const;
98 virtual void setCursorCross(
bool cursorIsCross);
102 void resize(
unsigned int width,
unsigned int height );
106 void setPos(
int x,
int y );
110 void setWindowTitle(
const std::string &str );
114 void enableMousePanZoom(
bool enabled );
142 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); }
144 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); }
146 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); }
148 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); }
151 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); }
153 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); }
156 void axis(
float x_min,
float x_max,
float y_min,
float y_max,
bool aspectRatioFix =
false );
159 void axis_equal(
bool enable=
true);
162 void axis_fit(
bool aspectRatioFix=
false);
177 template <
typename T>
182 const float quantiles,
183 const std::string &lineFormat = std::string(
"b-"),
184 const std::string &plotName = std::string(
"plotEllipse"),
185 bool showName =
false);
188 template <
typename T>
193 const float quantiles,
194 const std::string &lineFormat = std::string(
"b-"),
195 const std::string &plotName = std::string(
"plotEllipse"),
196 bool showName =
false);
206 const float &y_bottom,
207 const float &x_width,
208 const float &y_height,
209 const std::string &plotName = std::string(
"image") );
239 void addPopupMenuEntry(
const std::string &label,
int menuID );
245 void setMenuCallback(TCallbackMenu userFunction,
void* userParam = NULL );
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
Create a GUI window and display plots with MATLAB-like interfaces and commands.
A class for storing images as grayscale or RGB bitmaps.
void internal_plot_interface(const VECTOR1 &y, const std::string &lineFormat, const std::string &plotName)
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"))
A numeric matrix of compile-time fixed size.
This base provides a set of functions for maths stuff.
#define DEFINE_MRPT_OBJECT(class_name)
This declaration must be inserted in all CObject classes definition, within the class declaration...
#define DEFINE_MRPT_OBJECT_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
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"))
void plot(const std::vector< T > &y, const std::string &lineFormat=std::string("b-"), const std::string &plotName=std::string("plotXY"))
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"))
Adds a new layer with a 2D plot based on two vectors of X and Y points, using a MATLAB-like syntax...
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction...
#define DEFINE_MRPT_OBJECT_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void clf()
Remove all plot objects in the display (clear and clf do exactly the same).
A matrix of dynamic size.
void plot(const Eigen::MatrixBase< Derived > &y, const std::string &lineFormat=std::string("b-"), const std::string &plotName=std::string("plotXY"))
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"))
The base class for GUI window classes.