MRPT
2.0.1
|
A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.
This class always contains internally an instance of opengl::COpenGLScene, which the objects, viewports, etc. to be rendered.
Images can be grabbed automatically to disk for easy creation of videos. See CDisplayWindow3D::grabImagesStart (and for creating videos, mrpt::vision::CVideoFileWriter).
A short-cut for displaying 2D images (using the OpenGL rendering hardware) is available through setImageView() . Internally, these methods call methods in the "main" viewport of the window (see COpenGLViewport).
Since the 3D rendering is performed in a detached thread, especial care must be taken when updating the 3D scene to be rendered. The process involves an internal critical section and it must always consist of these steps:
An alternative way of updating the scene is by creating, before locking the 3D window, a new object of class COpenGLScene, then locking the window only for replacing the smart pointer. This may be advantageous is generating the 3D scene takes a long time, since while the window is locked it will not be responsive to the user input or window redraw.
It is safer against exceptions to use the auxiliary class CDisplayWindow3DLocker.
Notice however that a copy of the smart pointer is made, so replacement of the entire scene via operator =
is not possible if using this method. Still, in general it should be preferred because the mutexes are automatically released in case of unexpected exceptions.
The window can also display a set of 2D text messages overlapped to the 3D scene. See CDisplayWindow3D::addTextMessage
For a list of supported events with the observer/observable pattern, see the discussion in mrpt::gui::CBaseGUIWindow. In addition to those events, this class introduces mrpt::gui::mrptEvent3DWindowGrabImageFile
** CDisplayWindow3D mouse view navigation cheatsheet **
Definition at line 117 of file CDisplayWindow3D.h.
#include <mrpt/gui/CDisplayWindow3D.h>
Public Types | |
using | Ptr = std::shared_ptr< CDisplayWindow3D > |
using | ConstPtr = std::shared_ptr< const CDisplayWindow3D > |
Public Member Functions | |
CDisplayWindow3D (const std::string &windowCaption=std::string(), unsigned int initialWindowWidth=400, unsigned int initialWindowHeight=300) | |
Constructor. More... | |
~CDisplayWindow3D () override | |
Destructor. More... | |
mrpt::opengl::COpenGLScene::Ptr & | get3DSceneAndLock () |
Gets a reference to the smart shared pointer that holds the internal scene (carefuly read introduction in gui::CDisplayWindow3D before use!) This also locks the critical section for accesing the scene, thus the window will not be repainted until it is unlocked. More... | |
void | unlockAccess3DScene () |
Unlocks the access to the internal 3D scene. More... | |
void | forceRepaint () |
Repaints the window. More... | |
void | repaint () |
Repaints the window. More... | |
void | updateWindow () |
Repaints the window. More... | |
float | getFOV () const |
Return the camera field of view (in degrees) (used for gluPerspective) More... | |
void | setMinRange (float new_min) |
Changes the camera min clip range (z) (used for gluPerspective). More... | |
void | setMaxRange (float new_max) |
Changes the camera max clip range (z) (used for gluPerspective. More... | |
void | setFOV (float v) |
Changes the camera field of view (in degrees) (used for gluPerspective). More... | |
void | resize (unsigned int width, unsigned int height) override |
Resizes the window, stretching the image to fit into the display area. More... | |
void | setPos (int x, int y) override |
Changes the position of the window on the screen. More... | |
void | setWindowTitle (const std::string &str) override |
Changes the window title. More... | |
void | setCameraElevationDeg (float deg) |
Changes the camera parameters programmatically. More... | |
void | setCameraAzimuthDeg (float deg) |
Changes the camera parameters programmatically. More... | |
void | setCameraPointingToPoint (float x, float y, float z) |
Changes the camera parameters programmatically. More... | |
void | setCameraZoom (float zoom) |
Changes the camera parameters programmatically. More... | |
void | setCameraProjective (bool isProjective) |
Sets the camera as projective, or orthogonal. More... | |
float | getCameraElevationDeg () const |
Get camera parameters programmatically. More... | |
float | getCameraAzimuthDeg () const |
Get camera parameters programmatically. More... | |
void | getCameraPointingToPoint (float &x, float &y, float &z) const |
Get camera parameters programmatically. More... | |
float | getCameraZoom () const |
Get camera parameters programmatically. More... | |
bool | isCameraProjective () const |
Sets the camera as projective, or orthogonal. More... | |
void | useCameraFromScene (bool useIt=true) |
If set to true (default = false), the mouse-based scene navigation will be disabled and the camera position will be determined by the opengl viewports in the 3D scene. More... | |
bool | getLastMousePositionRay (mrpt::math::TLine3D &ray) const |
Gets the 3D ray for the direction line of the pixel where the mouse cursor is at. More... | |
bool | getLastMousePosition (int &x, int &y) const override |
Gets the last x,y pixel coordinates of the mouse. More... | |
void | setCursorCross (bool cursorIsCross) override |
Set cursor style to default (cursorIsCross=false) or to a cross (cursorIsCross=true) More... | |
void | grabImagesStart (const std::string &grab_imgs_prefix=std::string("video_")) |
Start to save rendered images to disk. More... | |
void | grabImagesStop () |
Stops image grabbing started by grabImagesStart. More... | |
void | captureImagesStart () |
Enables the grabbing of CImage objects from screenshots of the window. More... | |
void | captureImagesStop () |
Stop image grabbing. More... | |
bool | getLastWindowImage (mrpt::img::CImage &out_img) const |
Retrieve the last captured image from the window. More... | |
mrpt::img::CImage::Ptr | getLastWindowImagePtr () const |
Retrieve the last captured image from the window, as a smart pointer. More... | |
std::string | grabImageGetNextFile () |
Increments by one the image counter and return the next image file name (Users normally don't want to call this method). More... | |
bool | isCapturingImgs () const |
void | addTextMessage (const double x_frac, const double y_frac, const std::string &text, const size_t unique_index=0, const mrpt::opengl::TFontParams &fontParams=mrpt::opengl::TFontParams()) |
A shortcut for calling mrpt::opengl::COpenGLViewport::addTextMessage() in the "main" viewport of the 3D scene. More... | |
void | clearTextMessages () |
Clear all text messages created with addTextMessage(). More... | |
bool | updateTextMessage (const size_t unique_index, const std::string &text) |
Just updates the text of a given text message, without touching the other parameters. More... | |
double | getRenderingFPS () const |
Get the average Frames Per Second (FPS) value from the last 250 rendering events. More... | |
mrpt::opengl::COpenGLViewport::Ptr | getDefaultViewport () |
A short cut for getting the "main" viewport of the scene object, it is equivalent to: More... | |
void | setImageView (const mrpt::img::CImage &img) |
Set the "main" viewport into "image view"-mode, where an image is efficiently drawn (fitting the viewport area) using an OpenGL textured quad. More... | |
void | setImageView (mrpt::img::CImage &&img) |
Just like setImageView but moves the internal image memory instead of making a copy, so it's faster but empties the input image. More... | |
void * | getWxObject () |
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=nullptr) |
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=nullptr) |
Returns the latest pushed key, or 0 if there is no new key stroke. More... | |
Static Public Member Functions | |
static CDisplayWindow3D::Ptr | Create (const std::string &windowCaption, unsigned int initialWindowWidth=400, unsigned int initialWindowHeight=300) |
Class factory returning a smart pointer. More... | |
Protected Member Functions | |
void | createOpenGLContext () |
Throws an exception on initialization error. More... | |
void | doRender () |
void | internalSetMinMaxRange () |
void | internal_setRenderingFPS (double FPS) |
Set the rendering FPS (users don't call this, the method is for internal MRPT objects only) More... | |
void | internal_emitGrabImageEvent (const std::string &fil) |
called by CMyGLCanvas_DisplayWindow3D::OnPostRenderSwapBuffers More... | |
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. 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 | |
mrpt::opengl::COpenGLScene::Ptr | m_3Dscene |
Internal OpenGL object (see general discussion in about usage of this object) More... | |
std::recursive_timed_mutex | m_csAccess3DScene |
Critical section for accesing m_3Dscene. More... | |
mrpt::void_ptr_noncopy | m_DisplayDeviceContext |
mrpt::void_ptr_noncopy | m_GLRenderingContext |
std::string | m_grab_imgs_prefix |
unsigned int | m_grab_imgs_idx {0} |
bool | m_is_capturing_imgs {false} |
mrpt::img::CImage::Ptr | m_last_captured_img |
std::mutex | m_last_captured_img_cs |
mrpt::system::TTimeStamp | m_lastFullScreen |
double | m_last_FPS {10} |
std::promise< void > | m_threadReady |
This semaphore will be signaled when the wx window is built and ready. More... | |
std::promise< void > | m_windowDestroyed |
This semaphore will be signaled when the wx window is destroyed. More... | |
std::string | m_caption |
The caption of the window. More... | |
mrpt::void_ptr_noncopy | m_hwnd |
The window handle. More... | |
std::atomic_bool | m_keyPushed = false |
std::atomic_int | m_keyPushedCode = 0 |
std::atomic< mrptKeyModifier > | m_keyPushedModifier |
Friends | |
class | C3DWindowDialog |
class | CMyGLCanvas_DisplayWindow3D |
using mrpt::gui::CDisplayWindow3D::ConstPtr = std::shared_ptr<const CDisplayWindow3D> |
Definition at line 121 of file CDisplayWindow3D.h.
Definition at line 120 of file CDisplayWindow3D.h.
CDisplayWindow3D::CDisplayWindow3D | ( | const std::string & | windowCaption = std::string() , |
unsigned int | initialWindowWidth = 400 , |
||
unsigned int | initialWindowHeight = 300 |
||
) |
Constructor.
Definition at line 377 of file CDisplayWindow3D.cpp.
References mrpt::gui::CBaseGUIWindow::createWxWindow(), and m_3Dscene.
|
override |
Destructor.
Definition at line 397 of file CDisplayWindow3D.cpp.
References mrpt::gui::CBaseGUIWindow::destroyWxWindow(), and m_csAccess3DScene.
|
inline |
A shortcut for calling mrpt::opengl::COpenGLViewport::addTextMessage() in the "main" viewport of the 3D scene.
Definition at line 312 of file CDisplayWindow3D.h.
References m_3Dscene.
Referenced by mrpt::graphslam::CWindowManager::addTextMessage(), mrpt::graphslam::CGraphSlamEngine< GRAPH_T >::pauseExec(), and mrpt::graphslam::CGraphSlamEngine< GRAPH_T >::resumeExec().
void CDisplayWindow3D::captureImagesStart | ( | ) |
Enables the grabbing of CImage objects from screenshots of the window.
Definition at line 764 of file CDisplayWindow3D.cpp.
References m_is_capturing_imgs.
void CDisplayWindow3D::captureImagesStop | ( | ) |
Stop image grabbing.
Definition at line 768 of file CDisplayWindow3D.cpp.
References m_is_capturing_imgs.
|
inlineinherited |
Assure that "keyHit" will return false until the next pushed key.
Definition at line 143 of file CBaseGUIWindow.h.
References mrpt::gui::CBaseGUIWindow::m_keyPushed.
|
inline |
Clear all text messages created with addTextMessage().
A shortcut for calling mrpt::opengl::COpenGLViewport::clearTextMessages().
Definition at line 329 of file CDisplayWindow3D.h.
References m_3Dscene.
|
static |
Class factory returning a smart pointer.
Definition at line 387 of file CDisplayWindow3D.cpp.
Referenced by mrpt::hwdrivers::CSkeletonTracker::processPreview(), mrpt::hwdrivers::C2DRangeFinderAbstract::processPreview(), mrpt::hwdrivers::CSkeletonTracker::processPreviewNone(), and mrpt::apps::KFSLAMApp::Run_KF_SLAM().
|
protected |
Throws an exception on initialization error.
|
protectedinherited |
Must be called by child classes just within the constructor.
Definition at line 42 of file CBaseGUIWindow.cpp.
References mrpt::gui::WxSubsystem::createOneInstanceMainThread(), mrpt::non_copiable_ptr_basic< T >::getPtrToPtr(), mrpt::gui::WxSubsystem::isConsoleApp(), mrpt::gui::CBaseGUIWindow::m_caption, mrpt::gui::CBaseGUIWindow::m_CMD_CREATE_WIN, mrpt::gui::CBaseGUIWindow::m_hwnd, mrpt::gui::CBaseGUIWindow::m_threadReady, mrpt::gui::CBaseGUIWindow::m_winobj_voidptr, MRPT_END, MRPT_START, mrpt::gui::WxSubsystem::pushPendingWxRequest(), mrpt::gui::WxSubsystem::TRequestToWxMainThread::source2D, and THROW_EXCEPTION.
Referenced by mrpt::gui::CDisplayWindow::CDisplayWindow(), CDisplayWindow3D(), and mrpt::gui::CDisplayWindowPlots::CDisplayWindowPlots().
|
protectedinherited |
Must be called by child classes in their destructors.
The code cannot be put into this class' destructor.
Definition at line 103 of file CBaseGUIWindow.cpp.
References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::WxSubsystem::isConsoleApp(), mrpt::gui::CBaseGUIWindow::m_CMD_DESTROY_WIN, mrpt::gui::CBaseGUIWindow::m_hwnd, mrpt::gui::CBaseGUIWindow::m_windowDestroyed, mrpt::gui::CBaseGUIWindow::m_winobj_voidptr, MRPT_END, MRPT_START, mrpt::gui::WxSubsystem::TRequestToWxMainThread::OPCODE, mrpt::gui::WxSubsystem::pushPendingWxRequest(), and mrpt::gui::WxSubsystem::waitWxShutdownsIfNoWindows().
Referenced by mrpt::gui::CDisplayWindow::~CDisplayWindow(), ~CDisplayWindow3D(), and mrpt::gui::CDisplayWindowPlots::~CDisplayWindowPlots().
|
protected |
void CDisplayWindow3D::forceRepaint | ( | ) |
Repaints the window.
forceRepaint, repaint and updateWindow are all aliases of the same method
Definition at line 487 of file CDisplayWindow3D.cpp.
References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, mrpt::gui::WxSubsystem::pushPendingWxRequest(), mrpt::gui::WxSubsystem::TRequestToWxMainThread::source3D, and win.
Referenced by repaint(), mrpt::graphslam::detail::CEdgeCounter::updateTextMessages(), updateWindow(), and CGraphSlamHandler< GRAPH_T >::~CGraphSlamHandler().
opengl::COpenGLScene::Ptr & CDisplayWindow3D::get3DSceneAndLock | ( | ) |
Gets a reference to the smart shared pointer that holds the internal scene (carefuly read introduction in gui::CDisplayWindow3D before use!) This also locks the critical section for accesing the scene, thus the window will not be repainted until it is unlocked.
Definition at line 479 of file CDisplayWindow3D.cpp.
References m_3Dscene, and m_csAccess3DScene.
Referenced by mrpt::gui::CDisplayWindow3DLocker::CDisplayWindow3DLocker(), mrpt::detectors::CFaceDetection::experimental_viewFacePointsAndEigenVects(), mrpt::detectors::CFaceDetection::experimental_viewFacePointsScanned(), mrpt::detectors::CFaceDetection::experimental_viewRegions(), and CGraphSlamHandler< GRAPH_T >::initVisualization().
float CDisplayWindow3D::getCameraAzimuthDeg | ( | ) | const |
Get camera parameters programmatically.
Definition at line 635 of file CDisplayWindow3D.cpp.
References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, and win.
float CDisplayWindow3D::getCameraElevationDeg | ( | ) | const |
Get camera parameters programmatically.
Definition at line 622 of file CDisplayWindow3D.cpp.
References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, and win.
void CDisplayWindow3D::getCameraPointingToPoint | ( | float & | x, |
float & | y, | ||
float & | z | ||
) | const |
Get camera parameters programmatically.
Definition at line 648 of file CDisplayWindow3D.cpp.
References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, and win.
float CDisplayWindow3D::getCameraZoom | ( | ) | const |
Get camera parameters programmatically.
Definition at line 668 of file CDisplayWindow3D.cpp.
References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, and win.
mrpt::opengl::COpenGLViewport::Ptr CDisplayWindow3D::getDefaultViewport | ( | ) |
A short cut for getting the "main" viewport of the scene object, it is equivalent to:
Definition at line 812 of file CDisplayWindow3D.cpp.
References m_3Dscene, and m_csAccess3DScene.
float CDisplayWindow3D::getFOV | ( | ) | const |
Return the camera field of view (in degrees) (used for gluPerspective)
Definition at line 602 of file CDisplayWindow3D.cpp.
References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, and win.
|
overridevirtual |
Gets the last x,y pixel coordinates of the mouse.
Implements mrpt::gui::CBaseGUIWindow.
Definition at line 694 of file CDisplayWindow3D.cpp.
References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, and win.
Referenced by getLastMousePositionRay().
bool CDisplayWindow3D::getLastMousePositionRay | ( | mrpt::math::TLine3D & | ray | ) | const |
Gets the 3D ray for the direction line of the pixel where the mouse cursor is at.
Definition at line 710 of file CDisplayWindow3D.cpp.
References getLastMousePosition(), m_3Dscene, and m_csAccess3DScene.
bool CDisplayWindow3D::getLastWindowImage | ( | mrpt::img::CImage & | out_img | ) | const |
Retrieve the last captured image from the window.
You MUST CALL FIRST captureImagesStart to enable image grabbing.
Definition at line 772 of file CDisplayWindow3D.cpp.
References m_last_captured_img, and m_last_captured_img_cs.
CImage::Ptr CDisplayWindow3D::getLastWindowImagePtr | ( | ) | const |
Retrieve the last captured image from the window, as a smart pointer.
This method is more efficient than getLastWindowImage since only a copy of the pointer is performed, while getLastWindowImage would copy the entire image.
You MUST CALL FIRST captureImagesStart to enable image grabbing. If there was no time yet for grabbing any image, an empty smart pointer will be returned.
Definition at line 792 of file CDisplayWindow3D.cpp.
References m_last_captured_img, and m_last_captured_img_cs.
|
inherited |
Returns the latest pushed key, or 0 if there is no new key stroke.
out_pushModifier | If set to !=nullptr, the modifiers of the key stroke will be saved here. |
Definition at line 186 of file CBaseGUIWindow.cpp.
References mrpt::gui::CBaseGUIWindow::m_keyPushed, mrpt::gui::CBaseGUIWindow::m_keyPushedCode, mrpt::gui::CBaseGUIWindow::m_keyPushedModifier, and mrpt::gui::MRPTKMOD_NONE.
|
inline |
Get the average Frames Per Second (FPS) value from the last 250 rendering events.
Definition at line 353 of file CDisplayWindow3D.h.
References m_last_FPS.
|
inlineinherited |
Read-only access to the wxDialog object.
Definition at line 77 of file CBaseGUIWindow.h.
References mrpt::non_copiable_ptr_basic< T >::get(), and mrpt::gui::CBaseGUIWindow::m_hwnd.
Referenced by mrpt::gui::WxSubsystem::CWXMainFrame::OnTimerProcessRequests().
std::string CDisplayWindow3D::grabImageGetNextFile | ( | ) |
Increments by one the image counter and return the next image file name (Users normally don't want to call this method).
Definition at line 752 of file CDisplayWindow3D.cpp.
References mrpt::format(), m_grab_imgs_idx, and m_grab_imgs_prefix.
void CDisplayWindow3D::grabImagesStart | ( | const std::string & | grab_imgs_prefix = std::string("video_") | ) |
Start to save rendered images to disk.
Images will be saved independently as png files, depending on the template path passed to this method. For example:
path_prefix: "./video_"
Will generate "./video_000001.png", etc.
If this feature is enabled, the window will emit events of the type mrpt::gui::mrptEvent3DWindowGrabImageFile() which you can subscribe to.
Definition at line 739 of file CDisplayWindow3D.cpp.
References m_grab_imgs_idx, and m_grab_imgs_prefix.
void CDisplayWindow3D::grabImagesStop | ( | ) |
Stops image grabbing started by grabImagesStart.
Definition at line 748 of file CDisplayWindow3D.cpp.
References m_grab_imgs_prefix.
|
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 53 of file CObservable.h.
References mrpt::system::CObservable::m_subscribers.
Referenced by mrpt::gui::CWindowDialog::OnMouseDown(), mrpt::gui::CWindowDialog::OnMouseMove(), mrpt::gui::CWindowDialog::OnResize(), mrpt::opengl::COpenGLViewport::render(), and mrpt::opengl::COpenGLViewport::renderNormalSceneMode().
|
protected |
called by CMyGLCanvas_DisplayWindow3D::OnPostRenderSwapBuffers
Definition at line 805 of file CDisplayWindow3D.cpp.
References mrpt::system::CObservable::publishEvent().
|
protected |
Set the rendering FPS (users don't call this, the method is for internal MRPT objects only)
Definition at line 798 of file CDisplayWindow3D.cpp.
References m_last_FPS.
|
protected |
bool CDisplayWindow3D::isCameraProjective | ( | ) | const |
Sets the camera as projective, or orthogonal.
Definition at line 681 of file CDisplayWindow3D.cpp.
References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, and win.
|
inline |
Definition at line 306 of file CDisplayWindow3D.h.
References m_is_capturing_imgs.
|
inherited |
Returns false if the user has already closed the window.
Definition at line 201 of file CBaseGUIWindow.cpp.
References mrpt::gui::CBaseGUIWindow::m_hwnd.
Referenced by mrpt::gui::CDisplayWindowPlots::addPopupMenuEntry(), mrpt::gui::CDisplayWindowPlots::axis(), mrpt::gui::CDisplayWindowPlots::axis_equal(), mrpt::gui::CDisplayWindowPlots::axis_fit(), mrpt::gui::CDisplayWindowPlots::clear(), mrpt::math::CMonteCarlo< T, NUM, OTHER >::doExperiment(), mrpt::gui::CDisplayWindowPlots::enableMousePanZoom(), mrpt::gui::CDisplayWindowPlots::image(), mrpt::gui::CDisplayWindowPlots::internal_plot(), mrpt::graphslam::CWindowManager::isOpen(), mrpt::gui::CDisplayWindowPlots::plotEllipse(), mrpt::gui::CDisplayWindowPlots::resize(), resize(), mrpt::gui::CDisplayWindow::resize(), mrpt::gui::CDisplayWindowPlots::setPos(), setPos(), mrpt::gui::CDisplayWindow::setPos(), mrpt::gui::CDisplayWindowPlots::setWindowTitle(), setWindowTitle(), mrpt::gui::CDisplayWindow::setWindowTitle(), mrpt::gui::CBaseGUIWindow::waitForKey(), and CGraphSlamHandler< GRAPH_T >::~CGraphSlamHandler().
|
inlineinherited |
Returns true if a key has been pushed, without blocking waiting for a new key being pushed.
Definition at line 139 of file CBaseGUIWindow.h.
References mrpt::gui::CBaseGUIWindow::m_keyPushed.
|
inherited |
Called by wx main thread to set m_hwnd to NULL.
Definition at line 148 of file CBaseGUIWindow.cpp.
References mrpt::gui::CBaseGUIWindow::m_hwnd.
Referenced by mrpt::gui::CWindowDialog::OnClose(), and mrpt::gui::C3DWindowDialog::OnClose().
|
inherited |
Called by wx main thread to signal the semaphore that the wx window is built and ready.
Definition at line 205 of file CBaseGUIWindow.cpp.
References mrpt::gui::CBaseGUIWindow::m_threadReady.
Referenced by mrpt::gui::WxSubsystem::CWXMainFrame::OnTimerProcessRequests().
|
protectedinherited |
Called when you want this object to emit an event to all the observers currently subscribed to this object.
Definition at line 57 of file CObservable.cpp.
References MRPT_END, and MRPT_START.
Referenced by internal_emitGrabImageEvent(), mrpt::gui::CWindowDialog::OnChar(), mrpt::gui::CWindowDialog::OnClose(), mrpt::gui::C3DWindowDialog::OnClose(), mrpt::gui::CWindowDialog::OnMouseDown(), mrpt::gui::CWindowDialog::OnMouseMove(), mrpt::gui::CWindowDialog::OnResize(), mrpt::gui::C3DWindowDialog::OnResize(), mrpt::opengl::COpenGLViewport::render(), and mrpt::opengl::COpenGLViewport::renderNormalSceneMode().
|
inline |
Repaints the window.
forceRepaint, repaint and updateWindow are all aliases of the same method
Definition at line 188 of file CDisplayWindow3D.h.
References forceRepaint().
Referenced by mrpt::detectors::CFaceDetection::experimental_viewFacePointsAndEigenVects(), mrpt::detectors::CFaceDetection::experimental_viewFacePointsScanned(), and mrpt::detectors::CFaceDetection::experimental_viewRegions().
|
overridevirtual |
Resizes the window, stretching the image to fit into the display area.
Implements mrpt::gui::CBaseGUIWindow.
Definition at line 413 of file CDisplayWindow3D.cpp.
References mrpt::gui::CBaseGUIWindow::isOpen(), mrpt::gui::CBaseGUIWindow::m_caption, mrpt::gui::WxSubsystem::pushPendingWxRequest(), and mrpt::gui::WxSubsystem::TRequestToWxMainThread::source3D.
Referenced by mrpt::detectors::CFaceDetection::experimental_viewFacePointsAndEigenVects(), mrpt::detectors::CFaceDetection::experimental_viewFacePointsScanned(), and mrpt::detectors::CFaceDetection::experimental_viewRegions().
void CDisplayWindow3D::setCameraAzimuthDeg | ( | float | deg | ) |
Changes the camera parameters programmatically.
Definition at line 527 of file CDisplayWindow3D.cpp.
References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, and win.
Referenced by mrpt::detectors::CFaceDetection::experimental_viewFacePointsAndEigenVects(), mrpt::detectors::CFaceDetection::experimental_viewFacePointsScanned(), and mrpt::detectors::CFaceDetection::experimental_viewRegions().
void CDisplayWindow3D::setCameraElevationDeg | ( | float | deg | ) |
Changes the camera parameters programmatically.
Definition at line 508 of file CDisplayWindow3D.cpp.
References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, and win.
Referenced by mrpt::detectors::CFaceDetection::experimental_viewFacePointsAndEigenVects(), mrpt::detectors::CFaceDetection::experimental_viewFacePointsScanned(), and mrpt::detectors::CFaceDetection::experimental_viewRegions().
void CDisplayWindow3D::setCameraPointingToPoint | ( | float | x, |
float | y, | ||
float | z | ||
) |
Changes the camera parameters programmatically.
Definition at line 538 of file CDisplayWindow3D.cpp.
References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, and win.
Referenced by mrpt::detectors::CFaceDetection::experimental_viewFacePointsAndEigenVects(), mrpt::detectors::CFaceDetection::experimental_viewFacePointsScanned(), and mrpt::detectors::CFaceDetection::experimental_viewRegions().
void CDisplayWindow3D::setCameraProjective | ( | bool | isProjective | ) |
Sets the camera as projective, or orthogonal.
Definition at line 565 of file CDisplayWindow3D.cpp.
References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, and win.
void CDisplayWindow3D::setCameraZoom | ( | float | zoom | ) |
Changes the camera parameters programmatically.
Definition at line 554 of file CDisplayWindow3D.cpp.
References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, and win.
Referenced by mrpt::detectors::CFaceDetection::experimental_viewFacePointsAndEigenVects(), mrpt::detectors::CFaceDetection::experimental_viewFacePointsScanned(), and mrpt::detectors::CFaceDetection::experimental_viewRegions().
|
overridevirtual |
Set cursor style to default (cursorIsCross=false) or to a cross (cursorIsCross=true)
Implements mrpt::gui::CBaseGUIWindow.
Definition at line 726 of file CDisplayWindow3D.cpp.
References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, and win.
void CDisplayWindow3D::setFOV | ( | float | v | ) |
Changes the camera field of view (in degrees) (used for gluPerspective).
The window is not updated with this method, call "forceRepaint" to update the 3D view.
Definition at line 611 of file CDisplayWindow3D.cpp.
References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, and win.
void CDisplayWindow3D::setImageView | ( | const mrpt::img::CImage & | img | ) |
Set the "main" viewport into "image view"-mode, where an image is efficiently drawn (fitting the viewport area) using an OpenGL textured quad.
Call this method with the new image to update the displayed image (but recall to first lock the parent openglscene's critical section, then do the update, then release the lock, and then issue a window repaint). Internally, the texture is drawn using a mrpt::opengl::CTexturedPlane The viewport can be reverted to behave like a normal viewport by calling setNormalMode()
Definition at line 818 of file CDisplayWindow3D.cpp.
References m_3Dscene, and m_csAccess3DScene.
void CDisplayWindow3D::setImageView | ( | mrpt::img::CImage && | img | ) |
Just like setImageView but moves the internal image memory instead of making a copy, so it's faster but empties the input image.
Definition at line 824 of file CDisplayWindow3D.cpp.
References m_3Dscene, and m_csAccess3DScene.
void CDisplayWindow3D::setMaxRange | ( | float | new_max | ) |
Changes the camera max clip range (z) (used for gluPerspective.
The window is not updated with this method, call "forceRepaint" to update the 3D view.
Definition at line 587 of file CDisplayWindow3D.cpp.
References m_3Dscene.
void CDisplayWindow3D::setMinRange | ( | float | new_min | ) |
Changes the camera min clip range (z) (used for gluPerspective).
The window is not updated with this method, call "forceRepaint" to update the 3D view.
Definition at line 573 of file CDisplayWindow3D.cpp.
References m_3Dscene.
|
overridevirtual |
Changes the position of the window on the screen.
Implements mrpt::gui::CBaseGUIWindow.
Definition at line 437 of file CDisplayWindow3D.cpp.
References mrpt::gui::CBaseGUIWindow::isOpen(), mrpt::gui::CBaseGUIWindow::m_caption, mrpt::gui::WxSubsystem::pushPendingWxRequest(), and mrpt::gui::WxSubsystem::TRequestToWxMainThread::source3D.
Referenced by CGraphSlamHandler< GRAPH_T >::initVisualization().
|
overridevirtual |
Changes the window title.
Implements mrpt::gui::CBaseGUIWindow.
Definition at line 460 of file CDisplayWindow3D.cpp.
References mrpt::gui::CBaseGUIWindow::isOpen(), mrpt::gui::CBaseGUIWindow::m_caption, mrpt::gui::WxSubsystem::pushPendingWxRequest(), and mrpt::gui::WxSubsystem::TRequestToWxMainThread::source3D.
Referenced by mrpt::detectors::CFaceDetection::experimental_viewFacePointsAndEigenVects(), mrpt::detectors::CFaceDetection::experimental_viewFacePointsScanned(), and mrpt::detectors::CFaceDetection::experimental_viewRegions().
void CDisplayWindow3D::unlockAccess3DScene | ( | ) |
Unlocks the access to the internal 3D scene.
It is safer to use mrpt::gui::CDisplayWindow3DLocker instead. Typically user will want to call forceRepaint after updating the scene.
Definition at line 485 of file CDisplayWindow3D.cpp.
References m_csAccess3DScene.
Referenced by mrpt::detectors::CFaceDetection::experimental_viewFacePointsAndEigenVects(), mrpt::detectors::CFaceDetection::experimental_viewFacePointsScanned(), mrpt::detectors::CFaceDetection::experimental_viewRegions(), CGraphSlamHandler< GRAPH_T >::initVisualization(), and mrpt::gui::CDisplayWindow3DLocker::~CDisplayWindow3DLocker().
|
inline |
Just updates the text of a given text message, without touching the other parameters.
A shortcut for calling mrpt::opengl::COpenGLViewport::updateTextMessage()
Definition at line 343 of file CDisplayWindow3D.h.
References m_3Dscene.
|
inline |
Repaints the window.
forceRepaint, repaint and updateWindow are all aliases of the same method
Definition at line 191 of file CDisplayWindow3D.h.
References forceRepaint().
void CDisplayWindow3D::useCameraFromScene | ( | bool | useIt = true | ) |
If set to true (default = false), the mouse-based scene navigation will be disabled and the camera position will be determined by the opengl viewports in the 3D scene.
Definition at line 516 of file CDisplayWindow3D.cpp.
References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, and win.
|
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
ignoreControlKeys | If set to false, any push of shift, cmd, control, etc... will make this method to return. |
out_pushModifier | If set to !=nullptr, the modifiers of the key stroke will be saved here. |
Definition at line 152 of file CBaseGUIWindow.cpp.
References mrpt::system::os::getch(), mrpt::gui::CBaseGUIWindow::isOpen(), mrpt::system::os::kbhit(), mrpt::gui::CBaseGUIWindow::m_keyPushed, mrpt::gui::CBaseGUIWindow::m_keyPushedCode, mrpt::gui::CBaseGUIWindow::m_keyPushedModifier, and mrpt::gui::MRPTKMOD_NONE.
|
friend |
Definition at line 124 of file CDisplayWindow3D.h.
|
friend |
Definition at line 125 of file CDisplayWindow3D.h.
|
protected |
Internal OpenGL object (see general discussion in about usage of this object)
Definition at line 129 of file CDisplayWindow3D.h.
Referenced by addTextMessage(), CDisplayWindow3D(), clearTextMessages(), get3DSceneAndLock(), getDefaultViewport(), getLastMousePositionRay(), setImageView(), setMaxRange(), setMinRange(), and updateTextMessage().
|
protectedinherited |
The caption of the window.
Definition at line 60 of file CBaseGUIWindow.h.
Referenced by mrpt::gui::CBaseGUIWindow::createWxWindow(), mrpt::gui::CDisplayWindowPlots::resize(), resize(), mrpt::gui::CDisplayWindow::resize(), mrpt::gui::CDisplayWindowPlots::setPos(), setPos(), mrpt::gui::CDisplayWindow::setPos(), mrpt::gui::CDisplayWindowPlots::setWindowTitle(), setWindowTitle(), and mrpt::gui::CDisplayWindow::setWindowTitle().
|
mutableprotected |
Critical section for accesing m_3Dscene.
Definition at line 131 of file CDisplayWindow3D.h.
Referenced by get3DSceneAndLock(), getDefaultViewport(), getLastMousePositionRay(), setImageView(), unlockAccess3DScene(), and ~CDisplayWindow3D().
|
protected |
Definition at line 136 of file CDisplayWindow3D.h.
|
protected |
Definition at line 137 of file CDisplayWindow3D.h.
|
protected |
Definition at line 140 of file CDisplayWindow3D.h.
Referenced by grabImageGetNextFile(), and grabImagesStart().
|
protected |
Definition at line 139 of file CDisplayWindow3D.h.
Referenced by grabImageGetNextFile(), grabImagesStart(), and grabImagesStop().
|
protectedinherited |
The window handle.
Definition at line 62 of file CBaseGUIWindow.h.
Referenced by mrpt::gui::CBaseGUIWindow::createWxWindow(), mrpt::gui::CBaseGUIWindow::destroyWxWindow(), forceRepaint(), getCameraAzimuthDeg(), getCameraElevationDeg(), getCameraPointingToPoint(), getCameraZoom(), getFOV(), mrpt::gui::CDisplayWindow::getLastMousePosition(), mrpt::gui::CDisplayWindowPlots::getLastMousePosition(), getLastMousePosition(), mrpt::gui::CBaseGUIWindow::getWxObject(), isCameraProjective(), mrpt::gui::CBaseGUIWindow::isOpen(), mrpt::gui::CBaseGUIWindow::notifyChildWindowDestruction(), setCameraAzimuthDeg(), setCameraElevationDeg(), setCameraPointingToPoint(), setCameraProjective(), setCameraZoom(), mrpt::gui::CDisplayWindow::setCursorCross(), mrpt::gui::CDisplayWindowPlots::setCursorCross(), setCursorCross(), setFOV(), mrpt::gui::CDisplayWindow::showImage(), and useCameraFromScene().
|
protected |
Definition at line 142 of file CDisplayWindow3D.h.
Referenced by captureImagesStart(), captureImagesStop(), and isCapturingImgs().
|
protectedinherited |
Definition at line 65 of file CBaseGUIWindow.h.
Referenced by mrpt::gui::CBaseGUIWindow::clearKeyHitFlag(), mrpt::gui::CBaseGUIWindow::getPushedKey(), mrpt::gui::CBaseGUIWindow::keyHit(), mrpt::gui::CWindowDialog::OnChar(), and mrpt::gui::CBaseGUIWindow::waitForKey().
|
protectedinherited |
Definition at line 66 of file CBaseGUIWindow.h.
Referenced by mrpt::gui::CBaseGUIWindow::getPushedKey(), mrpt::gui::CWindowDialog::OnChar(), and mrpt::gui::CBaseGUIWindow::waitForKey().
|
protectedinherited |
Definition at line 67 of file CBaseGUIWindow.h.
Referenced by mrpt::gui::CBaseGUIWindow::getPushedKey(), mrpt::gui::CWindowDialog::OnChar(), and mrpt::gui::CBaseGUIWindow::waitForKey().
|
protected |
Definition at line 143 of file CDisplayWindow3D.h.
Referenced by getLastWindowImage(), and getLastWindowImagePtr().
|
mutableprotected |
Definition at line 144 of file CDisplayWindow3D.h.
Referenced by getLastWindowImage(), and getLastWindowImagePtr().
|
protected |
Definition at line 151 of file CDisplayWindow3D.h.
Referenced by getRenderingFPS(), and internal_setRenderingFPS().
|
protected |
Definition at line 148 of file CDisplayWindow3D.h.
|
mutableprotectedinherited |
This semaphore will be signaled when the wx window is built and ready.
Definition at line 56 of file CBaseGUIWindow.h.
Referenced by mrpt::gui::CBaseGUIWindow::createWxWindow(), and mrpt::gui::CBaseGUIWindow::notifySemThreadReady().
|
mutableprotectedinherited |
This semaphore will be signaled when the wx window is destroyed.
Definition at line 58 of file CBaseGUIWindow.h.
Referenced by mrpt::gui::CBaseGUIWindow::destroyWxWindow(), mrpt::gui::CWindowDialog::OnClose(), and mrpt::gui::C3DWindowDialog::OnClose().
Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020 |