pass feature to vertex_converters - refs #2148/#2140
This commit is contained in:
parent
c275d5512d
commit
89f72f02e8
13 changed files with 62 additions and 55 deletions
|
@ -89,8 +89,8 @@ void render_markers_symbolizer(markers_symbolizer const &sym,
|
|||
typedef decltype(rasterizer_dispatch) dispatch_type;
|
||||
|
||||
vertex_converter<box2d<double>, dispatch_type, markers_symbolizer,
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types>
|
||||
converter(clip_box, rasterizer_dispatch, sym,common.t_,prj_trans,tr,common.scale_factor_);
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types, feature_impl>
|
||||
converter(clip_box, rasterizer_dispatch, sym,common.t_,prj_trans,tr,feature,common.scale_factor_);
|
||||
if (clip && feature.paths().size() > 0) // optional clip (default: true)
|
||||
{
|
||||
geometry_type::types type = feature.paths()[0].type();
|
||||
|
@ -121,8 +121,8 @@ void render_markers_symbolizer(markers_symbolizer const &sym,
|
|||
typedef decltype(rasterizer_dispatch) dispatch_type;
|
||||
|
||||
vertex_converter<box2d<double>, dispatch_type, markers_symbolizer,
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types>
|
||||
converter(clip_box, rasterizer_dispatch, sym,common.t_,prj_trans,tr,common.scale_factor_);
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types, feature_impl>
|
||||
converter(clip_box, rasterizer_dispatch, sym,common.t_,prj_trans,tr,feature,common.scale_factor_);
|
||||
if (clip && feature.paths().size() > 0) // optional clip (default: true)
|
||||
{
|
||||
geometry_type::types type = feature.paths()[0].type();
|
||||
|
@ -150,8 +150,8 @@ void render_markers_symbolizer(markers_symbolizer const &sym,
|
|||
typedef decltype(rasterizer_dispatch) dispatch_type;
|
||||
|
||||
vertex_converter<box2d<double>, dispatch_type, markers_symbolizer,
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types>
|
||||
converter(clip_box, rasterizer_dispatch, sym,common.t_,prj_trans,tr,common.scale_factor_);
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types, feature_impl>
|
||||
converter(clip_box, rasterizer_dispatch, sym,common.t_,prj_trans,tr,feature,common.scale_factor_);
|
||||
|
||||
if (clip && feature.paths().size() > 0) // optional clip (default: true)
|
||||
{
|
||||
|
|
|
@ -44,7 +44,7 @@ void render_polygon_symbolizer(polygon_symbolizer const &sym,
|
|||
double opacity = get<value_double>(sym,keys::fill_opacity,feature, 1.0);
|
||||
|
||||
vertex_converter_type converter(clip_box, ras, sym, common.t_, prj_trans, tr,
|
||||
common.scale_factor_);
|
||||
feature,common.scale_factor_);
|
||||
|
||||
if (prj_trans.equal() && clip) converter.template set<clip_poly_tag>(); //optional clip (default: true)
|
||||
converter.template set<transform_tag>(); //always transform
|
||||
|
|
|
@ -98,7 +98,8 @@ struct converter_traits<T,mapnik::smooth_tag>
|
|||
static void setup(geometry_type & geom, Args const& args)
|
||||
{
|
||||
typename boost::mpl::at<Args,boost::mpl::int_<2> >::type sym = boost::fusion::at_c<2>(args);
|
||||
geom.smooth_value(get<value_double>(sym, keys::smooth));
|
||||
auto const& feat = boost::fusion::at_c<6>(args);
|
||||
geom.smooth_value(get<value_double>(sym, keys::smooth, feat));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -112,8 +113,9 @@ struct converter_traits<T,mapnik::simplify_tag>
|
|||
static void setup(geometry_type & geom, Args const& args)
|
||||
{
|
||||
typename boost::mpl::at<Args,boost::mpl::int_<2> >::type sym = boost::fusion::at_c<2>(args);
|
||||
geom.set_simplify_algorithm(static_cast<simplify_algorithm_e>(get<value_integer>(sym,keys::simplify_algorithm)));
|
||||
geom.set_simplify_tolerance(get<value_double>(sym, keys::simplify_tolerance));
|
||||
auto const& feat = boost::fusion::at_c<6>(args);
|
||||
geom.set_simplify_algorithm(static_cast<simplify_algorithm_e>(get<value_integer>(sym,keys::simplify_algorithm, feat)));
|
||||
geom.set_simplify_tolerance(get<value_double>(sym, keys::simplify_tolerance, feat));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -131,7 +133,6 @@ struct converter_traits<T, mapnik::clip_line_tag>
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
template <typename T>
|
||||
struct converter_traits<T, mapnik::dash_tag>
|
||||
{
|
||||
|
@ -142,7 +143,7 @@ struct converter_traits<T, mapnik::dash_tag>
|
|||
static void setup(geometry_type & geom, Args const& args)
|
||||
{
|
||||
typename boost::mpl::at<Args,boost::mpl::int_<2> >::type sym = boost::fusion::at_c<2>(args);
|
||||
double scale_factor = boost::fusion::at_c<6>(args);
|
||||
double scale_factor = boost::fusion::at_c<7>(args);
|
||||
auto dash = get_optional<dash_array>(sym, keys::stroke_dasharray);
|
||||
if (dash)
|
||||
{
|
||||
|
@ -165,16 +166,16 @@ struct converter_traits<T, mapnik::stroke_tag>
|
|||
static void setup(geometry_type & geom, Args const& args)
|
||||
{
|
||||
typename boost::mpl::at<Args,boost::mpl::int_<2> >::type sym = boost::fusion::at_c<2>(args);
|
||||
auto const& feat = boost::fusion::at_c<6>(args);
|
||||
set_join_caps(sym, geom);
|
||||
double miterlimit = get<value_double>(sym, keys::stroke_miterlimit, 4.0);
|
||||
double width = get<value_double>(sym, keys::stroke_width, 1.0);
|
||||
double miterlimit = get<value_double>(sym, keys::stroke_miterlimit, feat, 4.0);
|
||||
double width = get<value_double>(sym, keys::stroke_width, feat, 1.0);
|
||||
geom.generator().miter_limit(miterlimit);
|
||||
double scale_factor = boost::fusion::at_c<6>(args);
|
||||
double scale_factor = boost::fusion::at_c<7>(args);
|
||||
geom.generator().width(width * scale_factor);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <typename T>
|
||||
struct converter_traits<T,mapnik::clip_poly_tag>
|
||||
{
|
||||
|
@ -214,7 +215,6 @@ struct converter_traits<T,mapnik::transform_tag>
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
template <typename T>
|
||||
struct converter_traits<T,mapnik::affine_transform_tag>
|
||||
{
|
||||
|
@ -245,8 +245,9 @@ struct converter_traits<T,mapnik::offset_transform_tag>
|
|||
static void setup(geometry_type & geom, Args const& args)
|
||||
{
|
||||
typename boost::mpl::at<Args,boost::mpl::int_<2> >::type sym = boost::fusion::at_c<2>(args);
|
||||
double offset = get<value_double>(sym, keys::offset);
|
||||
double scale_factor = boost::fusion::at_c<6>(args);
|
||||
auto const& feat = boost::fusion::at_c<6>(args);
|
||||
double offset = get<value_double>(sym, keys::offset, feat);
|
||||
double scale_factor = boost::fusion::at_c<7>(args);
|
||||
geom.set_offset(offset * scale_factor);
|
||||
}
|
||||
};
|
||||
|
@ -313,7 +314,6 @@ struct dispatcher
|
|||
converter_fwd<boost::mpl::true_::value>::
|
||||
template forward<this_type,Geometry,args_type,conv_tag,Next,End>(*this,geom,args_);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template <typename Geometry>
|
||||
|
@ -329,9 +329,7 @@ struct dispatcher
|
|||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <typename B, typename R, typename S, typename T, typename P, typename A, typename C >
|
||||
template <typename B, typename R, typename S, typename T, typename P, typename A, typename C, typename F >
|
||||
struct vertex_converter : private mapnik::noncopyable
|
||||
{
|
||||
typedef C conv_types;
|
||||
|
@ -341,6 +339,7 @@ struct vertex_converter : private mapnik::noncopyable
|
|||
typedef T trans_type;
|
||||
typedef P proj_trans_type;
|
||||
typedef A affine_trans_type;
|
||||
typedef F feature_type;
|
||||
typedef typename boost::fusion::vector
|
||||
<
|
||||
bbox_type const&,
|
||||
|
@ -349,18 +348,25 @@ struct vertex_converter : private mapnik::noncopyable
|
|||
trans_type const&,
|
||||
proj_trans_type const&,
|
||||
affine_trans_type const&,
|
||||
feature_type const&,
|
||||
double //scale-factor
|
||||
> args_type;
|
||||
|
||||
vertex_converter(bbox_type const& b, rasterizer_type & ras,
|
||||
symbolizer_type const& sym, trans_type & tr,
|
||||
vertex_converter(bbox_type const& b,
|
||||
rasterizer_type & ras,
|
||||
symbolizer_type const& sym,
|
||||
trans_type & tr,
|
||||
proj_trans_type const& prj_trans,
|
||||
affine_trans_type const& affine_trans,
|
||||
feature_type const& feature,
|
||||
double scale_factor)
|
||||
: disp_(args_type(boost::cref(b), boost::ref(ras),
|
||||
boost::cref(sym), boost::cref(tr),
|
||||
: disp_(args_type(boost::cref(b),
|
||||
boost::ref(ras),
|
||||
boost::cref(sym),
|
||||
boost::cref(tr),
|
||||
boost::cref(prj_trans),
|
||||
boost::cref(affine_trans),
|
||||
boost::cref(feature),
|
||||
scale_factor)) {}
|
||||
|
||||
template <typename Geometry>
|
||||
|
|
|
@ -151,8 +151,8 @@ void agg_renderer<T0,T1>::process(line_pattern_symbolizer const& sym,
|
|||
|
||||
typedef boost::mpl::vector<clip_line_tag,transform_tag,offset_transform_tag,affine_transform_tag,simplify_tag,smooth_tag> conv_types;
|
||||
vertex_converter<box2d<double>, rasterizer_type, line_pattern_symbolizer,
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types>
|
||||
converter(clip_box,ras,sym,common_.t_,prj_trans,tr,common_.scale_factor_);
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types, feature_impl>
|
||||
converter(clip_box,ras,sym,common_.t_,prj_trans,tr,feature,common_.scale_factor_);
|
||||
|
||||
if (clip) converter.set<clip_line_tag>(); //optional clip (default: true)
|
||||
converter.set<transform_tag>(); //always transform
|
||||
|
|
|
@ -136,8 +136,8 @@ void agg_renderer<T0,T1>::process(line_symbolizer const& sym,
|
|||
set_join_caps_aa(sym , ras, feature);
|
||||
|
||||
vertex_converter<box2d<double>, rasterizer_type, line_symbolizer,
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types>
|
||||
converter(clip_box,ras,sym,common_.t_,prj_trans,tr,common_.scale_factor_);
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types, feature_impl>
|
||||
converter(clip_box,ras,sym,common_.t_,prj_trans,tr,feature,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
|
||||
|
@ -156,8 +156,8 @@ void agg_renderer<T0,T1>::process(line_symbolizer const& sym,
|
|||
else
|
||||
{
|
||||
vertex_converter<box2d<double>, rasterizer, line_symbolizer,
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types>
|
||||
converter(clip_box,*ras_ptr,sym,common_.t_,prj_trans,tr,common_.scale_factor_);
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types, feature_impl>
|
||||
converter(clip_box,*ras_ptr,sym,common_.t_,prj_trans,tr,feature,common_.scale_factor_);
|
||||
|
||||
if (clip) converter.set<clip_line_tag>(); // optional clip (default: true)
|
||||
converter.set<transform_tag>(); // always transform
|
||||
|
|
|
@ -160,8 +160,8 @@ void agg_renderer<T0,T1>::process(polygon_pattern_symbolizer const& sym,
|
|||
|
||||
typedef boost::mpl::vector<clip_poly_tag,transform_tag,affine_transform_tag,simplify_tag,smooth_tag> conv_types;
|
||||
vertex_converter<box2d<double>, rasterizer, polygon_pattern_symbolizer,
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types>
|
||||
converter(clip_box,*ras_ptr,sym,common_.t_,prj_trans,tr,common_.scale_factor_);
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types, feature_impl>
|
||||
converter(clip_box,*ras_ptr,sym,common_.t_,prj_trans,tr,feature,common_.scale_factor_);
|
||||
|
||||
if (prj_trans.equal() && clip) converter.set<clip_poly_tag>(); //optional clip (default: true)
|
||||
converter.set<transform_tag>(); //always transform
|
||||
|
|
|
@ -52,7 +52,7 @@ void agg_renderer<T0,T1>::process(polygon_symbolizer const& sym,
|
|||
typedef boost::mpl::vector<clip_poly_tag,transform_tag,affine_transform_tag,simplify_tag,smooth_tag> conv_types;
|
||||
typedef vertex_converter<box2d<double>, rasterizer, polygon_symbolizer,
|
||||
CoordTransform, proj_transform, agg::trans_affine,
|
||||
conv_types> vertex_converter_type;
|
||||
conv_types, feature_impl> vertex_converter_type;
|
||||
|
||||
ras_ptr->reset();
|
||||
double gamma = get<value_double>(sym, keys::gamma, feature, 1.0);
|
||||
|
|
|
@ -271,7 +271,7 @@ void cairo_renderer_base::process(polygon_symbolizer const& sym,
|
|||
typedef boost::mpl::vector<clip_poly_tag,transform_tag,affine_transform_tag,simplify_tag,smooth_tag> conv_types;
|
||||
typedef vertex_converter<box2d<double>, cairo_context, polygon_symbolizer,
|
||||
CoordTransform, proj_transform, agg::trans_affine,
|
||||
conv_types> vertex_converter_type;
|
||||
conv_types, feature_impl> vertex_converter_type;
|
||||
|
||||
cairo_save_restore guard(context_);
|
||||
composite_mode_e comp_op = get<composite_mode_e>(sym, keys::comp_op, feature, src_over);
|
||||
|
@ -376,8 +376,8 @@ void cairo_renderer_base::process(line_symbolizer const& sym,
|
|||
clipping_extent.pad(padding);
|
||||
}
|
||||
vertex_converter<box2d<double>, cairo_context, line_symbolizer,
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types>
|
||||
converter(clipping_extent,context_,sym,common_.t_,prj_trans,tr,common_.scale_factor_);
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types, feature_impl>
|
||||
converter(clipping_extent,context_,sym,common_.t_,prj_trans,tr,feature,common_.scale_factor_);
|
||||
|
||||
if (clip) converter.set<clip_line_tag>(); // optional clip (default: true)
|
||||
converter.set<transform_tag>(); // always transform
|
||||
|
@ -726,7 +726,7 @@ void cairo_renderer_base::process(polygon_pattern_symbolizer const& sym,
|
|||
typedef boost::mpl::vector<clip_poly_tag,transform_tag,affine_transform_tag,simplify_tag,smooth_tag> conv_types;
|
||||
vertex_converter<box2d<double>, cairo_context, polygon_pattern_symbolizer,
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types>
|
||||
converter(common_.query_extent_,context_,sym,common_.t_,prj_trans,tr, common_.scale_factor_);
|
||||
converter(common_.query_extent_,context_,sym,common_.t_,prj_trans,tr,feature,common_.scale_factor_);
|
||||
|
||||
if (prj_trans.equal() && clip) converter.set<clip_poly_tag>(); //optional clip (default: true)
|
||||
converter.set<transform_tag>(); //always transform
|
||||
|
|
|
@ -115,8 +115,8 @@ void grid_renderer<T>::process(line_pattern_symbolizer const& sym,
|
|||
put<value_double>(line, keys::smooth, value_double(smooth));
|
||||
|
||||
vertex_converter<box2d<double>, grid_rasterizer, line_symbolizer,
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types>
|
||||
converter(clipping_extent,*ras_ptr,line,common_.t_,prj_trans,tr,common_.scale_factor_);
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types, feature_impl>
|
||||
converter(clipping_extent,*ras_ptr,line,common_.t_,prj_trans,tr,feature,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
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <mapnik/grid/grid_renderer.hpp>
|
||||
#include <mapnik/grid/grid_renderer_base.hpp>
|
||||
#include <mapnik/grid/grid.hpp>
|
||||
|
||||
#include <mapnik/vertex_converters.hpp>
|
||||
|
||||
// agg
|
||||
|
@ -36,9 +35,6 @@
|
|||
#include "agg_conv_stroke.h"
|
||||
#include "agg_conv_dash.h"
|
||||
|
||||
// boost
|
||||
|
||||
|
||||
// stl
|
||||
#include <string>
|
||||
|
||||
|
@ -91,8 +87,8 @@ void grid_renderer<T>::process(line_symbolizer const& sym,
|
|||
}
|
||||
|
||||
vertex_converter<box2d<double>, grid_rasterizer, line_symbolizer,
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types>
|
||||
converter(clipping_extent,*ras_ptr,sym,common_.t_,prj_trans,tr,common_.scale_factor_);
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types, feature_impl>
|
||||
converter(clipping_extent,*ras_ptr,sym,common_.t_,prj_trans,tr,feature,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
|
||||
|
|
|
@ -76,8 +76,8 @@ void grid_renderer<T>::process(polygon_pattern_symbolizer const& sym,
|
|||
|
||||
typedef boost::mpl::vector<clip_poly_tag,transform_tag,affine_transform_tag,smooth_tag> conv_types;
|
||||
vertex_converter<box2d<double>, grid_rasterizer, polygon_pattern_symbolizer,
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types>
|
||||
converter(common_.query_extent_,*ras_ptr,sym,common_.t_,prj_trans,tr,common_.scale_factor_);
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types, feature_impl>
|
||||
converter(common_.query_extent_,*ras_ptr,sym,common_.t_,prj_trans,tr,feature,common_.scale_factor_);
|
||||
|
||||
if (prj_trans.equal() && clip) converter.set<clip_poly_tag>(); //optional clip (default: true)
|
||||
converter.set<transform_tag>(); //always transform
|
||||
|
|
|
@ -54,7 +54,7 @@ void grid_renderer<T>::process(polygon_symbolizer const& sym,
|
|||
typedef boost::mpl::vector<clip_poly_tag,transform_tag,affine_transform_tag,simplify_tag,smooth_tag> conv_types;
|
||||
typedef vertex_converter<box2d<double>, grid_rasterizer, polygon_symbolizer,
|
||||
CoordTransform, proj_transform, agg::trans_affine,
|
||||
conv_types> vertex_converter_type;
|
||||
conv_types, feature_impl> vertex_converter_type;
|
||||
|
||||
ras_ptr->reset();
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <mapnik/feature_type_style.hpp>
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/ctrans.hpp>
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/vertex_converters.hpp>
|
||||
#include <mapnik/geometry.hpp>
|
||||
#include <mapnik/wkt/wkt_factory.hpp>
|
||||
|
@ -57,9 +58,11 @@ boost::optional<std::string> linestring_bbox_clipping(mapnik::box2d<double> bbox
|
|||
output_geometry_backend backend(output_paths, mapnik::geometry_type::types::LineString);
|
||||
|
||||
typedef boost::mpl::vector<clip_line_tag> conv_types;
|
||||
mapnik::context_ptr ctx = std::make_shared<mapnik::context_type>();
|
||||
mapnik::feature_impl f(ctx,0);
|
||||
vertex_converter<box2d<double>, output_geometry_backend, line_symbolizer,
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types>
|
||||
converter(bbox, backend, sym, t, prj_trans, tr, 1.0);
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types, feature_impl>
|
||||
converter(bbox, backend, sym, t, prj_trans, tr, f, 1.0);
|
||||
|
||||
converter.set<clip_line_tag>();
|
||||
|
||||
|
@ -97,9 +100,11 @@ boost::optional<std::string> polygon_bbox_clipping(mapnik::box2d<double> bbox,
|
|||
output_geometry_backend backend(output_paths, mapnik::geometry_type::types::Polygon);
|
||||
|
||||
typedef boost::mpl::vector<clip_poly_tag> conv_types;
|
||||
mapnik::context_ptr ctx = std::make_shared<mapnik::context_type>();
|
||||
mapnik::feature_impl f(ctx,0);
|
||||
vertex_converter<box2d<double>, output_geometry_backend, polygon_symbolizer,
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types>
|
||||
converter(bbox, backend, sym, t, prj_trans, tr, 1.0);
|
||||
CoordTransform, proj_transform, agg::trans_affine, conv_types, feature_impl>
|
||||
converter(bbox, backend, sym, t, prj_trans, tr, f, 1.0);
|
||||
|
||||
converter.set<clip_poly_tag>();
|
||||
|
||||
|
|
Loading…
Reference in a new issue