Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
solverstack
vite
Commits
d1eaf35a
Commit
d1eaf35a
authored
May 16, 2009
by
Mathieu Faverge
Browse files
Correction des boulette a johnny qui sait pas faire une inversion verticale :)
parent
c555e359
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/render/render_stats_svg.cpp
View file @
d1eaf35a
/*!
*\file render_stats_svg.cpp
*/
#include "render_stats_svg.hpp"
using
namespace
std
;
#define message *Message::get_instance() << "(" << __FILE__ << " l." << __LINE__ << "): "
Render_stats_svg
::
Render_stats_svg
(){
_y_min
=
0
;
_y_max
=
0
;
}
Render_stats_svg
::~
Render_stats_svg
(){
...
...
@@ -33,12 +30,13 @@ void Render_stats_svg::clear(){
void
Render_stats_svg
::
fill_file
(){
list
<
Element_pos
>::
const_iterator
it_pos
;
list
<
string
>::
const_iterator
it_txt
;
list
<
string
>::
const_iterator
it_txt
;
list
<
Element_pos
>::
const_iterator
it_line
;
list
<
Element_pos
>::
const_iterator
it_rect
;
Element_pos
buf_x
;
Element_pos
buf_y
;
string
buf_txt
;
string
buf_txt
;
Element_pos
height
=
_y_max
-
_y_min
+
20
;
/* Draw rect */
for
(
it_rect
=
_rect_pos
.
begin
()
;
it_rect
!=
_rect_pos
.
end
()
;
it_rect
++
)
{
...
...
@@ -56,12 +54,12 @@ void Render_stats_svg::fill_file(){
it_rect
++
;
Element_pos
b
=
*
it_rect
;
_svg_file
<<
"
\n
<rect width=
\"
"
<<
w
<<
"
\"
height=
\"
"
<<
h
<<
"
\"
x=
\"
"
<<
x
<<
"
\"
y=
\"
"
<<
y
-
_y_min
<<
"
\"
fill=
\"
rgb("
<<
(
int
)(
r
*
255
)
<<
","
<<
(
int
)(
g
*
255
)
<<
","
<<
(
int
)(
b
*
255
)
<<
")
\"
/>
\n
"
;
_svg_file
<<
"<rect width=
\"
"
<<
w
<<
"
\"
height=
\"
"
<<
-
h
<<
"
\"
x=
\"
"
<<
x
<<
"
\"
y=
\"
"
<<
height
-
(
y
-
_y_min
)
<<
"
\"
fill=
\"
rgb("
<<
(
int
)(
r
*
255
)
<<
","
<<
(
int
)(
g
*
255
)
<<
","
<<
(
int
)(
b
*
255
)
<<
")
\"
/>
\n
"
;
}
/* end for(...) */
...
...
@@ -75,25 +73,23 @@ void Render_stats_svg::fill_file(){
it_line
++
;
Element_pos
size_y
=
*
it_line
;
_svg_file
<<
"<line x1=
\"
"
<<
x
<<
"
\"
y1=
\"
"
<<
y
-
_y_min
<<
"
\"
x2=
\"
"
<<
x
+
size_x
<<
"
\"
y2=
\"
"
<<
y
-
_y_min
+
size_y
<<
"
\"
stroke=
\"
black
\"
/>
\n
"
;
_svg_file
<<
"<line x1=
\"
"
<<
x
<<
"
\"
y1=
\"
"
<<
height
-
(
y
-
_y_min
)
<<
"
\"
x2=
\"
"
<<
x
+
size_x
<<
"
\"
y2=
\"
"
<<
height
-
(
y
-
_y_min
+
size_y
)
<<
"
\"
stroke=
\"
black
\"
/>
\n
"
;
}
/* end for(...) */
/* Draw texts */
for
(
it_txt
=
_text_value
.
begin
(),
it_pos
=
_text_pos
.
begin
()
;
it_txt
!=
_text_value
.
end
()
;
it_txt
++
,
it_pos
++
)
{
buf_x
=
*
it_pos
;
it_pos
++
;
buf_y
=
*
it_pos
;
for
(
it_txt
=
_text_value
.
begin
(),
it_pos
=
_text_pos
.
begin
()
;
it_txt
!=
_text_value
.
end
()
;
it_txt
++
,
it_pos
++
)
{
buf_x
=
*
it_pos
;
it_pos
++
;
buf_y
=
*
it_pos
;
buf_txt
=
*
it_txt
;
_svg_file
<<
"<text x=
\"
"
<<
buf_x
<<
"
\"
y=
\"
"
<<
buf_y
+
10
-
_y_min
<<
"
\"
> "
;
_svg_file
<<
buf_txt
;
_svg_file
<<
"</text>"
;
}
/* end for(...) */
_svg_file
<<
"<text x=
\"
"
<<
buf_x
<<
"
\"
y=
\"
"
<<
height
-
(
buf_y
+
10
-
_y_min
)
<<
"
\"
>"
<<
buf_txt
<<
"</text>
\n
"
;
}
/* end for(...) */
}
src/render/render_stats_svg.hpp
View file @
d1eaf35a
...
...
@@ -31,6 +31,7 @@ private:
static
const
double
_RENDER_WIDTH_DEFAULT
=
550.
;
static
const
double
_RENDER_HEIGHT_DEFAULT
=
300.
;
double
_y_min
;
double
_y_max
;
/*!
* \brief Contains container text coordinates.
*/
...
...
@@ -148,9 +149,9 @@ inline void Render_stats_svg::start_draw(){
}
inline
void
Render_stats_svg
::
draw_text
(
const
Element_pos
x
,
const
Element_pos
y
,
const
std
::
string
value
)
{
if
(
y
<
_y_min
)
{
_y_m
in
=
y
;
}
_y_min
=
fmin
(
y
,
_y_min
)
;
_y_m
ax
=
fmax
(
y
+
10
,
_y_max
)
;
_text_pos
.
push_back
(
x
);
_text_pos
.
push_back
(
y
);
_text_value
.
push_back
(
value
);
...
...
@@ -160,9 +161,9 @@ inline void Render_stats_svg::draw_text(const Element_pos x, const Element_pos y
}
inline
void
Render_stats_svg
::
draw_horizontal_line
(
const
Element_pos
x
,
const
Element_pos
y
,
const
Element_pos
size_x
){
if
(
y
<
_y_min
)
{
_y_m
in
=
y
;
}
_y_min
=
fmin
(
y
,
_y_min
)
;
_y_m
ax
=
fmax
(
y
,
_y_max
)
;
_line_pos
.
push_back
(
x
);
_line_pos
.
push_back
(
y
);
_line_pos
.
push_back
(
size_x
);
...
...
@@ -176,9 +177,9 @@ inline void Render_stats_svg::draw_horizontal_line(const Element_pos x, const El
inline
void
Render_stats_svg
::
draw_vertical_line
(
const
Element_pos
x
,
const
Element_pos
y
,
const
Element_pos
size_y
){
if
(
y
<
_y_min
)
{
_y_m
in
=
y
;
}
_y_min
=
fmin
(
fmin
(
y
,
y
+
size_y
),
_y_min
)
;
_y_m
ax
=
fmax
(
fmax
(
y
,
y
+
size_y
),
_y_max
)
;
_line_pos
.
push_back
(
x
);
_line_pos
.
push_back
(
y
);
_line_pos
.
push_back
(
0
);
...
...
@@ -197,9 +198,9 @@ inline void Render_stats_svg::draw_axis(const Element_pos x, const Element_pos y
}
inline
void
Render_stats_svg
::
draw_rect
(
const
Element_pos
x
,
const
Element_pos
y
,
const
Element_pos
w
,
const
Element_pos
h
,
const
Element_pos
r
,
const
Element_pos
g
,
const
Element_pos
b
)
{
if
(
y
<
_y_min
)
{
_y_min
=
y
;
}
_y_min
=
fmin
(
fmin
(
y
,
y
+
h
),
_y_min
)
;
_y_max
=
fmax
(
fmax
(
y
,
y
+
h
),
_y_max
);
_rect_pos
.
push_back
(
x
);
_rect_pos
.
push_back
(
y
);
...
...
@@ -208,12 +209,7 @@ inline void Render_stats_svg::draw_rect(const Element_pos x, const Element_pos y
_rect_pos
.
push_back
(
r
);
_rect_pos
.
push_back
(
g
);
_rect_pos
.
push_back
(
b
);
// _svg_file << "\n<rect width=\"" << w
// <<"\" height=\"" << h
// <<"\" x=\"" << x
// <<"\" y=\"" << y
// <<"\" fill=\"rgb("<<(int)(r*255)<<","<<(int)(g*255)<<","<<(int)(b*255)
// <<")\"/>\n";
}
inline
void
Render_stats_svg
::
end_draw
(){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment