From 00658482b3f1096e02d3b5aaae90108ae628a05c Mon Sep 17 00:00:00 2001 From: Mathieu Faverge Date: Fri, 18 Aug 2017 00:52:52 +0200 Subject: [PATCH] Fix visibility with OpenGl --- src/interface/Interface_graphic.cpp | 26 +++++++++------ src/interface/Node_select.cpp | 44 ++++++++++++------------ src/render/GanttDiagram.hpp | 2 +- src/render/Render_alternate.cpp | 11 ++++-- src/render/Render_opengl.cpp | 52 +++++++++++++++++------------ 5 files changed, 77 insertions(+), 58 deletions(-) diff --git a/src/interface/Interface_graphic.cpp b/src/interface/Interface_graphic.cpp index 5fea8ab..e1c06dd 100644 --- a/src/interface/Interface_graphic.cpp +++ b/src/interface/Interface_graphic.cpp @@ -559,30 +559,36 @@ void Interface_graphic::on_export_file_triggered(){ void Interface_graphic::on_reload_triggered() { if(_is_rendering_trace) { - Element_pos zoom[2]={Info::Splitter::_x_min,Info::Splitter::_x_max}; - if(_ui_settings != NULL){ + Element_pos zoom[2] = { Info::Splitter::_x_min, + Info::Splitter::_x_max }; + if( _ui_settings != NULL ) { _ui_settings->refresh(); } - if(_ui_node_selection!=NULL) - _ui_node_selection->on_reset_button_clicked(); - if(_ui_interval_selection!=NULL) - _ui_interval_selection->on_reset_button_clicked(); - if(_reload_type) + // if(_ui_node_selection!=NULL) + // _ui_node_selection->on_reset_button_clicked(); + // if(_ui_interval_selection!=NULL) + // _ui_interval_selection->on_reset_button_clicked(); + if( _reload_type ) { _core->launch_action(Core::_STATE_RELEASE_RENDER_AREA); - else + } + else { _core->launch_action(Core::_STATE_CLEAN_RENDER_AREA); + } _core->draw_trace(_trace_path, Core::_DRAW_OPENGL); - if(Info::Splitter::_x_max!=0.0) + if( Info::Splitter::_x_max != 0.0 ) { _core->launch_action(Core:: _STATE_ZOOM_IN_AN_INTERVAL, &zoom); + } _core->launch_action(Core:: _STATE_RENDER_UPDATE); + //reset the slider to its original value scale_container_state->setValue(20); //update the interval selection display - if(_ui_interval_selection!=NULL) + if( _ui_interval_selection != NULL ) { _ui_interval_selection->update_values(); + } } } diff --git a/src/interface/Node_select.cpp b/src/interface/Node_select.cpp index 9405d38..8bc5875 100644 --- a/src/interface/Node_select.cpp +++ b/src/interface/Node_select.cpp @@ -243,38 +243,36 @@ void Stats_window::set_selected_nodes(string kind_of_state){ */ - void Node_select::on_reset_button_clicked(){ - //resets to initial containers, +void Node_select::on_reset_button_clicked(){ + //resets to initial containers, _displayed_containers.clear(); - QList items; - QTreeWidgetItemIterator it(_nodes_original);//browse only top containers - while (*it) { + QList items; + QTreeWidgetItemIterator it(_nodes_original);//browse only top containers + while (*it) { if((*it)->parent()==NULL){//we only want parent nodes - _displayed_containers.push_back(((*it)->data(0,Qt::UserRole)).value()); - reassign_children_rec(*it, 0); + _displayed_containers.push_back(((*it)->data(0,Qt::UserRole)).value()); + reassign_children_rec(*it, 0); } - ++it; + ++it; - } + } - _nodes_displayed->clear(); - //can we load that from _nodes_original instead ? - set_displayed_container_names(); + _nodes_displayed->clear(); + //can we load that from _nodes_original instead ? + set_displayed_container_names(); Element_pos zoom[2]={Info::Render::_x_min, Info::Render::_x_max}; - Info::Render::_x_min_visible = 0.0; - Info::Render::_x_max_visible = 0.0; - _trace->set_view_root_containers(_displayed_containers); - //_trace->set_selected_container(_trace->get_root_containers()); + Info::Render::_x_min_visible = 0.0; + Info::Render::_x_max_visible = 0.0; + _trace->set_view_root_containers(_displayed_containers); + //_trace->set_selected_container(_trace->get_root_containers()); _console->get_console()->launch_action(Core:: _STATE_CLEAN_RENDER_AREA); - #if defined(USE_ITC) && defined(BOOST_SERIALIZE) - _trace->updateTrace(new Interval(zoom[0], zoom[1])); - #endif +#if defined(USE_ITC) && defined(BOOST_SERIALIZE) + _trace->updateTrace(new Interval(zoom[0], zoom[1])); +#endif _console->get_console()->draw_trace(_console->get_filename(),Core::_DRAW_OPENGL); - _console->get_console()->launch_action(Core:: _STATE_ZOOM_IN_AN_INTERVAL, &zoom); + _console->get_console()->launch_action(Core:: _STATE_ZOOM_IN_AN_INTERVAL, &zoom); _console->get_console()->launch_action(Core:: _STATE_RENDER_UPDATE); - - - } +} diff --git a/src/render/GanttDiagram.hpp b/src/render/GanttDiagram.hpp index 121b7b3..571b62c 100644 --- a/src/render/GanttDiagram.hpp +++ b/src/render/GanttDiagram.hpp @@ -113,7 +113,7 @@ public: /*! * \brief The default constructor */ - GanttDiagram(Render* instance){ + GanttDiagram( Render *instance ) { _render = instance; } diff --git a/src/render/Render_alternate.cpp b/src/render/Render_alternate.cpp index 82fc83f..e38dd1b 100644 --- a/src/render/Render_alternate.cpp +++ b/src/render/Render_alternate.cpp @@ -978,8 +978,14 @@ void Render_alternate::start_draw_states(){ _draw_states = true; } -void Render_alternate::draw_state(const Element_pos x, const Element_pos y, const Element_pos z, const Element_pos w, const Element_pos h, EntityValue* value){ - if(_states.count(value)==0){ //if there is no vbo corresponding to value +void Render_alternate::draw_state( const Element_pos x, + const Element_pos y, + const Element_pos z, + const Element_pos w, + const Element_pos h, + EntityValue *value ) +{ + if( _states.count(value) == 0 ) { //if there is no vbo corresponding to value //we create a new vbo and a new shader corresponding to the current color*/ Shader *s = new Shader(_glsl, _r, _g, _b, true); s->charger(); @@ -1472,5 +1478,4 @@ void Render_alternate::reload_events(){ } it++; } - } diff --git a/src/render/Render_opengl.cpp b/src/render/Render_opengl.cpp index da8c256..f38d2e7 100644 --- a/src/render/Render_opengl.cpp +++ b/src/render/Render_opengl.cpp @@ -860,8 +860,16 @@ void Render_opengl::start_draw_states(){ glNewList(_list_states, GL_COMPILE);/* open the list */ } -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, EntityValue* value){ - draw_quad(x, y, z, w, h); +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, + EntityValue *value ) +{ + if ((value == NULL) || (value->get_visible() == true) ) { + draw_quad( x, y, z, w, h ); + } } void Render_opengl::end_draw_states(){ @@ -880,22 +888,23 @@ void Render_opengl::draw_arrow(const Element_pos start_time, const Element_col red, const Element_col green, const Element_col blue, - EntityValue *v) + EntityValue *value) { Arrow_ buf; const Element_pos offset_x = -_default_entity_x_translate; const Element_pos offset_y = -_ruler_y - _ruler_height; - (void)v; - buf.start_time = start_time + offset_x; - buf.end_time = end_time + offset_x; - buf.start_height = start_height + offset_y; - buf.end_height = end_height + offset_y; - buf.red = red; - buf.green = green; - buf.blue = blue; + if ((value == NULL) || (value->get_visible() == true) ) { + buf.start_time = start_time + offset_x; + buf.end_time = end_time + offset_x; + buf.start_height = start_height + offset_y; + buf.end_height = end_height + offset_y; + buf.red = red; + buf.green = green; + buf.blue = blue; - _arrows.push_back(buf); + _arrows.push_back(buf); + } } void Render_opengl::end_draw_arrows(){ @@ -909,21 +918,22 @@ void Render_opengl::start_draw_events(){ void Render_opengl::draw_event(const Element_pos time, const Element_pos height, const Element_pos container_height, - EntityValue *v) + EntityValue *value) { Event_ buf; const Element_pos offset_x = -_default_entity_x_translate; const Element_pos offset_y = -_ruler_y - _ruler_height; - (void)v; - buf.time = time + offset_x; - buf.height = height + offset_y; - buf.container_height = -container_height/2 ; - buf.red = _red; - buf.green = _green; - buf.blue = _blue; + if ((value == NULL) || (value->get_visible() == true) ) { + buf.time = time + offset_x; + buf.height = height + offset_y; + buf.container_height = -container_height/2 ; + buf.red = _red; + buf.green = _green; + buf.blue = _blue; - _circles.push_back(buf); + _circles.push_back(buf); + } } -- 2.22.0