diff --git a/include/mapnik/svg/svg_path_commands.hpp b/include/mapnik/svg/svg_path_commands.hpp index 3b1e09dee..e45b5b1c0 100644 --- a/include/mapnik/svg/svg_path_commands.hpp +++ b/include/mapnik/svg/svg_path_commands.hpp @@ -35,232 +35,232 @@ namespace mapnik { namespace svg { - using namespace boost::fusion; +using namespace boost::fusion; - inline double deg2rad(double deg) +inline double deg2rad(double deg) +{ + return (M_PI * deg)/180.0; +} + +template +struct move_to +{ + template + struct result { - return (M_PI * deg)/180.0; + typedef void type; + }; + + explicit move_to(PathType & path) + : path_(path) {} + + template + void operator() (T0 v, T1 rel) const + { + path_.move_to(at_c<0>(v),at_c<1>(v),rel); // impl } - template - struct move_to + PathType & path_; +}; + +template +struct hline_to +{ + template + struct result { - template - struct result - { - typedef void type; - }; - - explicit move_to(PathType & path) - : path_(path) {} - - template - void operator() (T0 v, T1 rel) const - { - path_.move_to(at_c<0>(v),at_c<1>(v),rel); // impl - } - - PathType & path_; + typedef void type; }; - template - struct hline_to + explicit hline_to(PathType & path) + : path_(path) {} + + template + void operator() (T0 const& x, T1 rel) const { - template - struct result - { - typedef void type; - }; + path_.hline_to(x,rel); + } - explicit hline_to(PathType & path) - : path_(path) {} + PathType & path_; +}; - template - void operator() (T0 const& x, T1 rel) const - { - path_.hline_to(x,rel); - } - PathType & path_; +template +struct vline_to +{ + template + struct result + { + typedef void type; }; + explicit vline_to(PathType & path) + : path_(path) {} - template - struct vline_to + template + void operator() (T0 const& y, T1 rel) const { - template - struct result - { - typedef void type; - }; + path_.vline_to(y,rel); + } - explicit vline_to(PathType & path) - : path_(path) {} + PathType & path_; +}; - template - void operator() (T0 const& y, T1 rel) const - { - path_.vline_to(y,rel); - } - - PathType & path_; +template +struct line_to +{ + template + struct result + { + typedef void type; }; - template - struct line_to + explicit line_to(PathType & path) + : path_(path) {} + + template + void operator() (T0 const& v, T1 rel) const { - template - struct result - { - typedef void type; - }; + path_.line_to(at_c<0>(v),at_c<1>(v),rel); // impl + } - explicit line_to(PathType & path) - : path_(path) {} + PathType & path_; +}; - template - void operator() (T0 const& v, T1 rel) const - { - path_.line_to(at_c<0>(v),at_c<1>(v),rel); // impl - } - PathType & path_; +template +struct curve4 +{ + template + struct result + { + typedef void type; }; + explicit curve4(PathType & path) + : path_(path) {} - template - struct curve4 + template + void operator() (T0 const& v0, T1 const& v1, T2 const& v2, T3 rel) const { - template - struct result - { - typedef void type; - }; + path_.curve4(at_c<0>(v0),at_c<1>(v0), + at_c<0>(v1),at_c<1>(v1), + at_c<0>(v2),at_c<1>(v2), + rel); // impl + } - explicit curve4(PathType & path) - : path_(path) {} + PathType & path_; +}; - template - void operator() (T0 const& v0, T1 const& v1, T2 const& v2, T3 rel) const - { - path_.curve4(at_c<0>(v0),at_c<1>(v0), - at_c<0>(v1),at_c<1>(v1), - at_c<0>(v2),at_c<1>(v2), - rel); // impl - } - PathType & path_; +template +struct curve4_smooth +{ + template + struct result + { + typedef void type; }; + explicit curve4_smooth(PathType & path) + : path_(path) {} - template - struct curve4_smooth + template + void operator() (T0 const& v0, T1 const& v1, T2 rel) const { - template - struct result - { - typedef void type; - }; + path_.curve4(at_c<0>(v0),at_c<1>(v0), + at_c<0>(v1),at_c<1>(v1), + rel); // impl + } + PathType & path_; +}; - explicit curve4_smooth(PathType & path) - : path_(path) {} - - template - void operator() (T0 const& v0, T1 const& v1, T2 rel) const - { - path_.curve4(at_c<0>(v0),at_c<1>(v0), - at_c<0>(v1),at_c<1>(v1), - rel); // impl - } - PathType & path_; +template +struct curve3 +{ + template + struct result + { + typedef void type; }; - template - struct curve3 + explicit curve3(PathType & path) + : path_(path) {} + + template + void operator() (T0 const& v0, T1 const& v1, T2 rel) const { - template - struct result - { - typedef void type; - }; + path_.curve3(at_c<0>(v0),at_c<1>(v0), + at_c<0>(v1),at_c<1>(v1), + rel); // impl + } - explicit curve3(PathType & path) - : path_(path) {} + PathType & path_; +}; - template - void operator() (T0 const& v0, T1 const& v1, T2 rel) const - { - path_.curve3(at_c<0>(v0),at_c<1>(v0), - at_c<0>(v1),at_c<1>(v1), - rel); // impl - } - - PathType & path_; +template +struct curve3_smooth +{ + template + struct result + { + typedef void type; }; - template - struct curve3_smooth + explicit curve3_smooth(PathType & path) + : path_(path) {} + + template + void operator() (T0 const& v0, T1 rel) const { - template - struct result - { - typedef void type; - }; + path_.curve3(at_c<0>(v0),at_c<1>(v0), + rel); // impl + } - explicit curve3_smooth(PathType & path) - : path_(path) {} + PathType & path_; +}; - template - void operator() (T0 const& v0, T1 rel) const - { - path_.curve3(at_c<0>(v0),at_c<1>(v0), - rel); // impl - } - - PathType & path_; +template +struct arc_to +{ + template + struct result + { + typedef void type; }; - template - struct arc_to + explicit arc_to(PathType & path) + : path_(path) {} + + template + void operator() (T0 const& rv, T1 const& angle, T2 large_arc_flag, T3 sweep_flag, T4 const& v, T5 rel) const { - template - struct result - { - typedef void type; - }; + path_.arc_to(at_c<0>(rv),at_c<1>(rv), + deg2rad(angle),large_arc_flag,sweep_flag, + at_c<0>(v),at_c<1>(v), + rel); + } - explicit arc_to(PathType & path) - : path_(path) {} + PathType & path_; +}; - template - void operator() (T0 const& rv, T1 const& angle, T2 large_arc_flag, T3 sweep_flag, T4 const& v, T5 rel) const - { - path_.arc_to(at_c<0>(rv),at_c<1>(rv), - deg2rad(angle),large_arc_flag,sweep_flag, - at_c<0>(v),at_c<1>(v), - rel); - } +template +struct close +{ + typedef void result_type; - PathType & path_; - }; + explicit close(PathType & path) + : path_(path) {} - template - struct close + void operator()() const { - typedef void result_type; + path_.close_subpath(); + } - explicit close(PathType & path) - : path_(path) {} + PathType & path_; +}; - void operator()() const - { - path_.close_subpath(); - } - - PathType & path_; - }; - - }} +}} #endif // MAPNIK_SVG_COMMANDS_HPP