Commit 8f1e2a2f authored by Johnny Jazeix's avatar Johnny Jazeix
Browse files

Beginning for the render of stats. (the text printed means nothing for

the moment)
parent cdd7ed44
......@@ -458,6 +458,7 @@ void Interface_graphic::on_close_triggered(){
_ui_info_trace_text->clear();/* Clear the current text (if exists) */
_ui_info_selection_text->clear();/* Clear the current text (if exists) */
_ui_info_window->hide();/* Hide the informative window */
//_stats_window->hide(); // Hide the stats window
_core->launch_action(Interface_console::_STATE_RELEASE_RENDER_AREA);
......
......@@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>660</width>
<height>482</height>
<width>666</width>
<height>519</height>
</rect>
</property>
<property name="windowTitle" >
......@@ -21,181 +21,182 @@
<rect>
<x>0</x>
<y>26</y>
<width>660</width>
<height>456</height>
<width>666</width>
<height>493</height>
</rect>
</property>
<widget class="QSplitter" name="splitter_2" >
<widget class="QWidget" name="layoutWidget" >
<property name="geometry" >
<rect>
<x>20</x>
<y>10</y>
<width>601</width>
<height>421</height>
<width>621</width>
<height>461</height>
</rect>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<widget class="QWidget" name="horizontalLayoutWidget" >
<layout class="QHBoxLayout" name="horizontalLayout_6" >
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4" >
<property name="sizeConstraint" >
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Selected
node :</string>
</property>
</widget>
</item>
<item>
<widget class="QTreeWidget" name="_nodes_selected" >
<property name="selectionMode" >
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="selectionBehavior" >
<enum>QAbstractItemView::SelectItems</enum>
</property>
<property name="headerHidden" >
<bool>true</bool>
</property>
<column>
<layout class="QHBoxLayout" name="horizontalLayout_7" >
<property name="sizeConstraint" >
<enum>QLayout::SetMaximumSize</enum>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6" >
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4" >
<property name="sizeConstraint" >
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>1</string>
<string>Selected
node :</string>
</property>
</column>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QSplitter" name="splitter" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<widget class="QWidget" name="horizontalLayoutWidget_5" >
<layout class="QHBoxLayout" name="horizontalLayout_5" >
<property name="sizeConstraint" >
<enum>QLayout::SetDefaultConstraint</enum>
</property>
</widget>
</item>
<item>
<widget class="QTreeWidget" name="_nodes_selected" >
<property name="selectionMode" >
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="selectionBehavior" >
<enum>QAbstractItemView::SelectItems</enum>
</property>
<property name="headerHidden" >
<bool>true</bool>
</property>
<column>
<property name="text" >
<string>1</string>
</property>
</column>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3" >
<item>
<layout class="QVBoxLayout" name="verticalLayout" >
<layout class="QHBoxLayout" name="horizontalLayout_5" >
<property name="sizeConstraint" >
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout1" >
<layout class="QVBoxLayout" name="verticalLayout" >
<property name="sizeConstraint" >
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>start
time</string>
<layout class="QHBoxLayout" name="horizontalLayout1" >
<property name="sizeConstraint" >
<enum>QLayout::SetDefaultConstraint</enum>
</property>
</widget>
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>start
time</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="_start_time_widget" />
</item>
</layout>
</item>
<item>
<widget class="QLineEdit" name="_start_time_widget" />
<layout class="QHBoxLayout" name="horizontalLayout_2" >
<property name="sizeConstraint" >
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>end
time</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="_end_time_widget" />
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" >
<layout class="QHBoxLayout" name="horizontalLayout" >
<property name="sizeConstraint" >
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QLabel" name="label_3" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>end
time</string>
<string>Kind of viewing</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="_end_time_widget" />
<widget class="QComboBox" name="_kind_of_diagram_box" >
<item>
<property name="text" >
<string>Chart</string>
</property>
</item>
<item>
<property name="text" >
<string>Horizontal percentage</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout" >
<property name="sizeConstraint" >
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Kind of viewing</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox" >
<layout class="QVBoxLayout" name="verticalLayout_2" >
<item>
<property name="text" >
<string>Chart</string>
</property>
<widget class="QPushButton" name="reload_button" >
<property name="text" >
<string>Reload</string>
</property>
</widget>
</item>
<item>
<property name="text" >
<string>Horizontal percentage</string>
</property>
<widget class="QPushButton" name="export_button" >
<property name="text" >
<string>Export</string>
</property>
</widget>
</item>
</widget>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2" >
<layout class="QHBoxLayout" name="horizontalLayout_3" >
<property name="sizeConstraint" >
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QPushButton" name="reload_button" >
<property name="text" >
<string>Reload</string>
<layout class="QVBoxLayout" name="stats_area" >
<property name="sizeConstraint" >
<enum>QLayout::SetDefaultConstraint</enum>
</property>
</widget>
</layout>
</item>
<item>
<widget class="QPushButton" name="export_button" >
<property name="text" >
<string>Export</string>
<widget class="QScrollBar" name="y_scroll" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget" >
<layout class="QHBoxLayout" name="horizontalLayout_3" >
<property name="sizeConstraint" >
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<layout class="QVBoxLayout" name="stats_area" >
<property name="sizeConstraint" >
<enum>QLayout::SetDefaultConstraint</enum>
</property>
</layout>
</item>
<item>
<widget class="QScrollBar" name="y_scroll" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QMenuBar" name="menubar" >
......@@ -203,7 +204,7 @@ time</string>
<rect>
<x>0</x>
<y>0</y>
<width>660</width>
<width>666</width>
<height>26</height>
</rect>
</property>
......
......@@ -45,22 +45,18 @@ public:
virtual void start_draw() = 0;
/*!
* \brief Draw the text of a container.
* \brief Draw the text.
* \param x the x position of the text.
* \param y the y position of the text.
* \param value the string value of the text.
*/
virtual void draw_container_name(const Element_pos x, const Element_pos y, const std::string value) = 0;
virtual void draw_text(const Element_pos x, const Element_pos y, const std::string value) = 0;
/*!
* \brief Draw a container according to the parameters
* \param x the x position of the container
* \param y the y position of the container
* \param w the width of the container
* \param h the height of the container
* \brief Proceeds with the end of draw functions.
*/
virtual void draw_container(const Element_pos x, const Element_pos y, const Element_pos w, const Element_pos h) = 0;
virtual void end_draw() = 0;
/*!
* \brief Set the height of the render area.
......
/*!
*\file render_opengl.cpp
*\file render_stats_opengl.cpp
*/
#include "render_opengl.hpp"
#include "render_stats_opengl.hpp"
using namespace std;
......@@ -12,11 +12,9 @@ using namespace std;
#define message *Message::get_instance() << "(" << __FILE__ << " l." << __LINE__ << "): "
Render_stats_opengl::Render_stats_opengl(QWidget *parent) : QGLWidget(parent){
}
Render_stats_opengl::~Render_stats_opengl(){
}
void Render_stats_opengl::initializeGL(){
......@@ -69,16 +67,6 @@ void Render_stats_opengl::paintGL(){
doneCurrent();
}
void Render_stats_opengl::start_draw(){
}
void Render_stats_opengl::draw_container_name(const Element_pos x, const Element_pos y, const std::string value) {
cout << "container name: " << value << " pos : ("<<x<<","<<y<<")." << endl;
}
void Render_stats_opengl::draw_container(const Element_pos x, const Element_pos y, const Element_pos w, const Element_pos h) {
cout << "draw_container: " << endl <<"\t pos: ("<<x<<","<<y<<"), taille: (" <<w<<","<<h<<")."<< endl;
}
void Render_stats_opengl::set_total_height(Element_pos h) {
_render_height = h;
......
......@@ -62,17 +62,20 @@ public:
* \param y the y position of the text.
* \param value the string value of the text.
*/
void draw_container_name(const Element_pos x, const Element_pos y, const std::string value);
void draw_text(const Element_pos x, const Element_pos y, const std::string value);
/*!
* \brief Draw a container according to the parameters
* \param x the x position of the container
* \param y the y position of the container
* \param w the width of the container
* \param h the height of the container
* \brief Draw the text of a container.
* \param x the x position of the text.
* \param y the y position of the text.
* \param value the string value of the text.
*/
void draw_container(const Element_pos x, const Element_pos y, const Element_pos w, const Element_pos h);
void draw_rect(const Element_pos x, const Element_pos y, const Element_pos w, const Element_pos h, const Element_pos r, const Element_pos g, const Element_pos b);
/*!
* \brief Proceeds with the end of draw functions.
*/
void end_draw();
/*!
* \brief Set the height of the render area.
......@@ -80,4 +83,17 @@ public:
void set_total_height(Element_pos h);
};
inline void Render_stats_opengl::start_draw(){}
inline void Render_stats_opengl::draw_text(const Element_pos x, const Element_pos y, const std::string value) {
std::cout << "text: " << value << " @ position : ("<<x<<","<<y<<")." << std::endl;
}
inline void Render_stats_opengl::draw_rect(const Element_pos x, const Element_pos y, const Element_pos w, const Element_pos h, const Element_pos r, const Element_pos g, const Element_pos b) {
std::cout << "rect: " << "x "<<x<<", y"<<y<<", w"<<w<<", "<<h << " ("<<r<<", "<<g<<", "<<b<<std::endl;
}
inline void Render_stats_opengl::end_draw(){}
#endif
......@@ -7,45 +7,23 @@
#include <string>
#include <vector>
#include <map>
#include "../message/Message.hpp"
#include "../trace/Trace.hpp"
#include "../trace/tree/Interval.hpp"
/*
* Theses constants can not be put as static const float because it is a template and there binary representation is not normed by the C++ langage.
*/
/*!
* \def _DRAWING_CONTAINER_HEIGHT_DEFAULT
* \brief The default height for containers.
*/
#define _DRAWING_CONTAINER_HEIGHT_DEFAULT 1.2f
#include "Statistic.hpp"
/*!
* \def _DRAWING_CONTAINER_WIDTH_DEFAULT
* \brief The default width for containers.
* \def _HEIGHT_FOR_ONE_CONTAINER_DEFAULT
* \brief The default height for one container's statistics.
*/
#define _DRAWING_CONTAINER_WIDTH_DEFAULT 2.5f
#define _HEIGHT_FOR_ONE_CONTAINER_DEFAULT 1.2f
/*!
* \def _DRAWING_CONTAINER_V_SPACE_DEFAULT
* \brief The default vertical space between containers.
* \def _HEIGHT_V_SPACE_DEFAULT
* \brief The default vertical space between two statistics.
*/
#define _DRAWING_CONTAINER_V_SPACE_DEFAULT 0.2f
/*!
* \def _DRAWING_STATE_HEIGHT_DEFAULT
* \brief The default height for states.
*/
#define _DRAWING_STATE_HEIGHT_DEFAULT 1.2f
/*!
* \def _DRAWING_STATE_V_SPACE_DEFAULT
* \brief The default vertical space between states.
*/
#define _DRAWING_STATE_V_SPACE_DEFAULT 0.2f
#define _HEIGHT_V_SPACE_DEFAULT 0.2f
/*!
......@@ -57,36 +35,12 @@ class DrawStats {
protected:
Trace *_trace;
std::vector<Container *> _containers_to_print;
std::vector<std::map<const EntityValue*, stats*> > _states;
// Geometrical informations about the stats shape.
/*!
* \brief _container_width width of the container
*/
Element_pos _container_width;
/*!
* \brief _container_height height of the container
*/
Element_pos _container_height;
/*!
* \brief _container_h_space Horizontal space beetween 2 containers
*/
Element_pos _container_h_space;
/*!
* \brief _container_v_space Vertical space between 2 containers
*/
Element_pos _container_v_space;
/*!
* \brief _state_height Height of the state
*/
Element_pos _state_height;
/*!
* \brief _state_v_space Vertical space between 2 states
*/
Element_pos _state_v_space;
public:
/*
......@@ -104,33 +58,57 @@ public:
/*!
* \fn build(T* draw_object, Trace* trace, const Interval & interval)
* \fn build(T* draw_object, Trace* trace, std::string kind_of_diagram)
* \brief The trace building function.
* \param draw_object the kind of object which will be drawn (OpenGL, SVG...).
* \param trace the trace data.
* \param interval The interval we want to display in
* \param kind_of_diagram th ekind of diagram (histogram, chart...)
*/
void build(T* draw_object, Trace* trace, const Interval & interval) {
void build(T* draw_object, std::vector<Container *> containers_to_print, std::string kind_of_diagram) {
_containers_to_print = containers_to_print;
const int number_of_containers = _containers_to_print.size();
draw_object->start_draw();
draw_object->start_draw_containers();
//browse_container_tree(draw_object, trace);
draw_object->end_draw_containers();
browse_entities(draw_object, interval);
for(int i = 0 ; i < number_of_containers ; i ++) {
draw_container_name(draw_object, i);
draw_diagram(draw_object, i, kind_of_diagram);
draw_legend(draw_object, i);
}
draw_object->end_draw();
}
void draw_container_name(T* draw_object, const int container_id){
// Get the position for the i-th container name
// TO DO
Element_pos pos_x = 33;
Element_pos pos_y = 33 * container_id;
std::string name = _containers_to_print[container_id]->get_name().to_string();
////
draw_object->draw_text(pos_x, pos_y, name);
}
void draw_diagram(T* draw_object, const int container_id, std::string kind_of_diagram){
// TO DO
draw_object->draw_text(0, container_id, kind_of_diagram);
}
/*!
* \brief Browse the states list and draw them
*/
inline void browse_entities(T* draw_object, const Interval& interval) {
void draw_legend(T* draw_object, const int container_id){
// TO DO
Element_pos pos_x = 33;
Element_pos pos_y = 33 * container_id;
std::string name = _containers_to_print[container_id]->get_name().to_string();
float red = 0.0f, green = 0.0f, blue = 0.0f;
int w = 30, h = 20;
/////
draw_object->draw_text(pos_x, pos_y, name);
draw_object->draw_rect(pos_x, pos_y, w, h, red, green, blue);
}
};
#endif
......@@ -46,7 +46,7 @@ void Statistic::set_nb_event(int n){
_event = n;
}
int Statistic::get_nb_event(){
int Statistic::get_nb_event() const {
return _event;
}
......
......@@ -30,13 +30,13 @@ private :
public :
/*!
* \fn Statistique()
* \fn Statistic()
* \brief default constructor
*/
Statistic();
/*!
* \fn ~Statistique()
* \fn ~Statistic()
* \brief Destructor
*/
~Statistic();
......@@ -59,7 +59,16 @@ public :