From cd15d8f2b3bdc54fc66ae298f176c8b55b6ab9e0 Mon Sep 17 00:00:00 2001 From: artemp Date: Wed, 4 Mar 2015 18:39:31 +0100 Subject: [PATCH] revive polygon/line pattern rendering --- src/agg/process_line_pattern_symbolizer.cpp | 55 ++++++++----------- .../process_polygon_pattern_symbolizer.cpp | 51 ++++++++--------- 2 files changed, 50 insertions(+), 56 deletions(-) diff --git a/src/agg/process_line_pattern_symbolizer.cpp b/src/agg/process_line_pattern_symbolizer.cpp index c3af2b7cb..7f11446b1 100644 --- a/src/agg/process_line_pattern_symbolizer.cpp +++ b/src/agg/process_line_pattern_symbolizer.cpp @@ -31,10 +31,12 @@ #include #include #include +#include #include #include #include #include +#include // agg #include "agg_basics.h" #include "agg_pixfmt_rgba.h" @@ -124,12 +126,12 @@ struct agg_renderer_process_visitor_l padding *= common_.scale_factor_; clip_box.pad(padding); } + using vertex_converter_type = vertex_converter; - vertex_converter - converter(clip_box,ras,sym_,common_.t_,prj_trans_,tr,feature_,common_.vars_,common_.scale_factor_); + vertex_converter_type converter(clip_box,ras,sym_,common_.t_,prj_trans_,tr,feature_,common_.vars_,common_.scale_factor_); if (clip) converter.set(); //optional clip (default: true) converter.set(); //always transform @@ -137,16 +139,11 @@ struct agg_renderer_process_visitor_l if (std::fabs(offset) > 0.0) converter.set(); // parallel offset converter.set(); // optional affine transform if (smooth > 0.0) converter.set(); // optional smooth converter -#if 0 // FIXME - for (geometry_type const& geom : feature_.paths()) - { - if (geom.size() > 1) - { - vertex_adapter va(geom); - converter.apply(va); - } - } -#endif + + using apply_vertex_converter_type = detail::apply_vertex_converter; + using vertex_processor_type = new_geometry::vertex_processor; + apply_vertex_converter_type apply(converter); + mapnik::util::apply_visitor(vertex_processor_type(apply),feature_.get_geometry()); } void operator() (marker_rgba8 const& marker) @@ -169,7 +166,8 @@ struct agg_renderer_process_visitor_l value_double simplify_tolerance = get(sym_, feature_, common_.vars_); value_double smooth = get(sym_, feature_, common_.vars_); - agg::rendering_buffer buf(current_buffer_->getBytes(),current_buffer_->width(),current_buffer_->height(), current_buffer_->getRowSize()); + agg::rendering_buffer buf(current_buffer_->getBytes(),current_buffer_->width(), + current_buffer_->height(), current_buffer_->getRowSize()); pixfmt_type pixf(buf); pixf.comp_op(static_cast(get(sym_, feature_, common_.vars_))); renderer_base ren_base(pixf); @@ -196,12 +194,12 @@ struct agg_renderer_process_visitor_l padding *= common_.scale_factor_; clip_box.pad(padding); } + using vertex_converter_type = vertex_converter; - vertex_converter - converter(clip_box,ras,sym_,common_.t_,prj_trans_,tr,feature_,common_.vars_,common_.scale_factor_); + vertex_converter_type converter(clip_box,ras,sym_,common_.t_,prj_trans_,tr,feature_,common_.vars_,common_.scale_factor_); if (clip) converter.set(); //optional clip (default: true) converter.set(); //always transform @@ -209,16 +207,11 @@ struct agg_renderer_process_visitor_l if (std::fabs(offset) > 0.0) converter.set(); // parallel offset converter.set(); // optional affine transform if (smooth > 0.0) converter.set(); // optional smooth converter -#if 0 // FIXME - for (geometry_type const& geom : feature_.paths()) - { - if (geom.size() > 1) - { - vertex_adapter va(geom); - converter.apply(va); - } - } -#endif + + using apply_vertex_converter_type = detail::apply_vertex_converter; + using vertex_processor_type = new_geometry::vertex_processor; + apply_vertex_converter_type apply(converter); + mapnik::util::apply_visitor(vertex_processor_type(apply),feature_.get_geometry()); } private: diff --git a/src/agg/process_polygon_pattern_symbolizer.cpp b/src/agg/process_polygon_pattern_symbolizer.cpp index c0813690c..0f5949bb1 100644 --- a/src/agg/process_polygon_pattern_symbolizer.cpp +++ b/src/agg/process_polygon_pattern_symbolizer.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -36,7 +37,7 @@ #include #include #include - +#include // agg #include "agg_basics.h" #include "agg_rendering_buffer.h" @@ -164,9 +165,14 @@ struct agg_renderer_process_visitor_p agg::trans_affine tr; auto transform = get_optional(sym_, keys::geometry_transform); if (transform) evaluate_transform(tr, feature_, common_.vars_, *transform, common_.scale_factor_); + using vertex_converter_type = vertex_converter; - vertex_converter - converter(clip_box,*ras_ptr_,sym_,common_.t_,prj_trans_,tr,feature_,common_.vars_,common_.scale_factor_); + vertex_converter_type converter(clip_box,*ras_ptr_,sym_,common_.t_,prj_trans_,tr,feature_,common_.vars_,common_.scale_factor_); if (prj_trans_.equal() && clip) converter.set(); //optional clip (default: true) @@ -174,16 +180,11 @@ struct agg_renderer_process_visitor_p converter.set(); // optional affine transform if (simplify_tolerance > 0.0) converter.set(); // optional simplify converter if (smooth > 0.0) converter.set(); // optional smooth converter -#if 0 // FIXME - for ( geometry_type const& geom : feature_.paths()) - { - if (geom.size() > 2) - { - vertex_adapter va(geom); - converter.apply(va); - } - } -#endif + + using apply_vertex_converter_type = detail::apply_vertex_converter; + using vertex_processor_type = new_geometry::vertex_processor; + apply_vertex_converter_type apply(converter); + mapnik::util::apply_visitor(vertex_processor_type(apply),feature_.get_geometry()); agg::scanline_u8 sl; ras_ptr_->filling_rule(agg::fill_even_odd); agg::render_scanlines(*ras_ptr_, sl, rp); @@ -273,25 +274,25 @@ struct agg_renderer_process_visitor_p agg::trans_affine tr; auto transform = get_optional(sym_, keys::geometry_transform); if (transform) evaluate_transform(tr, feature_, common_.vars_, *transform, common_.scale_factor_); + using vertex_converter_type = vertex_converter; - vertex_converter - converter(clip_box,*ras_ptr_,sym_,common_.t_,prj_trans_,tr,feature_,common_.vars_,common_.scale_factor_); + vertex_converter_type converter(clip_box,*ras_ptr_,sym_,common_.t_,prj_trans_,tr,feature_,common_.vars_,common_.scale_factor_); if (prj_trans_.equal() && clip) converter.set(); //optional clip (default: true) converter.set(); //always transform converter.set(); // optional affine transform if (simplify_tolerance > 0.0) converter.set(); // optional simplify converter if (smooth > 0.0) converter.set(); // optional smooth converter -#if 0 // FIXME - for ( geometry_type const& geom : feature_.paths()) - { - if (geom.size() > 2) - { - vertex_adapter va(geom); - converter.apply(va); - } - } -#endif + + using apply_vertex_converter_type = detail::apply_vertex_converter; + using vertex_processor_type = new_geometry::vertex_processor; + apply_vertex_converter_type apply(converter); + mapnik::util::apply_visitor(vertex_processor_type(apply),feature_.get_geometry()); agg::scanline_u8 sl; ras_ptr_->filling_rule(agg::fill_even_odd); agg::render_scanlines(*ras_ptr_, sl, rp);