vertex_converter - refactor to pass Processor to apply function (while it allows to instantiate vertex_converter object only using converter tags, it doesn't reduce object code)

make offset_converter 'non-switchable' relying on be able to shortcut in `vertex(*x, *y)` when offset is 0.0 -> results in reduced binary size
This commit is contained in:
artemp 2015-04-28 14:18:33 +02:00
parent 3e54b06935
commit c64dc3672a
19 changed files with 98 additions and 112 deletions

View file

@ -193,11 +193,11 @@ void setup_transform_scaling(agg::trans_affine & tr,
symbolizer_base const& sym);
// Apply markers to a feature with multiple geometries
template <typename Converter>
void apply_markers_multi(feature_impl const& feature, attributes const& vars, Converter & converter, symbolizer_base const& sym)
template <typename Converter, typename Processor>
void apply_markers_multi(feature_impl const& feature, attributes const& vars, Converter & converter, Processor & proc, symbolizer_base const& sym)
{
using vertex_converter_type = Converter;
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type,Processor>;
using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
auto const& geom = feature.get_geometry();
@ -207,7 +207,7 @@ void apply_markers_multi(feature_impl const& feature, attributes const& vars, Co
|| type == geometry::geometry_types::LineString
|| type == geometry::geometry_types::Polygon)
{
apply_vertex_converter_type apply(converter);
apply_vertex_converter_type apply(converter, proc);
mapnik::util::apply_visitor(vertex_processor_type(apply), geom);
}
else
@ -226,7 +226,7 @@ void apply_markers_multi(feature_impl const& feature, attributes const& vars, Co
// unset any clipping since we're now dealing with a point
converter.template unset<clip_poly_tag>();
geometry::point_vertex_adapter<double> va(pt);
converter.apply(va);
converter.apply(va, proc);
}
}
else if ((placement == MARKER_POINT_PLACEMENT || placement == MARKER_INTERIOR_PLACEMENT) &&
@ -253,7 +253,7 @@ void apply_markers_multi(feature_impl const& feature, attributes const& vars, Co
if (largest)
{
geometry::polygon_vertex_adapter<double> va(*largest);
converter.apply(va);
converter.apply(va, proc);
}
}
else
@ -267,7 +267,7 @@ void apply_markers_multi(feature_impl const& feature, attributes const& vars, Co
{
MAPNIK_LOG_WARN(marker_symbolizer) << "marker_multi_policy != 'each' has no effect with marker_placement != 'point'";
}
apply_vertex_converter_type apply(converter);
apply_vertex_converter_type apply(converter, proc);
mapnik::util::apply_visitor(vertex_processor_type(apply), geom);
}
}

View file

@ -25,17 +25,18 @@
namespace mapnik { namespace detail {
template <typename VertexConverter>
template <typename VertexConverter, typename Processor>
struct apply_vertex_converter
{
apply_vertex_converter(VertexConverter & converter)
: converter_(converter) {}
apply_vertex_converter(VertexConverter & converter, Processor & proc)
: converter_(converter), proc_(proc) {}
template <typename Adapter>
void operator() (Adapter const& adapter) const
{
converter_.apply(adapter);
converter_.apply(adapter, proc_);
}
VertexConverter & converter_;
Processor & proc_;
};
}}

View file

@ -40,6 +40,14 @@ struct render_marker_symbolizer_visitor
using raster_dispatch_type = RD;
using buffer_type = typename std::tuple_element<0,ContextType>::type;
using vertex_converter_type = vertex_converter<clip_line_tag,
clip_poly_tag,
transform_tag,
affine_transform_tag,
simplify_tag,
smooth_tag,
offset_transform_tag>;
render_marker_symbolizer_visitor(std::string const& filename,
markers_symbolizer const& sym,
mapnik::feature_impl & feature,
@ -100,14 +108,7 @@ struct render_marker_symbolizer_visitor
snap_to_pixels,
renderer_context_);
using vertex_converter_type = vertex_converter<vector_dispatch_type,clip_line_tag,
clip_poly_tag,
transform_tag,
affine_transform_tag,
simplify_tag, smooth_tag,
offset_transform_tag>;
vertex_converter_type converter(clip_box_,
rasterizer_dispatch,
sym_,
common_.t_,
prj_trans_,
@ -129,7 +130,7 @@ struct render_marker_symbolizer_visitor
converter.template set<affine_transform_tag>(); // optional affine transform
if (simplify_tolerance > 0.0) converter.template set<simplify_tag>(); // optional simplify converter
if (smooth > 0.0) converter.template set<smooth_tag>(); // optional smooth converter
apply_markers_multi(feature_, common_.vars_, converter, sym_);
apply_markers_multi(feature_, common_.vars_, converter, rasterizer_dispatch, sym_);
}
else
{
@ -153,14 +154,7 @@ struct render_marker_symbolizer_visitor
snap_to_pixels,
renderer_context_);
using vertex_converter_type = vertex_converter<vector_dispatch_type,clip_line_tag,
clip_poly_tag,
transform_tag,
affine_transform_tag,
simplify_tag, smooth_tag,
offset_transform_tag>;
vertex_converter_type converter(clip_box_,
rasterizer_dispatch,
sym_,
common_.t_,
prj_trans_,
@ -182,7 +176,7 @@ struct render_marker_symbolizer_visitor
converter.template set<affine_transform_tag>(); // optional affine transform
if (simplify_tolerance > 0.0) converter.template set<simplify_tag>(); // optional simplify converter
if (smooth > 0.0) converter.template set<smooth_tag>(); // optional smooth converter
apply_markers_multi(feature_, common_.vars_, converter, sym_);
apply_markers_multi(feature_, common_.vars_, converter, rasterizer_dispatch, sym_);
}
}
@ -217,14 +211,8 @@ struct render_marker_symbolizer_visitor
common_.vars_,
renderer_context_);
using vertex_converter_type = vertex_converter<raster_dispatch_type,clip_line_tag,
clip_poly_tag,
transform_tag,
affine_transform_tag,
simplify_tag, smooth_tag,
offset_transform_tag>;
vertex_converter_type converter(clip_box_,
rasterizer_dispatch,
sym_,
common_.t_,
prj_trans_,
@ -246,7 +234,7 @@ struct render_marker_symbolizer_visitor
converter.template set<affine_transform_tag>(); // optional affine transform
if (simplify_tolerance > 0.0) converter.template set<simplify_tag>(); // optional simplify converter
if (smooth > 0.0) converter.template set<smooth_tag>(); // optional smooth converter
apply_markers_multi(feature_, common_.vars_, converter, sym_);
apply_markers_multi(feature_, common_.vars_, converter, rasterizer_dispatch, sym_);
}
private:

