--- src/GraphicPath.h.old 2010-07-20 06:08:05.342145486 +0200 +++ src/GraphicPath.h 2010-07-20 06:11:03.532544211 +0200 @@ -91,6 +91,25 @@ virtual bool quit () {return false;} }; + struct WriteActions : Actions { + WriteActions (std::ostream &os, double sx, double sy) : _os(os), _sx(sx), _sy(sy) {} + void draw (char cmd, const Point *points, int n) { + _os << cmd; + switch (cmd) { + case 'H': _os << _sx*points->x(); break; + case 'V': _os << _sy*points->y(); break; + default : + for (int i=0; i < n; i++) { + if (i > 0) + _os << ' '; + _os << _sx*points[i].x() << ' ' << _sy*points[i].y(); + } + } + } + std::ostream &_os; + double _sx, _sy; + }; + typedef typename std::vector::iterator Iterator; typedef typename std::vector::const_iterator ConstIterator; typedef typename std::vector::const_reverse_iterator ConstRevIterator; @@ -176,24 +195,7 @@ void writeSVG (std::ostream &os, double sx=1.0, double sy=1.0) const { - struct WriteActions : Actions { - WriteActions (std::ostream &os, double sx, double sy) : _os(os), _sx(sx), _sy(sy) {} - void draw (char cmd, const Point *points, int n) { - _os << cmd; - switch (cmd) { - case 'H': _os << _sx*points->x(); break; - case 'V': _os << _sy*points->y(); break; - default : - for (int i=0; i < n; i++) { - if (i > 0) - _os << ' '; - _os << _sx*points[i].x() << ' ' << _sy*points[i].y(); - } - } - } - std::ostream &_os; - double _sx, _sy; - } actions(os, sx, sy); + WriteActions actions(os, sx, sy); iterate(actions, true); }