diff --git a/src/common/Info.cpp b/src/common/Info.cpp index 418a1cce4a1e6c088e7d31cf5d4330914f8affdb..7ff25c6f2b72b0f9195352831a83e4c051716195 100644 --- a/src/common/Info.cpp +++ b/src/common/Info.cpp @@ -26,11 +26,6 @@ using namespace std; unsigned int Info::Screen::width = 800; unsigned int Info::Screen::height = 600; -Element_pos Info::Container::x_min = 0; -Element_pos Info::Container::x_max = 0; -Element_pos Info::Container::y_min = 0; -Element_pos Info::Container::y_max = 0; - Element_pos Info::Render::width = 100; /* 100 OpenGL units for 1 pixel */ Element_pos Info::Render::height = 100; /* 100 OpenGL units for 1 pixel */ @@ -53,11 +48,3 @@ std::string Info::Splitter::filename; std::string Info::Splitter::xml_filename; Element_pos Info::Splitter::_x_min = 0.0; Element_pos Info::Splitter::_x_max = 0.0; - -void Info::release_all() { - - Info::Container::x_min = 0; - Info::Container::x_max = 0; - Info::Container::y_min = 0; - Info::Container::y_max = 0; -} diff --git a/src/common/Info.hpp b/src/common/Info.hpp index 369b77d0f41a9349b704654a1eb891dd17dba89c..eef201eefd2b51acd3558dad41102d45c1a261da 100644 --- a/src/common/Info.hpp +++ b/src/common/Info.hpp @@ -42,11 +42,6 @@ public: */ virtual ~Info(); - /*! - * \brief Release all Info class attributes. - */ - static void release_all(); - /*! * \brief Sub structure to store screen information. */ @@ -64,33 +59,6 @@ public: static unsigned int height; }; - /*! - * \brief Sub structure to store container information. - */ - struct Container - { - - /*! - * \brief Minimum x position. - */ - static Element_pos x_min; - - /*! - * \brief Maximum x position. - */ - static Element_pos x_max; - - /*! - * \brief Minimum y position. - */ - static Element_pos y_min; - - /*! - * \brief Maximum y position. - */ - static Element_pos y_max; - }; - /*! * \brief Sub structure to store render area information. */ diff --git a/src/interface/Interface_graphic.cpp b/src/interface/Interface_graphic.cpp index 54417ad99f9b61a162ac4a50aedd32618acd7a1e..23afdf43be11faaa15e576b124dd9714b4c33ed0 100644 --- a/src/interface/Interface_graphic.cpp +++ b/src/interface/Interface_graphic.cpp @@ -1146,9 +1146,6 @@ void Interface_graphic::release_render_area() { _render_layouts.front()->delete_trace(); } get_render_area()->update_render(); - - /* Release all data */ - Info::release_all(); } void Interface_graphic::redraw_trace() { diff --git a/src/render/GanttDiagram.hpp b/src/render/GanttDiagram.hpp index 335feed839ce4957f20efd807c7ad8ed7d6b8dac..b9efc4f9dd48ac1809431794e3cfd4c32c4d4155 100644 --- a/src/render/GanttDiagram.hpp +++ b/src/render/GanttDiagram.hpp @@ -66,6 +66,16 @@ private: */ bool _start_new_line; + /*! + * \brief Containers minimum x position + */ + Element_pos _container_max_x; + + /*! + * \brief Containers minimum y position + */ + Element_pos _container_min_y; + std::vector<Container_> _containers; std::vector<Container_text_> _container_texts; @@ -85,10 +95,11 @@ public: /*! * \brief The default constructor */ - GanttDiagram(Render *instance) { - _render = instance; - _start_new_line = false; - } + GanttDiagram(Render *instance) : + _render(instance), + _start_new_line(false), + _container_max_x(0), + _container_min_y(0) { } /*! * \brief The destructor @@ -147,22 +158,20 @@ public: _container_texts.push_back(buft); - if ((x + w) > Info::Container::x_max) - Info::Container::x_max = x + w; + if ((x + w) > _container_max_x) + _container_max_x = x + w; - if ((y + h) > Info::Container::y_max) - Info::Container::y_max = y + h; - - if (Info::Container::x_min > x) - Info::Container::x_min = x; + if ((y + h) > _trace_height) { + _trace_height = y + h; + } - if (Info::Container::y_min > y) - Info::Container::y_min = y; + if (_container_min_y > y) + _container_min_y = y; #ifdef DEBUG_MODE_RENDER_AREA std::cerr << __FILE__ << " l." << __LINE__ << ":" << std::endl; std::cerr < "Container drawing:" << std::endl; - std::cerr << "x: " << x << " y: " << y << " w: " << w << " h: " << h << " xmax-xmin: " << Info::Container::x_max << " - " << Info::Container::x_min << " ymax-ymin: " << Info::Container::y_max << " - " << Info::Container::y_min << std::endl; + std::cerr << "x: " << x << " y: " << y << " w: " << w << " h: " << h << " xmax: " << _container_max_x << " ymax-ymin: " << _container_max_y << " - " << _container_min_y << std::endl; #endif } @@ -187,10 +196,10 @@ public: */ inline void end_draw_containers() { static float j = 0.6f; - float coeffx = (Info::Render::width / Info::Container::x_max) * _x_scale_container_state; - float coeffy = ((Info::Render::height - _ruler_height) / Info::Container::y_max) * _y_state_scale; + float coeffx = (Info::Render::width / _container_max_x) * _x_scale_container_state; + float coeffy = ((Info::Render::height - _ruler_height) / (_trace_height - _container_min_y)) * _y_state_scale; - /* Before calling start_draw_container(), Info::Container::y_max should have a correct value */ + /* Before calling start_draw_container(), _container_max_y should have a correct value */ _render->start_draw_containers(); for (const auto &_container: _containers) { diff --git a/src/render/Geometry.cpp b/src/render/Geometry.cpp index f1042fcbdaa40d5b7fef938736645765d2014e94..98c4bcf92abc813415cd8052c620576eccf5bd63 100644 --- a/src/render/Geometry.cpp +++ b/src/render/Geometry.cpp @@ -92,6 +92,7 @@ void Geometry::init_geometry() { _min_visible_time = 0; _max_visible_time = 0; _trace_length = 1; /* Default value can't be 0 because we divide by it so 1 was chosen */ + _trace_height = 1; /* Default value can't be 0 because we divide by it so 1 was chosen */ } void Geometry::set_trace_length(float new_trace_length) { @@ -162,7 +163,7 @@ Element_pos Geometry::coeff_trace_render_x() const { Element_pos Geometry::coeff_trace_render_y() const { - return ((Info::Render::height - _ruler_height) * _y_state_scale) / (Info::Container::y_max - Info::Container::y_min); + return ((Info::Render::height - _ruler_height) * _y_state_scale) / _trace_height; } void Geometry::update_visible_interval_value() { diff --git a/src/render/Geometry.hpp b/src/render/Geometry.hpp index eb2b22381cc950b7d6e1c1e81420d7d9ef01bd38..80831bc2ae4b4ebcdec331497585b4301bca28f0 100644 --- a/src/render/Geometry.hpp +++ b/src/render/Geometry.hpp @@ -203,6 +203,12 @@ protected: */ Element_pos _max_visible_time; + /** + * \brief Height of the trace on which Geometry works on + * Used for coeff_trace_render_y to convert trace y coordinate into render y coordinate + */ + Element_pos _trace_height; + /*********************************** * * Constructor and destructor. diff --git a/src/render/opengl/Render_opengl.cpp b/src/render/opengl/Render_opengl.cpp index 1f7f24a5ea706083ea6c95713fc2b15f57e3b574..2d5746c5fe9a60fbb6112a1c85c49bc09800676a 100644 --- a/src/render/opengl/Render_opengl.cpp +++ b/src/render/opengl/Render_opengl.cpp @@ -740,6 +740,9 @@ void Render_opengl::draw_quad(Element_pos x, Element_pos y, Element_pos /*z*/, E if (!_draw_container) offset_x = -_default_entity_x_translate; + else if (_trace_height < y + h) { + _trace_height = y + h; + } glBegin(GL_QUADS); { diff --git a/src/render/vbo/Render_alternate.cpp b/src/render/vbo/Render_alternate.cpp index 3148fc744fe605b656c17a64b0fdededab300ae6..234ee95c22a70e2820b9c347a1132dbb795deeb0 100644 --- a/src/render/vbo/Render_alternate.cpp +++ b/src/render/vbo/Render_alternate.cpp @@ -905,6 +905,9 @@ void Render_alternate::draw_quad(Element_pos x, Element_pos y, Element_pos z, El _containers.add((x + w) + offset_x, (y + h) + offset_y, _r, _g, _b); _containers.add(x + offset_x, (y + h) + offset_y, _r, _g, _b); _containers.add(x + offset_x, y + offset_y, _r, _g, _b); + if (_trace_height < y + h) { + _trace_height = y + h; + } } else if (_draw_states) { offset_x = -_default_entity_x_translate; diff --git a/src/trace/DrawTrace.cpp b/src/trace/DrawTrace.cpp index 78d7151fcf1eaca597c90fcf42836bfc898bc440..2fb24410c0ac83747d1c9f47ad0a5ffbcb542aad 100644 --- a/src/trace/DrawTrace.cpp +++ b/src/trace/DrawTrace.cpp @@ -405,7 +405,6 @@ void DrawTrace::add(std::vector<const Container *> *container, std::stack<Contai } void DrawTrace::build(GanttDiagram *draw_object, Trace *trace) { - Info::Container::y_max = 0; // reset the vertical zoom when rebuilding double zoom = trace->get_filter(); Interval *interval; // = trace->get_interval_constrained(); // clear entities