View file

@ -51,7 +51,7 @@ void render_polygon_symbolizer(polygon_symbolizer const &sym,
value_double smooth = get<value_double,keys::smooth>(sym, feature, common.vars_);
value_double opacity = get<value_double,keys::fill_opacity>(sym, feature, common.vars_);
vertex_converter_type converter(clip_box, ras, sym, common.t_, prj_trans, tr,
vertex_converter_type converter(clip_box, sym, common.t_, prj_trans, tr,
feature,common.vars_,common.scale_factor_);
if (prj_trans.equal() && clip) converter.template set<clip_poly_tag>(); //optional clip (default: true)
@ -60,9 +60,9 @@ void render_polygon_symbolizer(polygon_symbolizer const &sym,
if (simplify_tolerance > 0.0) converter.template set<simplify_tag>(); // optional simplify converter
if (smooth > 0.0) converter.template set<smooth_tag>(); // optional smooth converter
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type, rasterizer_type>;
using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter);
apply_vertex_converter_type apply(converter, ras);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry());
color const& fill = get<mapnik::color, keys::fill>(sym, feature, common.vars_);

View file

@ -56,7 +56,7 @@ struct placement_finder_adapter
};
using vertex_converter_type = vertex_converter<placement_finder_adapter<placement_finder>,clip_line_tag , transform_tag, affine_transform_tag, simplify_tag, smooth_tag>;
using vertex_converter_type = vertex_converter<clip_line_tag , transform_tag, affine_transform_tag, simplify_tag, smooth_tag>;
class base_symbolizer_helper
{

View file

@ -271,6 +271,11 @@ struct is_switchable<T,stroke_tag>
static constexpr bool value = false;
};
template <typename T>
struct is_switchable<T,offset_transform_tag>
{
static constexpr bool value = false;
};
template <typename Dispatcher, typename... ConverterTypes>
@ -377,11 +382,10 @@ struct arguments : util::noncopyable
}
template <typename Processor, typename... ConverterTypes >
template <typename... ConverterTypes >
struct vertex_converter : private util::noncopyable
{
using bbox_type = box2d<double>;
using processor_type = Processor;
using symbolizer_type = symbolizer_base;
using trans_type = view_transform;
using proj_trans_type = proj_transform;
@ -391,7 +395,6 @@ struct vertex_converter : private util::noncopyable
using dispatcher_type = detail::dispatcher<args_type, sizeof...(ConverterTypes)>;
vertex_converter(bbox_type const& bbox,
processor_type & proc,
symbolizer_type const& sym,
trans_type const& tr,
proj_trans_type const& prj_trans,
@ -399,13 +402,12 @@ struct vertex_converter : private util::noncopyable
feature_type const& feature,
attributes const& vars,
double scale_factor)
: disp_(bbox,sym,tr,prj_trans,affine_trans,feature,vars,scale_factor),
proc_(proc) {}
: disp_(bbox,sym,tr,prj_trans,affine_trans,feature,vars,scale_factor) {}
template <typename VertexAdapter>
void apply(VertexAdapter & geom)
template <typename VertexAdapter, typename Processor>
void apply(VertexAdapter & geom, Processor & proc)
{
detail::converters_helper<dispatcher_type, ConverterTypes...>:: template forward<VertexAdapter, Processor>(disp_, geom, proc_);
detail::converters_helper<dispatcher_type, ConverterTypes...>:: template forward<VertexAdapter, Processor>(disp_, geom, proc);
}
template <typename Converter>
@ -421,7 +423,6 @@ struct vertex_converter : private util::noncopyable
}
dispatcher_type disp_;
Processor & proc_;
};
}

