Commit 4ca18174 authored by Olivier Lagrasse's avatar Olivier Lagrasse

- Resize SVG export.

- Add rule for the OpenGL render.
parent dfe854ea
......@@ -80,12 +80,11 @@ SET(VITE_HDRS
trace/DrawTree.hpp
trace/Trace.hpp
# Render headers
render/render.hpp
render/Render.hpp
render/Geometry.hpp
render/Hook_event.hpp
render/Render_opengl_dl.hpp
render/Render_opengl.hpp
render/render_svg.hpp
render/Render_svg.hpp
render/render_stats.hpp
render/render_stats_opengl.hpp
render/render_stats_svg.hpp
......@@ -161,8 +160,9 @@ SET(VITE_SRCS
# Render code files
render/Geometry.cpp
render/Hook_event.cpp
render/Render.hpp
render/Render_opengl.cpp
render/render_svg.cpp
render/Render_svg.cpp
render/render_stats_opengl.cpp
render/render_stats_svg.cpp
#render/vbo.cpp
......
......@@ -73,15 +73,21 @@
// const int Info::Core::_STATE_RENDER_DISPLAY_INFORMATION = 21;
// const int Info::Core::_STATE_RENDER_UPDATE = 22;
Element_pos Info::Container::x_min = 0;
Element_pos Info::Container::x_max = 0;
Element_pos Info::Container::y_min = 0;
Element_pos Info::Container::y_max = 0;
int Info::Screen::width = 800;
int Info::Screen::height = 600;
Element_pos Info::Container::x_min = 0;
Element_pos Info::Container::x_max = 0;
Element_pos Info::Container::y_min = 0;
Element_pos Info::Container::y_max = 0;
Element_pos Info::Entity::x_min = 0;
Element_pos Info::Entity::x_max = 0;
Element_pos Info::Entity::y_min = 0;
Element_pos Info::Entity::y_max = 0;
Element_pos Info::Entity::x_min = 0;
Element_pos Info::Entity::x_max = 0;
Element_pos Info::Entity::y_min = 0;
Element_pos Info::Entity::y_max = 0;
Element_pos Info::Render::width = 100; /* 100 OpenGL units for 1 pixel */
Element_pos Info::Render::height = 100; /* 100 OpenGL units for 1 pixel */
bool Info::Render::_key_alt = false;
bool Info::Render::_key_ctrl = false;
......@@ -95,5 +101,5 @@ Element_pos Info::Render::_info_accurate = 0.0;
bool Info::Render::_no_arrows = false;
bool Info::Render::_no_events = false;
QLabel* Info::Render::_ui_render_min_value = NULL;
QLabel* Info::Render::_ui_render_max_value = NULL;
QLabel* Info::Render::_ui_render_min_value = NULL;
QLabel* Info::Render::_ui_render_max_value = NULL;
......@@ -74,142 +74,20 @@ public:
/*!
* \brief Sub structure to store core system informations.
* \brief Sub structure to store screen informations.
*/
// struct Core{
// /*!
// * \brief Function pointer to the launch_action method of core system.
// */
// static void (Interface_console::* launch_action)(int, void*);
// /***********************************
// *
// * The command line parameter processing functions.
// *
// **********************************/
// /*!
// *\brief An error state.
// */
// static const int _STATE_UNKNOWN;
// /*!
// *\brief A state which corresponds to display a help text.
// */
// static const int _STATE_DISPLAY_HELP;
// /*!
// *\brief A state which corresponds to display the trace within a time.
// */
// static const int _STATE_IN_AN_INTERVAL; // 2^0
// /*!
// *\brief A state which corresponds to display a the ViTE window and opening a file.
// */
// static const int _STATE_OPEN_FILE; // 2^1
// /*!
// *\brief A state which corresponds to display the trace within a time.
// */
// static const int _STATE_OPEN_FILE_IN_AN_INTERVAL;
// /*!
// *\brief A state which corresponds to an export of file.
// */
// static const int _STATE_EXPORT_FILE; // 2^2
// /*!
// *\brief A state which corresponds to an export of file.
// */
// static const int _STATE_EXPORT_FILE_IN_INTERVAL;
// /*!
// *\brief A state which corresponds to release the OpenGL render area (display the wait screen).
// */
// static const int _STATE_RELEASE_RENDER_AREA;
// /*!
// *\brief A state which corresponds to change the render area translation.
// */
// static const int _STATE_RENDER_AREA_CHANGE_TRANSLATE;
// /*!
// *\brief A state which corresponds to change the render area scale.
// */
// static const int _STATE_RENDER_AREA_CHANGE_SCALE;
// /*!
// *\brief A state which corresponds to change the render area container/state scale.
// */
// static const int _STATE_RENDER_AREA_CHANGE_CONTAINER_SCALE;
// /*!
// *\brief Informs that a trace has to be parsed and displayed in the main window.
// */
// static const int _DRAW_OPENGL;
// /*!
// *\brief Informs that a trace has to be exported in svg format.
// */
// static const int _DRAW_SVG;
// /*!
// *\brief A state which corresponds to display the ViTE window.
// */
// static const int _STATE_LAUNCH_GRAPHICAL_INTERFACE;
// /*!
// *\brief A state which corresponds to replace the render area scale.
// */
// static const int _STATE_RENDER_AREA_REPLACE_SCALE;
// /*!
// *\brief A state which corresponds to replace the render area translate.
// */
// static const int _STATE_RENDER_AREA_REPLACE_TRANSLATE;
// /*!
// *\brief A state which corresponds to replace the render area translate.
// */
// static const int _STATE_RENDER_AREA_REPLACE_TRANSLATE_Y;
// /*!
// *\brief A state which corresponds to the registered render area translate.
// */
// static const int _STATE_RENDER_AREA_REGISTERED_TRANSLATE;
// /*!
// *\brief A state which corresponds to change the render area scale.
// */
// static const int _STATE_RENDER_AREA_CHANGE_SCALE_Y;
// /*!
// *\brief A state which corresponds to set new scroll bar length.
// */
// static const int _STATE_AJUST_SCROLL_BARS;
// /*!
// *\brief A state which corresponds to a scroll modification of the render area.
// */
// static const int _STATE_REFRESH_SCROLL_BARS;
// /*!
// *\brief Allow render area to change the graphical interface zoom box value.
// */
// static const int _STATE_ZOOM_BOX_VALUE;
// /*!
// *\brief Display information about a selected entity.
// */
// static const int _STATE_RENDER_DISPLAY_INFORMATION;
// /*!
// *\brief Update the render area.
// */
// static const int _STATE_RENDER_UPDATE;
// };
struct Screen{
/*!
* \brief The screen width. (in pixel)
*/
static int width;
/*!
* \brief The screen height. (in pixel)
*/
static int height;
};
/*!
......@@ -271,6 +149,16 @@ public:
*/
struct Render{
/*!
* \brief The render width. (no unit)
*/
static Element_pos width;
/*!
* \brief The render height. (no unit)
*/
static Element_pos height;
/*!
* \brief Contains the state of tke ALT key.
* true -> key pushed.
......
......@@ -62,7 +62,7 @@
#include "trace/Trace.hpp"
/* -- */
//#include "render/render.hpp"
#include "render/render_svg.hpp"
//#include "render/render_svg.hpp"
/* -- */
#include "statistics/Stats_window.hpp"
/* -- */
......
......@@ -74,20 +74,20 @@ Geometry::Geometry(){
_render_width = 100; /* 100 OpenGL units for the render scene width */
_render_height = 100; /* 100 OpenGL units for the render scene height */
// Info::Render::width = 100;
// Info::Render::height = 100; /* 100 OpenGL units for the render scene height */
_x_scale_container_state = 0.2;/* 20% of screen is used for containers then the other part for states */
_ruler_height = 4.0; /* height of the ruler */
_ruler_y = 0.0; /* highness of the ruler */
_default_entity_x_translate = 20;/* _render_width * _x_scale_container_state */
_default_entity_x_translate = 20;/* Info::Render::width * _x_scale_container_state */
_container_x_max = 0;
_container_y_max = 0;
_container_x_min = 0;
_container_y_min = 0;
/*Info::Container::x_max = 0;
Info::Container::y_max = 0;
Info::Container::x_min = 0;
Info::Container::y_min = 0;*/
_state_y_max = 0;
_state_y_min = 0;
......@@ -118,8 +118,8 @@ Geometry::Geometry(){
_z_state = -5.0;
/* Set in the child class */
_screen_width = 0;
_screen_height = 0;
// Info::Screen::width = 0;
//Info::Screen::height = 0;
}
......@@ -142,33 +142,33 @@ Geometry::~Geometry(){
Element_pos Geometry::screen_to_render_x(Element_pos e){
return e * (Element_pos)_render_width / (Element_pos)_screen_width;
return e * (Element_pos)Info::Render::width / (Element_pos)Info::Screen::width;
}
Element_pos Geometry::screen_to_render_y(Element_pos e){
return e * (Element_pos)_render_height / (Element_pos)_screen_height;
return e * (Element_pos)Info::Render::height / (Element_pos)Info::Screen::height;
}
Element_pos Geometry::render_to_trace_x(Element_pos e){
return (e - _default_entity_x_translate + _x_state_translate) *
(Info::Entity::x_max - Info::Entity::x_min) / ((_render_width - _default_entity_x_translate) * _x_state_scale);
(Info::Entity::x_max - Info::Entity::x_min) / ((Info::Render::width - _default_entity_x_translate) * _x_state_scale);
}
Element_pos Geometry::render_to_trace_y(Element_pos e){
return (e-_ruler_y-_ruler_height + _y_state_translate) *
(_container_y_max - _container_y_min) / ((_render_height - _ruler_height) * _y_state_scale);
(Info::Container::y_max - Info::Container::y_min) / ((Info::Render::height - _ruler_height) * _y_state_scale);
}
Element_pos Geometry::render_to_screen_x(Element_pos e){
return e * (Element_pos)_screen_width / (Element_pos)_render_width;
return e * (Element_pos)Info::Screen::width / (Element_pos)Info::Render::width;
}
Element_pos Geometry::render_to_screen_y(Element_pos e){
return e * (Element_pos)_screen_height / (Element_pos)_render_height;
return e * (Element_pos)Info::Screen::height / (Element_pos)Info::Render::height;
}
Element_pos Geometry::trace_to_render_x(Element_pos e){
......@@ -185,10 +185,10 @@ Element_pos Geometry::trace_to_render_y(Element_pos e){
Element_pos Geometry::coeff_trace_render_x(){
return ((_render_width-_default_entity_x_translate)*_x_state_scale) / (Info::Entity::x_max - Info::Entity::x_min);
return ((Info::Render::width-_default_entity_x_translate)*_x_state_scale) / (Info::Entity::x_max - Info::Entity::x_min);
}
Element_pos Geometry::coeff_trace_render_y(){
return ((_render_height-_ruler_height)*_y_state_scale) / (_container_y_max-_container_y_min);
return ((Info::Render::height-_ruler_height)*_y_state_scale) / (Info::Container::y_max - Info::Container::y_min);
}
......@@ -72,42 +72,42 @@ protected:
/*!
* \brief The opengl render area width in pixels.
*/
Element_pos _screen_width;
// Element_pos _screen_width;
/*!
* \brief The opengl render area height in pixels.
*/
Element_pos _screen_height;
// Element_pos _screen_height;
/*!
* \brief The opengl visibled scene width in the OpenGL units.
*/
Element_pos _render_width;
// Element_pos _render_width;
/*!
* \brief The opengl visibled scene height in the OpenGL units.
*/
Element_pos _render_height;
// Element_pos _render_height;
/*!
* \brief The width of container area draw.
*/
Element_pos _container_x_max;
// Element_pos _container_x_max;
/*!
* \brief The height of container area draw.
*/
Element_pos _container_y_max;
// Element_pos _container_y_max;
/*!
* \brief The x base of container area draw.
*/
Element_pos _container_x_min;
// Element_pos _container_x_min;
/*!
* \brief The y base of container area draw.
*/
Element_pos _container_y_min;
//Element_pos _container_y_min;
/*!
* \brief The width of state area draw.
......
This diff is collapsed.
......@@ -148,10 +148,9 @@ public:
}
/*!
* \brief Creates and opens the display list for container draws.
* \brief Initialize container draws.
*/
inline void start_draw_containers(){
drawing_instance->start_draw_containers();
}
/*!
......@@ -172,25 +171,25 @@ public:
_containers.push_back(buf);
if ((x+w)>_container_x_max)
_container_x_max = x+w;
if ((y+h)>_container_y_max)
_container_y_max = y+h;
if ((x+w)>Info::Container::x_max)
Info::Container::x_max = x+w;
if (_container_x_min > x)
_container_x_min = x;
if ((y+h)>Info::Container::y_max)
Info::Container::y_max = y+h;
if (_container_y_min > y)
_container_y_min = y;
if (Info::Container::x_min > x)
Info::Container::x_min = x;
if (Info::Container::y_min > y)
Info::Container::y_min = y;
#ifdef DEBUG_MODE_RENDER_AREA
std::cerr << __FILE__ << " l." << __LINE__ << ":" << std::endl;
std::cerr < "Container drawing:" << std::endl;
std::cerr << "x: " << x << " y: " << y << " w: " << w << " h: " << h << " xmax-xmin: " << _container_x_max << " - " << _container_x_min << " ymax-ymin: " << _container_y_max << " - " << _container_y_min << std::endl;
std::cerr << "x: " << x << " y: " << y << " w: " << w << " h: " << h << " xmax-xmin: " << Info::Container::x_max << " - " << Info::Container::x_min << " ymax-ymin: " << Info::Container::y_max << " - " << Info::Container::y_min << std::endl;
#endif
......@@ -207,9 +206,8 @@ public:
inline void draw_container_text(const Element_pos x, const Element_pos y, const std::string value){
Container_text_ buf;
// std::cout << y << std::endl;
buf.x = x * (_render_width/_container_x_max)*_x_scale_container_state;
buf.y = y * _y_state_scale*(_render_height-_ruler_height)/_container_y_max;
buf.x = x;
buf.y = y;
buf.value = value;
_container_texts.push_back(buf);
......@@ -221,16 +219,24 @@ public:
inline void end_draw_containers(){
float j = 0.6;
// std::cout << __FILE__ << " ~~ " << __LINE__ << " " << Info::Container::y_max << " " << Info::Container::y_min << std::endl;
/* Before calling start_draw_container(), Info::Container::y_max should have a correct value */
drawing_instance->start_draw_containers();
for (unsigned int i=0 ; i<_containers.size() ; i++){
drawing_instance->set_color(0, 0, j);
drawing_instance->draw_quad(_containers[i].x * (_render_width/_container_x_max)*_x_scale_container_state,
trace_to_render_y(_containers[i].y),// * _y_state_scale*(_render_height-_ruler_height)/_container_y_max) - _y_state_translate + _ruler_y + _ruler_height,
drawing_instance->draw_quad(_containers[i].x * (Info::Render::width/Info::Container::x_max)*_x_scale_container_state,
trace_to_render_y(_containers[i].y),// * _y_state_scale*(_render_height-_ruler_height)/Info::Container::y_max) - _y_state_translate + _ruler_y + _ruler_height,
_z_container,
_containers[i].w * (_render_width/_container_x_max)*_x_scale_container_state,
_containers[i].h * _y_state_scale*(_render_height-_ruler_height)/_container_y_max);
_containers[i].w * (Info::Render::width/Info::Container::x_max)*_x_scale_container_state,
_containers[i].h * _y_state_scale*(Info::Render::height-_ruler_height)/Info::Container::y_max);
}
// std::cout << __FILE__ << " ~ " << __LINE__ << " " << Info::Container::y_max << " " << Info::Container::y_min << std::endl;
for (unsigned int i=0 ; i<_container_texts.size() ; i++){
_container_texts[i].x *= (Info::Render::width/Info::Container::x_max)*_x_scale_container_state;
_container_texts[i].y = trace_to_render_y(_container_texts[i].y);// + _render_height-_ruler_height)*coeff_trace_render_y();
drawing_instance->draw_text(_container_texts[i].x, _container_texts[i].y, _z_container+1, _container_texts[i].value);
}
......@@ -242,6 +248,7 @@ public:
*/
inline void start_draw_states(){
drawing_instance->start_draw_states();
}
/*!
......
......@@ -114,8 +114,8 @@ void Render_opengl::resizeGL(int width, int height) {
glViewport(0, 0, width, height);
/* update informations about widget size */
_screen_width = width;
_screen_height = height;
Info::Screen::width = width;
Info::Screen::height = height;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
......@@ -125,7 +125,7 @@ void Render_opengl::resizeGL(int width, int height) {
if(DRAWING_STATE_WAITING == _state){// A wait is drawn
glOrtho(-50, 50, -50, 50, 0, 1000);
}else if (DRAWING_STATE_DRAWING == _state){// A trace is drawn
glOrtho(0, _render_width, 0, _render_height, 0, -1000);
glOrtho(0, Info::Render::width, 0, Info::Render::height, 0, -1000);
}else{
message << tr("Undefined value for the drawing state attribute - Render area").toStdString() << Message::ende;
}
......@@ -173,7 +173,7 @@ void Render_opengl::paintGL(){
static float a = 0;
a ++;
glTranslated(0.0, _render_height, 100.0);
glTranslated(0.0, Info::Render::height, 100.0);
glRotated(180.0, 1.0, 0.0, 0.0);
......@@ -187,7 +187,7 @@ void Render_opengl::paintGL(){
// glTranslated(- _x_state_translate, -_y_state_translate, 0.0);
glTranslatef(0.0f, -_y_state_translate, 0.0);
// glScalef( (_render_width/_container_x_max)*_x_scale_container_state, _y_state_scale*(_render_height-_ruler_height)/_container_y_max, 0.0f);
// glScalef( (Info::Render::width/Info::Container::x_max)*_x_scale_container_state, _y_state_scale*(Info::Render::height-_ruler_height)/Info::Container::y_max, 0.0f);
glScalef(_x_scale_container_state/0.20, _y_state_scale, 1.0);
if (glIsList(_list_containers) == GL_FALSE)
......@@ -210,18 +210,20 @@ void Render_opengl::paintGL(){
}
glPopMatrix();
draw_stored_arrows();
draw_stored_circles();
draw_stored_texts();
call_ruler();
draw_stored_texts();
// display_state(0, 0, 0, 0, 0, 0);
// if (false == Info::Render::_no_arrows)/* display arrows */
if (false == Info::Render::_no_arrows)/* display arrows */
draw_stored_arrows();
// display_arrow(0, 0, 0, 0, 0, 0);
// if (false == Info::Render::_no_events)/* display events */
if (false == Info::Render::_no_events)/* display events */
draw_stored_circles();
// display_event(0, 0, 0, 0);
// display_counter(0, 0, 0, 0);
......@@ -243,7 +245,7 @@ void Render_opengl::paintGL(){
glPushMatrix();
{
// glTranslated(0.0, _container_y_max- 3*_ruler_height, 100.0);/* not accurate */
// glTranslated(0.0, Info::Container::y_max- 3*_ruler_height, 100.0);/* not accurate */
glTranslated(0.0, 0.0, 100.0);/* not accurate */
if (_mouse_pressed){
......@@ -253,10 +255,10 @@ void Render_opengl::paintGL(){
Element_pos old_x, old_y, new_x, new_y;
old_x = _mouse_x*(_render_width/_screen_width);
old_y = _render_height - _mouse_y*(_render_height/_screen_height);
new_x = _new_mouse_x*(_render_width/_screen_width);
new_y = _render_height - _new_mouse_y*(_render_height/_screen_height);
old_x = _mouse_x*(Info::Render::width/Info::Screen::width);
old_y = Info::Render::height - _mouse_y*(Info::Render::height/Info::Screen::height);
new_x = _new_mouse_x*(Info::Render::width/Info::Screen::width);
new_y = Info::Render::height - _new_mouse_y*(Info::Render::height/Info::Screen::height);
#ifdef DEBUG_MODE_RENDER_OPENGL
......@@ -370,10 +372,10 @@ bool Render_opengl::unbuild(){
_wait_angle_y=0.0f;/* begin with 0 rad angle */
/* init measurement attributes */
_container_x_max = 0;
_container_y_max = 0;
_container_x_min = 0;
_container_y_min = 0;
Info::Container::x_max = 0;
Info::Container::y_max = 0;
Info::Container::x_min = 0;
Info::Container::y_min = 0;
Info::Render::_ui_render_min_value->setText("");
Info::Render::_ui_render_max_value->setText("");
......@@ -511,7 +513,7 @@ GLuint Render_opengl::draw_ruler() {
/*
* NOTE:
* _ruler_distance is the desire distance between 2 graduations.
* There are ceil(_render_width/_ruler_distance) graduations.
* There are ceil(Info::Render::width/_ruler_distance) graduations.
* Between 2 consecutive graduations, there are 4 small graduations.
*/
_ruler_distance = 1.0/nb_graduation;
......@@ -827,7 +829,7 @@ void Render_opengl::call_ruler(){
}*/
// cout << trace_to_render_x(i/graduation_value_adjustement)<< endl;
//if ( _render_width*_x_scale_container_state <= trace_to_render_x(i/adjustement) ){/* Do not write if graduation is inside container area */
//if ( Info::Render::width*_x_scale_container_state <= trace_to_render_x(i/adjustement) ){/* Do not write if graduation is inside container area */
for(unsigned int j = 0 ; j < buf_txt.str().length() ; j ++){
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10, buf_txt.str().c_str()[j]);
}
......@@ -985,7 +987,7 @@ void Render_opengl::draw_stored_texts(){
float length = 0;
const unsigned int buf_text_size =_texts[i].value.length();
const int size_of_container = (const int)(20*_x_scale_container_state*_render_width/_container_x_max);
const int size_of_container = (const int)(20*_x_scale_container_state*Info::Render::width/Info::Container::x_max);
for(unsigned int j = 0 ; j < buf_text_size ; j ++){
const char letter = _texts[i].value.c_str()[j];
/* length += glutBitmapWidth(GLUT_BITMAP_HELVETICA_10, letter);
......
......@@ -97,24 +97,30 @@ void Render_svg::set_color(float r, float g, float b){
}
void Render_svg::draw_text(const Element_pos x, const Element_pos y, const Element_pos z, const std::string s){
/* _buffer.str("");
_buffer << "<text x=\"" << x <<"\""
<< " y=\"" << y << "\">|"
_buffer.str("");
_buffer << "<text x=\"" << render_to_screen_x(x) <<"\""
<< " y=\"" << render_to_screen_y(y) << "\""
<< " font-size=\"8\""
<< " fill=\"white\">"
<< s
<< "</text>\n";
_output_file.write(_buffer.str().c_str(), _buffer.str().size()); */
_output_file.write(_buffer.str().c_str(), _buffer.str().size());
}
void Render_svg::draw_quad(Element_pos x, Element_pos y, Element_pos z, Element_pos w, Element_pos h){
if (render_to_screen_x(w) < 1)/* less than 1 pixel */
return;
_buffer.str("");
_buffer << "<rect "
<< " x=\"" << x << "\""
<< " y=\"" << y << "\""
<< " width=\"" << w << "\""
<< " height=\"" << h << "\""
<< " x=\"" << render_to_screen_x(x) << "\""
<< " y=\"" << render_to_screen_y(y) << "\""
<< " width=\"" << render_to_screen_x(w) << "\""
<< " height=\"" << render_to_screen_y(h) << "\""
<< " fill=\"rgb(" << _red*256 << "," << _green*256 << "," << _blue*256 << ")\""/* TODO: choice better scale than '*256' */
<< " style=\"stroke:white;stroke-width:0.05\""
<< " />\n";
_output_file.write(_buffer.str().c_str(), _buffer.str().size());
......@@ -124,10 +130,10 @@ void Render_svg::draw_triangle(Element_pos x, Element_pos y,
Element_pos size, Element_pos r){
_buffer.str("");
_buffer << "<polygon points=\""
<< x << "," << y << ","
<< x-1.2 << "," << y-0.4 << ","
<< x-1.2 << "," << y+0.4 << "\""
<< " transform = \"rotate("<< r << " " << x << " " << y << " )\""
<< render_to_screen_x(x) << "," << render_to_screen_y(y) << ","
<< render_to_screen_x(x-1.2) << "," << render_to_screen_y(y-0.4) << ","
<< render_to_screen_x(x-1.2) << "," << render_to_screen_y(y+0.4) << "\""
<< " transform = \"rotate("<< r << " " << render_to_screen_x(x) << " " << render_to_screen_y(y) << " )\""
<< " style=\"fill:yellow\""
<< "/>\n";
......@@ -137,11 +143,11 @@ void Render_svg::draw_triangle(Element_pos x, Element_pos y,
void Render_svg::draw_line(Element_pos x1, Element_pos y1, Element_pos x2, Element_pos y2, Element_pos z){
_buffer.str("");
_buffer << "<line "
<< " x1=\"" << x1 << "\""
<< " y1=\"" << y1 << "\""
<< " x2=\"" << x2 << "\""
<< " y2=\"" << y2 << "\""
<< " style=\"stroke:yellow;stroke-width:0.05\""
<< " x1=\"" << render_to_screen_x(x1) << "\""
<< " y1=\"" << render_to_screen_y(y1) << "\""
<< " x2=\"" << render_to_screen_x(x2) << "\""
<< " y2=\"" << render_to_screen_y(y2) << "\""
<< " style=\"stroke:yellow\""
<< "/>\n";
_output_file.write(_buffer.str().c_str(), _buffer.str().size());
......@@ -150,9 +156,9 @@ void Render_svg::draw_line(Element_pos x1, Element_pos y1, Element_pos x2, Eleme
void Render_svg::draw_circle(Element_pos x, Element_pos y, Element_pos z, Element_pos r){
_buffer.str("");
_buffer << "<circle "
<< "cx=\"" << x << "\""
<< "cy=\"" << y << "\""
<< "r=\"" << r << "\""
<< "cx=\"" << render_to_screen_x(x) << "\""
<< "cy=\"" << render_to_screen_x(y) << "\""
<< "r=\"" << max(render_to_screen_x(r), render_to_screen_y(r)) << "\""
<< " style=\"fill:yellow\""
<< "/>\n";
......@@ -161,15 +167,21 @@ void Render_svg::draw_circle(Element_pos x, Element_pos y, Element_pos z, Elemen
void Render_svg::start_draw(){
const unsigned int w = (unsigned int)(Info::Entity::x_max - Info::Entity::x_min);
_buffer.str("");
_buffer << "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n"
<< "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n"
<< "<svg xmlns=\"http://www.w3.org/2000/svg\">\n";
<< "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"" << Info::Screen::width << "\" height=\"" << Info::Screen::height << "\">\n";
_output_file.write(_buffer.str().c_str(), _buffer.str().size());
}
void Render_svg::start_draw_containers(){
/* _buffer.str("");
_buffer << "<g transform=\"scale(" << 10 << "," << 800/(Info::Container::y_max-Info::Container::y_min) << "\">\n";
std::cout << __FILE__ << " !! " << __LINE__ << " " << 600/(Info::Entity::x_max - Info::Entity::x_min) << " " << 800/(Info::Container::y_max-Info::Container::y_min) << std::endl;
_output_file.write(_buffer.str().c_str(), _buffer.str().size()); */
}