Main MRPT website > C++ reference for MRPT 1.5.5
List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes
mrpt::gui::CDisplayWindow Class Reference

Detailed Description

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.

Definition at line 29 of file CDisplayWindow.h.

#include <mrpt/gui/CDisplayWindow.h>

Inheritance diagram for mrpt::gui::CDisplayWindow:
Inheritance graph

Public Member Functions

voidoperator new (size_t size)
 
voidoperator new[] (size_t size)
 
void operator delete (void *ptr) throw ()
 
void operator delete[] (void *ptr) throw ()
 
void operator delete (void *memory, void *ptr) throw ()
 
voidoperator new (size_t size, const std::nothrow_t &) throw ()
 
void operator delete (void *ptr, const std::nothrow_t &) throw ()
 
 CDisplayWindow (const std::string &windowCaption=std::string(), unsigned int initWidth=400, unsigned int initHeight=400)
 Constructor. More...
 
virtual ~CDisplayWindow ()
 Destructor. More...
 
virtual bool getLastMousePosition (int &x, int &y) const MRPT_OVERRIDE
 Gets the last x,y pixel coordinates of the mouse. More...
 
virtual void setCursorCross (bool cursorIsCross) MRPT_OVERRIDE
 Set cursor style to default (cursorIsCross=false) or to a cross (cursorIsCross=true) More...
 
void showImageAndPoints (const mrpt::utils::CImage &img, const mrpt::math::CVectorFloat &x, const mrpt::math::CVectorFloat &y, const mrpt::utils::TColor &color=mrpt::utils::TColor::red, const bool &showNumbers=false)
 Show a given color or grayscale image on the window and print a set of points on it. More...
 
void showImageAndPoints (const mrpt::utils::CImage &img, const std::vector< float > &x, const std::vector< float > &y, const mrpt::utils::TColor &color=mrpt::utils::TColor::red, const bool &showNumbers=false)
 
template<class FEATURELIST >
void showImageAndPoints (const mrpt::utils::CImage &img, const FEATURELIST &list, const mrpt::utils::TColor &color=mrpt::utils::TColor::red, const bool &showIDs=false)
 Show a given color or grayscale image on the window and print a set of points on it. More...
 
template<class FEATURELIST >
void showTiledImageAndPoints (const mrpt::utils::CImage &img, const FEATURELIST &list, const mrpt::utils::TColor &color=mrpt::utils::TColor::red)
 Show a given color or grayscale image on the window and print a set of points on it and a set of lines splitting the image in tiles. More...
 
template<class MATCHEDLIST >
void showImagesAndMatchedPoints (const mrpt::utils::CImage &img1, const mrpt::utils::CImage &img2, const MATCHEDLIST &mList, const mrpt::utils::TColor &color=mrpt::utils::TColor::red, bool showNumbers=false)
 Show a pair of given color or grayscale images (put together) on the window and print a set of matches on them. More...
 
template<class FEATURELIST >
void showImagesAndMatchedPoints (const mrpt::utils::CImage &img1, const mrpt::utils::CImage &img2, const FEATURELIST &leftList, const FEATURELIST &rightList, const mrpt::utils::TColor &color=mrpt::utils::TColor::red)
 Show a pair of given color or grayscale images (put together) on the window and print a set of matches on them. More...
 
void showImage (const mrpt::utils::CImage &img)
 Show a given color or grayscale image on the window. More...
 
void plot (const mrpt::math::CVectorFloat &x, const mrpt::math::CVectorFloat &y)
 Plots a graph in MATLAB-like style. More...
 
void plot (const mrpt::math::CVectorFloat &y)
 Plots a graph in MATLAB-like style. More...
 
void resize (unsigned int width, unsigned int height) MRPT_OVERRIDE
 Resizes the window, stretching the image to fit into the display area. More...
 
void setPos (int x, int y) MRPT_OVERRIDE
 Changes the position of the window on the screen. More...
 
