MachineIntelligenceCore:Visualization
|
Class responsible for management of all OpenGL windows - defined in the form of a singleton, with double-checked locking pattern (DCLP) based access to instance. More...
#include <WindowManager.hpp>
Public Member Functions | |
virtual | ~WindowManager () |
void | registerWindow (mic::opengl::visualization::Window *window_) |
mic::opengl::visualization::Window * | findWindow (unsigned int id_) |
void | startVisualizationLoop () |
Runs the main GL loop. More... | |
void | terminateWindows (void) |
Static Public Member Functions | |
static WindowManager * | getInstance () |
static void | displayHandler (void) |
static void | mouseHandler (int button, int state, int x, int y) |
static void | reshapeHandler (int width_, int height_) |
static void | keyboardHandler (unsigned char key_, int x_, int y_) |
static void | idle (void) |
static void | initializeGLUT (int argc, char *argv[]) |
Private Member Functions | |
WindowManager () | |
Private Attributes | |
std::map< unsigned int, mic::opengl::visualization::Window * > | window_registry |
Static Private Attributes | |
static boost::atomic < WindowManager * > | instance_ |
static boost::mutex | instantiation_mutex |
Class responsible for management of all OpenGL windows - defined in the form of a singleton, with double-checked locking pattern (DCLP) based access to instance.
Definition at line 56 of file WindowManager.hpp.
|
virtual |
Virtual destructor.
Definition at line 156 of file WindowManager.cpp.
|
private |
Private constructor. Initializes GLUT!
Definition at line 152 of file WindowManager.cpp.
Referenced by getInstance().
|
static |
Refreshes the content of the window.
Definition at line 82 of file WindowManager.cpp.
References mic::opengl::visualization::Window::displayHandler(), and VGL_MANAGER.
mic::opengl::visualization::Window * mic::opengl::visualization::WindowManager::findWindow | ( | unsigned int | id_ | ) |
Finds window in the registry.
id_ | Window id. |
Definition at line 70 of file WindowManager.cpp.
References window_registry.
|
static |
Method for accessing the object instance, with double-checked locking optimization.
Definition at line 42 of file WindowManager.cpp.
References instance_, instantiation_mutex, and WindowManager().
|
static |
Idle function. Iterates through the window registry and updates all windows.
Definition at line 122 of file WindowManager.cpp.
References VGL_MANAGER, and window_registry.
|
static |
Initializes GLUT.
argc | |
argv |
Definition at line 160 of file WindowManager.cpp.
References VGL_MANAGER.
|
static |
Handles the keypressed event.
key_ | Pressed key. |
x_ | X coodrinate (unused). |
y_ | Y coordinate (unused). |
Definition at line 114 of file WindowManager.cpp.
References VGL_MANAGER.
|
static |
Refreshes the content of the window.
Definition at line 98 of file WindowManager.cpp.
References mic::opengl::visualization::Window::mouseHandler(), and VGL_MANAGER.
void mic::opengl::visualization::WindowManager::registerWindow | ( | mic::opengl::visualization::Window * | window_ | ) |
Adds window to registry.
window_ | Pointer to the registered window. |
Definition at line 62 of file WindowManager.cpp.
References mic::opengl::visualization::Window::getId(), and window_registry.
|
static |
Changes size of the window.
width_ | New width. |
height_ | New height. |
Definition at line 106 of file WindowManager.cpp.
References mic::opengl::visualization::Window::reshapeHandler(), and VGL_MANAGER.
void mic::opengl::visualization::WindowManager::startVisualizationLoop | ( | ) |
Runs the main GL loop.
It must be executed in the main thread (!!) and it is an infinite loop (!!), so the proper application must be executed in a separate thread.
Definition at line 170 of file WindowManager.cpp.
void mic::opengl::visualization::WindowManager::terminateWindows | ( | void | ) |
Definition at line 135 of file WindowManager.cpp.
|
staticprivate |
Private instance - accessed as atomic operation.
Definition at line 134 of file WindowManager.hpp.
Referenced by getInstance().
|
staticprivate |
Mutex used for instantiation of the instance.
Definition at line 139 of file WindowManager.hpp.
Referenced by getInstance().
|
private |
Window dispatcher, storing pointers to all OpenGL windows.
Definition at line 149 of file WindowManager.hpp.
Referenced by findWindow(), idle(), and registerWindow().