View file

@ -127,12 +127,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,
using vertex_converter_type = vertex_converter<clip_line_tag, transform_tag,
affine_transform_tag,
simplify_tag,smooth_tag,
offset_transform_tag>;
vertex_converter_type converter(clip_box,ras,sym_,common_.t_,prj_trans_,tr,feature_,common_.vars_,common_.scale_factor_);
vertex_converter_type converter(clip_box,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
@ -141,9 +141,9 @@ struct agg_renderer_process_visitor_l
converter.set<affine_transform_tag>(); // optional affine transform
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type, rasterizer_type>;
using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter);
apply_vertex_converter_type apply(converter, ras);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature_.get_geometry());
}
@ -196,12 +196,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,
using vertex_converter_type = vertex_converter<clip_line_tag, transform_tag,
affine_transform_tag,
simplify_tag,smooth_tag,
offset_transform_tag>;
vertex_converter_type converter(clip_box,ras,sym_,common_.t_,prj_trans_,tr,feature_,common_.vars_,common_.scale_factor_);
vertex_converter_type converter(clip_box,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
@ -210,9 +210,9 @@ struct agg_renderer_process_visitor_l
converter.set<affine_transform_tag>(); // optional affine transform
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type, rasterizer_type>;
using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter);
apply_vertex_converter_type apply(converter, ras);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature_.get_geometry());
}

View file

@ -164,13 +164,13 @@ void agg_renderer<T0,T1>::process(line_symbolizer const& sym,
rasterizer_type ras(ren);
set_join_caps_aa(sym, ras, feature, common_.vars_);
using vertex_converter_type = vertex_converter<rasterizer_type,clip_line_tag, transform_tag,
using vertex_converter_type = vertex_converter<clip_line_tag, transform_tag,
affine_transform_tag,
simplify_tag, smooth_tag,
offset_transform_tag,
dash_tag, stroke_tag>;
vertex_converter_type converter(clip_box,ras,sym,common_.t_,prj_trans,tr,feature,common_.vars_,common_.scale_factor_);
vertex_converter_type converter(clip_box,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
if (std::fabs(offset) > 0.0) converter.set<offset_transform_tag>(); // parallel offset
@ -178,19 +178,19 @@ void agg_renderer<T0,T1>::process(line_symbolizer const& sym,
if (simplify_tolerance > 0.0) converter.set<simplify_tag>(); // optional simplify converter
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type, rasterizer_type>;
using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter);
apply_vertex_converter_type apply(converter, ras);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry());
}
else
{
using vertex_converter_type = vertex_converter<rasterizer,clip_line_tag, transform_tag,
using vertex_converter_type = vertex_converter<clip_line_tag, transform_tag,
affine_transform_tag,
simplify_tag, smooth_tag,
offset_transform_tag,
dash_tag, stroke_tag>;
vertex_converter_type converter(clip_box,*ras_ptr,sym,common_.t_,prj_trans,tr,feature,common_.vars_,common_.scale_factor_);
vertex_converter_type converter(clip_box, 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
@ -202,9 +202,9 @@ void agg_renderer<T0,T1>::process(line_symbolizer const& sym,
converter.set<dash_tag>();
converter.set<stroke_tag>(); //always stroke
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type, rasterizer>;
using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter);
apply_vertex_converter_type apply(converter, *ras_ptr);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry());
using renderer_type = agg::renderer_scanline_aa_solid<renderer_base>;

View file

@ -156,14 +156,13 @@ 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,
using vertex_converter_type = vertex_converter<clip_poly_tag,
transform_tag,
affine_transform_tag,
simplify_tag,
smooth_tag>;
vertex_converter_type converter(clip_box,*ras_ptr_,sym_,common_.t_,prj_trans_,tr,feature_,common_.vars_,common_.scale_factor_);
vertex_converter_type converter(clip_box,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)
@ -172,9 +171,9 @@ struct agg_renderer_process_visitor_p
if (simplify_tolerance > 0.0) converter.set<simplify_tag>(); // optional simplify converter
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type, rasterizer>;
using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter);
apply_vertex_converter_type apply(converter, *ras_ptr_);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature_.get_geometry());
agg::scanline_u8 sl;
ras_ptr_->filling_rule(agg::fill_even_odd);
@ -257,14 +256,13 @@ 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,
using vertex_converter_type = vertex_converter<clip_poly_tag,
transform_tag,
affine_transform_tag,
simplify_tag,
smooth_tag>;
vertex_converter_type converter(clip_box,*ras_ptr_,sym_,common_.t_,prj_trans_,tr,feature_,common_.vars_,common_.scale_factor_);
vertex_converter_type converter(clip_box, 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
@ -272,9 +270,9 @@ struct agg_renderer_process_visitor_p
if (simplify_tolerance > 0.0) converter.set<simplify_tag>(); // optional simplify converter
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type, rasterizer>;
using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter);
apply_vertex_converter_type apply(converter, *ras_ptr_);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature_.get_geometry());
agg::scanline_u8 sl;
ras_ptr_->filling_rule(agg::fill_even_odd);

View file