void enableCursorCoordinatesVisualization (bool enable)
 Enables or disables the visualization of cursor coordinates on the window caption (default = enabled). More...
 
void setWindowTitle (const std::string &str) MRPT_OVERRIDE
 Changes the window title text. More...
 
voidgetWxObject ()
 Read-only access to the wxDialog object. More...
 
void notifyChildWindowDestruction ()
 Called by wx main thread to set m_hwnd to NULL. More...
 
void notifySemThreadReady ()
 Called by wx main thread to signal the semaphore that the wx window is built and ready. More...
 
bool isOpen ()
 Returns false if the user has already closed the window. More...
 
int waitForKey (bool ignoreControlKeys=true, mrptKeyModifier *out_pushModifier=NULL)
 Waits for any key to be pushed on the image or the console, and returns the key code. More...
 
bool keyHit () const
 Returns true if a key has been pushed, without blocking waiting for a new key being pushed. More...
 
void clearKeyHitFlag ()
 Assure that "keyHit" will return false until the next pushed key. More...
 
int getPushedKey (mrptKeyModifier *out_pushModifier=NULL)
 Returns the latest pushed key, or 0 if there is no new key stroke. More...
 
mrpt::utils::CObjectPtr duplicateGetSmartPtr () const
 Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer). More...
 
CObjectclone () const
 Cloning interface for smart pointers. More...
 

Static Public Member Functions

static voidoperator new (size_t size, void *ptr)
 
static CDisplayWindowPtr Create (const std::string &windowCaption, unsigned int initWidth=400, unsigned int initHeight=400)
 Class factory returning a smart pointer. More...
 

Static Public Attributes

static const
mrpt::utils::TRuntimeClassId 
classCObject
 
RTTI stuff
static const
mrpt::utils::TRuntimeClassId 
classCBaseGUIWindow
 

Protected Member Functions

void createWxWindow (unsigned int initialWidth, unsigned int initialHeight)
 Must be called by child classes just within the constructor. More...
 
void destroyWxWindow ()
 Must be called by child classes in their destructors. The code cannot be put into this class' destructor. More...
 
void publishEvent (const mrptEvent &e) const
 Called when you want this object to emit an event to all the observers currently subscribed to this object. More...
 
bool hasSubscribers () const
 Can be called by a derived class before preparing an event for publishing with publishEvent to determine if there is no one subscribed, so it can save the wasted time preparing an event that will be not read. More...
 

Protected Attributes

bool m_enableCursorCoordinates
 Enables or disables the visualization of cursor coordinates on the window caption. More...
 
synch::CSemaphore m_semThreadReady
 This semaphore will be signaled when the wx window is built and ready. More...
 
synch::CSemaphore m_semWindowDestroyed
 This semaphore will be signaled when the wx window is destroyed. More...
 
std::string m_caption
 The caption of the window. More...
 
mrpt::utils::void_ptr_noncopy m_hwnd
 The window handle. More...
 
volatile bool m_keyPushed
 
volatile int m_keyPushedCode
 
volatile mrptKeyModifier m_keyPushedModifier
 

RTTI stuff

typedef CDisplayWindowPtr Ptr
 
typedef CDisplayWindowPtr ConstPtr
 
static mrpt::utils::CLASSINIT _init_CDisplayWindow
 
static mrpt::utils::TRuntimeClassId classCDisplayWindow
 
static const
mrpt::utils::TRuntimeClassId
classinfo
 
static const
mrpt::utils::TRuntimeClassId
_GetBaseClass ()
 
virtual const
mrpt::utils::TRuntimeClassId
GetRuntimeClass () const
 Returns information about the class of an object in runtime. More...
 
virtual mrpt::utils::CObjectduplicate () const
 Returns a copy of the object, indepently of its class. More...
 
static mrpt::utils::CObjectCreateObject ()
 
static CDisplayWindowPtr Create ()
 

Member Typedef Documentation

