Go to the documentation of this file.
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 );
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 );
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") );
void GUI_IMPEXP plotEllipse(const T mean_x, const T mean_y, const mrpt::math::CMatrixFixedNumeric< T, 2, 2 > &cov22, const float quantiles, const std::string &lineFormat=std::string("b-"), const std::string &plotName=std::string("plotEllipse"), bool showName=false)
This is an overloaded member function, provided for convenience. It differs from the above function o...
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 is an overloaded member function, provided for convenience. It differs from the above function o...
virtual bool getLastMousePosition(int &x, int &y) const MRPT_OVERRIDE
Gets the last x,y pixel coordinates of the mouse.
void setMenuCallback(TCallbackMenu userFunction, void *userParam=NULL)
Must be called to have a callback when the user selects one of the user-defined entries in the popup ...
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction.
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 is an overloaded member function, provided for convenience. It differs from the above function o...
void enableMousePanZoom(bool enabled)
Enable/disable the feature of pan/zoom with the mouse (default=enabled)
void clear()
Remove all plot objects in the display.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
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.
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 is an overloaded member function, provided for convenience. It differs from the above function o...
A class for storing images as grayscale or RGB bitmaps.
void image(const utils::CImage &img, const float &x_left, const float &y_bottom, const float &x_width, const float &y_height, const std::string &plotName=std::string("image"))
Adds a bitmap image layer.
A matrix of dynamic size.
void axis(float x_min, float x_max, float y_min, float y_max, bool aspectRatioFix=false)
Set the view area according to the passed coordinated.
void internal_plot(mrpt::math::CVectorFloat &x, mrpt::math::CVectorFloat &y, const std::string &lineFormat, const std::string &plotName)
void hold_off()
Disables keeping all the graphs (this is the default behavior).
The base class for GUI window classes.
void internal_plot_interface(const VECTOR1 &x, const VECTOR2 &y, const std::string &lineFormat, const std::string &plotName)
void axis_fit(bool aspectRatioFix=false)
Fix automatically the view area according to existing graphs.
void internal_plot_interface(const VECTOR1 &y, const std::string &lineFormat, const std::string &plotName)
void setPos(int x, int y) MRPT_OVERRIDE
Changes the position of the window on the screen.
void plot(const Eigen::MatrixBase< Derived > &y, const std::string &lineFormat=std::string("b-"), const std::string &plotName=std::string("plotXY"))
This is an overloaded member function, provided for convenience. It differs from the above function o...
#define DEFINE_MRPT_OBJECT_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
bool m_holdon
Whether hold_on is enabled.
bool m_holdon_just_disabled
A numeric matrix of compile-time fixed size.
Create a GUI window and display plots with MATLAB-like interfaces and commands.
void clf()
Remove all plot objects in the display (clear and clf do exactly the same).
void hold_on()
Enables keeping all the graphs, instead of overwritting them.
uint32_t m_holdon_cnt
Counter for hold_on.
void GUI_IMPEXP plotEllipse(const T mean_x, const T mean_y, const mrpt::math::CMatrixTemplateNumeric< T > &cov22, const float quantiles, const std::string &lineFormat=std::string("b-"), const std::string &plotName=std::string("plotEllipse"), bool showName=false)
Plots a 2D ellipse given its mean, covariance matrix, and Each call to this function creates a new pl...
virtual void setCursorCross(bool cursorIsCross) MRPT_OVERRIDE
Set cursor style to default (cursorIsCross=false) or to a cross (cursorIsCross=true)
void resize(unsigned int width, unsigned int height) MRPT_OVERRIDE
Resizes the window, stretching the image to fit into the display area.
CDisplayWindowPlots(const std::string &windowCaption=std::string(), unsigned int initialWidth=350, unsigned int initialHeight=300)
Constructor.
void addPopupMenuEntry(const std::string &label, int menuID)
Disables keeping all the graphs (this is the default behavior).
void plot(const std::vector< T > &y, const std::string &lineFormat=std::string("b-"), const std::string &plotName=std::string("plotXY"))
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setWindowTitle(const std::string &str) MRPT_OVERRIDE
Changes the window title text.
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
#define DEFINE_MRPT_OBJECT_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
#define DEFINE_MRPT_OBJECT(class_name)
This declaration must be inserted in all CObject classes definition, within the class declaration.
void axis_equal(bool enable=true)
Enable/disable the fixed X/Y aspect ratio fix feature (default=disabled).
virtual ~CDisplayWindowPlots()
Destructor.
static CDisplayWindowPlotsPtr Create(const std::string &windowCaption, unsigned int initialWindowWidth=400, unsigned int initialWindowHeight=300)
Class factory returning a smart pointer.
Page generated by Doxygen 1.8.20 for MRPT 1.4.0 SVN: at Thu Aug 27 02:40:23 UTC 2020 | | |