Commit 9aba6c07 authored by Johnny Jazeix's avatar Johnny Jazeix

Beginning of the statistics repair. Stats are printed but need to fix

the text behaviour -> Changed from QPainter to QGLWidget draw text 
method so the origin point is not the same.
parent 981b7a16
......@@ -280,12 +280,12 @@ protected:
QString _run_env[2];
/*!
*\brief If a file must be opened, this attributes contains its path.
*\brief If a file must be opened, this attribute contains its path.
*/
std::string _file_opened;
/*!
*\brief If a file must be exported, this attributes contains its path.
*\brief If a file must be exported, this attribute contains its path.
*/
std::string _path_to_export;
......
......@@ -56,7 +56,7 @@ Line::Line() : _line_count(0) {
Line::Line(const Line &l) : _tokens(l._tokens), _line_count(l._line_count) {
}
Line::Line(string &string_line) {
Line::Line(const string &string_line) {
fill_line(string_line);
}
......
......@@ -77,7 +77,7 @@ public:
* \brief Constructor for the line
* \param string_line : a filename
*/
Line(std::string &string_line);
Line(const std::string &string_line);
/*!
* \brief Destructor
......
This diff is collapsed.
......@@ -61,6 +61,8 @@ class ParserEventOTF{
private:
OTF_HandlerArray* _handlers;
static std::map <const String, Container *, String::less_than> _containers;
static uint64_t _cur_time;
static uint64_t _min_time;
static uint64_t _max_time;
......
......@@ -205,9 +205,6 @@ void Render_opengl::paintGL(){
glPushMatrix();
{
static float a = 0;
a ++;
glTranslated(0.0, Info::Render::height, 100.0);
glRotated(180.0, 1.0, 0.0, 0.0);
......@@ -933,7 +930,8 @@ void Render_opengl::draw_stored_arrows(){
set_color(1, 1, 1);
for (unsigned int i=0 ; i<_arrows.size() ; i++){
const unsigned int arrow_size = _arrows.size();
for (unsigned int i=0 ; i<arrow_size ; i++){
start_time = _arrows[i].start_time;// + _x_state_scale*_x_state_translate;
end_time = _arrows[i].end_time;// + _x_state_scale*_x_state_translate;
......@@ -997,7 +995,8 @@ void Render_opengl::draw_stored_circles(){
set_color(1, 1, 1);
for (unsigned int i=0 ; i<_circles.size() ; i++){
const unsigned int size = _circles.size();
for (unsigned int i=0 ; i<size ; i++){
glBegin(GL_POLYGON);
{
......
......@@ -44,8 +44,6 @@
*\file Render_svg.cpp
*/
//#include <iostream>
//#include <sstream>
#include <fstream>
/* -- */
#include "common/common.hpp"
......
......@@ -56,7 +56,7 @@
/* -- */
using namespace std;
Render_stats_opengl::Render_stats_opengl(QWidget *parent) : QGLWidget(parent){
Render_stats_opengl::Render_stats_opengl(QWidget *parent) : QGLWidget(parent), _stats_beginned_drawed(false) {
_translated_y = 0.;
_translated_x = 0.;
_render_height = height();
......@@ -89,7 +89,7 @@ void Render_stats_opengl::resizeGL(int width, int height){
}
void Render_stats_opengl::paintGL(){
makeCurrent();
glClearDepth(1.0);
glClearColor(1.f, 1.f, 1.f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
......@@ -101,13 +101,21 @@ void Render_stats_opengl::paintGL(){
glTranslated(-_translated_x, _translated_y, 0);
if(!_stats_beginned_drawed) {
return;
}
list<Element_pos>::const_iterator it_pos;
list<string>::const_iterator it_txt;
Element_pos buf_x;
Element_pos buf_y;
string buf_txt;
glCallList(_rect_list);
if (glIsList(_rect_list) == GL_FALSE)
printf("ERROR LIST not exist for stats\n");
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 ++) {
......@@ -133,24 +141,33 @@ void Render_stats_opengl::paintGL(){
// }/* end for(...) */
glFlush();
QPainter painter(this);/* Should be create AFTER glFlush() */
painter.setPen(Qt::black);
painter.setFont(QFont("Arial", 10));
/* Check the errors */
GLenum glerror;
glerror = glGetError();
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 ++) {
buf_x = *it_pos;
buf_x = *it_pos + _translated_x;
it_pos ++;
buf_y = *it_pos;
buf_y = *it_pos + _translated_y;
buf_txt = *it_txt;
painter.drawText(buf_x, buf_y, buf_txt.c_str());
//painter.drawText(buf_x, buf_y, buf_txt.c_str());
renderText(buf_x, buf_y, buf_txt.c_str(), arial_font);
}
painter.end();
// painter.end();
}
void Render_stats_opengl::translate_y(int value) {
......
......@@ -54,8 +54,6 @@
#include "common/common.hpp"
#include "render_stats.hpp"
class Render_stats_opengl;
/*!
* \brief This class redefined the OpenGL widget - QGLWidget - to display the trace.
*/
......@@ -80,6 +78,8 @@ private:
double _translated_x;
bool _stats_beginned_drawed;
public:
/*!
......@@ -217,7 +217,11 @@ inline void Render_stats_opengl::start_draw(){
_text_pos.clear();
_text_value.clear();
// makeCurrent();
_stats_beginned_drawed = true;
_rect_list = glGenLists(1);
if(_rect_list == 0) {
fprintf(stderr, "error while initialising _rect_list for stats\n");
}
glNewList(_rect_list, GL_COMPILE);
}
......@@ -226,8 +230,6 @@ inline void Render_stats_opengl::draw_text(const Element_pos x, const Element_po
_text_pos.push_back(x);
_text_pos.push_back(y);
_text_value.push_back(value);
// std::cout << "text: " << value << " @ position : ("<<x<<","<<y<<")." << std::endl;
}
inline void Render_stats_opengl::draw_line(const Element_pos x, const Element_pos y, const Element_pos x2, const Element_pos y2) {
......@@ -299,7 +301,6 @@ inline void Render_stats_opengl::draw_rect(const Element_pos x, const Element_po
glColor3d(r/1.5, g/1.5, b/1.5); glVertex2d(x+w, y);
}
glEnd();
//std::cout << "rect: " << "x ="<<x<<", y = "<<y<<", w = "<<w<<", "<<h << " ("<<r<<", "<<g<<", "<<b<<") "<<std::endl;
}
inline void Render_stats_opengl::end_draw(){
......
......@@ -45,7 +45,6 @@
*/
/* Global informations */
#include <iostream>
#include <fstream>
#include <string>
#include <list>
......
......@@ -151,11 +151,11 @@ public:
// We search for a color
if((*it).first->get_extra_fields()->find(std::string("Color")) != (*it).first->get_extra_fields()->end()) {
const Color *color = (const Color *)(*it).first->get_extra_fields()->find(std::string("Color"))->second;
draw_object->draw_rect(pos_x, pos_y, _WIDTH_HISTOGRAM_DEFAULT, height/max_percentage, color->get_red(), color->get_green(), color->get_blue());
const Color *color = (const Color *)(*it).first->get_extra_fields()->find(std::string("Color"))->second;
draw_object->draw_rect(pos_x, pos_y, _WIDTH_HISTOGRAM_DEFAULT, height/max_percentage, color->get_red(), color->get_green(), color->get_blue());
}
else {
draw_object->draw_rect(pos_x, pos_y, _WIDTH_HISTOGRAM_DEFAULT, height/max_percentage, 0.7, 0.7, 0.75);
draw_object->draw_rect(pos_x, pos_y, _WIDTH_HISTOGRAM_DEFAULT, height/max_percentage, 0.7, 0.7, 0.75);
}
// We print the percentage above
......
......@@ -44,7 +44,6 @@
#include <map>
#include <list>
#include <stack>
#include <iostream>
/* -- */
#include "trace/values/Values.hpp"
#include "trace/EntityTypes.hpp"
......
......@@ -52,9 +52,9 @@
*/
class ContainerType {
private:
Name _name;
ContainerType *_parent;
std::list<ContainerType *> _children;
Name _name;
ContainerType *_parent;
std::list<ContainerType *> _children;
public:
/*!
......
......@@ -40,7 +40,6 @@
** - VUCHENER Clément
**
*/
#include <iostream>
#include <string>
#include <list>
#include <map>
......
......@@ -45,7 +45,6 @@
#include <map>
#include <list>
#include <vector>
#include <iostream>
#include <sstream>
#include <stack>
/* -- */
......
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