@ -48,7 +48,7 @@ void agg_renderer<T0,T1>::process(polygon_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
using vertex_converter_type = vertex_converter<rasterizer,clip_poly_tag,transform_tag,affine_transform_tag,simplify_tag,smooth_tag>;
using vertex_converter_type = vertex_converter<clip_poly_tag,transform_tag,affine_transform_tag,simplify_tag,smooth_tag>;
ras_ptr->reset();
double gamma = get<value_double>(sym, keys::gamma, feature, common_.vars_, 1.0);

View file

@ -143,13 +143,13 @@ void cairo_renderer<T>::process(line_pattern_symbolizer const& sym,
using rasterizer_type = line_pattern_rasterizer<cairo_context>;
rasterizer_type ras(context_, *pattern, width, height);
using vertex_converter_type = vertex_converter<rasterizer_type,clip_line_tag, transform_tag,
using vertex_converter_type = vertex_converter<clip_line_tag, transform_tag,
affine_transform_tag,
simplify_tag, smooth_tag,
offset_transform_tag,
dash_tag, stroke_tag>;
vertex_converter_type converter(clipping_extent, ras, sym, common_.t_, prj_trans, tr, feature, common_.vars_, common_.scale_factor_);
vertex_converter_type converter(clipping_extent,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
@ -158,9 +158,9 @@ void cairo_renderer<T>::process(line_pattern_symbolizer const& sym,
if (simplify_tolerance > 0.0) converter.set<simplify_tag>(); // optional simplify converter
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type, rasterizer_type>;
using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter);
apply_vertex_converter_type apply(converter, ras);
mapnik::util::apply_visitor(vertex_processor_type(apply), feature.get_geometry());
}

View file

@ -81,15 +81,14 @@ void cairo_renderer<T>::process(line_symbolizer const& sym,
padding *= common_.scale_factor_;
clipping_extent.pad(padding);
}
using vertex_converter_type = vertex_converter<cairo_context,
clip_line_tag,
using vertex_converter_type = vertex_converter<clip_line_tag,
transform_tag,
affine_transform_tag,
simplify_tag, smooth_tag,
offset_transform_tag,
dash_tag, stroke_tag>;
vertex_converter_type converter(clipping_extent,context_,sym,common_.t_,prj_trans,tr,feature,common_.vars_,common_.scale_factor_);
vertex_converter_type converter(clipping_extent,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
@ -98,9 +97,9 @@ void cairo_renderer<T>::process(line_symbolizer const& sym,
if (simplify_tolerance > 0.0) converter.set<simplify_tag>(); // optional simplify converter
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type, cairo_context>;
using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter);
apply_vertex_converter_type apply(converter, context_);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry());
// stroke
context_.set_fill_rule(CAIRO_FILL_RULE_WINDING);

View file

@ -124,23 +124,23 @@ void cairo_renderer<T>::process(polygon_pattern_symbolizer const& sym,
agg::trans_affine tr;
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_); }
using vertex_converter_type = vertex_converter<cairo_context,
using vertex_converter_type = vertex_converter<
clip_poly_tag,
transform_tag,
affine_transform_tag,
simplify_tag,
smooth_tag>;
vertex_converter_type converter(clip_box, context_,sym,common_.t_,prj_trans,tr,feature,common_.vars_,common_.scale_factor_);
vertex_converter_type converter(clip_box,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>();
if (simplify_tolerance > 0.0) converter.set<simplify_tag>(); // optional simplify converter
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type, cairo_context>;
using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter);
apply_vertex_converter_type apply(converter, context_);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry());
// fill polygon
context_.set_fill_rule(CAIRO_FILL_RULE_EVEN_ODD);

View file

@ -38,7 +38,7 @@ void cairo_renderer<T>::process(polygon_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
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<clip_poly_tag,transform_tag,affine_transform_tag,simplify_tag,smooth_tag>;
cairo_save_restore guard(context_);
composite_mode_e comp_op = get<composite_mode_e, keys::comp_op>(sym, feature, common_.vars_);
context_.set_operator(comp_op);

View file

@ -115,11 +115,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::smooth, value_double(smooth));
using vertex_converter_type = vertex_converter<grid_rasterizer,
clip_line_tag, transform_tag,
using vertex_converter_type = vertex_converter<clip_line_tag, transform_tag,
offset_transform_tag, affine_transform_tag,
simplify_tag, smooth_tag, stroke_tag>;
vertex_converter_type converter(clipping_extent,*ras_ptr,line,common_.t_,prj_trans,tr,feature,common_.vars_,common_.scale_factor_);
vertex_converter_type converter(clipping_extent,line,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
if (std::fabs(offset) > 0.0) converter.set<offset_transform_tag>(); // parallel offset
@ -127,9 +126,9 @@ void grid_renderer<T>::process(line_pattern_symbolizer const& sym,
if (simplify_tolerance > 0.0) converter.set<simplify_tag>(); // optional simplify converter
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
converter.set<stroke_tag>(); //always stroke
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type,grid_rasterizer>;
using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter);
apply_vertex_converter_type apply(converter, *ras_ptr);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry());
// render id

View file

