diff --git a/src/interface/render_svg.cpp b/src/interface/render_svg.cpp index d0a0b804fee0613661226e92386e7bbe4d1950d1..c87cb61736e265dbbfbb6dda3c9952a3e27b0a5d 100644 --- a/src/interface/render_svg.cpp +++ b/src/interface/render_svg.cpp @@ -42,7 +42,7 @@ void Svg::init(const char *path){ << "\t\t\t}\n" << "\t\tpath\n" << "\t\t\t{\n" - << "\t\t\t\tfill:green;stroke:black;stroke-width:1\n" + << "\t\t\t\tfill:none;stroke:green;stroke-width:1\n" << "\t\t\t}\n" << "\t\n" << "\tRectangles\n"; diff --git a/src/interface/render_svg.hpp b/src/interface/render_svg.hpp index 7e0eae0395088cf8cb7dcbdd0e0f2d9298040477..1bcf635b9f13571b2173ee98db315610dcd1f977 100644 --- a/src/interface/render_svg.hpp +++ b/src/interface/render_svg.hpp @@ -11,15 +11,14 @@ #define MARGIN 10 //distance between two object #define ARROWSIZE 4 //spike size +#define WAIT_NEW_CHRONO 0 +#define INIT 1 +#define WAIT_FOR_POINT 2 #include "render.hpp" #include "resource.hpp" -/*typedef unsigned long Element_count ; -typedef double Element_pos; -typedef unsigned char Element_col; -*/ class Svg : public Render{ @@ -27,11 +26,12 @@ class Svg : public Render{ private: std::ostringstream _buffer; std::ostringstream _chronogramme; + int _chronogramme_state; std::ofstream _svg_file; inline void print(); - inline void rectangle(const char* name,unsigned long w, unsigned long h,unsigned long x1,unsigned long y1, unsigned int r, unsigned int g, unsigned int b ); - inline void line(const char* name, long unsigned int x1, long unsigned int y1, long unsigned int x2, long unsigned int y2); - inline void triangle(const char* name,unsigned long x1,unsigned long y1,unsigned long x2,unsigned long y2, unsigned long x3,unsigned long y3); + inline void rectangle(const char* name,Element_pos w, Element_pos h,Element_pos x1,Element_pos y1, unsigned int r, unsigned int g, unsigned int b ); + inline void line(const char* name, Element_pos x1, Element_pos y1, Element_pos x2, Element_pos y2); + inline void triangle(const char* name,Element_pos x1,Element_pos y1,Element_pos x2,Element_pos y2, Element_pos x3,Element_pos y3); public: /*! * \brief SVG header buiding @@ -111,6 +111,7 @@ inline void Svg::draw_container_text(const Element_pos x, const Element_pos y, c } inline void Svg::start_draw_containers(){ + } inline void Svg::end_draw_containers(){ @@ -128,12 +129,59 @@ inline void Svg::end_draw_states(){ *******************/ inline void Svg::start_draw_counter(){ + _chronogramme_state=INIT; } inline void Svg::draw_counter(const Element_pos x, const Element_pos y){ + + if (_chronogramme_state==INIT) + { + if (x==0) + { + _chronogramme << "\n"; + _svg_file.write(_chronogramme.str().c_str(), _chronogramme.str().size()); + _chronogramme.str(""); + _chronogramme_state=WAIT_NEW_CHRONO; + } + else + { + _chronogramme << " L" << x << " " << y; + } + + } + + else if (_chronogramme_state==WAIT_NEW_CHRONO) + { + if (x==0) + { + _chronogramme << "\n" << std::endl; + <<")'/>"; print(); } @@ -155,12 +203,12 @@ void Svg::rectangle(const char* name,unsigned long w, unsigned long h,unsigned l -void Svg::triangle(const char* name,unsigned long x1,unsigned long y1,unsigned long x2,unsigned long y2, unsigned long x3,unsigned long y3){ +void Svg::triangle(const char* name,Element_pos x1,Element_pos y1,Element_pos x2,Element_pos y2, Element_pos x3,Element_pos y3){ _buffer << "\n" << std::endl; + <<"' />"; print(); } @@ -173,7 +221,7 @@ void Svg::print(){ -inline void Svg::line(const char* name, long unsigned int x1, long unsigned int y1, long unsigned int x2, long unsigned int y2){ +inline void Svg::line(const char* name, Element_pos x1, Element_pos y1, Element_pos x2, Element_pos y2){ _buffer << "\n