Commit 530e817b authored by Johnny Jazeix's avatar Johnny Jazeix

Correction for text printing in statistics while moving the sliders.

parent 8bf0647a
......@@ -76,6 +76,11 @@ protected:
*/
Element_pos _render_height;
/*!
* \brief The height used to show one container (fixed for now)
*/
Element_pos _size_for_one_container;
public:
/*!
* \brief Proceeds with the initialization of draw functions.
......@@ -100,6 +105,11 @@ public:
*/
virtual void set_total_height(Element_pos h) = 0;
/*!
* \brief Set the height for one container.
*/
virtual void set_height_for_one_container(Element_pos h) = 0;
};
......
......@@ -117,29 +117,6 @@ void Render_stats_opengl::paintGL(){
else
glCallList(_rect_list);
// /* Draw container texts */
// for (it_txt=_text_value.begin(), it_pos=_text_pos.begin() ; it_txt!=_text_value.end() ; it_txt ++, it_pos ++) {
// buf_x = *it_pos;
// it_pos ++;
// buf_y = *it_pos;
// buf_txt = *it_txt;
// glPushMatrix();
// glColor3d(0, 0, 0);
// glRasterPos2f(buf_x, buf_y);
// const unsigned int buf_text_size = buf_txt.length();
// for(unsigned int i = 0 ; i < buf_text_size ; i ++){
// glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10, buf_txt.c_str()[i]);
// }
// glPopMatrix();
// }/* end for(...) */
glFlush();
/* Check the errors */
......@@ -148,10 +125,7 @@ void Render_stats_opengl::paintGL(){
if(glerror != GL_NO_ERROR) {
fprintf(stderr, "Render stats openGL : the following OpengGL error occured: %s\n", gluErrorString(glerror));
}
// QPainter painter(this);/* Should be create AFTER glFlush() */
// painter.setPen(Qt::black);
// painter.setFont(QFont("Arial", 10));
const QFont &arial_font = QFont("Arial", 10);
qglColor(QColor(0, 0, 0)); // We put the text in black
for (it_txt=_text_value.begin(), it_pos=_text_pos.begin() ; it_txt!=_text_value.end() ; it_txt ++, it_pos ++) {
......@@ -159,7 +133,7 @@ void Render_stats_opengl::paintGL(){
buf_x = *it_pos - _translated_x;
it_pos ++;
buf_y = *it_pos - _translated_y;
buf_y = *it_pos - _translated_y + height() - _size_for_one_container;
buf_txt = *it_txt;
......@@ -195,6 +169,9 @@ void Render_stats_opengl::set_total_height(Element_pos h) {
_render_height = h;
}
void Render_stats_opengl::set_height_for_one_container(Element_pos h) {
_size_for_one_container = h;
}
void Render_stats_opengl::set_total_width(Element_pos w) {
_render_width = w;
......
......@@ -205,6 +205,11 @@ public:
*/
void set_total_width(Element_pos w);
/*!
* \brief Set the height for one container.
*/
void set_height_for_one_container(Element_pos h);
/*!
* \fn clear()
* \brief Reinitialize the render.
......
......@@ -180,6 +180,13 @@ public:
*/
void set_total_width(Element_pos w);
/*!
* \fn set_height_for_a_container()
* \brief Useless for svg.
*/
void set_height_for_one_container(Element_pos /*h*/){};
/*!
* \fn clear()
* \brief Reinitialize the render.
......
......@@ -268,7 +268,7 @@ public:
}
this->_max_width = pos_x + w + _POS_X_LEGEND_DEFAULT;
set_width(draw_object);
set_geometrical_informations_object(draw_object);
}
};
......
......@@ -236,12 +236,13 @@ public:
}
/*!
* \fn set_width(T* draw_object)
* \brief Set the total width for the draw object
* \fn set_geometrical_informations_object(T* draw_object)
* \brief Set the total width and height for one container for the draw object
* \param draw_object The kind of object which will be drawn (OpenGL, SVG...).
*/
virtual void set_width(T* draw_object) {
virtual void set_geometrical_informations_object(T* draw_object) {
draw_object->set_total_width(this->_max_width);
draw_object->set_height_for_one_container(this->_size_for_one_container);
}
};
......
......@@ -95,7 +95,7 @@ public:
draw_legend(draw_object, i);
}
set_width(draw_object);
set_geometrical_informations_object(draw_object);
end_draw(draw_object);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment