#ifndef RENDER_SVG #define RENDER_SVG #include #include #include #define BUFFER_SIZE 2048 //character number stored before flush the _buffer #define LEVEL 110 //distance between two containers #define MARGIN 10 //distance between two object #define ARROWSIZE 4 //spike size #include "render.hpp" #include "resource.hpp" /*typedef unsigned long Element_count ; typedef double Element_pos; typedef unsigned char Element_col; */ class Svg : public Render{ private: std::ostringstream _buffer; std::ofstream _svg_file; inline void print(); inline void rectangle(unsigned long w, unsigned long h,unsigned long x1,unsigned long y1, unsigned int r, unsigned int g, unsigned int b ); inline void line(unsigned long x1,unsigned long y1,unsigned long x2,unsigned long y2); inline void triangle(unsigned long x1,unsigned long y1,unsigned long x2,unsigned long y2, unsigned long x3,unsigned long y3); public: /*! * \brief SVG header buiding */ void init(const char *path); /*! * \brief SVG bottom file buiding */ void end(); void start_draw(); void start_draw_containers(); /*! * \brief Draw a container according to the parameters * \param x the x position of the container * \param y the y position of the container * \param w the width of the container * \param h the height of the container */ 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. * \param r the red color rate of the state. * \param g the green color rate of the state. * \param b the blue color rate of the state. * \param start the beginning time of the state. * \param end the ending time of the state. * \param level refer to the container which state belongs to. */ 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 * */ 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