Commit aa64bd55 authored by Thibault Soucarre's avatar Thibault Soucarre

Correct container texts when using node selection

parent 45667617
This diff is collapsed.
......@@ -99,6 +99,9 @@ static bool _draw_counter;
Render_alternate::Render_alternate(Core* core, QWidget *parent, const QGLFormat& format)
: Hook_event(this, core, parent, format), _containers(GL_QUADS), /*_states(GL_QUADS),*/ _events(GL_POINTS), _events2(GL_LINES), _arrows(GL_LINE), _arrows2(GL_TRIANGLES), _counters(GL_LINE), _ruler(GL_QUADS), _modelview(glm::mat4(1.0)), _projection(glm::mat4(1.0)), _container_height(_DRAWING_CONTAINER_HEIGHT_DEFAULT){
_texts.clear();
_variable_texts.clear();
_links.clear();
}
......@@ -347,10 +350,10 @@ void Render_alternate::paintGL(){
const std::map<long int, Variable_text_>::const_iterator it_end=_variable_texts.end();
for(;it!=it_end;it++){
renderText ( render_to_screen_x(trace_to_render_x(vertical_line))+3,
renderText ( render_to_screen_x(trace_to_render_x(vertical_line))+3,
render_to_screen_y( trace_to_render_y((*it).second.y) + 0.5),
QString().setNum((*it).second.value),
arial_font);
arial_font);
}
......@@ -474,90 +477,92 @@ bool Render_alternate::build(){
bool Render_alternate::unbuild(){
/**********************
*
* Init OpenGL features
*
**********************/
/* enable some OpenGL features*/
// glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
// glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
// glEnable(GL_TEXTURE_2D);
// glEnable(GL_BLEND);/* enable blending for the alpha color */
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// glColor3d(1.0, 1.0, 1.0);/* init color to white */
/*enable some OpenGL features*/
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glEnable(GL_TEXTURE_2D);
// /*****************************
// *
// * Init render area attributes
// *
// *****************************/
glEnable(GL_BLEND);/* enable blending for the alpha color */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// _state = DRAWING_STATE_WAITING;/* change the drawing state */
glColor3d(1.0, 1.0, 1.0);/* init color to white */
// _wait_angle=0.0f;/* begin with 0 rad angle */
// _wait_angle_y=0.0f;/* begin with 0 rad angle */
// /* init measurement attributes */
// Info::Container::x_max = 0;
// Info::Container::y_max = 0;
// Info::Container::x_min = 0;
// Info::Container::y_min = 0;
// // Info::Render::_ui_render_min_value->setText("");
// // Info::Render::_ui_render_max_value->setText("");
// Info::Entity::x_max = 0;
// Info::Entity::x_min = 0;
// // _state_x_max = 0;
// _state_y_max = 0;
// // _state_x_min = 0;
// _state_y_min = 0;
/*****************************
*
* Init render area attributes
*
*****************************/
_state = DRAWING_STATE_WAITING;/* change the drawing state */
//_wait_angle=0.0f;/* begin with 0 rad angle */
//_wait_angle_y=0.0f;/* begin with 0 rad angle */
/* init measurement attributes */
/*Info::Container::x_max = 0;
Info::Container::y_max = 0;
Info::Container::x_min = 0;
Info::Container::y_min = 0;*/
// Info::Render::_ui_render_min_value->setText("");
// Info::Render::_ui_render_max_value->setText("");
//Info::Entity::x_max = 0;
//Info::Entity::x_min = 0;
// _state_x_max = 0;
//_state_y_max = 0;
// _state_x_min = 0;
//_state_y_min = 0;
/* clear lists to store container texts */
_text_pos.clear();
_text_value.clear();
clear_text();
//_arrows.clear();
//_circles.clear();
//_texts.clear();
/*for (unsigned int i=0 ;
i<_vbos.size() ;
i++){
delete _vbos[i];
}
_vbos.clear();*/
// /* clear lists to store container texts */
// _text_pos.clear();
// _text_value.clear();
/* clear the event vector */
// _events.clear();
/* clear the arrow vector */
// _arrows.clear();
// _circles.clear();
// _texts.clear();
// for (unsigned int i=0 ;
// i<_vbos.size() ;
// i++){
// delete _vbos[i];
// }
// _vbos.clear();
// /* clear the event vector */
// // _events.clear();
// /* clear the arrow vector */
// // _arrows.clear();
// /* empty the selection stack */
// while(false == _previous_selection.empty())
// _previous_selection.pop();
/* empty the selection stack */
while(false == _previous_selection.empty())
_previous_selection.pop();
// if (NULL == _render_instance)
// return true;
if (NULL == _render_instance)
return true;
// /* Now, timer is set */
// if (_wait_timer == NULL){
// _wait_angle = 0.0f;
/* Now, timer is set */
// if (_wait_timer == NULL){
// _wait_angle = 0.0f;
// /* _wait_timer = new QTimer(this);
// connect(_wait_timer, SIGNAL(timeout()), _render_instance, SLOT(updateGL()));
// _wait_timer->start(_wait_spf);*/
// }
/* _wait_timer = new QTimer(this);
connect(_wait_timer, SIGNAL(timeout()), _render_instance, SLOT(updateGL()));
_wait_timer->start(_wait_spf);*/
//}
// return true;//_render_instance->display_unbuild();
return true;//_render_instance->display_unbuild();
}
......@@ -645,7 +650,7 @@ void Render_alternate::draw_text(const Element_pos x, const Element_pos y, const
if (_draw_ruler) return;/* do not draw text for ruler */
Container_text_ buf;
buf.x = x;
buf.y = render_to_trace_y(y);// + offset_y; //render_to_trace_y(y);/* Cancel previous transformation. */
buf.y = render_to_trace_y(y);/* Cancel previous transformation. */
buf.value = s;
buf.size = size;
_texts.push_back(buf);
......@@ -943,3 +948,7 @@ Element_pos Render_alternate::get_vertical_line(){
return vertical_line;
}
void Render_alternate::clear_text (){
_texts.clear();
_variable_texts.clear();
}
......@@ -543,6 +543,9 @@ public slots:
*/
void update_vertical_line();
/*! Function that only delete the text of the screen */
void clear_text ();
};
......
......@@ -399,9 +399,9 @@ void Render_opengl::paintGL(){
if (it==it_end || render_to_screen_y(trace_to_render_y(_texts[i].y)) - render_to_screen_y(trace_to_render_y((*it).second))> height ){
const QString text_elided = metric.elidedText(_texts[i].value.c_str(), Qt::ElideRight, _x_scale_container_state*Info::Screen::width/(Info::Trace::depth+1.));
renderText ( render_to_screen_x(_texts[i].x * _x_scale_container_state/0.20),
render_to_screen_y( trace_to_render_y(_texts[i].y) + 0.5),
text_elided,
arial_font);
render_to_screen_y( trace_to_render_y(_texts[i].y) + 0.5),
text_elided,
arial_font);
//push only displayed values in the map
previous_by_column[_texts[i].x]=_texts[i].y;
......@@ -872,7 +872,8 @@ void Render_opengl::start_draw_states(){
glNewList(_list_states, GL_COMPILE);/* open the list */
}
void Render_opengl::draw_state(const Element_pos, const Element_pos, const Element_pos, const Element_pos, const Element_col, const EntityValue* ){
void Render_opengl::draw_state(const Element_pos x, const Element_pos y, const Element_pos z, const Element_pos w, const Element_pos h, const EntityValue* value){
draw_quad(x, y, z, w, h);
}
void Render_opengl::end_draw_states(){
......
......@@ -56,6 +56,9 @@ private:
Name _name;
EntityType *_type;
std::map<std::string, Value *> _opt;
//Element_col _r;
//Element_col _g;
//Element_col _b;
public:
/*!
......
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