Class CDisplayWindow

Inheritance Relationships

Base Type

Class Documentation

class CDisplayWindow : public mrpt::gui::CBaseGUIWindow

This class creates a window as a graphical user interface (GUI) for displaying images to the user.

For a list of supported events with the observer/observable pattern, see the discussion in mrpt::gui::CBaseGUIWindow.

../../output_staging/generated/doxygen/xml/preview_CDisplayWindow.jpg

Public Types

using Ptr = std::shared_ptr<CDisplayWindow>
using ConstPtr = std::shared_ptr<const CDisplayWindow>

Public Functions

CDisplayWindow(const std::string &windowCaption = std::string(), unsigned int initWidth = 400, unsigned int initHeight = 400)

Constructor

~CDisplayWindow() override

Destructor

virtual std::optional<mrpt::img::TPixelCoord> getLastMousePosition() const override

Gets the last x,y pixel coordinates of the mouse.

Returns:

nullopt if the window is closed.

virtual void setCursorCross(bool cursorIsCross) override

Set cursor style to default (cursorIsCross=false) or to a cross (cursorIsCross=true)

void showImage(const mrpt::img::CImage &img)

Show a given color or grayscale image on the window. It adapts the size of the window to that of the image.

void plot(const mrpt::math::CVectorFloat &x, const mrpt::math::CVectorFloat &y)

Plots a graph in MATLAB-like style.

void plot(const mrpt::math::CVectorFloat &y)

Plots a graph in MATLAB-like style.

virtual void resize(unsigned int width, unsigned int height) override

Resizes the window, stretching the image to fit into the display area.

virtual void setPos(int x, int y) override

Changes the position of the window on the screen.

inline void enableCursorCoordinatesVisualization(bool enable)

Enables or disables the visualization of cursor coordinates on the window caption (default = enabled).

virtual void setWindowTitle(const std::string &str) override

Changes the window title text.

Public Static Functions

static CDisplayWindow::Ptr Create(const std::string &windowCaption, unsigned int initWidth = 400, unsigned int initHeight = 400)

Class factory returning a smart pointer, equivalent to std::make_shared<>(...)

Protected Attributes

bool m_enableCursorCoordinates = {true}

Enables or disables the visualization of cursor coordinates on the window caption.