9 #ifndef CDisplayWindowPlots_H
10 #define CDisplayWindowPlots_H
32 using Ptr = std::shared_ptr<CDisplayWindowPlots>;
36 void (*)(
int menuID,
float cursor_x,
float cursor_y,
void* userParam);
52 template <
typename VECTOR1,
typename VECTOR2>
54 const VECTOR1&
x,
const VECTOR2&
y,
const std::string& lineFormat,
58 const size_t N1 = size_t(
x.size());
59 for (
size_t i = 0; i < N1; i++) x1[i] =
x[i];
60 const size_t N2 = size_t(
y.size());
61 for (
size_t i = 0; i < N2; i++) y1[i] =
y[i];
64 template <
typename VECTOR1>
69 const size_t N = size_t(
y.size());
71 for (
size_t i = 0; i < N; i++)
84 unsigned int initialWidth = 350,
unsigned int initialHeight = 300);
88 const std::string& windowCaption,
unsigned int initialWindowWidth = 400,
89 unsigned int initialWindowHeight = 300);
151 template <
typename T1,
typename T2>
153 const std::vector<T1>&
x,
const std::vector<T2>&
y,
160 template <
typename T1,
typename Derived2>
169 template <
typename Derived1,
typename T2>
178 template <
typename Derived1,
typename Derived2>
189 template <
typename T>
191 const std::vector<T>&
y,
198 template <
typename Derived>
209 float x_min,
float x_max,
float y_min,
float y_max,
210 bool aspectRatioFix =
false);
217 void axis_fit(
bool aspectRatioFix =
false);
238 template <
typename T>
240 const T mean_x,
const T mean_y,
242 const float quantiles,
245 bool showName =
false);
248 template <
typename T>
250 const T mean_x,
const T mean_y,
252 const float quantiles,
255 bool showName =
false);
267 const float& y_bottom,
const float& x_width,
const float& y_height,
The base class for GUI window classes.
Create a GUI window and display plots with MATLAB-like interfaces and commands.
virtual bool getLastMousePosition(int &x, int &y) const override
Gets the last x,y pixel coordinates of the mouse.
static CDisplayWindowPlots::Ptr Create(const std::string &windowCaption, unsigned int initialWindowWidth=400, unsigned int initialWindowHeight=300)
Class factory returning a smart pointer.
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.
virtual ~CDisplayWindowPlots()
Destructor.
bool m_holdon_just_disabled
void image(const mrpt::img::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.
void setWindowTitle(const std::string &str) override
Changes the window title text.
bool m_holdon
Whether hold_on is enabled.
void setPos(int x, int y) override
Changes the position of the window on the screen.
void resize(unsigned int width, unsigned int height) override
Resizes the window, stretching the image to fit into the display area.
void 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...
void internal_plot(mrpt::math::CVectorFloat &x, mrpt::math::CVectorFloat &y, const std::string &lineFormat, const std::string &plotName)
void(*)(int menuID, float cursor_x, float cursor_y, void *userParam) TCallbackMenu
Type for the callback function used in setMenuCallback.
void hold_on()
Enables keeping all the graphs, instead of overwritting them.
void clf()
Remove all plot objects in the display (clear and clf do exactly the same).
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 internal_plot_interface(const VECTOR1 &y, const std::string &lineFormat, const std::string &plotName)
virtual void setCursorCross(bool cursorIsCross) override
Set cursor style to default (cursorIsCross=false) or to a cross (cursorIsCross=true)
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...
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...
void addPopupMenuEntry(const std::string &label, int menuID)
Disables keeping all the graphs (this is the default behavior).
void hold_off()
Disables keeping all the graphs (this is the default behavior).
uint32_t m_holdon_cnt
Counter for hold_on.
void axis_equal(bool enable=true)
Enable/disable the fixed X/Y aspect ratio fix feature (default=disabled).
std::shared_ptr< CDisplayWindowPlots > Ptr
void axis_fit(bool aspectRatioFix=false)
Fix automatically the view area according to existing graphs.
void enableMousePanZoom(bool enabled)
Enable/disable the feature of pan/zoom with the mouse (default=enabled)
void internal_plot_interface(const VECTOR1 &x, const VECTOR2 &y, const std::string &lineFormat, const std::string &plotName)
void setMenuCallback(TCallbackMenu userFunction, void *userParam=nullptr)
Must be called to have a callback when the user selects one of the user-defined entries in the popup ...
CDisplayWindowPlots(const std::string &windowCaption=std::string(), unsigned int initialWidth=350, unsigned int initialHeight=300)
Constructor.
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...
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 clear()
Remove all plot objects in the display.
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...
The wx dialog for gui::CDisplayWindowPlots.
A class for storing images as grayscale or RGB bitmaps.
A numeric matrix of compile-time fixed size.
A matrix of dynamic size.
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction.
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
GLenum GLsizei GLsizei height
GLsizei const GLchar ** string
Classes for creating GUI windows for 2D and 3D visualization.
unsigned __int32 uint32_t