revive polygon/line pattern rendering

This commit is contained in:
artemp 2015-03-04 18:39:31 +01:00
parent ae1da6ae12
commit cd15d8f2b3
2 changed files with 50 additions and 56 deletions

View file

@ -31,10 +31,12 @@
#include <mapnik/marker_cache.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/vertex_converters.hpp>
#include <mapnik/vertex_processor.hpp>
#include <mapnik/util/noncopyable.hpp>
#include <mapnik/parse_path.hpp>
#include <mapnik/renderer_common/clipping_extent.hpp>
#include <mapnik/renderer_common/render_pattern.hpp>
#include <mapnik/renderer_common/apply_vertex_converter.hpp>
// 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<rasterizer_type, clip_line_tag, transform_tag,
affine_transform_tag,
simplify_tag,smooth_tag,
offset_transform_tag>;
vertex_converter<rasterizer_type, clip_line_tag, transform_tag,
affine_transform_tag,
simplify_tag,smooth_tag,
offset_transform_tag>
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<clip_line_tag>(); //optional clip (default: true)
converter.set<transform_tag>(); //always transform
@ -137,16 +139,11 @@ struct agg_renderer_process_visitor_l
if (std::fabs(offset) > 0.0) converter.set<offset_transform_tag>(); // parallel offset
converter.set<affine_transform_tag>(); // optional affine transform
if (smooth > 0.0) converter.set<smooth_tag>(); // 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<vertex_converter_type>;
using vertex_processor_type = new_geometry::vertex_processor<apply_vertex_converter_type>;
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<value_double, keys::simplify_tolerance>(sym_, feature_, common_.vars_);
value_double smooth = get<value_double, keys::smooth>(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<agg::comp_op_e>(get<composite_mode_e, keys::comp_op>(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<rasterizer_type, clip_line_tag, transform_tag,
affine_transform_tag,
simplify_tag,smooth_tag,
offset_transform_tag>;
vertex_converter<rasterizer_type, clip_line_tag, transform_tag,
affine_transform_tag,
simplify_tag,smooth_tag,
offset_transform_tag>
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<clip_line_tag>(); //optional clip (default: true)
converter.set<transform_tag>(); //always transform
@ -209,16 +207,11 @@ struct agg_renderer_process_visitor_l
if (std::fabs(offset) > 0.0) converter.set<offset_transform_tag>(); // parallel offset
converter.set<affine_transform_tag>(); // optional affine transform
if (smooth > 0.0) converter.set<smooth_tag>(); // 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<vertex_converter_type>;
using vertex_processor_type = new_geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature_.get_geometry());
}
private:

View file

@ -29,6 +29,7 @@
#include <mapnik/marker.hpp>
#include <mapnik/marker_cache.hpp>
#include <mapnik/vertex_converters.hpp>
#include <mapnik/vertex_processor.hpp>
#include <mapnik/parse_path.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/svg/svg_converter.hpp>
@ -36,7 +37,7 @@
#include <mapnik/svg/svg_path_adapter.hpp>
#include <mapnik/renderer_common/clipping_extent.hpp>
#include <mapnik/renderer_common/render_pattern.hpp>
#include <mapnik/renderer_common/apply_vertex_converter.hpp>
// 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<transform_type>(sym_, keys::geometry_transform);
if (transform) evaluate_transform(tr, feature_, common_.vars_, *transform, common_.scale_factor_);
using vertex_converter_type = vertex_converter<rasterizer,
clip_poly_tag,
transform_tag,
affine_transform_tag,
simplify_tag,
smooth_tag>;
vertex_converter<rasterizer, clip_poly_tag,transform_tag,affine_transform_tag,simplify_tag,smooth_tag>
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<clip_poly_tag>(); //optional clip (default: true)
@ -174,16 +180,11 @@ struct agg_renderer_process_visitor_p
converter.set<affine_transform_tag>(); // optional affine transform
if (simplify_tolerance > 0.0) converter.set<simplify_tag>(); // optional simplify converter
if (smooth > 0.0) converter.set<smooth_tag>(); // 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<vertex_converter_type>;
using vertex_processor_type = new_geometry::vertex_processor<apply_vertex_converter_type>;
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<transform_type>(sym_, keys::geometry_transform);
if (transform) evaluate_transform(tr, feature_, common_.vars_, *transform, common_.scale_factor_);
using vertex_converter_type = vertex_converter<rasterizer,
clip_poly_tag,
transform_tag,
affine_transform_tag,
simplify_tag,
smooth_tag>;
vertex_converter<rasterizer, clip_poly_tag,transform_tag,affine_transform_tag,simplify_tag,smooth_tag>
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<clip_poly_tag>(); //optional clip (default: true)
converter.set<transform_tag>(); //always transform
converter.set<affine_transform_tag>(); // optional affine transform
if (simplify_tolerance > 0.0) converter.set<simplify_tag>(); // optional simplify converter
if (smooth > 0.0) converter.set<smooth_tag>(); // 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<vertex_converter_type>;
using vertex_processor_type = new_geometry::vertex_processor<apply_vertex_converter_type>;
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);