update cairo and grid renderers to use new vertex_converters

This commit is contained in:
artemp 2014-09-29 12:25:34 +01:00
parent 7f81fc9146
commit 4f67ec0fc7
8 changed files with 25 additions and 32 deletions

View file

@ -41,13 +41,6 @@ void cairo_renderer<T>::process(line_pattern_symbolizer const& sym,
mapnik::feature_impl & feature, mapnik::feature_impl & feature,
proj_transform const& prj_trans) proj_transform const& prj_trans)
{ {
using conv_types = boost::mpl::vector<clip_line_tag, transform_tag,
affine_transform_tag,
simplify_tag, smooth_tag,
offset_transform_tag,
dash_tag, stroke_tag>;
std::string filename = get<std::string>(sym, keys::file, feature, common_.vars_); std::string filename = get<std::string>(sym, keys::file, feature, common_.vars_);
composite_mode_e comp_op = get<composite_mode_e>(sym, keys::comp_op, feature, common_.vars_, src_over); composite_mode_e comp_op = get<composite_mode_e>(sym, keys::comp_op, feature, common_.vars_, src_over);
bool clip = get<bool>(sym, keys::clip, feature, common_.vars_, false); bool clip = get<bool>(sym, keys::clip, feature, common_.vars_, false);
@ -111,7 +104,11 @@ void cairo_renderer<T>::process(line_pattern_symbolizer const& sym,
using rasterizer_type = line_pattern_rasterizer<cairo_context>; using rasterizer_type = line_pattern_rasterizer<cairo_context>;
rasterizer_type ras(context_, *pattern, width, height); rasterizer_type ras(context_, *pattern, width, height);
vertex_converter<rasterizer_type,conv_types> vertex_converter<rasterizer_type,clip_line_tag, transform_tag,
affine_transform_tag,
simplify_tag, smooth_tag,
offset_transform_tag,
dash_tag, stroke_tag>
converter(clipping_extent, ras, sym, common_.t_, prj_trans, tr, feature, common_.vars_, common_.scale_factor_); converter(clipping_extent, ras, sym, common_.t_, prj_trans, tr, feature, common_.vars_, common_.scale_factor_);
if (clip) converter.set<clip_line_tag>(); // optional clip (default: true) if (clip) converter.set<clip_line_tag>(); // optional clip (default: true)

View file

@ -36,12 +36,6 @@ void cairo_renderer<T>::process(line_symbolizer const& sym,
mapnik::feature_impl & feature, mapnik::feature_impl & feature,
proj_transform const& prj_trans) proj_transform const& prj_trans)
{ {
using conv_types = boost::mpl::vector<clip_line_tag, transform_tag,
affine_transform_tag,
simplify_tag, smooth_tag,
offset_transform_tag,
dash_tag, stroke_tag>;
composite_mode_e comp_op = get<composite_mode_e>(sym, keys::comp_op, feature, common_.vars_, src_over); composite_mode_e comp_op = get<composite_mode_e>(sym, keys::comp_op, feature, common_.vars_, src_over);
bool clip = get<bool>(sym, keys::clip, feature, common_.vars_, false); bool clip = get<bool>(sym, keys::clip, feature, common_.vars_, false);
double offset = get<double>(sym, keys::offset, feature, common_.vars_, 0.0); double offset = get<double>(sym, keys::offset, feature, common_.vars_, 0.0);
@ -84,7 +78,13 @@ void cairo_renderer<T>::process(line_symbolizer const& sym,
padding *= common_.scale_factor_; padding *= common_.scale_factor_;
clipping_extent.pad(padding); clipping_extent.pad(padding);
} }
vertex_converter<cairo_context,conv_types> vertex_converter<cairo_context,
clip_line_tag,
transform_tag,
affine_transform_tag,
simplify_tag, smooth_tag,
offset_transform_tag,
dash_tag, stroke_tag>
converter(clipping_extent,context_,sym,common_.t_,prj_trans,tr,feature,common_.vars_,common_.scale_factor_); converter(clipping_extent,context_,sym,common_.t_,prj_trans,tr,feature,common_.vars_,common_.scale_factor_);
if (clip) converter.set<clip_line_tag>(); // optional clip (default: true) if (clip) converter.set<clip_line_tag>(); // optional clip (default: true)

View file

@ -102,8 +102,7 @@ void cairo_renderer<T>::process(polygon_pattern_symbolizer const& sym,
auto geom_transform = get_optional<transform_type>(sym, keys::geometry_transform); auto geom_transform = get_optional<transform_type>(sym, keys::geometry_transform);
if (geom_transform) { evaluate_transform(tr, feature, common_.vars_, *geom_transform, common_.scale_factor_); } if (geom_transform) { evaluate_transform(tr, feature, common_.vars_, *geom_transform, common_.scale_factor_); }
using conv_types = boost::mpl::vector<clip_poly_tag,transform_tag,affine_transform_tag,simplify_tag,smooth_tag>; vertex_converter<cairo_context,clip_poly_tag,transform_tag,affine_transform_tag,simplify_tag,smooth_tag>
vertex_converter<cairo_context, conv_types>
converter(clip_box, context_,sym,common_.t_,prj_trans,tr,feature,common_.vars_,common_.scale_factor_); converter(clip_box, context_,sym,common_.t_,prj_trans,tr,feature,common_.vars_,common_.scale_factor_);
if (prj_trans.equal() && clip) converter.set<clip_poly_tag>(); //optional clip (default: true) if (prj_trans.equal() && clip) converter.set<clip_poly_tag>(); //optional clip (default: true)

View file

@ -38,9 +38,7 @@ void cairo_renderer<T>::process(polygon_symbolizer const& sym,
mapnik::feature_impl & feature, mapnik::feature_impl & feature,
proj_transform const& prj_trans) proj_transform const& prj_trans)
{ {
using conv_types = boost::mpl::vector<clip_poly_tag,transform_tag,affine_transform_tag,simplify_tag,smooth_tag>; using vertex_converter_type = vertex_converter<cairo_context,clip_poly_tag,transform_tag,affine_transform_tag,simplify_tag,smooth_tag>;
using vertex_converter_type = vertex_converter<cairo_context, conv_types>;
cairo_save_restore guard(context_); cairo_save_restore guard(context_);
composite_mode_e comp_op = get<composite_mode_e>(sym, keys::comp_op, feature, common_.vars_, src_over); composite_mode_e comp_op = get<composite_mode_e>(sym, keys::comp_op, feature, common_.vars_, src_over);
context_.set_operator(comp_op); context_.set_operator(comp_op);

View file

@ -73,9 +73,7 @@ void grid_renderer<T>::process(line_pattern_symbolizer const& sym,
using pixfmt_type = typename grid_renderer_base_type::pixfmt_type; using pixfmt_type = typename grid_renderer_base_type::pixfmt_type;
using color_type = typename grid_renderer_base_type::pixfmt_type::color_type; using color_type = typename grid_renderer_base_type::pixfmt_type::color_type;
using renderer_type = agg::renderer_scanline_bin_solid<grid_renderer_base_type>; using renderer_type = agg::renderer_scanline_bin_solid<grid_renderer_base_type>;
using conv_types = boost::mpl::vector<clip_line_tag, transform_tag,
offset_transform_tag, affine_transform_tag,
simplify_tag, smooth_tag, stroke_tag>;
agg::scanline_bin sl; agg::scanline_bin sl;
grid_rendering_buffer buf(pixmap_.raw_data(), common_.width_, common_.height_, common_.width_); grid_rendering_buffer buf(pixmap_.raw_data(), common_.width_, common_.height_, common_.width_);
@ -119,7 +117,10 @@ void grid_renderer<T>::process(line_pattern_symbolizer const& sym,
put<value_double>(line, keys::simplify_tolerance, value_double(simplify_tolerance)); put<value_double>(line, keys::simplify_tolerance, value_double(simplify_tolerance));
put<value_double>(line, keys::smooth, value_double(smooth)); put<value_double>(line, keys::smooth, value_double(smooth));
vertex_converter<grid_rasterizer,conv_types> vertex_converter<grid_rasterizer,
clip_line_tag, transform_tag,
offset_transform_tag, affine_transform_tag,
simplify_tag, smooth_tag, stroke_tag>
converter(clipping_extent,*ras_ptr,line,common_.t_,prj_trans,tr,feature,common_.vars_,common_.scale_factor_); converter(clipping_extent,*ras_ptr,line,common_.t_,prj_trans,tr,feature,common_.vars_,common_.scale_factor_);
if (clip) converter.set<clip_line_tag>(); // optional clip (default: true) if (clip) converter.set<clip_line_tag>(); // optional clip (default: true)
converter.set<transform_tag>(); // always transform converter.set<transform_tag>(); // always transform

View file

@ -50,9 +50,7 @@ void grid_renderer<T>::process(line_symbolizer const& sym,
using pixfmt_type = typename grid_renderer_base_type::pixfmt_type; using pixfmt_type = typename grid_renderer_base_type::pixfmt_type;
using color_type = typename grid_renderer_base_type::pixfmt_type::color_type; using color_type = typename grid_renderer_base_type::pixfmt_type::color_type;
using renderer_type = agg::renderer_scanline_bin_solid<grid_renderer_base_type>; using renderer_type = agg::renderer_scanline_bin_solid<grid_renderer_base_type>;
using conv_types = boost::mpl::vector<clip_line_tag, transform_tag,
offset_transform_tag, affine_transform_tag,
simplify_tag, smooth_tag, dash_tag, stroke_tag>;
agg::scanline_bin sl; agg::scanline_bin sl;
grid_rendering_buffer buf(pixmap_.raw_data(), common_.width_, common_.height_, common_.width_); grid_rendering_buffer buf(pixmap_.raw_data(), common_.width_, common_.height_, common_.width_);
@ -91,7 +89,9 @@ void grid_renderer<T>::process(line_symbolizer const& sym,
clipping_extent.pad(padding); clipping_extent.pad(padding);
} }
vertex_converter<grid_rasterizer, conv_types> vertex_converter<grid_rasterizer, clip_line_tag, transform_tag,
offset_transform_tag, affine_transform_tag,
simplify_tag, smooth_tag, dash_tag, stroke_tag>
converter(clipping_extent,*ras_ptr,sym,common_.t_,prj_trans,tr,feature,common_.vars_,common_.scale_factor_); converter(clipping_extent,*ras_ptr,sym,common_.t_,prj_trans,tr,feature,common_.vars_,common_.scale_factor_);
if (clip) converter.set<clip_line_tag>(); // optional clip (default: true) if (clip) converter.set<clip_line_tag>(); // optional clip (default: true)
converter.set<transform_tag>(); // always transform converter.set<transform_tag>(); // always transform

View file

@ -77,8 +77,7 @@ void grid_renderer<T>::process(polygon_pattern_symbolizer const& sym,
evaluate_transform(tr, feature, common_.vars_, *transform, common_.scale_factor_); evaluate_transform(tr, feature, common_.vars_, *transform, common_.scale_factor_);
} }
using conv_types = boost::mpl::vector<clip_poly_tag,transform_tag,affine_transform_tag,smooth_tag>; vertex_converter<grid_rasterizer, clip_poly_tag,transform_tag,affine_transform_tag,smooth_tag>
vertex_converter<grid_rasterizer,conv_types>
converter(common_.query_extent_,*ras_ptr,sym,common_.t_,prj_trans,tr,feature,common_.vars_,common_.scale_factor_); converter(common_.query_extent_,*ras_ptr,sym,common_.t_,prj_trans,tr,feature,common_.vars_,common_.scale_factor_);
if (prj_trans.equal() && clip) converter.set<clip_poly_tag>(); //optional clip (default: true) if (prj_trans.equal() && clip) converter.set<clip_poly_tag>(); //optional clip (default: true)

View file

@ -53,8 +53,7 @@ void grid_renderer<T>::process(polygon_symbolizer const& sym,
using renderer_type = agg::renderer_scanline_bin_solid<grid_renderer_base_type>; using renderer_type = agg::renderer_scanline_bin_solid<grid_renderer_base_type>;
using pixfmt_type = typename grid_renderer_base_type::pixfmt_type; using pixfmt_type = typename grid_renderer_base_type::pixfmt_type;
using color_type = typename grid_renderer_base_type::pixfmt_type::color_type; using color_type = typename grid_renderer_base_type::pixfmt_type::color_type;
using conv_types = boost::mpl::vector<clip_poly_tag,transform_tag,affine_transform_tag,simplify_tag,smooth_tag>; using vertex_converter_type = vertex_converter<grid_rasterizer,clip_poly_tag,transform_tag,affine_transform_tag,simplify_tag,smooth_tag>;
using vertex_converter_type = vertex_converter<grid_rasterizer,conv_types>;
ras_ptr->reset(); ras_ptr->reset();