Main MRPT website > C++ reference
MRPT logo
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends
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.

#include <mrpt/gui/CDisplayWindow.h>

Inheritance diagram for mrpt::gui::CDisplayWindow:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CDisplayWindow (const std::string &windowCaption=std::string(), unsigned int initWidth=400, unsigned int initHeight=400)
 Constructor.
virtual ~CDisplayWindow ()
 Destructor.
virtual bool getLastMousePosition (int &x, int &y) const
 Gets the last x,y pixel coordinates of the mouse.
virtual void setCursorCross (bool cursorIsCross)
 Set cursor style to default (cursorIsCross=false) or to a cross (cursorIsCross=true)
void showImageAndPoints (const CImage &img, const vector_float &x, const vector_float &y, const TColor &color=TColor::red, const bool &showNumbers=false)
 Show a given color or grayscale image on the window and print a set of points on it.
template<class FEATURELIST >
void showImageAndPoints (const CImage &img, const FEATURELIST &list, const TColor &color=TColor::red, const bool &showIDs=false)
 Show a given color or grayscale image on the window and print a set of points on it.
template<class FEATURELIST >
void showTiledImageAndPoints (const CImage &img, const FEATURELIST &list, const TColor &color=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.
template<class MATCHEDLIST >
void showImagesAndMatchedPoints (const CImage &img1, const CImage &img2, const MATCHEDLIST &mList, const TColor &color=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.
template<class FEATURELIST >
void showImagesAndMatchedPoints (const CImage &img1, const CImage &img2, const FEATURELIST &leftList, const FEATURELIST &rightList, const TColor &color=TColor::red)
 Show a pair of given color or grayscale images (put together) on the window and print a set of matches on them.
void showImage (const CImage &img)
 Show a given color or grayscale image on the window.
void plot (const vector_float &x, const vector_float &y)
 Plots a graph in MATLAB-like style.
void plot (const vector_float &y)
 Plots a graph in MATLAB-like style.
void resize (unsigned int width, unsigned int height)
 Resizes the window, stretching the image to fit into the display area.
void setPos (int x, int y)
 Changes the position of the window on the screen.
void enableCursorCoordinatesVisualization (bool enable)
 Enables or disables the visualization of cursor coordinates on the window caption (default = enabled).
void setWindowTitle (const std::string &str)
 Changes the window title text.
void * getWxObject ()
 Read-only access to the wxDialog object.
void notifyChildWindowDestruction ()
 Called by wx main thread to set m_hwnd to NULL.
void notifySemThreadReady ()
 Called by wx main thread to signal the semaphore that the wx window is built and ready.
bool isOpen ()
 Returns false if the user has already closed the window.
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.
bool keyHit () const
 Returns true if a key has been pushed, without blocking waiting for a new key being pushed.
void clearKeyHitFlag ()
 Assure that "keyHit" will return false until the next pushed key.
int getPushedKey (mrptKeyModifier *out_pushModifier=NULL)
 Returns the latest pushed key, or 0 if there is no new key stroke.
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).
CObjectclone () const
 Cloning interface for smart pointers.

Static Public Member Functions

static CDisplayWindowPtr Create (const std::string &windowCaption=std::string(), unsigned int initWidth=400, unsigned int initHeight=400)
 Class factory returning a smart pointer.

Static Public Attributes

static const
mrpt::utils::TRuntimeClassId 
classCObject

Protected Member Functions

void createWxWindow (unsigned int initialWidth, unsigned int initialHeight)
 Must be called by child classes just within the constructor.
void destroyWxWindow ()
 Must be called by child classes in their destructors. The code cannot be put into this class' destructor.
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.
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.

Protected Attributes

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

Friends

class CWindowDialog
class C3DWindowDialog
class CWindowDialogPlots

RTTI stuff

static const
mrpt::utils::TRuntimeClassId 
classCBaseGUIWindow
class mrpt::utils::CStream

RTTI stuff

typedef CDisplayWindowPtr SmartPtr
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.
virtual mrpt::utils::CObjectduplicate () const
 Returns a copy of the object, indepently of its class.
static mrpt::utils::CObjectCreateObject ()
static CDisplayWindowPtr Create ()

Member Typedef Documentation

A typedef for the associated smart pointer

Definition at line 51 of file CDisplayWindow.h.


Constructor & Destructor Documentation

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

Constructor.

virtual mrpt::gui::CDisplayWindow::~CDisplayWindow ( ) [virtual]

Destructor.


Member Function Documentation

static const mrpt::utils::TRuntimeClassId* mrpt::gui::CDisplayWindow::_GetBaseClass ( ) [static, protected]

Reimplemented from mrpt::gui::CBaseGUIWindow.

void mrpt::gui::CBaseGUIWindow::clearKeyHitFlag ( ) [inline, inherited]

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

See also:
keyHit, waitForKey

Definition at line 149 of file CBaseGUIWindow.h.

CObject* mrpt::utils::CObject::clone ( ) const [inline, inherited]

Cloning interface for smart pointers.

Reimplemented in mrpt::opengl::CRenderizable, and mrpt::opengl::CRenderizableDisplayList.

Definition at line 154 of file CObject.h.

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

Class factory returning a smart pointer.

Definition at line 65 of file CDisplayWindow.h.

static mrpt::utils::CObject* mrpt::gui::CDisplayWindow::CreateObject ( ) [static]
void mrpt::gui::CBaseGUIWindow::createWxWindow ( unsigned int  initialWidth,
unsigned int  initialHeight 
) [protected, inherited]

Must be called by child classes just within the constructor.

void mrpt::gui::CBaseGUIWindow::destroyWxWindow ( ) [protected, inherited]

Must be called by child classes in their destructors. The code cannot be put into this class' destructor.

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 [inline, inherited]

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 151 of file CObject.h.

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 215 of file CDisplayWindow.h.

virtual bool mrpt::gui::CDisplayWindow::getLastMousePosition ( int &  x,
int &  y 
) const [virtual]

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

Returns:
False if the window is closed.

Implements mrpt::gui::CBaseGUIWindow.

int mrpt::gui::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
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 ( ) [inline, inherited]

Read-only access to the wxDialog object.

Definition at line 97 of file CBaseGUIWindow.h.

References mrpt::utils::non_copiable_ptr_basic::get().

bool mrpt::utils::CObservable::hasSubscribers ( ) const [inline, protected, inherited]

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 69 of file CObservable.h.

bool mrpt::gui::CBaseGUIWindow::isOpen ( ) [inherited]

Returns false if the user has already closed the window.

bool mrpt::gui::CBaseGUIWindow::keyHit ( ) const [inline, inherited]

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

See also:
waitForKey, clearKeyHitFlag

Definition at line 144 of file CBaseGUIWindow.h.

void mrpt::gui::CBaseGUIWindow::notifyChildWindowDestruction ( ) [inherited]

Called by wx main thread to set m_hwnd to NULL.

void mrpt::gui::CBaseGUIWindow::notifySemThreadReady ( ) [inherited]

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

void mrpt::gui::CDisplayWindow::plot ( const vector_float x,
const vector_float y 
)

Plots a graph in MATLAB-like style.

void mrpt::gui::CDisplayWindow::plot ( const vector_float y)

Plots a graph in MATLAB-like style.

void mrpt::utils::CObservable::publishEvent ( const mrptEvent e) const [protected, inherited]

Called when you want this object to emit an event to all the observers currently subscribed to this object.

void mrpt::gui::CDisplayWindow::resize ( unsigned int  width,
unsigned int  height 
) [virtual]

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

Implements mrpt::gui::CBaseGUIWindow.

virtual void mrpt::gui::CDisplayWindow::setCursorCross ( bool  cursorIsCross) [virtual]

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

Implements mrpt::gui::CBaseGUIWindow.

void mrpt::gui::CDisplayWindow::setPos ( int  x,
int  y 
) [virtual]

Changes the position of the window on the screen.

Implements mrpt::gui::CBaseGUIWindow.

void mrpt::gui::CDisplayWindow::setWindowTitle ( const std::string str) [virtual]

Changes the window title text.

Implements mrpt::gui::CBaseGUIWindow.

void mrpt::gui::CDisplayWindow::showImage ( const 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 mrpt::gui::CDisplayWindow::showImageAndPoints ( const CImage img,
const vector_float x,
const vector_float y,
const TColor color = 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.

template<class FEATURELIST >
void mrpt::gui::CDisplayWindow::showImageAndPoints ( const CImage img,
const FEATURELIST &  list,
const TColor color = 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 93 of file CDisplayWindow.h.

References MRPT_START, CH_RGB, mrpt::utils::CImage::colorImage(), and MRPT_END.

template<class MATCHEDLIST >
void mrpt::gui::CDisplayWindow::showImagesAndMatchedPoints ( const CImage img1,
const CImage img2,
const MATCHEDLIST &  mList,
const TColor color = 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 133 of file CDisplayWindow.h.

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

template<class FEATURELIST >
void mrpt::gui::CDisplayWindow::showImagesAndMatchedPoints ( const CImage img1,
const CImage img2,
const FEATURELIST &  leftList,
const FEATURELIST &  rightList,
const TColor color = 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 169 of file CDisplayWindow.h.

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

template<class FEATURELIST >
void mrpt::gui::CDisplayWindow::showTiledImageAndPoints ( const CImage img,
const FEATURELIST &  list,
const TColor color = 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 108 of file CDisplayWindow.h.

References MRPT_START, mrpt::utils::CImage::colorImage(), mrpt::utils::TColor::green, and MRPT_END.

int mrpt::gui::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

Friends And Related Function Documentation

friend class C3DWindowDialog [friend, inherited]

Reimplemented in mrpt::gui::CDisplayWindow3D.

Definition at line 74 of file CBaseGUIWindow.h.

friend class CWindowDialog [friend, inherited]

Definition at line 73 of file CBaseGUIWindow.h.

friend class CWindowDialogPlots [friend, inherited]

Reimplemented in mrpt::gui::CDisplayWindowPlots.

Definition at line 75 of file CBaseGUIWindow.h.

friend class mrpt::utils::CStream [friend, inherited]

Definition at line 71 of file CBaseGUIWindow.h.


Member Data Documentation

Definition at line 51 of file CDisplayWindow.h.

Definition at line 71 of file CBaseGUIWindow.h.

Definition at line 51 of file CDisplayWindow.h.

Definition at line 139 of file CObject.h.

Definition at line 51 of file CDisplayWindow.h.

The caption of the window.

Definition at line 85 of file CBaseGUIWindow.h.

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

Definition at line 57 of file CDisplayWindow.h.

The window handle.

Definition at line 86 of file CBaseGUIWindow.h.

volatile bool mrpt::gui::CBaseGUIWindow::m_keyPushed [protected, inherited]

Definition at line 89 of file CBaseGUIWindow.h.

volatile int mrpt::gui::CBaseGUIWindow::m_keyPushedCode [protected, inherited]

Definition at line 90 of file CBaseGUIWindow.h.

Definition at line 91 of file CBaseGUIWindow.h.

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

Definition at line 83 of file CBaseGUIWindow.h.

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

Definition at line 84 of file CBaseGUIWindow.h.




Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011