@ -89,11 +89,11 @@ void grid_renderer<T>::process(line_symbolizer const& sym,
padding *= common_.scale_factor_;
clipping_extent.pad(padding);
}
using vertex_converter_type = vertex_converter<grid_rasterizer, clip_line_tag, transform_tag,
using vertex_converter_type = vertex_converter<clip_line_tag, transform_tag,
offset_transform_tag, affine_transform_tag,
simplify_tag, smooth_tag, dash_tag, stroke_tag>;
vertex_converter_type converter(clipping_extent,*ras_ptr,sym,common_.t_,prj_trans,tr,feature,common_.vars_,common_.scale_factor_);
vertex_converter_type converter(clipping_extent,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
if (std::fabs(offset) > 0.0) converter.set<offset_transform_tag>(); // parallel offset
@ -103,9 +103,9 @@ void grid_renderer<T>::process(line_symbolizer const& sym,
if (has_dash) converter.set<dash_tag>();
converter.set<stroke_tag>(); //always stroke
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type, grid_rasterizer>;
using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter);
apply_vertex_converter_type apply(converter, *ras_ptr);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry());
// render id

View file

@ -76,8 +76,8 @@ void grid_renderer<T>::process(polygon_pattern_symbolizer const& sym,
evaluate_transform(tr, feature, common_.vars_, *transform, common_.scale_factor_);
}
using vertex_converter_type = vertex_converter<grid_rasterizer, clip_poly_tag,transform_tag,affine_transform_tag,smooth_tag>;
vertex_converter_type converter(common_.query_extent_,*ras_ptr,sym,common_.t_,prj_trans,tr,feature,common_.vars_,common_.scale_factor_);
using vertex_converter_type = vertex_converter<clip_poly_tag,transform_tag,affine_transform_tag,smooth_tag>;
vertex_converter_type converter(common_.query_extent_,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
@ -85,9 +85,9 @@ void grid_renderer<T>::process(polygon_pattern_symbolizer const& sym,
if (simplify_tolerance > 0.0) converter.set<simplify_tag>(); // optional simplify converter
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type, grid_rasterizer>;
using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter);
apply_vertex_converter_type apply(converter, *ras_ptr);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry());
using pixfmt_type = typename grid_renderer_base_type::pixfmt_type;

View file

@ -53,7 +53,7 @@ void grid_renderer<T>::process(polygon_symbolizer const& sym,
using renderer_type = agg::renderer_scanline_bin_solid<grid_renderer_base_type>;
using pixfmt_type = typename grid_renderer_base_type::pixfmt_type;
using color_type = typename grid_renderer_base_type::pixfmt_type::color_type;
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<clip_poly_tag,transform_tag,affine_transform_tag,simplify_tag,smooth_tag>;
ras_ptr->reset();

View file

@ -288,7 +288,7 @@ text_symbolizer_helper::text_symbolizer_helper(
: base_symbolizer_helper(sym, feature, vars, prj_trans, width, height, scale_factor, t, query_extent),
finder_(feature, vars, detector, dims_, *info_ptr_, font_manager, scale_factor),
adapter_(finder_,false),
converter_(query_extent_, adapter_, sym_, t, prj_trans, affine_trans, feature, vars, scale_factor)
converter_(query_extent_, sym_, t, prj_trans, affine_trans, feature, vars, scale_factor)
{
// setup vertex converter
@ -335,7 +335,7 @@ bool text_symbolizer_helper::next_line_placement() const
{
auto const& line = util::get<geometry::line_string<double> const>(*geo_itr_);
geometry::line_string_vertex_adapter<double> va(line);
converter_.apply(va);
//converter_.apply(va, adapter_);
if (adapter_.status())
{
//Found a placement
@ -385,7 +385,7 @@ text_symbolizer_helper::text_symbolizer_helper(
: base_symbolizer_helper(sym, feature, vars, prj_trans, width, height, scale_factor, t, query_extent),
finder_(feature, vars, detector, dims_, *info_ptr_, font_manager, scale_factor),
adapter_(finder_,true),
converter_(query_extent_, adapter_, sym_, t, prj_trans, affine_trans, feature, vars, scale_factor)
converter_(query_extent_, sym_, t, prj_trans, affine_trans, feature, vars, scale_factor)
{
// setup vertex converter
value_bool clip = mapnik::get<value_bool, keys::clip>(sym_, feature_, vars_);