typedef CDisplayWindowPtr mrpt::gui::CDisplayWindow::ConstPtr

Definition at line 32 of file CDisplayWindow.h.

typedef CDisplayWindowPtr mrpt::gui::CDisplayWindow::Ptr

A typedef for the associated smart pointer

Definition at line 32 of file CDisplayWindow.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 341 of file CDisplayWindow.cpp.

References mrpt::gui::CBaseGUIWindow::createWxWindow().

Referenced by Create().

CDisplayWindow::~CDisplayWindow ( )
virtual

Destructor.

Definition at line 351 of file CDisplayWindow.cpp.

References mrpt::gui::CBaseGUIWindow::destroyWxWindow().

Member Function Documentation

static const mrpt::utils::TRuntimeClassId* mrpt::gui::CDisplayWindow::_GetBaseClass ( )
staticprotected
void mrpt::gui::CBaseGUIWindow::clearKeyHitFlag ( )
inlineinherited

Assure that "keyHit" will return false until the next pushed key.

See Also
keyHit, waitForKey

Definition at line 127 of file CBaseGUIWindow.h.

CObject* mrpt::utils::CObject::clone ( ) const
inlineinherited

Cloning interface for smart pointers.

Definition at line 143 of file CObject.h.

static CDisplayWindowPtr mrpt::gui::CDisplayWindow::Create ( )
static
CDisplayWindowPtr CDisplayWindow::Create ( const std::string windowCaption,
unsigned int  initWidth = 400,
unsigned int  initHeight = 400 
)
static

Class factory returning a smart pointer.

Definition at line 331 of file CDisplayWindow.cpp.

References CDisplayWindow().

static mrpt::utils::CObject* mrpt::gui::CDisplayWindow::CreateObject ( )
static
void CBaseGUIWindow::createWxWindow ( unsigned int  initialWidth,
unsigned int  initialHeight 
)
protectedinherited
void CBaseGUIWindow::destroyWxWindow ( )
protectedinherited
virtual mrpt::utils::CObject* mrpt::gui::CDisplayWindow::duplicate ( ) const
virtual

Returns a copy of the object, indepently of its class.

Implements mrpt::utils::CObject.

mrpt::utils::CObjectPtr mrpt::utils::CObject::duplicateGetSmartPtr ( ) const
inlineinherited

Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer).

Definition at line 140 of file CObject.h.

Referenced by mrpt::obs::CRawlog::addActions(), mrpt::slam::CIncrementalMapPartitioner::addMapFrame(), and mrpt::obs::CRawlog::addObservations().

void mrpt::gui::CDisplayWindow::enableCursorCoordinatesVisualization ( bool  enable)
inline

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

Definition at line 195 of file CDisplayWindow.h.

bool CDisplayWindow::getLastMousePosition ( int x,
int y 
) const
virtual
int CBaseGUIWindow::getPushedKey ( mrptKeyModifier out_pushModifier = NULL)
inherited

Returns the latest pushed key, or 0 if there is no new key stroke.

Parameters
out_pushModifierIf set to !=NULL, the modifiers of the key stroke will be saved here.
Returns
The virtual key code, as defined in <mrpt/gui/keycodes.h> (a replication of wxWidgets key codes).
See Also
keyHit, waitForKey

Definition at line 188 of file CBaseGUIWindow.cpp.

References mrpt::gui::MRPTKMOD_NONE, and mrpt::system::sleep().

virtual const mrpt::utils::TRuntimeClassId* mrpt::gui::CDisplayWindow::GetRuntimeClass ( ) const
virtual

Returns information about the class of an object in runtime.

Reimplemented from mrpt::gui::CBaseGUIWindow.

void* mrpt::gui::CBaseGUIWindow::getWxObject ( )
inlineinherited

Read-only access to the wxDialog object.

Definition at line 75 of file CBaseGUIWindow.h.

References mrpt::utils::non_copiable_ptr_basic< T >::get().

