From 030650f94924b05d4cefa3c1c003b32cd326eba9 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Tue, 3 Apr 2012 16:29:27 +0100 Subject: [PATCH] + impl converter_traits for 'transform_tag' + support proj_transform and CoordTransform as args --- include/mapnik/vertex_converters.hpp | 55 ++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/include/mapnik/vertex_converters.hpp b/include/mapnik/vertex_converters.hpp index a61909f43..930ad5920 100644 --- a/include/mapnik/vertex_converters.hpp +++ b/include/mapnik/vertex_converters.hpp @@ -54,10 +54,10 @@ namespace mapnik { -struct transform {}; -struct clip_line {}; -struct clip_poly {}; -struct smooth {}; +struct transform_tag {}; +struct clip_line_tag {}; +struct clip_poly_tag {}; +struct smooth_tag {}; namespace detail { @@ -74,7 +74,7 @@ struct converter_traits }; template -struct converter_traits +struct converter_traits { typedef T geometry_type; typedef typename agg::conv_smooth_poly1_curve conv_type; @@ -86,9 +86,9 @@ struct converter_traits } }; -/* + template -struct converter_traits +struct converter_traits { typedef T geometry_type; typedef typename agg::conv_clip_polyline conv_type; @@ -100,10 +100,10 @@ struct converter_traits geom.clip_box(box.x0,box.y0,box.x1,box.y1); } }; -*/ + template -struct converter_traits +struct converter_traits { typedef T geometry_type; typedef typename agg::conv_clip_polygon conv_type; @@ -112,7 +112,24 @@ struct converter_traits static void setup(geometry_type & geom, Args & args) { typename boost::mpl::at >::type const& box = boost::fusion::at_c<0>(args); - geom.clip_box(box.x0,box.y0,box.x1,box.y1); + geom.clip_box(box.minx(),box.miny(),box.maxx(),box.maxy()); + } +}; + + +template +struct converter_traits +{ + typedef T geometry_type; + typedef coord_transform2 conv_type; + + template + static void setup(geometry_type & geom, Args & args) + { + typename boost::mpl::at >::type const& tr = boost::fusion::at_c<3>(args); + typename boost::mpl::at >::type const& prj_trans = boost::fusion::at_c<4>(args); + geom.set_proj_trans(prj_trans); + geom.set_trans(tr); } }; @@ -196,23 +213,29 @@ struct dispatcher -template +template struct vertex_converter : private boost::noncopyable { typedef C conv_types; typedef B bbox_type; typedef R rasterizer_type; typedef S symbolizer_type; - - typedef typename boost::fusion::vector3 + typedef P proj_trans_type; + typedef T trans_type; + typedef typename boost::fusion::vector < bbox_type const&, rasterizer_type&, - symbolizer_type const& + symbolizer_type const&, + trans_type const&, + proj_trans_type const& > args_type; - vertex_converter(bbox_type const& b, rasterizer_type & ras, symbolizer_type const& sym) - : disp_(args_type(boost::cref(b),boost::ref(ras),boost::cref(sym))) {} + vertex_converter(bbox_type const& b, rasterizer_type & ras, + symbolizer_type const& sym, trans_type & tr, proj_trans_type const& prj_trans) + : disp_(args_type(boost::cref(b),boost::ref(ras), + boost::cref(sym),boost::cref(tr), + boost::cref(prj_trans))) {} template void apply(Geometry & geom)