- bugfix drawing holt_graph

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1182 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
paolo 2006-09-15 23:29:52 +00:00
parent 5cb771ba81
commit 28bd934c50
1 changed files with 11 additions and 2 deletions

View File

@ -335,7 +335,7 @@ void HoltRequest::arrow(cairo_t *cr, Vec2 first, Vec2 second)
// some calculation to draw arrowpoint...
// take a short line parallel to main line
Vec2 arrowside = second-first;
arrowside *= 15.0*line_width/std::abs(arrowside);
arrowside *= 5.0*line_width/std::abs(arrowside);
// make a rotation component
Vec2 deviation(5.0, 1.0); deviation /= std::abs(deviation);
// make left and right sides rotating that first short line
@ -478,6 +478,13 @@ HoltWidget::arrange()
int sx = _draw_w; // get_width();
int sy = _draw_h; // get_height();
int nelem = _holt_resources.size()+_holt_schedulables.size();
// take minimum between x and y
/*
if(sx<=sy)
inc = Vec2((sx/2-2*_radius), 0);
else
inc = Vec2((sy/2-2*_radius), 0);
*/
if(nelem>1)
{
// take minimum between x and y
@ -492,13 +499,15 @@ HoltWidget::arrange()
inc = Vec2(0, 0);
}
// calc rotation angle
if(nelem>0)
mul = Vec2(cos(2*M_PI/(double)nelem), sin(2*M_PI/(double)nelem));
else
mul = Vec2(0,0);
cen = Vec2(2*_radius+inc.real(), 2*_radius+inc.real());
// cen = Vec2(2*_radius+inc.real(), 2*_radius+inc.real());
cen = Vec2(2*_radius+std::abs(inc), 2*_radius+std::abs(inc));
pos = inc + cen;
}