Referenced by mrpt::gui::WxSubsystem::CWXMainFrame::OnTimerProcessRequests().

bool mrpt::utils::CObservable::hasSubscribers ( ) const
inlineprotectedinherited

Can be called by a derived class before preparing an event for publishing with publishEvent to determine if there is no one subscribed, so it can save the wasted time preparing an event that will be not read.

Definition at line 52 of file CObservable.h.

Referenced by mrpt::gui::CWindowDialog::OnMouseDown(), mrpt::gui::CWindowDialog::OnMouseMove(), mrpt::gui::CWindowDialog::OnResize(), and mrpt::opengl::COpenGLViewport::render().

bool CBaseGUIWindow::isOpen ( )
inherited
bool mrpt::gui::CBaseGUIWindow::keyHit ( ) const
inlineinherited

Returns true if a key has been pushed, without blocking waiting for a new key being pushed.

See Also
waitForKey, clearKeyHitFlag

Definition at line 122 of file CBaseGUIWindow.h.

void CBaseGUIWindow::notifyChildWindowDestruction ( )
inherited

Called by wx main thread to set m_hwnd to NULL.

Definition at line 145 of file CBaseGUIWindow.cpp.

Referenced by mrpt::gui::CWindowDialog::OnClose(), and mrpt::gui::C3DWindowDialog::OnClose().

void CBaseGUIWindow::notifySemThreadReady ( )
inherited

Called by wx main thread to signal the semaphore that the wx window is built and ready.

Definition at line 220 of file CBaseGUIWindow.cpp.

Referenced by mrpt::gui::WxSubsystem::CWXMainFrame::OnTimerProcessRequests().

void mrpt::gui::CDisplayWindow::operator delete ( void memory,
void ptr 
)
throw (
)
inline

Definition at line 32 of file CDisplayWindow.h.

void mrpt::gui::CDisplayWindow::operator delete ( void ptr)
throw (
)
inline

Definition at line 32 of file CDisplayWindow.h.

void mrpt::gui::CDisplayWindow::operator delete ( void ptr,
const std::nothrow_t &   
)
throw (
)
inline

Definition at line 32 of file CDisplayWindow.h.

void mrpt::gui::CDisplayWindow::operator delete[] ( void ptr)
throw (
)
inline

Definition at line 32 of file CDisplayWindow.h.

static void* mrpt::gui::CDisplayWindow::operator new ( size_t  size,
void ptr 
)
inlinestatic

Definition at line 32 of file CDisplayWindow.h.

void* mrpt::gui::CDisplayWindow::operator new ( size_t  size,
const std::nothrow_t &   
)
throw (
)
inline

Definition at line 32 of file CDisplayWindow.h.

void* mrpt::gui::CDisplayWindow::operator new ( size_t  size)
inline

Definition at line 32 of file CDisplayWindow.h.

void* mrpt::gui::CDisplayWindow::operator new[] ( size_t  size)
inline

Definition at line 32 of file CDisplayWindow.h.

void CDisplayWindow::plot ( const mrpt::math::CVectorFloat x,
const mrpt::math::CVectorFloat y 
)
void CDisplayWindow::plot ( const mrpt::math::CVectorFloat y)
void CObservable::publishEvent ( const mrptEvent e) const
protectedinherited
void CDisplayWindow::resize ( unsigned int  width,
unsigned int  height 
)
virtual
void CDisplayWindow::setCursorCross ( bool  cursorIsCross)
virtual

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

Implements mrpt::gui::CBaseGUIWindow.

Definition at line 357 of file CDisplayWindow.cpp.

References mrpt::utils::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, mrpt::gui::CWindowDialog::m_image, and MRPT_UNUSED_PARAM.

