This commit is contained in:
artemp 2012-07-06 13:50:44 +01:00
parent 6e03fd7bb1
commit 04589282bb

View file

@ -35,232 +35,232 @@
namespace mapnik { namespace svg { 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 <typename PathType>
struct move_to
{
template <typename T0, typename T1>
struct result
{ {
return (M_PI * deg)/180.0; typedef void type;
};
explicit move_to(PathType & path)
: path_(path) {}
template <typename T0, typename T1>
void operator() (T0 v, T1 rel) const
{
path_.move_to(at_c<0>(v),at_c<1>(v),rel); // impl
} }
template <typename PathType> PathType & path_;
struct move_to };
template <typename PathType>
struct hline_to
{
template <typename T0, typename T1>
struct result
{ {
template <typename T0, typename T1> typedef void type;
struct result
{
typedef void type;
};
explicit move_to(PathType & path)
: path_(path) {}
template <typename T0, typename T1>
void operator() (T0 v, T1 rel) const
{
path_.move_to(at_c<0>(v),at_c<1>(v),rel); // impl
}
PathType & path_;
}; };
template <typename PathType> explicit hline_to(PathType & path)
struct hline_to : path_(path) {}
template <typename T0, typename T1>
void operator() (T0 const& x, T1 rel) const
{ {
template <typename T0, typename T1> path_.hline_to(x,rel);
struct result }
{
typedef void type;
};
explicit hline_to(PathType & path) PathType & path_;
: path_(path) {} };
template <typename T0, typename T1>
void operator() (T0 const& x, T1 rel) const
{
path_.hline_to(x,rel);
}
PathType & path_; template <typename PathType>
struct vline_to
{
template <typename T0, typename T1>
struct result
{
typedef void type;
}; };
explicit vline_to(PathType & path)
: path_(path) {}
template <typename PathType> template <typename T0, typename T1>
struct vline_to void operator() (T0 const& y, T1 rel) const
{ {
template <typename T0, typename T1> path_.vline_to(y,rel);
struct result }
{
typedef void type;
};
explicit vline_to(PathType & path) PathType & path_;
: path_(path) {} };
template <typename T0, typename T1> template <typename PathType>
void operator() (T0 const& y, T1 rel) const struct line_to
{ {
path_.vline_to(y,rel); template <typename T0, typename T1>
} struct result
{
PathType & path_; typedef void type;
}; };
template <typename PathType> explicit line_to(PathType & path)
struct line_to : path_(path) {}
template <typename T0, typename T1>
void operator() (T0 const& v, T1 rel) const
{ {
template <typename T0, typename T1> path_.line_to(at_c<0>(v),at_c<1>(v),rel); // impl
struct result }
{
typedef void type;
};
explicit line_to(PathType & path) PathType & path_;
: path_(path) {} };
template <typename T0, typename T1>
void operator() (T0 const& v, T1 rel) const
{
path_.line_to(at_c<0>(v),at_c<1>(v),rel); // impl
}
PathType & path_; template <typename PathType>
struct curve4
{
template <typename T0, typename T1, typename T2, typename T3>
struct result
{
typedef void type;
}; };
explicit curve4(PathType & path)
: path_(path) {}
template <typename PathType> template <typename T0, typename T1,typename T2, typename T3>
struct curve4 void operator() (T0 const& v0, T1 const& v1, T2 const& v2, T3 rel) const
{ {
template <typename T0, typename T1, typename T2, typename T3> path_.curve4(at_c<0>(v0),at_c<1>(v0),
struct result at_c<0>(v1),at_c<1>(v1),
{ at_c<0>(v2),at_c<1>(v2),
typedef void type; rel); // impl
}; }
explicit curve4(PathType & path) PathType & path_;
: path_(path) {} };
template <typename T0, typename T1,typename T2, typename T3>
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 <typename PathType>
struct curve4_smooth
{
template <typename T0, typename T1, typename T2>
struct result
{
typedef void type;
}; };
explicit curve4_smooth(PathType & path)
: path_(path) {}
template <typename PathType> template <typename T0, typename T1,typename T2>
struct curve4_smooth void operator() (T0 const& v0, T1 const& v1, T2 rel) const
{ {
template <typename T0, typename T1, typename T2> path_.curve4(at_c<0>(v0),at_c<1>(v0),
struct result at_c<0>(v1),at_c<1>(v1),
{ rel); // impl
typedef void type; }
}; PathType & path_;
};
explicit curve4_smooth(PathType & path) template <typename PathType>
: path_(path) {} struct curve3
{
template <typename T0, typename T1,typename T2> template <typename T0, typename T1, typename T2>
void operator() (T0 const& v0, T1 const& v1, T2 rel) const struct result
{ {
path_.curve4(at_c<0>(v0),at_c<1>(v0), typedef void type;
at_c<0>(v1),at_c<1>(v1),
rel); // impl
}
PathType & path_;
}; };
template <typename PathType> explicit curve3(PathType & path)
struct curve3 : path_(path) {}
template <typename T0, typename T1,typename T2>
void operator() (T0 const& v0, T1 const& v1, T2 rel) const
{ {
template <typename T0, typename T1, typename T2> path_.curve3(at_c<0>(v0),at_c<1>(v0),
struct result at_c<0>(v1),at_c<1>(v1),
{ rel); // impl
typedef void type; }
};
explicit curve3(PathType & path) PathType & path_;
: path_(path) {} };
template <typename T0, typename T1,typename T2> template <typename PathType>
void operator() (T0 const& v0, T1 const& v1, T2 rel) const struct curve3_smooth
{ {
path_.curve3(at_c<0>(v0),at_c<1>(v0), template <typename T0, typename T1>
at_c<0>(v1),at_c<1>(v1), struct result
rel); // impl {
} typedef void type;
PathType & path_;
}; };
template <typename PathType> explicit curve3_smooth(PathType & path)
struct curve3_smooth : path_(path) {}
template <typename T0, typename T1>
void operator() (T0 const& v0, T1 rel) const
{ {
template <typename T0, typename T1> path_.curve3(at_c<0>(v0),at_c<1>(v0),
struct result rel); // impl
{ }
typedef void type;
};
explicit curve3_smooth(PathType & path) PathType & path_;
: path_(path) {} };
template <typename T0, typename T1> template <typename PathType>
void operator() (T0 const& v0, T1 rel) const struct arc_to
{ {
path_.curve3(at_c<0>(v0),at_c<1>(v0), template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
rel); // impl struct result
} {
typedef void type;
PathType & path_;
}; };
template <typename PathType> explicit arc_to(PathType & path)
struct arc_to : path_(path) {}
template <typename T0, typename T1,typename T2, typename T3, typename T4, typename T5>
void operator() (T0 const& rv, T1 const& angle, T2 large_arc_flag, T3 sweep_flag, T4 const& v, T5 rel) const
{ {
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5> path_.arc_to(at_c<0>(rv),at_c<1>(rv),
struct result deg2rad(angle),large_arc_flag,sweep_flag,
{ at_c<0>(v),at_c<1>(v),
typedef void type; rel);
}; }
explicit arc_to(PathType & path) PathType & path_;
: path_(path) {} };
template <typename T0, typename T1,typename T2, typename T3, typename T4, typename T5> template <typename PathType>
void operator() (T0 const& rv, T1 const& angle, T2 large_arc_flag, T3 sweep_flag, T4 const& v, T5 rel) const struct close
{ {
path_.arc_to(at_c<0>(rv),at_c<1>(rv), typedef void result_type;
deg2rad(angle),large_arc_flag,sweep_flag,
at_c<0>(v),at_c<1>(v),
rel);
}
PathType & path_; explicit close(PathType & path)
}; : path_(path) {}
template <typename PathType> void operator()() const
struct close
{ {
typedef void result_type; path_.close_subpath();
}
explicit close(PathType & path) PathType & path_;
: path_(path) {} };
void operator()() const }}
{
path_.close_subpath();
}
PathType & path_;
};
}}
#endif // MAPNIK_SVG_COMMANDS_HPP #endif // MAPNIK_SVG_COMMANDS_HPP