Commit 26de62f2 authored by Olivier Lagrasse's avatar Olivier Lagrasse

liage pour l'exportation (pas encore fonctionnel)

parent a0b69c33
...@@ -94,6 +94,21 @@ bool Interface_console::draw_trace(const string & filename, Render_area* render_ ...@@ -94,6 +94,21 @@ bool Interface_console::draw_trace(const string & filename, Render_area* render_
bool Interface_console::draw_trace(const string & filename, Svg* svg){
Trace trace;
ParserPaje parser;
DrawTrace<Svg> drawing;
parser.parse(filename, trace);
drawing.build(svg, &trace);
return true;
}
int Interface_console::run(){ int Interface_console::run(){
return app->exec(); return app->exec();
...@@ -232,9 +247,13 @@ void Interface_console::launch_action(int state){ ...@@ -232,9 +247,13 @@ void Interface_console::launch_action(int state){
case _STATE_EXPORT_FILE: case _STATE_EXPORT_FILE:
cout << "export of " << _file_opened << " to " << _path_to_export << endl; message << "export of " << _file_opened << " to " << _path_to_export << endi;
///// Do the export ///// ///// Do the export /////
{
Svg svg;
svg.init(_path_to_export);
draw_trace(_file_opened, &svg);
}
///////////////////////// /////////////////////////
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
break; break;
......
...@@ -12,6 +12,7 @@ class Interface_console; ...@@ -12,6 +12,7 @@ class Interface_console;
#include "interface.hpp" #include "interface.hpp"
#include "interface_graphic.hpp" #include "interface_graphic.hpp"
#include "render_area.hpp" #include "render_area.hpp"
#include "render_svg.hpp"
#include "../trace/Trace.hpp" #include "../trace/Trace.hpp"
#include "../trace/DrawTrace.hpp" #include "../trace/DrawTrace.hpp"
...@@ -187,6 +188,8 @@ protected: ...@@ -187,6 +188,8 @@ protected:
*/ */
bool draw_trace(const std::string & filename, Render_area* render_area); bool draw_trace(const std::string & filename, Render_area* render_area);
bool draw_trace(const std::string & filename, Svg* svg);
/*! /*!
* \brief This function launch Qt event loop. * \brief This function launch Qt event loop.
......
...@@ -81,7 +81,6 @@ void Interface_graphic::load_windows(){ ...@@ -81,7 +81,6 @@ void Interface_graphic::load_windows(){
/* Set some windows properties */ /* Set some windows properties */
_ui_info_window->setWindowOpacity(0.7);/* Change alpha value of the informative window */
_ui_info_window->setWindowFlags(_ui_info_window->windowFlags() | Qt::WindowStaysOnTopHint);/* Always display info_window on top */ _ui_info_window->setWindowFlags(_ui_info_window->windowFlags() | Qt::WindowStaysOnTopHint);/* Always display info_window on top */
/* Load widget from the .ui file */ /* Load widget from the .ui file */
......
...@@ -83,6 +83,6 @@ void Svg::draw_arrow(const Element_pos start_time, const Element_pos end_time, c ...@@ -83,6 +83,6 @@ void Svg::draw_arrow(const Element_pos start_time, const Element_pos end_time, c
triangle(end_time,end_height+ARROWSIZE,end_time,end_height-ARROWSIZE,end_time+ARROWSIZE,end_height);//spike triangle(end_time,end_height+ARROWSIZE,end_time,end_height-ARROWSIZE,end_time+ARROWSIZE,end_height);//spike
} }
void Svg::draw_state(const Element_pos start , const Element_pos end, const Element_count level, const Element_col r, const Element_col g, const Element_col b){ void Svg::draw_state(const Element_pos start , const Element_pos end, const Element_pos level, const Element_pos height, const Element_col r, const Element_col g, const Element_col b){
rectangle(end-start,LEVEL - MARGIN, start,level*LEVEL,r , g, b); rectangle(end-start,LEVEL - MARGIN, start,level*LEVEL,r , g, b);
} }
...@@ -11,12 +11,17 @@ ...@@ -11,12 +11,17 @@
#define MARGIN 10 //distance between two object #define MARGIN 10 //distance between two object
#define ARROWSIZE 4 //spike size #define ARROWSIZE 4 //spike size
typedef unsigned long Element_count ;
typedef unsigned long Element_pos;
typedef unsigned char Element_col;
#include "render.hpp"
#include "resource.hpp"
/*typedef unsigned long Element_count ;
typedef double Element_pos;
typedef unsigned char Element_col;
*/
class Svg{ class Svg : public Render{
private: private:
...@@ -37,6 +42,8 @@ public: ...@@ -37,6 +42,8 @@ public:
*/ */
void end(); void end();
void start_draw();
void start_draw_containers();
/*! /*!
* \brief Draw a container according to the parameters * \brief Draw a container according to the parameters
...@@ -47,6 +54,11 @@ public: ...@@ -47,6 +54,11 @@ public:
*/ */
void draw_container(const Element_pos x, const Element_pos y, const Element_pos w, const Element_pos h) ; void draw_container(const Element_pos x, const Element_pos y, const Element_pos w, const Element_pos h) ;
void draw_container_text(const Element_pos x, const Element_pos y, const std::string value);
void end_draw_containers();
void start_draw_states();
/*! /*!
* \brief Draw a state of the trace. * \brief Draw a state of the trace.
* \param r the red color rate of the state. * \param r the red color rate of the state.
...@@ -56,7 +68,7 @@ public: ...@@ -56,7 +68,7 @@ public:
* \param end the ending time of the state. * \param end the ending time of the state.
* \param level refer to the container which state belongs to. * \param level refer to the container which state belongs to.
*/ */
void draw_state(const Element_pos start , const Element_pos end, const Element_count level, const Element_col r, const Element_col g, const Element_col b) ; void draw_state(const Element_pos start , const Element_pos end, const Element_pos level, const Element_pos height, const Element_col r, const Element_col g, const Element_col b) ;
/*! /*!
* \brief Draw an arrow * \brief Draw an arrow
...@@ -64,6 +76,49 @@ public: ...@@ -64,6 +76,49 @@ public:
*/ */
void draw_arrow(const Element_pos start_time, const Element_pos end_time, const Element_pos start_height, const Element_pos end_height); void draw_arrow(const Element_pos start_time, const Element_pos end_time, const Element_pos start_height, const Element_pos end_height);
void end_draw_states();
void draw_event(const Element_pos time, const Element_pos height, const Element_pos container_height);
void end_draw();
}; };
/***********************************
*
*
*
* Drawing function for the trace.
*
*
*
**********************************/
inline void Svg::start_draw(){
}
inline void Svg::draw_container_text(const Element_pos x, const Element_pos y, const std::string value){
}
inline void Svg::start_draw_containers(){
}
inline void Svg::end_draw_containers(){
}
inline void Svg::start_draw_states(){
}
inline void Svg::end_draw_states(){
}
inline void Svg::draw_event(const Element_pos time, const Element_pos height, const Element_pos container_height){
}
inline void Svg::end_draw(){
}
#endif // RENDER_SVG #endif // RENDER_SVG
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "resource.hpp" #include "resource.hpp"
#include "../interface/render_area.hpp" #include "../interface/render_area.hpp"
#include "../interface/render_svg.hpp"
......
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