30 namespace visualization {
34 unsigned int position_x_,
unsigned int position_y_,
35 unsigned int width_ ,
unsigned int height_) :
36 Window(name_, position_x_, position_y_, width_, height_)
50 LOG(LTRACE) <<
"WindowProbability::Display handler of window " << glutGetWindow();
52 APP_DATA_SYNCHRONIZATION_SCOPED_LOCK();
55 glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
56 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
60 draw_rectangle(1.0f, 1.0f, (
float)glutGet(GLUT_WINDOW_HEIGHT)*0.9, (
float)glutGet(GLUT_WINDOW_WIDTH)-2.0f, 0.7f, 0.7f, 0.7f, 1.0f);
72 float scale_x = (float)glutGet(GLUT_WINDOW_WIDTH)/(float)(elements);
73 float scale_y = (float)glutGet(GLUT_WINDOW_HEIGHT) * 0.9 - 1.0f;
76 for (
size_t x = 0; x < elements; x++) {
78 float val = data_ptr[x];
80 glColor4f(1.0, 0.5, 0.5, 1.0);
83 glVertex2i(((
float) (x+0.4) * scale_x), scale_y);
84 glVertex2i(((
float) (x+0.4) * scale_x), (
float) (1.0-val) * scale_y);
90 scale_y = (float)glutGet(GLUT_WINDOW_HEIGHT) * 0.97;
91 for (
size_t x = 0; x < elements; x++) {
92 char* str_value = (
char*)std::to_string(x).c_str();
93 draw_text((
float) (x+0.45) * scale_x, scale_y, str_value, 1.0f, 1.0f, 1.0f, 1.0f, GLUT_BITMAP_HELVETICA_10);
106 float scale_x = (float)glutGet(GLUT_WINDOW_WIDTH)/(float)(elements);
107 float scale_y = (float)glutGet(GLUT_WINDOW_HEIGHT) * 0.9 - 1.0f;
110 for (
size_t x = 0; x < elements; x++) {
112 float val = data_ptr[x];
114 glColor4f(0.5, 1.0, 0.5, 1.0);
117 glVertex2i(((
float) (x+0.6) * scale_x), scale_y);
118 glVertex2i(((
float) (x+0.6) * scale_x), (
float) (1.0-val) * scale_y);
124 scale_y = (float)glutGet(GLUT_WINDOW_HEIGHT) * 0.97;
125 for (
size_t x = 0; x < elements; x++) {
126 char* str_value = (
char*)std::to_string(x).c_str();
127 draw_text((
float) (x+0.45) * scale_x, scale_y, str_value, 1.0f, 1.0f, 1.0f, 1.0f, GLUT_BITMAP_HELVETICA_10);
140 APP_DATA_SYNCHRONIZATION_SCOPED_LOCK();
148 APP_DATA_SYNCHRONIZATION_SCOPED_LOCK();
WindowProbability(std::string name_="WindowProbability", unsigned int position_x_=0, unsigned int position_y_=0, unsigned int width_=512, unsigned int height_=512)
mic::types::MatrixXfPtr displayed_matrix1
void draw_text(float x, float y, char *string, float r, float g, float b, float a, void *font)
void setMatrixPointer2(mic::types::MatrixXfPtr displayed_matrix_)
mic::types::MatrixXfPtr displayed_matrix2
virtual ~WindowProbability()
Parent class of all OpenGL-based windows (abstract).
void setMatrixPointer1(mic::types::MatrixXfPtr displayed_matrix_)
void draw_rectangle(float x, float y, float h, float w, float r, float g, float b, float a)
void displayHandler(void)
Declaration of WindowManager class along with a bunch of helpful types and macros.