40 void (*)(
int menuID,
float cursor_x,
float cursor_y,
void* userParam);
55 const std::string& lineFormat,
const std::string& plotName);
56 template <
typename VECTOR1,
typename VECTOR2>
58 const VECTOR1& x,
const VECTOR2& y,
const std::string& lineFormat,
59 const std::string& plotName)
62 const auto N1 = size_t(x.size());
63 for (
size_t i = 0; i < N1; i++) x1[i] =
mrpt::d2f(x[i]);
64 const auto N2 = size_t(y.size());
65 for (
size_t i = 0; i < N2; i++) y1[i] =
mrpt::d2f(y[i]);
68 template <
typename VECTOR1>
70 const VECTOR1& y,
const std::string& lineFormat,
71 const std::string& plotName)
73 const auto N = size_t(y.size());
75 for (
size_t i = 0; i < N; i++)
87 const std::string& windowCaption = std::string(),
88 unsigned int initialWidth = 350,
unsigned int initialHeight = 300);
92 const std::string& windowCaption,
unsigned int initialWindowWidth = 400,
93 unsigned int initialWindowHeight = 300);
109 void resize(
unsigned int width,
unsigned int height)
override;
113 void setPos(
int x,
int y)
override;
155 template <
typename VEC1,
typename VEC2,
typename =
typename VEC2::Scalar>
157 const VEC1& x,
const VEC2& y,
158 const std::string& lineFormat = std::string(
"b-"),
159 const std::string& plotName = std::string(
"plotXY"))
164 template <
typename T>
166 const std::vector<T>& x,
const std::vector<T>& y,
167 const std::string& lineFormat = std::string(
"b-"),
168 const std::string& plotName = std::string(
"plotXY"))
174 template <
typename VEC>
176 const VEC& y,
const std::string& lineFormat = std::string(
"b-"),
177 const std::string& plotName = std::string(
"plotXY"))
184 float x_min,
float x_max,
float y_min,
float y_max,
185 bool aspectRatioFix =
false);
192 void axis_fit(
bool aspectRatioFix =
false);
213 template <
typename T>
215 const T mean_x,
const T mean_y,
217 const std::string& lineFormat = std::string(
"b-"),
218 const std::string& plotName = std::string(
"plotEllipse"),
219 bool showName =
false);
222 template <
typename T>
224 const T mean_x,
const T mean_y,
226 const std::string& lineFormat = std::string(
"b-"),
227 const std::string& plotName = std::string(
"plotEllipse"),
228 bool showName =
false);
240 float x_width,
float y_height,
241 const std::string& plotName = std::string(
"image"));
~CDisplayWindowPlots() override
Destructor.
A compile-time fixed-size numeric matrix container.
Template for column vectors of dynamic size, compatible with Eigen.
Create a GUI window and display plots with MATLAB-like interfaces and commands.
void enableMousePanZoom(bool enabled)
Enable/disable the feature of pan/zoom with the mouse (default=enabled)
The wx dialog for gui::CDisplayWindowPlots.
void setPos(int x, int y) override
Changes the position of the window on the screen.
bool m_holdon
Whether hold_on is enabled.
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).
void internal_plot_interface(const VECTOR1 &y, const std::string &lineFormat, const std::string &plotName)
void axis_equal(bool enable=true)
Enable/disable the fixed X/Y aspect ratio fix feature (default=disabled).
CDisplayWindowPlots(const std::string &windowCaption=std::string(), unsigned int initialWidth=350, unsigned int initialHeight=300)
Constructor.
float d2f(const double d)
shortcut for static_cast<float>(double)
uint32_t m_holdon_cnt
Counter for hold_on.
bool getLastMousePosition(int &x, int &y) const override
Gets the last x,y pixel coordinates of the mouse.
void plot(const std::vector< T > &x, const std::vector< T > &y, const std::string &lineFormat=std::string("b-"), const std::string &plotName=std::string("plotXY"))
void(*)(int menuID, float cursor_x, float cursor_y, void *userParam) TCallbackMenu
Type for the callback function used in setMenuCallback.
void addPopupMenuEntry(const std::string &label, int menuID)
Disables keeping all the graphs (this is the default behavior).
void internal_plot_interface(const VECTOR1 &x, const VECTOR2 &y, const std::string &lineFormat, const std::string &plotName)
void clear()
Remove all plot objects in the display.
void axis_fit(bool aspectRatioFix=false)
Fix automatically the view area according to existing graphs.
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 setWindowTitle(const std::string &str) override
Changes the window title text.
static CDisplayWindowPlots::Ptr Create(const std::string &windowCaption, unsigned int initialWindowWidth=400, unsigned int initialWindowHeight=300)
Class factory returning a smart pointer.
void setCursorCross(bool cursorIsCross) override
Set cursor style to default (cursorIsCross=false) or to a cross (cursorIsCross=true) ...
Classes for creating GUI windows for 2D and 3D visualization.
void plotEllipse(const T mean_x, const T mean_y, const mrpt::math::CMatrixDynamic< 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 image(const mrpt::img::CImage &img, float x_left, float y_bottom, float x_width, float y_height, const std::string &plotName=std::string("image"))
Adds a bitmap image layer.
void plot(const VEC1 &x, const VEC2 &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...
This template class provides the basic functionality for a general 2D any-size, resizable container o...
bool m_holdon_just_disabled
The base class for GUI window classes based on wxWidgets.
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 ...
void resize(unsigned int width, unsigned int height) override
Resizes the window, stretching the image to fit into the display area.
void plot(const VEC &y, const std::string &lineFormat=std::string("b-"), const std::string &plotName=std::string("plotXY"))
A class for storing images as grayscale or RGB bitmaps.