Commit 2de68443 authored by Olivier Lagrasse's avatar Olivier Lagrasse

Ajout des compteurs

Correction du bug ou les containers et les etats etaient decales 
(reinitialisation des positions)
Vidage des vecteurs de fleches et d'evenements pour eviter une 
accumulation entre les dessins
Reduction epaisseur des fleches et evenements
Ajout chemin de la trace dans barre de titre lors de l'ouverture en 
ligne de commande
La fenetre d'information ne s'affiche plus au demarrage mais quand un 
warning ou une erreur surviennent
Suppression warning a la compilation de info_window.ui
Reajustement de la profondeur (z-buffer) des entites
parent 441f570d
...@@ -61,10 +61,6 @@ p, li { white-space: pre-wrap; } ...@@ -61,10 +61,6 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
</item> </item>
</layout> </layout>
<zorder>info_trace_text</zorder>
<zorder>info_trace_clear</zorder>
<zorder>verticalLayoutWidget</zorder>
<zorder>verticalLayoutWidget_2</zorder>
</widget> </widget>
</item> </item>
<item> <item>
...@@ -122,15 +118,6 @@ p, li { white-space: pre-wrap; } ...@@ -122,15 +118,6 @@ p, li { white-space: pre-wrap; }
</layout> </layout>
</item> </item>
</layout> </layout>
<zorder>horizontalLayoutWidget</zorder>
<zorder>horizontalLayoutWidget</zorder>
<zorder>verticalLayoutWidget</zorder>
<zorder>gridLayoutWidget</zorder>
<zorder>verticalLayoutWidget</zorder>
<zorder>info_trace_clear</zorder>
<zorder>verticalLayoutWidget</zorder>
<zorder>verticalLayoutWidget_2</zorder>
<zorder>info_trace</zorder>
</widget> </widget>
</widget> </widget>
<resources> <resources>
......
...@@ -99,7 +99,6 @@ void Interface_graphic::load_windows(){ ...@@ -99,7 +99,6 @@ void Interface_graphic::load_windows(){
QMetaObject::connectSlotsByName(this); QMetaObject::connectSlotsByName(this);
/* Display both the main and informative windows */ /* Display both the main and informative windows */
_ui_info_window->show();
_ui_main_window->show(); _ui_main_window->show();
} }
...@@ -119,6 +118,8 @@ void Interface_graphic::error(const string s) const{ ...@@ -119,6 +118,8 @@ void Interface_graphic::error(const string s) const{
QString buf = s.c_str(); QString buf = s.c_str();
_ui_info_trace_text->moveCursor(QTextCursor::End);/* Insert the new text on the beginning */ _ui_info_trace_text->moveCursor(QTextCursor::End);/* Insert the new text on the beginning */
_ui_info_trace_text->insertHtml("<font color='red'>"+buf+"</font><br /><br />"); _ui_info_trace_text->insertHtml("<font color='red'>"+buf+"</font><br /><br />");
_ui_info_window->show();
} }
...@@ -126,6 +127,8 @@ void Interface_graphic::warning(const string s) const{ ...@@ -126,6 +127,8 @@ void Interface_graphic::warning(const string s) const{
QString buf = s.c_str(); QString buf = s.c_str();
_ui_info_trace_text->moveCursor(QTextCursor::End);/* Insert the new text on the beginning */ _ui_info_trace_text->moveCursor(QTextCursor::End);/* Insert the new text on the beginning */
_ui_info_trace_text->insertHtml("<font color='orange'>"+buf+"</font><br /><br />"); _ui_info_trace_text->insertHtml("<font color='orange'>"+buf+"</font><br /><br />");
_ui_info_window->show();
} }
...@@ -152,6 +155,8 @@ void Interface_graphic::opening_file(string const &path){ ...@@ -152,6 +155,8 @@ void Interface_graphic::opening_file(string const &path){
information(string("File opened: ")+ path); information(string("File opened: ")+ path);
_trace_path = path; _trace_path = path;
_ui_main_window->setWindowTitle(QString("ViTE :: ")+_trace_path.c_str());
_core->draw_trace(path, _ui_render_area); _core->draw_trace(path, _ui_render_area);
...@@ -211,8 +216,7 @@ void Interface_graphic::on_open_triggered(){ ...@@ -211,8 +216,7 @@ void Interface_graphic::on_open_triggered(){
} }
else{ else{
opening_file(filename.toStdString()); opening_file(filename.toStdString());
_ui_main_window->setWindowTitle(QString("ViTE :: ")+filename);
} }
} }
......
...@@ -75,7 +75,8 @@ Render_area::Render_area(QWidget *parent) ...@@ -75,7 +75,8 @@ Render_area::Render_area(QWidget *parent)
/* Camera is placed on (0,0,0) and looks to (0,0,-1) */ /* Camera is placed on (0,0,0) and looks to (0,0,-1) */
_z_container = -1.0f; _z_container = -1.0f;
_z_arrow = -2.0f;/* closer to camera than containers or states (MUST be negative)*/ _z_arrow = -2.0f;/* closer to camera than containers or states (MUST be negative)*/
_z_state= -3.0f; _z_event = -3.0f;/* closer to camera than containers or states (MUST be negative)*/
_z_state= -4.0f;
setAutoFillBackground(false); setAutoFillBackground(false);
} }
...@@ -115,9 +116,6 @@ void Render_area::initializeGL(){ ...@@ -115,9 +116,6 @@ void Render_area::initializeGL(){
glClearStencil(0); glClearStencil(0);
_wait_list = draw_wait(); _wait_list = draw_wait();
message << "Counter drawing not yet implemented" << endw;
} }
void Render_area::resizeGL(int width, int height){ void Render_area::resizeGL(int width, int height){
...@@ -262,7 +260,7 @@ void Render_area::paintGL(){ ...@@ -262,7 +260,7 @@ void Render_area::paintGL(){
glTranslated( _render_width*_x_scale_container_state-_state_translate , 0.0f, _z_state); glTranslated( _render_width*_x_scale_container_state-_state_translate , 0.0f, _z_state);
glScalef( _state_scale*(_render_width/_state_x_max), _render_height/_state_y_max, 0.0f); glScalef( _state_scale*(_render_width/_state_x_max), _render_height/_state_y_max, 0.0f);
if (glIsList(_list_states)==GL_FALSE) if (glIsList(_list_states)==GL_FALSE)
message << "ERROR LIST not exist for states." << ende; message << "ERROR LIST not exist for states." << ende;
...@@ -271,7 +269,11 @@ void Render_area::paintGL(){ ...@@ -271,7 +269,11 @@ void Render_area::paintGL(){
glPopMatrix(); glPopMatrix();
//glCallList(_list_counters);
if (glIsList(_list_counters)==GL_FALSE)
;// message << "ERROR LIST not exist for counters." << ende;
else
glCallList(_list_counters);
draw_stored_arrows(_arrows);/* draw arrows without display lists */ draw_stored_arrows(_arrows);/* draw arrows without display lists */
...@@ -346,8 +348,7 @@ bool Render_area::build(){ ...@@ -346,8 +348,7 @@ bool Render_area::build(){
/* disable some OpenGL features to enhance the rendering */ /* disable some OpenGL features to enhance the rendering */
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND); glDisable(GL_BLEND);
return true; return true;
} }
...@@ -385,6 +386,14 @@ bool Render_area::unbuild(){ ...@@ -385,6 +386,14 @@ bool Render_area::unbuild(){
glColor3d(1.0, 1.0, 1.0);/* init color to white */ glColor3d(1.0, 1.0, 1.0);/* init color to white */
/* init measurement attributes */
_container_x_max = 0;
_container_y_max = 0;
_state_x_max = 0;
_state_y_max = 0;
return true; return true;
} }
......
...@@ -236,6 +236,7 @@ class Render_area : public QGLWidget, public Render ...@@ -236,6 +236,7 @@ class Render_area : public QGLWidget, public Render
Element_pos _z_container;/* z position for containers */ Element_pos _z_container;/* z position for containers */
Element_pos _z_state;/* z position for states */ Element_pos _z_state;/* z position for states */
Element_pos _z_event;/* z position for events */
Element_pos _z_arrow;/* z position for arrows */ Element_pos _z_arrow;/* z position for arrows */
/*********************************** /***********************************
...@@ -377,6 +378,12 @@ inline void Render_area::start_draw(){ ...@@ -377,6 +378,12 @@ inline void Render_area::start_draw(){
/* clear lists to store container texts */ /* clear lists to store container texts */
_text_pos.clear(); _text_pos.clear();
_text_value.clear(); _text_value.clear();
/* clear the event vector */
_events.clear();
/* clear the arrow vector */
_arrows.clear();
} }
...@@ -524,19 +531,19 @@ inline void Render_area::draw_stored_arrows(std::vector<Arrow_> &arrows){ ...@@ -524,19 +531,19 @@ inline void Render_area::draw_stored_arrows(std::vector<Arrow_> &arrows){
angle = atan2((end_height - start_height), (end_time - start_time))*180.0f/PI;/* arc tangent */ angle = atan2((end_height - start_height), (end_time - start_time))*180.0f/PI;/* arc tangent */
glRotatef(angle,0, 0, 1); glRotatef(angle, 0, 0, 1);
}/* end if (start_time != end_time) */ }/* end if (start_time != end_time) */
else else
glRotatef(90,0, 0, 1);/* vertical alignment */ glRotatef(90, 0, 0, 1);/* vertical alignment */
glBegin(GL_TRIANGLES);/* create an arrow */ glBegin(GL_TRIANGLES);/* create an arrow */
{ {
glColor3d(1.0, 1.0, 1.0);glVertex2d(0.4, 0.0); glColor3d(1.0, 1.0, 1.0);glVertex2d(0.0, 0.0);
glColor3d(0.9, 0.9, 0.9);glVertex2d(-0.4, -0.4); glColor3d(0.9, 0.9, 0.9);glVertex2d(-0.6, -0.2);
glColor3d(0.9, 0.9, 0.9);glVertex2d(-0.4, 0.4); glColor3d(0.9, 0.9, 0.9);glVertex2d(-0.6, 0.2);
} }
glEnd(); glEnd();
...@@ -545,14 +552,14 @@ inline void Render_area::draw_stored_arrows(std::vector<Arrow_> &arrows){ ...@@ -545,14 +552,14 @@ inline void Render_area::draw_stored_arrows(std::vector<Arrow_> &arrows){
glPushMatrix(); glPushMatrix();
glTranslated(0, 0, _z_arrow); glTranslated(0, 0, _z_arrow);
glLineWidth(1.5f); // glLineWidth(1.5f);
glBegin(GL_LINES); glBegin(GL_LINES);
{ {
glColor3d(1.0, 1.0, 1.0);glVertex2d(start_time, start_height); glColor3d(0.8, 0.8, 0.8);glVertex2d(start_time, start_height);
glColor3d(0.9, 0.9, 0.9);glVertex2d(end_time, end_height); glColor3d(1.0, 1.0, 1.0);glVertex2d(end_time, end_height);
} }
glEnd(); glEnd();
glLineWidth(1.0f);/* 1 is the default value */ // glLineWidth(1.0f);/* 1 is the default value */
glPopMatrix(); glPopMatrix();
} }
...@@ -619,21 +626,21 @@ inline void Render_area::draw_stored_events(std::vector<Event_> &events){ ...@@ -619,21 +626,21 @@ inline void Render_area::draw_stored_events(std::vector<Event_> &events){
glBegin(GL_POLYGON); glBegin(GL_POLYGON);
{ {
for(int i =0 ; i<step ; i++){ for(int i =0 ; i<step ; i++){
glVertex3d(time + cos(angle+delta_angle*i)*radius , height + sin(angle+delta_angle*i)*radius , _z_arrow); glVertex3d(time + cos(angle+delta_angle*i)*radius , height + sin(angle+delta_angle*i)*radius , _z_event);
} }
} }
glEnd(); glEnd();
/* draw line */ /* draw line */
glLineWidth(1.5f); // glLineWidth(1.5f);
glBegin(GL_LINES); glBegin(GL_LINES);
{ {
glColor3d(0.5, 0.8, 0.5);glVertex3d(time, height, _z_arrow); glColor3d(0.5, 0.8, 0.5);glVertex3d(time, height, _z_event);
glColor3d(0.4, 0.7, 0.4);glVertex3d(time, height+container_height, _z_arrow); glColor3d(0.4, 0.7, 0.4);glVertex3d(time, height+container_height, _z_event);
} }
glEnd(); glEnd();
glLineWidth(1.0f); // glLineWidth(1.0f);
}/* and loop */ }/* and loop */
} }
...@@ -647,8 +654,7 @@ inline void Render_area::start_draw_counter(){ ...@@ -647,8 +654,7 @@ inline void Render_area::start_draw_counter(){
_list_counters = glGenLists(1);/* create the list */ _list_counters = glGenLists(1);/* create the list */
if (_list_counters==0){ if (_list_counters==0){
//message_ns::message << "Error when creating list" << message_ns::ende;
// _parent->warning("Error when creating list");
} }
glNewList(_list_counters, GL_COMPILE);/* open the list */ glNewList(_list_counters, GL_COMPILE);/* open the list */
...@@ -659,34 +665,35 @@ inline void Render_area::start_draw_counter(){ ...@@ -659,34 +665,35 @@ inline void Render_area::start_draw_counter(){
inline void Render_area::draw_counter(const Element_pos x, const Element_pos y){ inline void Render_area::draw_counter(const Element_pos x, const Element_pos y){
static bool which_color = true; static bool line_already_begun = false;
float a;
if (x <= 0.0f ){
if (which_color==true){/* yellow color */
a = 0.0f; if (line_already_begun==true){/* it is not the first call */
which_color = false; glEnd();
}else{/* white color */ }else
a = 1.0f; line_already_begun = true;
which_color = true;
} glBegin(GL_LINE_STRIP);/* set of connected verteces */
glColor3d(1.0, 1.0, 1.0);glVertex2d(0.0f, y);/* draw the init point */
glLineWidth(2.5f);
glBegin(GL_QUADS); _counter_last_x = 0.0f;
{
glColor3d(1.0, 1.0, a);glVertex2d(_counter_last_x, 0); }else{
glColor3d(1.0, 1.0, a);glVertex2d(_counter_last_x, _counter_last_y);
glColor3d(1.0, 1.0, a);glVertex2d(x, y); glColor3d(1.0, 1.0, 1.0);glVertex2d(x, y);
glColor3d(1.0, 1.0, a);glVertex2d(x, 0);
_counter_last_x = x;
} }
glEnd();
glLineWidth(1.0f);
_counter_last_x = x;
_counter_last_y = y; _counter_last_y = y;
} }
inline void Render_area::end_draw_counter(){ inline void Render_area::end_draw_counter(){
glEnd();/* suppose that line is not ended */
glEndList();/* close the list */ glEndList();/* close the list */
} }
......
...@@ -19,9 +19,13 @@ public: ...@@ -19,9 +19,13 @@ public:
cerr << s << endl; cerr << s << endl;
} }
void information(string s) const{ void information(string s) const{
cerr << s << endl; cerr << s << endl;
} }
const std::string get_filename() const{
return string("Filename");
}
}; };
...@@ -44,16 +48,14 @@ int main(int argc, char** argv){ ...@@ -44,16 +48,14 @@ int main(int argc, char** argv){
t.show(); t.show();
Element_pos a = 50;
r.start_draw(); r.start_draw();
{ {
r.start_draw_containers(); r.start_draw_containers();
{ {
r.draw_container(0, 0, 30, 20); /* r.draw_container(0, 0, 30, 20);
r.draw_container(0, 22, 10, 20); r.draw_container(0, 22, 10, 20);
r.draw_container(0, 43, 15, 20); r.draw_container(0, 43, 15, 20);*/
// r.draw_container(1, 60, 60, 20); // r.draw_container(1, 60, 60, 20);
r.draw_container_text(0, 10,"Container 2"); r.draw_container_text(0, 10,"Container 2");
r.draw_container_text(0, 32,"Container 1"); r.draw_container_text(0, 32,"Container 1");
...@@ -63,7 +65,7 @@ int main(int argc, char** argv){ ...@@ -63,7 +65,7 @@ int main(int argc, char** argv){
r.start_draw_states(); r.start_draw_states();
{ {
r.draw_state(0, 4, 0, 20, 0.6, 0.7, 0.8); /* r.draw_state(0, 4, 0, 20, 0.6, 0.7, 0.8);
r.draw_state(4.5, 7.98, 0, 20, 0.6, 0.7, 0.8); r.draw_state(4.5, 7.98, 0, 20, 0.6, 0.7, 0.8);
r.draw_arrow(10, 10, 0, 3); r.draw_arrow(10, 10, 0, 3);
r.draw_arrow(10, -10, -15, -3); r.draw_arrow(10, -10, -15, -3);
...@@ -71,18 +73,19 @@ int main(int argc, char** argv){ ...@@ -71,18 +73,19 @@ int main(int argc, char** argv){
r.draw_event(14, 4, 2); r.draw_event(14, 4, 2);
r.draw_event(10, 4, 1); r.draw_event(10, 4, 1);
r.draw_event(18, 4, 3); r.draw_event(18, 4, 3);
r.draw_event(10, 4, 10); r.draw_event(10, 4, 10);*/
} }
r.end_draw_states(); r.end_draw_states();
r.start_draw_counter(); r.start_draw_counter();
{ {
r.draw_counter(0.0f, 1);
r.draw_counter(5, 1); r.draw_counter(5, 1.2);
r.draw_counter(17, 2); r.draw_counter(7, 2);
r.draw_counter(19.345, 3); r.draw_counter(19.345, 3);
r.draw_counter(21.45, 2); r.draw_counter(24.45, 2);
r.draw_counter(32, 6);
} }
r.end_draw_counter(); r.end_draw_counter();
......
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