Commit ce87ab23 authored by Pascal Noisette's avatar Pascal Noisette

wide

parent d036d22c
......@@ -7,7 +7,7 @@ void Svg::init(const char *path){
_container_width_max = 0;
_debug_counter=0;
_container_height_min = 1280;
_epsilon = 0.001;
_epsilon = 0.1;
_svg_file.open(path , std::ofstream::out | std::ofstream::trunc);
......@@ -73,11 +73,20 @@ void Svg::end(){
_buffer.flush();
_buffer.str("");
_svg_file.write(_chronogramme.str().c_str(), _chronogramme.str().size());
_chronogramme.flush();
_chronogramme.str("");
_thin_element_buffer << "\n</g></svg>";
_svg_file.write(_thin_element_buffer.str().c_str(), _thin_element_buffer.str().size());
_thin_element_buffer.flush();
_thin_element_buffer.str("");
_svg_file.close();
......
......@@ -10,7 +10,7 @@
#define LEVEL 20 //distance between two containers
#define MARGIN 10 //distance between two object
#define ARROWSIZE 2 //spike size
#define WIDE 20
#define WIDE 1000
#define MARGINSTATE 0.5
#define WAIT_NEW_CHRONO 0
......@@ -154,17 +154,23 @@ inline void Svg::end_draw_states(){
inline void Svg::start_draw_counter(){
_chronogramme_state=INIT;
std::cout<<"INIT\n";
}
inline void Svg::draw_counter(const Element_pos x, const Element_pos y){
std::cout<<"s.draw_counter("<<x<<","<<y<<");\n";
Element_pos xprime = x*WIDE + _container_width_max ;
Element_pos yprime = y*LEVEL;
Element_pos switchvalue = _container_width_max;
std::cout<<"s.draw_counter("<<xprime<<","<<yprime<<");\n";
if (_chronogramme_state==INIT)
{
if (x==0)
if (xprime==switchvalue)
{
_chronogramme << "\n<path d='M0 "<< y;
std::cout<<"WAITFORPOINT\n";
_chronogramme << "\n<path d='M"<< xprime << " " << yprime;
_chronogramme_state=WAIT_FOR_POINT;
}
else
......@@ -175,8 +181,9 @@ std::cout<<"s.draw_counter("<<x<<","<<y<<");\n";
{
if (x==0)
if (xprime==switchvalue)
{
std::cout<<"WAITFORNEWCHRONO\n";
_chronogramme << "'/>";
_svg_file.write(_chronogramme.str().c_str(), _chronogramme.str().size());
_chronogramme.str("");
......@@ -184,16 +191,18 @@ std::cout<<"s.draw_counter("<<x<<","<<y<<");\n";
}
else
{
_chronogramme << " L" << x << " " << y;
_chronogramme << " L" << xprime << " " << yprime;
}
}
else if (_chronogramme_state==WAIT_NEW_CHRONO)
{
if (x==0)
if (xprime==switchvalue)
{
_chronogramme << "\n<path d='M0 "<< y;
std::cout<<"WAITFORPOINT\n";
_chronogramme << "\n<path d='M"<< xprime << " " << yprime;
_chronogramme_state=WAIT_FOR_POINT;
}
else
......@@ -281,7 +290,7 @@ inline void Svg::draw_container(const Element_pos x, const Element_pos y, const
yprime = LEVEL*y;
xprime = LEVEL*x;
//std::cout<<"s.draw_container("<<x<<","<<y<<","<<w<<","<< h<<");\n";
std::cout<<"s.draw_container("<<x<<","<<y<<","<<w<<","<< h<<");\n";
Svg::rectangle("container",wprime, hprime, xprime, yprime, 0xff, 0x44, 0xcc);
......
This diff is collapsed.
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