26 #include <logger/Log.hpp>
32 namespace visualization {
50 tmp =
instance_.load(boost::memory_order_consume);
54 instance_.store(tmp, boost::memory_order_release);
63 LOG(LTRACE) <<
"WindowManager::registerWindow";
64 if (window_ != NULL) {
65 LOG(LDEBUG) <<
"Registering window " << window_->
getId();
71 LOG(LTRACE) <<
"WindowManager::findWindow";
77 LOG(LWARNING) <<
"Window " << id_ <<
" not found";
82 void WindowManager::displayHandler(
void) {
83 LOG(LTRACE) <<
"Display handler of " << glutGetWindow() <<
" window";
86 if (APP_STATE->Quit()) {
88 throw std::exception();
98 void WindowManager::mouseHandler(
int button,
int state,
int x,
int y) {
99 LOG(LTRACE) <<
"Mouse handler of " << glutGetWindow() <<
" window";
106 void WindowManager::reshapeHandler(
int width_,
int height_) {
107 LOG(LTRACE) <<
"Reshape handler of " << glutGetWindow() <<
" window";
114 void WindowManager::keyboardHandler(
unsigned char key,
int x,
int y) {
115 LOG(LTRACE) <<
"Keyboard handler of " << glutGetWindow() <<
" window";
118 w->keyboardHandler(key);
122 void WindowManager::idle(
void) {
123 LOG(LTRACE) <<
"WindowManager::idle";
128 glutSetWindow(it->first);
135 void WindowManager::terminateWindows(
void) {
136 LOG(LTRACE) <<
"WindowManager::terminateWindows";
152 WindowManager::WindowManager() {
156 WindowManager::~WindowManager() {
160 void WindowManager::initializeGLUT(
int argc,
char *argv[]) {
161 LOG(LTRACE) <<
"WindowManager::initializeGLUT";
163 glutInit(&argc, argv);
170 void WindowManager::startVisualizationLoop() {
171 LOG(LTRACE) <<
"WindowManager::startVisualizationLoop";
173 APP_STATE->startUsingOpenGL();
177 LOG(LTRACE) <<
"glutMainLoop()";
182 LOG(LTRACE) <<
"Exiting glutMainLoop";
185 APP_STATE->stopUsingOpenGL();
std::map< unsigned int, mic::opengl::visualization::Window * >::iterator id_win_it_t
Type used in iterating/searching for windows in registry.
std::pair< unsigned int, mic::opengl::visualization::Window * > id_win_pair_t
Type used in adding windows to registry.
void registerWindow(mic::opengl::visualization::Window *window_)
std::map< unsigned int, mic::opengl::visualization::Window * > window_registry
unsigned int getId() const
#define VGL_MANAGER
Macro returning OpenGL window manager instance.
virtual void mouseHandler(int button, int state, int x, int y)
Contains declaration of parent class of all OpenGL-based windows.
mic::opengl::visualization::Window * findWindow(unsigned int id_)
virtual void reshapeHandler(int width_, int height_)
static boost::atomic< WindowManager * > instance_
Class responsible for management of all OpenGL windows - defined in the form of a singleton...
static boost::mutex instantiation_mutex
Parent class of all OpenGL-based windows (abstract).
virtual void displayHandler(void)=0
Declaration of WindowManager class along with a bunch of helpful types and macros.
static WindowManager * getInstance()