Commit 540caf23 authored by Mathieu Faverge's avatar Mathieu Faverge

Some cleanups

parent 1f990cff
......@@ -487,13 +487,6 @@ bool Core::draw_trace(const string & filename, const int format) {
DrawTrace drawing_ogl;
bool killed=false;
#ifdef WITH_VBO
Render<Render_alternate>render(_render_opengl) ;
#else
Render<Render_opengl> render(_render_opengl) ;
#endif
_render=(void*)&render;
QTime time_elapsed;
ostringstream buf_txt;
int time_buf = 0;
......@@ -526,9 +519,9 @@ bool Core::draw_trace(const string & filename, const int format) {
_trace = new Trace();
// Init of the thread
_finished= new QWaitCondition();
_closed= new QWaitCondition();
_mutex= new QMutex();
_finished = new QWaitCondition();
_closed = new QWaitCondition();
_mutex = new QMutex();
QThread thread;
......@@ -755,10 +748,10 @@ bool Core::draw_trace(const string & filename, const int format) {
if(!_xml_config_file.empty() && _trace->get_view_root_containers()->empty()){//if we have a partial loading, process it here, but only once
launch_action(_DRAW_OPENGL_PARTIAL,NULL);
}
if (_DRAW_OPENGL == format) {
if (_DRAW_OPENGL == format) {
drawing_ogl.build(&render, _trace);
drawing_ogl.build(&_render_opengl, _trace);
_render_opengl->build();
// _render_opengl->updateGL();
_render_opengl->refresh_scroll_bars();
......
/*
** This file is part of the ViTE project.
**
** This software is governed by the CeCILL-A license under French law
** and abiding by the rules of distribution of free software. You can
** use, modify and/or redistribute the software under the terms of the
** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info".
**
** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited
** liability.
**
** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software,
** that may mean that it is complicated to manipulate, and that also
** therefore means that it is reserved for developers and experienced
** professionals having in-depth computer knowledge. Users are therefore
** encouraged to load and test the software's suitability as regards
** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security.
**
** The fact that you are presently reading this means that you have had
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
** - JAZEIX Johnny
** - LAGRASSE Olivier
** - MARCOUEILLE Jule
** - NOISETTE Pascal
** - REDONDY Arthur
** - VUCHENER Clément
**
*/
** This file is part of the ViTE project.
**
** This software is governed by the CeCILL-A license under French law
** and abiding by the rules of distribution of free software. You can
** use, modify and/or redistribute the software under the terms of the
** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info".
**
** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited
** liability.
**
** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software,
** that may mean that it is complicated to manipulate, and that also
** therefore means that it is reserved for developers and experienced
** professionals having in-depth computer knowledge. Users are therefore
** encouraged to load and test the software's suitability as regards
** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security.
**
** The fact that you are presently reading this means that you have had
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
** - JAZEIX Johnny
** - LAGRASSE Olivier
** - MARCOUEILLE Jule
** - NOISETTE Pascal
** - REDONDY Arthur
** - VUCHENER Clément
**
*/
/*!
*\file Render.hpp
*/
......@@ -79,7 +79,7 @@ struct Container_text_{
template<class T>
class Render: public Geometry
{
private:
private:
/*!
* This attribute store the instance of a drawing class. (OpenGL or SVG for example)
......@@ -137,7 +137,7 @@ public:
/* clear vectors */
_containers.clear();
_container_texts.clear();
drawing_instance->start_draw();
}
......@@ -155,7 +155,7 @@ public:
* \param h the height of the container
*/
inline void draw_container(const Element_pos x, const Element_pos y, const Element_pos w, const Element_pos h){
Container_ buf;
buf.x = x;
......@@ -164,29 +164,26 @@ public:
buf.h = h;
_containers.push_back(buf);
if ((x+w)>Info::Container::x_max)
Info::Container::x_max = 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 (Info::Container::y_min > y)
Info::Container::y_min = 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;
#endif
}
/*!
......@@ -198,7 +195,7 @@ public:
* This function stores text in a list. This list will be display each time the render area need to be updated.
*/
inline void draw_container_text(const Element_pos x, const Element_pos y, const std::string value){
Container_text_ buf;
buf.x = x;
buf.y = y;
......@@ -221,19 +218,19 @@ public:
drawing_instance->set_color(0, 0, j);
drawing_instance->draw_quad(_containers[i].x * (Info::Render::width/Info::Container::x_max)*_x_scale_container_state,
trace_to_render_y(_containers[i].y),// * _y_state_scale*(_render_height-_ruler_height)/Info::Container::y_max) - _y_state_translate + _ruler_y + _ruler_height,
_z_container,
_z_container,
_containers[i].w * (Info::Render::width/Info::Container::x_max)*_x_scale_container_state,
_containers[i].h * _y_state_scale*(Info::Render::height-_ruler_height)/Info::Container::y_max);
}
// std::cout << __FILE__ << " ~ " << __LINE__ << " " << Info::Container::y_max << " " << Info::Container::y_min << std::endl;
for (unsigned int i=0 ; i<_container_texts.size() ; i++){
_container_texts[i].x *= (Info::Render::width/Info::Container::x_max)*_x_scale_container_state;
_container_texts[i].y = trace_to_render_y(_container_texts[i].y);// + _render_height-_ruler_height)*coeff_trace_render_y();
drawing_instance->draw_text(_container_texts[i].x, _container_texts[i].y, _z_container+1, _container_texts[i].value);
}
drawing_instance->end_draw_containers();
}
......@@ -261,14 +258,14 @@ public:
*/
inline void draw_state(const Element_pos start, const Element_pos end, const Element_pos base, const Element_pos height, const Element_col r, const Element_col g, const Element_col b) {
drawing_instance->set_color(r, g, b);
drawing_instance->draw_quad(trace_to_render_x(start - Info::Render::_x_min_visible),
trace_to_render_y(base),
_z_state,
(end-start)*coeff_trace_render_x(),
_z_state,
(end-start)*coeff_trace_render_x(),
height*coeff_trace_render_y());
}
......@@ -296,28 +293,28 @@ public:
* This function stores all the information of the arrow to display it each time the render area need to be updated.
*/
inline void draw_arrow(Element_pos start_time, Element_pos end_time, Element_pos start_height, Element_pos end_height, const Element_col r, const Element_col g, const Element_col b){
/* For SVG */
const Element_pos triangle_size = 2.0;
const Element_pos coeff = 180.0f/M_PI;
Element_pos angle;
drawing_instance->set_color(r, g, b);
start_time = trace_to_render_x(start_time - Info::Render::_x_min_visible);
end_time = trace_to_render_x(end_time - Info::Render::_x_min_visible);
start_height = trace_to_render_y(start_height);
end_height = trace_to_render_y(end_height);
if (start_time != end_time)
angle = atan2((end_height - start_height), (end_time - start_time))*coeff;/* arc tangent */
else
angle = 90;
drawing_instance->draw_triangle(end_time, end_height, triangle_size, angle);
drawing_instance->draw_line(start_time, start_height,
end_time, end_height, _z_arrow);
drawing_instance->draw_line(start_time, start_height,
end_time, end_height, _z_arrow);
/* For OpenGL */
drawing_instance->draw_arrow(start_time, end_time, start_height, end_height, r, g, b);
......@@ -331,7 +328,7 @@ public:
inline void end_draw_arrows(){
drawing_instance->end_draw_arrows();
}
inline void start_draw_events(){
drawing_instance->start_draw_events();
}
......@@ -346,17 +343,17 @@ public:
*/
inline void draw_event(Element_pos time, Element_pos height, Element_pos container_height, const Element_col r, const Element_col g, const Element_col b){
/* For SVG */
/* For SVG */
Element_pos radius;/* the circle radius */
drawing_instance->set_color(r, g, b);
time = trace_to_render_x(time - Info::Render::_x_min_visible);
height = trace_to_render_y(height);
container_height = container_height*coeff_trace_render_y();
radius = .5f;
radius = .5f;
drawing_instance->draw_circle(time, height, _z_event, radius);
drawing_instance->draw_line(time, height,
time, height+container_height, _z_event);
......@@ -364,7 +361,7 @@ public:
/* For OpenGL */
drawing_instance->draw_event(time, height, container_height);
}
inline void end_draw_events(){
drawing_instance->end_draw_events();
}
......@@ -401,37 +398,37 @@ public:
inline void draw_counter(const Element_pos x, const Element_pos y){
if (_start_new_line){/* Start a new line */
_counter_last_x = x;
_counter_last_y = y;
_start_new_line = false;
}else{/* line is already started */
if (x <= 0.0){/* convention: the line is over */
// drawing_instance->draw_line( _counter_last_x, _counter_last_y,
// _state_x_max, _counter_last_y, _z_counter);
drawing_instance->draw_line( trace_to_render_x(_counter_last_x - Info::Render::_x_min_visible), trace_to_render_y(_counter_last_y),
trace_to_render_x(Info::Entity::x_max), trace_to_render_y(_counter_last_y), _z_counter);
_start_new_line = true;
}else{/* add new points to the line */
/* Each time, the method draw the line from the previous point to
the current point (x, y). This last is stored for the next line drawing. */
/* Each time, the method draw the line from the previous point to
the current point (x, y). This last is stored for the next line drawing. */
// drawing_instance->draw_line( _counter_last_x, _counter_last_y,
// x, _counter_last_y, _z_counter);
// drawing_instance->draw_line( x, _counter_last_y,
// x, y, _z_counter);
drawing_instance->draw_line( trace_to_render_x(_counter_last_x - Info::Render::_x_min_visible), trace_to_render_y(_counter_last_y),
trace_to_render_x(x - Info::Render::_x_min_visible), trace_to_render_y(_counter_last_y), _z_counter);
drawing_instance->draw_line( trace_to_render_x(x - Info::Render::_x_min_visible), trace_to_render_y(_counter_last_y),
trace_to_render_x(x - Info::Render::_x_min_visible), trace_to_render_y(y), _z_counter);
_counter_last_x = x;
_counter_last_y = y;
}
......@@ -453,7 +450,7 @@ public:
}
drawing_instance->end_draw_counter();
}
/*!
* \brief Do nothing (it is present for compatibility of the Render class).
*/
......@@ -463,10 +460,10 @@ public:
//Element_pos coeff_prefix;
const Element_pos offset_x = 0;
const Element_pos offset_y = 0;
graduation_diff = Ruler::get_graduation_diff(Info::Render::_x_min_visible, Info::Render::_x_max_visible);
// coeff_prefix = Ruler::get_coeff_for_common_prefix(Info::Render::_x_min_visible, Info::Render::_x_max_visible);
// coeff_prefix = Ruler::get_coeff_for_common_prefix(Info::Render::_x_min_visible, Info::Render::_x_max_visible);
/* Now, draw ruler */
......@@ -474,7 +471,7 @@ public:
drawing_instance->start_ruler();
{
/* Since SVG has no depth, first draw the quads then the graduation */
/* Draw quads */
drawing_instance->set_color(0.0, 0.0, 1.0);
......@@ -486,23 +483,23 @@ public:
drawing_instance->set_color(0.0, 0.0, 0.0);
drawing_instance->draw_quad(trace_to_render_x(0),
0,
_z_ruler_over,
trace_to_render_x(Info::Render::_x_max_visible) - trace_to_render_x(Info::Render::_x_min_visible),
drawing_instance->draw_quad(trace_to_render_x(0),
0,
_z_ruler_over,
trace_to_render_x(Info::Render::_x_max_visible) - trace_to_render_x(Info::Render::_x_min_visible),
3);
/* Draw graduations */
drawing_instance->set_color(1, 1, 1);
for (Element_pos i = Info::Render::_x_min_visible ; i < Info::Render::_x_max_visible ; i+=graduation_diff){
const Element_pos grad_div_by_5 = graduation_diff/5;
for (Element_pos j = (i+grad_div_by_5) ; j<(i+graduation_diff) ; j+= grad_div_by_5){
drawing_instance->draw_line( trace_to_render_x(j - Info::Render::_x_min_visible) + offset_x, offset_y+3,
trace_to_render_x(j - Info::Render::_x_min_visible) + offset_x, 5+offset_y, _z_ruler);
}
drawing_instance->draw_line( trace_to_render_x(i - Info::Render::_x_min_visible) + offset_x, offset_y+3,
trace_to_render_x(i - Info::Render::_x_min_visible) + offset_x, 7+offset_y, _z_ruler);
}
......@@ -518,6 +515,4 @@ public:
}
};
#endif
/*
** This file is part of the ViTE project.
**
** This software is governed by the CeCILL-A license under French law
** and abiding by the rules of distribution of free software. You can
** use, modify and/or redistribute the software under the terms of the
** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info".
**
** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited
** liability.
**
** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software,
** that may mean that it is complicated to manipulate, and that also
** therefore means that it is reserved for developers and experienced
** professionals having in-depth computer knowledge. Users are therefore
** encouraged to load and test the software's suitability as regards
** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security.
**
** The fact that you are presently reading this means that you have had
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
** - JAZEIX Johnny
** - LAGRASSE Olivier
** - MARCOUEILLE Jule
** - NOISETTE Pascal
** - REDONDY Arthur
** - VUCHENER Clément
**
*/
** This file is part of the ViTE project.
**
** This software is governed by the CeCILL-A license under French law
** and abiding by the rules of distribution of free software. You can
** use, modify and/or redistribute the software under the terms of the
** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info".
**
** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited
** liability.
**
** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software,
** that may mean that it is complicated to manipulate, and that also
** therefore means that it is reserved for developers and experienced
** professionals having in-depth computer knowledge. Users are therefore
** encouraged to load and test the software's suitability as regards
** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security.
**
** The fact that you are presently reading this means that you have had
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
** - JAZEIX Johnny
** - LAGRASSE Olivier
** - MARCOUEILLE Jule
** - NOISETTE Pascal
** - REDONDY Arthur
** - VUCHENER Clément
**
*/
/*!
*\file Render_opengl.hpp
*/
......@@ -70,18 +70,18 @@
struct Container_text_;
/*template<typename T>
class CSingleton
{
public:
static T& Instance()
{
static T me;
return me;
}
};
class CSingleton
{
public:
static T& Instance()
{
static T me;
return me;
}
};
*/
*/
/*!
* \brief Structure used to store arrow information.
......@@ -131,7 +131,7 @@ class Render_opengl : /*public QGLWidget,*/ public Hook_event, public Render_te
Q_OBJECT
private:
private:
bool _draw_container;
bool _draw_state;
......@@ -144,7 +144,7 @@ protected:
/*!
* \brief The waiting screen display list.
*/
GLuint _wait_list;
GLuint _wait_list;
/*!
* \brief The minimap.
......@@ -161,15 +161,15 @@ protected:
*/
GLuint _list_states;
/*!
* \brief The counter GLu list.
*/
/*!
* \brief The counter GLu list.
*/
GLuint _list_counters;
/*!
* \brief The arrows GLu list.
*/
/*!
* \brief The arrows GLu list.
*/
GLuint _list_arrows;
......@@ -212,10 +212,10 @@ protected:
*/
int _wait_spf;
/*!
* \brief Offset of the vertical helper line
*/
Element_pos vertical_line;
/*!
* \brief Offset of the vertical helper line
*/
Element_pos vertical_line;
/*!
......@@ -283,8 +283,8 @@ public:
*/
void display_time_scale(){}
// void set_vertical_line(int l){}
// void draw_vertical_line();
// void set_vertical_line(int l){}
// void draw_vertical_line();
/***********************************
*
* Default QGLWidget functions.
......@@ -294,7 +294,7 @@ public:
/*!
* \brief Call by the system to initialize the OpenGL render area.
*/
void initializeGL();
void initializeGL();
/*!
* \brief Call by the system when the render area was resized (occurs during a window resizement).
......@@ -311,8 +311,8 @@ public:
//void paintEvent(QPaintEvent *event);
/* void initializeOverlayGL();
void resizeOverlayGL(int width, int height);
void paintOverlayGL();*/
void resizeOverlayGL(int width, int height);
void paintOverlayGL();*/
/***********************************
......@@ -523,64 +523,64 @@ public:
*
**********************************/
// /*!
// * \brief Display on screen containers between container_begin and container_end.
// * \param container_begin integer value : id of the first container.
// * \param container_end integer value : id of the last container.
// */
// void display_container(Element_count container_begin, Element_count container_end) =0;
// /*!
// * \brief Display on screen states between timer_begin and time_end,
// * container_begin and container_end and with timer width between depth_begin and depth_end.
// * \param time_begin floating point value : time of the first state.
// * \param time_end floating point value : time of the last state.
// * \param container_begin integer value : id of the first container.
// * \param container_end integer value : id of the last container.
// * \param depth_begin floating point value : width of the narrowest state.
// * \param depth_end floating point value : width of the widest state.
// */
// void display_state(Element_pos time_begin, Element_pos time_end,
// Element_count container_begin, Element_count container_end,
// Element_pos depth_begin, Element_pos depth_end) =0;
// /*!
// * \brief Display on screen arrows between timer_begin and time_end,
// * container_begin and container_end and with timer width between depth_begin and depth_end.
// * \param time_begin floating point value : time of the smallest arrow time value.
// * \param time_end floating point value : time of the higher arrow time value.
// * \param container_begin integer value : id of the first container.
// * \param container_end integer value : id of the last container.
// * \param depth_begin floating point value : the narrowest difference between
// * the beginning time and the ending time of the arrow.
// * \param depth_end floating point value : width of the widest difference between
// * the beginning time and the ending time of the arrow.
// */