void CDisplayWindow::setPos ( int  x,
int  y 
)
virtual
void CDisplayWindow::setWindowTitle ( const std::string str)
virtual
void CDisplayWindow::showImage ( const mrpt::utils::CImage img)
void CDisplayWindow::showImageAndPoints ( const mrpt::utils::CImage img,
const mrpt::math::CVectorFloat x,
const mrpt::math::CVectorFloat y,
const mrpt::utils::TColor color = mrpt::utils::TColor::red,
const bool &  showNumbers = false 
)

Show a given color or grayscale image on the window and print a set of points on it.

It adapts the size of the window to that of the image.

Definition at line 416 of file CDisplayWindow.cpp.

void CDisplayWindow::showImageAndPoints ( const mrpt::utils::CImage img,
const std::vector< float > &  x,
const std::vector< float > &  y,
const mrpt::utils::TColor color = mrpt::utils::TColor::red,
const bool &  showNumbers = false 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 425 of file CDisplayWindow.cpp.

References ASSERT_, mrpt::utils::CImage::colorImage(), MRPT_END, MRPT_START, MRPT_UNUSED_PARAM, mrpt::utils::round(), showImage(), and mrpt::system::os::sprintf().

template<class FEATURELIST >
void mrpt::gui::CDisplayWindow::showImageAndPoints ( const mrpt::utils::CImage img,
const FEATURELIST &  list,
const mrpt::utils::TColor color = mrpt::utils::TColor::red,
const bool &  showIDs = false 
)
inline

Show a given color or grayscale image on the window and print a set of points on it.

It adapts the size of the window to that of the image. The class of FEATURELIST can be: mrpt::vision::CFeatureList or any STL container of entities having "x","y" and "ID" fields.

Definition at line 73 of file CDisplayWindow.h.

References CH_RGB, MRPT_END, and MRPT_START.

template<class MATCHEDLIST >
void mrpt::gui::CDisplayWindow::showImagesAndMatchedPoints ( const mrpt::utils::CImage img1,
const mrpt::utils::CImage img2,
const MATCHEDLIST &  mList,
const mrpt::utils::TColor color = mrpt::utils::TColor::red,
bool  showNumbers = false 
)
inline

Show a pair of given color or grayscale images (put together) on the window and print a set of matches on them.

It adapts the size of the window to that of the image. MATCHEDLIST can be of the class: mrpt::vision::CMatchedFeatureList, or any STL container of pairs of anything having ".x" and ".y" (e.g. mrpt::math::TPoint2D)

Definition at line 113 of file CDisplayWindow.h.

References mrpt::utils::CImage::getWidth(), mrpt::utils::CImage::joinImagesHorz(), MRPT_END, MRPT_START, mrpt::utils::round(), and mrpt::system::os::sprintf().

template<class FEATURELIST >
void mrpt::gui::CDisplayWindow::showImagesAndMatchedPoints ( const mrpt::utils::CImage img1,
const mrpt::utils::CImage img2,
const FEATURELIST &  leftList,
const FEATURELIST &  rightList,
const mrpt::utils::TColor color = mrpt::utils::TColor::red 
)
inline

Show a pair of given color or grayscale images (put together) on the window and print a set of matches on them.

It adapts the size of the window to that of the image. FEATURELIST can be of the class: mrpt::vision::CFeatureList

Definition at line 149 of file CDisplayWindow.h.

References ASSERT_, mrpt::utils::CImage::getWidth(), MRPT_END, MRPT_START, and mrpt::utils::round().

template<class FEATURELIST >
void mrpt::gui::CDisplayWindow::showTiledImageAndPoints ( const mrpt::utils::CImage img,
const FEATURELIST &  list,
const mrpt::utils::TColor color = mrpt::utils::TColor::red 
)
inline

Show a given color or grayscale image on the window and print a set of points on it and a set of lines splitting the image in tiles.

It adapts the size of the window to that of the image. The class of FEATURELIST can be: mrpt::vision::CFeatureList

Definition at line 88 of file CDisplayWindow.h.

References mrpt::utils::CImage::colorImage(), mrpt::utils::CImage::getHeight(), mrpt::utils::CImage::getWidth(), mrpt::utils::CImage::line(), MRPT_END, and MRPT_START.

int CBaseGUIWindow::waitForKey ( bool  ignoreControlKeys = true,
mrptKeyModifier out_pushModifier = NULL 
)
inherited

Waits for any key to be pushed on the image or the console, and returns the key code.

This method remove key strokes previous to its call, so it will always wait. To get the latest pushed key, see

Parameters
ignoreControlKeysIf set to false, any push of shift, cmd, control, etc... will make this method to return.
out_pushModifierIf set to !=NULL, the modifiers of the key stroke will be saved here.
Returns
The virtual key code, as defined in mrptKeyCode (a replication of wxWidgets key codes).
See Also
getPushedKey, Key codes in the enum mrptKeyCode

Definition at line 154 of file CBaseGUIWindow.cpp.

References mrpt::system::os::getch(), mrpt::system::os::kbhit(), mrpt::gui::MRPTKMOD_NONE, and mrpt::system::sleep().

Referenced by find_chessboard_corners_multiple(), and mrpt::vision::CFeature::internal_distanceBetweenPolarImages().

Member Data Documentation

mrpt::utils::CLASSINIT mrpt::gui::CDisplayWindow::_init_CDisplayWindow
staticprotected

Definition at line 32 of file CDisplayWindow.h.

const mrpt::utils::TRuntimeClassId mrpt::gui::CBaseGUIWindow::classCBaseGUIWindow
staticinherited

Definition at line 49 of file CBaseGUIWindow.h.

mrpt::utils::TRuntimeClassId mrpt::gui::CDisplayWindow::classCDisplayWindow
static

Definition at line 32 of file CDisplayWindow.h.

const mrpt::utils::TRuntimeClassId mrpt::utils::CObject::classCObject
staticinherited

Definition at line 128 of file CObject.h.

const mrpt::utils::TRuntimeClassId* mrpt::gui::CDisplayWindow::classinfo
static

Definition at line 32 of file CDisplayWindow.h.

std::string mrpt::gui::CBaseGUIWindow::m_caption
protectedinherited
bool mrpt::gui::CDisplayWindow::m_enableCursorCoordinates
protected

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

Definition at line 38 of file CDisplayWindow.h.

mrpt::utils::void_ptr_noncopy mrpt::gui::CBaseGUIWindow::m_hwnd
protectedinherited
volatile bool mrpt::gui::CBaseGUIWindow::m_keyPushed
protectedinherited

Definition at line 67 of file CBaseGUIWindow.h.

Referenced by mrpt::gui::CWindowDialog::OnChar().

volatile int mrpt::gui::CBaseGUIWindow::m_keyPushedCode
protectedinherited

Definition at line 68 of file CBaseGUIWindow.h.

Referenced by mrpt::gui::CWindowDialog::OnChar().

volatile mrptKeyModifier mrpt::gui::CBaseGUIWindow::m_keyPushedModifier
protectedinherited

Definition at line 69 of file CBaseGUIWindow.h.

Referenced by mrpt::gui::CWindowDialog::OnChar().

synch::CSemaphore mrpt::gui::CBaseGUIWindow::m_semThreadReady
protectedinherited

This semaphore will be signaled when the wx window is built and ready.

Definition at line 61 of file CBaseGUIWindow.h.

synch::CSemaphore mrpt::gui::CBaseGUIWindow::m_semWindowDestroyed
protectedinherited

This semaphore will be signaled when the wx window is destroyed.

Definition at line 62 of file CBaseGUIWindow.h.

Referenced by mrpt::gui::CWindowDialog::OnClose(), and mrpt::gui::C3DWindowDialog::OnClose().




Page generated by Doxygen 1.8.6 for MRPT 1.5.5 Git: e06b63d Fri Dec 1 14:41:11 2017 +0100 at sáb dic 2 13:00:21 CET 2017