upgrade to new get<value_type, keys::key>

This commit is contained in:
artemp 2014-10-17 20:45:15 +01:00
parent 35a044578b
commit 6eb65434c5
23 changed files with 171 additions and 159 deletions

View file

@ -104,20 +104,20 @@ struct vector_markers_rasterizer_dispatch : mapnik::noncopyable
scale_factor_(scale_factor),
snap_to_pixels_(snap_to_pixels)
{
pixf_.comp_op(static_cast<agg::comp_op_e>(get<composite_mode_e>(sym, keys::comp_op, feature_, vars_, src_over)));
pixf_.comp_op(static_cast<agg::comp_op_e>(get<composite_mode_e, keys::comp_op>(sym,feature_, vars_)));
}
template <typename T>
void add_path(T & path)
{
agg::scanline_u8 sl_;
marker_placement_enum placement_method = get<marker_placement_enum>(sym_, keys::markers_placement_type, feature_, vars_, MARKER_POINT_PLACEMENT);
bool ignore_placement = get<bool>(sym_, keys::ignore_placement, feature_, vars_, false);
bool allow_overlap = get<bool>(sym_, keys::allow_overlap, feature_, vars_, false);
bool avoid_edges = get<bool>(sym_, keys::avoid_edges, feature_, vars_, false);
double opacity = get<double>(sym_,keys::opacity, feature_, vars_, 1.0);
double spacing = get<double>(sym_, keys::spacing, feature_, vars_, 100.0);
double max_error = get<double>(sym_, keys::max_error, feature_, vars_, 0.2);
marker_placement_enum placement_method = get<marker_placement_enum, keys::markers_placement_type>(sym_, feature_, vars_);
value_bool ignore_placement = get<value_bool, keys::ignore_placement>(sym_, feature_, vars_);
value_bool allow_overlap = get<value_bool, keys::allow_overlap>(sym_, feature_, vars_);
value_bool avoid_edges = get<value_bool, keys::avoid_edges>(sym_, feature_, vars_);
value_double opacity = get<value_double,keys::opacity>(sym_, feature_, vars_);
value_double spacing = get<value_double, keys::spacing>(sym_, feature_, vars_);
value_double max_error = get<value_double, keys::max_error>(sym_, feature_, vars_);
coord2d center = bbox_.center();
agg::trans_affine_translation recenter(-center.x, -center.y);
agg::trans_affine tr = recenter * marker_trans_;
@ -191,20 +191,20 @@ struct raster_markers_rasterizer_dispatch : mapnik::noncopyable
scale_factor_(scale_factor),
snap_to_pixels_(snap_to_pixels)
{
pixf_.comp_op(static_cast<agg::comp_op_e>(get<composite_mode_e>(sym, keys::comp_op, feature_, vars_, src_over)));
pixf_.comp_op(static_cast<agg::comp_op_e>(get<composite_mode_e, keys::comp_op>(sym, feature_, vars_)));
}
template <typename T>
void add_path(T & path)
{
marker_placement_enum placement_method = get<marker_placement_enum>(sym_, keys::markers_placement_type, feature_, vars_, MARKER_POINT_PLACEMENT);
bool allow_overlap = get<bool>(sym_, keys::allow_overlap, feature_, vars_, false);
bool avoid_edges = get<bool>(sym_, keys::avoid_edges, feature_, vars_, false);
marker_placement_enum placement_method = get<marker_placement_enum, keys::markers_placement_type>(sym_, feature_, vars_);
value_bool allow_overlap = get<value_bool, keys::allow_overlap>(sym_, feature_, vars_);
value_bool avoid_edges = get<value_bool, keys::avoid_edges>(sym_, feature_, vars_);
box2d<double> bbox_(0,0, src_.width(),src_.height());
double opacity = get<double>(sym_, keys::opacity, feature_, vars_, 1.0);
bool ignore_placement = get<bool>(sym_, keys::ignore_placement, feature_, vars_, false);
double spacing = get<double>(sym_, keys::spacing, feature_, vars_, 100.0);
double max_error = get<double>(sym_, keys::max_error, feature_, vars_, 0.2);
value_double opacity = get<value_double, keys::opacity>(sym_, feature_, vars_);
value_bool ignore_placement = get<value_bool, keys::ignore_placement>(sym_, feature_, vars_);
value_double spacing = get<value_double, keys::spacing>(sym_, feature_, vars_);
value_double max_error = get<value_double, keys::max_error>(sym_, feature_, vars_);
markers_placement_params params { bbox_, marker_trans_, spacing * scale_factor_, max_error, allow_overlap, avoid_edges };
markers_placement_finder<T, label_collision_detector4> placement_finder(
placement_method, path, detector_, params);
@ -337,8 +337,8 @@ void apply_markers_multi(feature_impl const& feature, attributes const& vars, Co
}
else if (geom_count > 1)
{
marker_multi_policy_enum multi_policy = get<marker_multi_policy_enum>(sym, keys::markers_multipolicy, feature, vars, MARKER_EACH_MULTI);
marker_placement_enum placement = get<marker_placement_enum>(sym, keys::markers_placement_type, feature, vars, MARKER_POINT_PLACEMENT);
marker_multi_policy_enum multi_policy = get<marker_multi_policy_enum, keys::markers_multipolicy>(sym, feature, vars);
marker_placement_enum placement = get<marker_placement_enum, keys::markers_placement_type>(sym, feature, vars);
if (placement == MARKER_POINT_PLACEMENT &&
multi_policy == MARKER_WHOLE_MULTI)

View file

@ -45,10 +45,10 @@ void render_markers_symbolizer(markers_symbolizer const& sym,
using raster_dispatch_type = T1;
std::string filename = get<std::string>(sym, keys::file, feature, common.vars_, "shape://ellipse");
bool clip = get<value_bool>(sym, keys::clip, feature, common.vars_, false);
double offset = get<value_double>(sym, keys::offset, feature, common.vars_, 0.0);
double simplify_tolerance = get<value_double>(sym, keys::simplify_tolerance, feature, common.vars_, 0.0);
double smooth = get<value_double>(sym, keys::smooth, feature, common.vars_, false);
bool clip = get<value_bool, keys::clip>(sym, feature, common.vars_);
double offset = get<value_double, keys::offset>(sym, feature, common.vars_);
double simplify_tolerance = get<value_double, keys::simplify_tolerance>(sym, feature, common.vars_);
double smooth = get<value_double, keys::smooth>(sym, feature, common.vars_);
// https://github.com/mapnik/mapnik/issues/1316
bool snap_to_pixels = !mapnik::marker_cache::instance().is_uri(filename);

View file

@ -40,17 +40,17 @@ void render_point_symbolizer(point_symbolizer const &sym,
RendererType &common,
F render_marker)
{
std::string filename = get<std::string>(sym, keys::file, feature, common.vars_);
std::string filename = get<std::string,keys::file>(sym,feature, common.vars_);
boost::optional<mapnik::marker_ptr> marker = filename.empty()
? std::make_shared<mapnik::marker>()
: marker_cache::instance().find(filename, true);
if (marker)
{
double opacity = get<double>(sym,keys::opacity,feature, common.vars_, 1.0);
bool allow_overlap = get<bool>(sym, keys::allow_overlap, feature, common.vars_, false);
bool ignore_placement = get<bool>(sym, keys::ignore_placement, feature, common.vars_, false);
point_placement_enum placement= get<point_placement_enum>(sym, keys::point_placement_type, feature, common.vars_, CENTROID_POINT_PLACEMENT);
value_double opacity = get<value_double,keys::opacity>(sym, feature, common.vars_);
value_bool allow_overlap = get<value_bool, keys::allow_overlap>(sym, feature, common.vars_);
value_bool ignore_placement = get<value_bool, keys::ignore_placement>(sym, feature, common.vars_);
point_placement_enum placement= get<point_placement_enum, keys::point_placement_type>(sym, feature, common.vars_);
box2d<double> const& bbox = (*marker)->bounding_box();
coord2d center = bbox.center();

View file

@ -44,10 +44,10 @@ void render_polygon_symbolizer(polygon_symbolizer const &sym,
auto transform = get_optional<transform_type>(sym, keys::geometry_transform);
if (transform) evaluate_transform(tr, feature, common.vars_, *transform, common.scale_factor_);
bool clip = get<value_bool>(sym, keys::clip, feature, common.vars_, false);
double simplify_tolerance = get<double>(sym, keys::simplify_tolerance, feature, common.vars_, 0.0);
double smooth = get<value_double>(sym, keys::smooth, feature, common.vars_, 0.0);
double opacity = get<value_double>(sym,keys::fill_opacity,feature,common.vars_, 1.0);
value_bool clip = get<value_bool,keys::clip>(sym, feature, common.vars_);
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_);
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,
feature,common.vars_,common.scale_factor_);
@ -66,7 +66,7 @@ void render_polygon_symbolizer(polygon_symbolizer const &sym,
}
}
color const& fill = get<mapnik::color>(sym, keys::fill, feature, common.vars_, mapnik::color(128,128,128)); // gray
color const& fill = get<mapnik::color, keys::fill>(sym, feature, common.vars_);
fill_func(fill, opacity);
}

View file

@ -31,17 +31,9 @@
namespace mapnik {
template <typename T, keys key>
struct symbolizer_default
{
using value_type = T;
static value_type value()
{
return value_type();
}
};
struct symbolizer_default {};
// specializations for properties
// gamma
template <>
struct symbolizer_default<value_double, keys::gamma>
@ -79,7 +71,7 @@ struct symbolizer_default<value_double, keys::offset>
// comp-op
template <>
struct symbolizer_default<composite_mode_e, keys::alignment>
struct symbolizer_default<composite_mode_e, keys::comp_op>
{
static composite_mode_e value() { return src_over; }
};
@ -135,7 +127,7 @@ struct symbolizer_default<line_join_enum, keys::stroke_linejoin>
// stroke-linecap
template <>
struct symbolizer_default<line_join_enum, keys::stroke_linecap>
struct symbolizer_default<line_cap_enum, keys::stroke_linecap>
{
static line_cap_enum value() { return BUTT_CAP; }
};
@ -185,14 +177,14 @@ struct symbolizer_default<line_rasterizer_enum, keys::line_rasterizer>
template <>
struct symbolizer_default<value_double, keys::spacing>
{
static value_double value() { return 0.0; }
static value_double value() { return 100.0; }
};
// max-error
template <>
struct symbolizer_default<value_double, keys::max_error>
{
static value_double value() { return 0.0; }
static value_double value() { return 0.2; }
};
// allow-overlap
@ -318,13 +310,25 @@ struct symbolizer_default<halo_rasterizer_enum, keys::halo_rasterizer>
// placement (point-placement-type FIXME)
template <>
struct symbolizer_default<label_placement_enum, keys::point_placement_type>
struct symbolizer_default<point_placement_enum, keys::point_placement_type>
{
static label_placement_enum value() { return POINT_PLACEMENT; }
static point_placement_enum value() { return CENTROID_POINT_PLACEMENT; }
};
// marker placement
template <>
struct symbolizer_default<marker_placement_enum, keys::markers_placement_type>
{
static marker_placement_enum value() { return MARKER_POINT_PLACEMENT; }
};
// placement
// multi-policy
template <>
struct symbolizer_default<marker_multi_policy_enum, keys::markers_multipolicy>
{
static marker_multi_policy_enum value() { return MARKER_EACH_MULTI; }
};
// placement
// colorizer
@ -343,7 +347,14 @@ struct symbolizer_default<label_placement_enum, keys::point_placement_type>
// justify-alignment
// vertical-alignment
// upright
// avoid-edges
template <>
struct symbolizer_default<value_bool, keys::avoid_edges>
{
static value_bool value() { return false; }
};
// font-feature-settings
} // namespace mapnik

View file

@ -151,7 +151,7 @@ public:
std::string operator() ( mapnik::enumeration_wrapper const& e) const
{
std::stringstream ss;
auto const& convert_fun_ptr(std::get<2>(meta_));
auto const& convert_fun_ptr(std::get<1>(meta_));
if ( convert_fun_ptr )
{
ss << convert_fun_ptr(e);
@ -296,7 +296,7 @@ struct set_property_impl<Symbolizer, std::integral_constant<property_types, prop
template <typename Symbolizer, typename T>
inline void set_property(Symbolizer & sym, mapnik::keys key, T const& val)
{
switch (std::get<3>(get_meta(key)))
switch (std::get<2>(get_meta(key)))
{
case property_types::target_bool:
set_property_impl<Symbolizer, std::integral_constant<property_types, property_types::target_bool> >::apply(sym,key,val);
@ -318,7 +318,7 @@ inline void set_property(Symbolizer & sym, mapnik::keys key, T const& val)
template <typename Symbolizer, typename T>
inline void set_property_from_value(Symbolizer & sym, mapnik::keys key, T const& val)
{
switch (std::get<3>(get_meta(key)))
switch (std::get<2>(get_meta(key)))
{
case property_types::target_bool:
put(sym, key, val.to_bool());

View file

@ -85,7 +85,7 @@ struct converter_traits<T,mapnik::smooth_tag>
template <typename Args>
static void setup(geometry_type & geom, Args const& args)
{
geom.smooth_value(get<value_double>(args.sym, keys::smooth, args.feature, args.vars));
geom.smooth_value(get<value_double, keys::smooth>(args.sym, args.feature, args.vars));
}
};
@ -98,8 +98,8 @@ struct converter_traits<T,mapnik::simplify_tag>
template <typename Args>
static void setup(geometry_type & geom, Args const& args)
{
geom.set_simplify_algorithm(static_cast<simplify_algorithm_e>(get<value_integer>(args.sym, keys::simplify_algorithm, args.feature, args.vars)));
geom.set_simplify_tolerance(get<value_double>(args.sym, keys::simplify_tolerance,args.feature, args.vars));
geom.set_simplify_algorithm(static_cast<simplify_algorithm_e>(get<simplify_algorithm_e,keys::simplify_algorithm>(args.sym, args.feature, args.vars)));
geom.set_simplify_tolerance(get<value_double,keys::simplify_tolerance>(args.sym,args.feature, args.vars));
}
};
@ -145,7 +145,7 @@ struct converter_traits<T, mapnik::dash_tag>
template <typename Symbolizer, typename PathType, typename Feature>
void set_join_caps(Symbolizer const& sym, PathType & stroke, Feature const& feature, attributes const& vars)
{
line_join_enum join = get<line_join_enum>(sym, keys::stroke_linejoin, feature, vars, MITER_JOIN);
line_join_enum join = get<line_join_enum,keys::stroke_linejoin>(sym, feature, vars);
switch (join)
{
case MITER_JOIN:
@ -161,7 +161,7 @@ void set_join_caps(Symbolizer const& sym, PathType & stroke, Feature const& feat
stroke.generator().line_join(agg::bevel_join);
}
line_cap_enum cap = get<line_cap_enum>(sym, keys::stroke_linecap, feature, vars, BUTT_CAP);
line_cap_enum cap = get<line_cap_enum,keys::stroke_linecap>(sym, feature, vars);
switch (cap)
{
@ -189,10 +189,10 @@ struct converter_traits<T, mapnik::stroke_tag>
auto const& feat = args.feature;
auto const& vars = args.vars;
set_join_caps(sym, geom, feat, vars);
double miterlimit = get<value_double>(sym, keys::stroke_miterlimit, feat, vars, 4.0);
double miterlimit = get<value_double,keys::stroke_miterlimit>(sym, feat, vars);
geom.generator().miter_limit(miterlimit);
double scale_factor = args.scale_factor;
double width = get<value_double>(sym, keys::stroke_width, feat, vars, 1.0);
double width = get<value_double,keys::stroke_width>(sym, feat, vars);
geom.generator().width(width * scale_factor);
}
};
@ -263,7 +263,7 @@ struct converter_traits<T,mapnik::offset_transform_tag>
auto const& sym = args.sym;
auto const& feat = args.feature;
auto const& vars = args.vars;
double offset = get<value_double>(sym, keys::offset, feat, vars);
double offset = get<value_double, keys::offset>(sym, feat, vars);
geom.set_offset(offset * args.scale_factor);
}
};

View file

@ -62,8 +62,8 @@ void agg_renderer<T0,T1>::process(building_symbolizer const& sym,
agg::pixfmt_rgba32_pre pixf(buf);
ren_base renb(pixf);
double opacity = get<value_double>(sym,keys::fill_opacity,feature, common_.vars_, 1.0);
color const& fill = get<mapnik::color>(sym, keys::fill, feature, common_.vars_, mapnik::color(128,128,128));
value_double opacity = get<value_double,keys::fill_opacity>(sym,feature, common_.vars_);
color const& fill = get<color, keys::fill>(sym, feature, common_.vars_);
unsigned r=fill.red();
unsigned g=fill.green();
unsigned b=fill.blue();
@ -72,8 +72,8 @@ void agg_renderer<T0,T1>::process(building_symbolizer const& sym,
agg::scanline_u8 sl;
ras_ptr->reset();
double gamma = get<value_double>(sym, keys::gamma, feature, common_.vars_, 1.0);
gamma_method_enum gamma_method = get<gamma_method_enum>(sym, keys::gamma_method, feature, common_.vars_, GAMMA_POWER);
double gamma = get<value_double, keys::gamma>(sym, feature, common_.vars_);
gamma_method_enum gamma_method = get<gamma_method_enum, keys::gamma_method>(sym, feature, common_.vars_);
if (gamma != gamma_ || gamma_method != gamma_method_)
{
set_gamma_method(ras_ptr, gamma, gamma_method);
@ -81,7 +81,7 @@ void agg_renderer<T0,T1>::process(building_symbolizer const& sym,
gamma_ = gamma;
}
double height = get<double>(sym, keys::height, feature, common_.vars_,0.0) * common_.scale_factor_;
double height = get<double, keys::height>(sym, feature, common_.vars_) * common_.scale_factor_;
render_building_symbolizer(
feature, height,

View file

@ -68,13 +68,13 @@ void agg_renderer<T0,T1>::process(line_pattern_symbolizer const& sym,
using renderer_type = agg::renderer_outline_image<renderer_base, pattern_type>;
using rasterizer_type = agg::rasterizer_outline_aa<renderer_type>;
std::string filename = get<std::string>(sym, keys::file, feature, common_.vars_);
std::string filename = get<std::string, keys::file>(sym, feature, common_.vars_);
if (filename.empty()) return;
boost::optional<mapnik::marker_ptr> marker_ptr = marker_cache::instance().find(filename, true);
if (!marker_ptr || !(*marker_ptr)) return;
boost::optional<image_ptr> pat;
// TODO - re-implement at renderer level like polygon_pattern symbolizer
double opacity = get<value_double>(sym, keys::opacity, feature, common_.vars_,1.0);
value_double opacity = get<value_double, keys::opacity>(sym, feature, common_.vars_);
if ((*marker_ptr)->is_bitmap())
{
pat = (*marker_ptr)->get_bitmap_data();
@ -89,14 +89,14 @@ void agg_renderer<T0,T1>::process(line_pattern_symbolizer const& sym,
if (!pat) return;
bool clip = get<value_bool>(sym, keys::clip, feature, common_.vars_, false);
double offset = get<value_double>(sym, keys::offset, feature, common_.vars_, 0.0);
double simplify_tolerance = get<value_double>(sym, keys::simplify_tolerance, feature, common_.vars_, 0.0);
double smooth = get<value_double>(sym, keys::smooth, feature, common_.vars_, false);
value_bool clip = get<value_bool, keys::clip>(sym, feature, common_.vars_);
value_double offset = get<value_double, keys::offset>(sym, feature, common_.vars_);
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_->raw_data(),current_buffer_->width(),current_buffer_->height(), current_buffer_->width() * 4);
pixfmt_type pixf(buf);
pixf.comp_op(static_cast<agg::comp_op_e>(get<composite_mode_e>(sym, keys::comp_op, feature, common_.vars_, src_over)));
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);
agg::pattern_filter_bilinear_rgba8 filter;

View file

@ -55,7 +55,7 @@ namespace mapnik {
template <typename Symbolizer, typename Rasterizer, typename Feature>
void set_join_caps_aa(Symbolizer const& sym, Rasterizer & ras, Feature & feature, attributes const& vars)
{
line_join_enum join = get<line_join_enum>(sym, keys::stroke_linejoin, feature, vars, MITER_JOIN);
line_join_enum join = get<line_join_enum, keys::stroke_linejoin>(sym, feature, vars);
switch (join)
{
case MITER_JOIN:
@ -71,7 +71,7 @@ void set_join_caps_aa(Symbolizer const& sym, Rasterizer & ras, Feature & feature
ras.line_join(agg::outline_no_join);
}
line_cap_enum cap = get<line_cap_enum>(sym, keys::stroke_linecap, feature, vars, BUTT_CAP);
line_cap_enum cap = get<line_cap_enum, keys::stroke_linecap>(sym, feature, vars);
switch (cap)
{
@ -92,14 +92,14 @@ void agg_renderer<T0,T1>::process(line_symbolizer const& sym,
proj_transform const& prj_trans)
{
color const& col = get<color>(sym, keys::stroke, feature, common_.vars_, mapnik::color(0,0,0));
color const& col = get<color, keys::stroke>(sym, feature, common_.vars_);
unsigned r=col.red();
unsigned g=col.green();
unsigned b=col.blue();
unsigned a=col.alpha();
double gamma = get<value_double>(sym, keys::stroke_gamma, feature, common_.vars_, 1.0);
gamma_method_enum gamma_method = get<gamma_method_enum>(sym, keys::stroke_gamma_method, feature, common_.vars_, GAMMA_POWER);
double gamma = get<value_double, keys::stroke_gamma>(sym, feature, common_.vars_);
gamma_method_enum gamma_method = get<gamma_method_enum, keys::stroke_gamma_method>(sym, feature, common_.vars_);
ras_ptr->reset();
if (gamma != gamma_ || gamma_method != gamma_method_)
@ -118,7 +118,7 @@ void agg_renderer<T0,T1>::process(line_symbolizer const& sym,
using renderer_base = agg::renderer_base<pixfmt_comp_type>;
pixfmt_comp_type pixf(buf);
pixf.comp_op(static_cast<agg::comp_op_e>(get<composite_mode_e>(sym, keys::comp_op, feature, common_.vars_, src_over)));
pixf.comp_op(static_cast<agg::comp_op_e>(get<composite_mode_e, keys::comp_op>(sym, feature, common_.vars_)));
renderer_base renb(pixf);
agg::trans_affine tr;
@ -127,13 +127,13 @@ void agg_renderer<T0,T1>::process(line_symbolizer const& sym,
box2d<double> clip_box = clipping_extent(common_);
bool clip = get<value_bool>(sym, keys::clip, feature, common_.vars_, false);
double width = get<value_double>(sym, keys::stroke_width, feature, common_.vars_, 1.0);
double opacity = get<value_double>(sym,keys::stroke_opacity,feature, common_.vars_, 1.0);
double offset = get<value_double>(sym, keys::offset, feature, common_.vars_, 0.0);
double simplify_tolerance = get<value_double>(sym, keys::simplify_tolerance, feature, common_.vars_, 0.0);
double smooth = get<value_double>(sym, keys::smooth, feature, common_.vars_, false);
line_rasterizer_enum rasterizer_e = get<line_rasterizer_enum>(sym, keys::line_rasterizer, feature, common_.vars_, RASTERIZER_FULL);
value_bool clip = get<value_bool, keys::clip>(sym, feature, common_.vars_);
value_double width = get<value_double, keys::stroke_width>(sym, feature, common_.vars_);
value_double opacity = get<value_double,keys::stroke_opacity>(sym,feature, common_.vars_);
value_double offset = get<value_double, keys::offset>(sym, feature, common_.vars_);
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_);
line_rasterizer_enum rasterizer_e = get<line_rasterizer_enum, keys::line_rasterizer>(sym, feature, common_.vars_);
if (clip)
{
double padding = static_cast<double>(common_.query_extent_.width()/pixmap_.width());

View file

@ -80,8 +80,8 @@ void agg_renderer<T0,T1>::process(markers_symbolizer const& sym,
ras_ptr->reset();
double gamma = get<value_double>(sym, keys::gamma, feature, common_.vars_, 1.0);
gamma_method_enum gamma_method = get<gamma_method_enum>(sym, keys::gamma_method, feature, common_.vars_, GAMMA_POWER);
double gamma = get<value_double, keys::gamma>(sym, feature, common_.vars_);
gamma_method_enum gamma_method = get<gamma_method_enum, keys::gamma_method>(sym, feature, common_.vars_);
if (gamma != gamma_ || gamma_method != gamma_method_)
{
set_gamma_method(ras_ptr, gamma, gamma_method);

View file

@ -59,7 +59,7 @@ void agg_renderer<T0,T1>::process(polygon_pattern_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
std::string filename = get<std::string>(sym, keys::file, feature, common_.vars_);
std::string filename = get<std::string, keys::file>(sym, feature, common_.vars_);
if (filename.empty()) return;
boost::optional<mapnik::marker_ptr> marker_ptr = marker_cache::instance().find(filename, true);
if (!marker_ptr || !(*marker_ptr)) return;
@ -86,8 +86,8 @@ void agg_renderer<T0,T1>::process(polygon_pattern_symbolizer const& sym,
agg::rendering_buffer buf(current_buffer_->raw_data(), current_buffer_->width(),
current_buffer_->height(), current_buffer_->width() * 4);
ras_ptr->reset();
double gamma = get<value_double>(sym, keys::gamma, feature, common_.vars_, 1.0);
gamma_method_enum gamma_method = get<gamma_method_enum>(sym, keys::gamma_method, feature, common_.vars_, GAMMA_POWER);
value_double gamma = get<value_double, keys::gamma>(sym, feature, common_.vars_);
gamma_method_enum gamma_method = get<gamma_method_enum, keys::gamma_method>(sym, feature, common_.vars_);
if (gamma != gamma_ || gamma_method != gamma_method_)
{
set_gamma_method(ras_ptr, gamma, gamma_method);
@ -95,10 +95,10 @@ void agg_renderer<T0,T1>::process(polygon_pattern_symbolizer const& sym,
gamma_ = gamma;
}
bool clip = get<value_bool>(sym, keys::clip, feature, common_.vars_, false);
double opacity = get<double>(sym,keys::opacity, feature, common_.vars_, 1.0);
double simplify_tolerance = get<value_double>(sym, keys::simplify_tolerance, feature, common_.vars_, 0.0);
double smooth = get<value_double>(sym, keys::smooth, feature, common_.vars_, false);
value_bool clip = get<value_bool, keys::clip>(sym, feature, common_.vars_);
value_double opacity = get<double, keys::opacity>(sym, feature, common_.vars_);
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_);
box2d<double> clip_box = clipping_extent(common_);
@ -121,7 +121,7 @@ void agg_renderer<T0,T1>::process(polygon_pattern_symbolizer const& sym,
span_gen_type>;
pixfmt_type pixf(buf);
pixf.comp_op(static_cast<agg::comp_op_e>(get<composite_mode_e>(sym, keys::comp_op, feature, common_.vars_, src_over)));
pixf.comp_op(static_cast<agg::comp_op_e>(get<composite_mode_e, keys::comp_op>(sym, feature, common_.vars_)));
ren_base renb(pixf);
unsigned w=(*pat)->width();
@ -130,7 +130,7 @@ void agg_renderer<T0,T1>::process(polygon_pattern_symbolizer const& sym,
agg::pixfmt_rgba32_pre pixf_pattern(pattern_rbuf);
img_source_type img_src(pixf_pattern);
pattern_alignment_enum alignment = get<pattern_alignment_enum>(sym, keys::alignment, feature, common_.vars_, GLOBAL_ALIGNMENT);
pattern_alignment_enum alignment = get<pattern_alignment_enum, keys::alignment>(sym, feature, common_.vars_);
unsigned offset_x=0;
unsigned offset_y=0;

View file

@ -45,10 +45,10 @@ void cairo_renderer<T>::process(building_symbolizer const& sym,
{
using path_type = transform_path_adapter<view_transform,geometry_type>;
cairo_save_restore guard(context_);
composite_mode_e comp_op = get<composite_mode_e>(sym, keys::comp_op, feature, common_.vars_, src_over);
mapnik::color fill = get<mapnik::color>(sym, keys::fill, feature, common_.vars_, mapnik::color(128,128,128));
double opacity = get<double>(sym, keys::fill_opacity, feature, common_.vars_, 1.0);
double height = get<double>(sym, keys::height, feature, common_.vars_, 0.0);
composite_mode_e comp_op = get<composite_mode_e, keys::comp_op>(sym, feature, common_.vars_);
mapnik::color fill = get<color, keys::fill>(sym, feature, common_.vars_);
value_double opacity = get<value_double, keys::fill_opacity>(sym, feature, common_.vars_);
value_double height = get<value_double, keys::height>(sym, feature, common_.vars_);
context_.set_operator(comp_op);

View file

@ -41,12 +41,12 @@ void cairo_renderer<T>::process(line_pattern_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
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);
bool clip = get<bool>(sym, keys::clip, feature, common_.vars_, false);
double offset = get<double>(sym, keys::offset, feature, common_.vars_, 0.0);
double simplify_tolerance = get<double>(sym, keys::simplify_tolerance, feature, common_.vars_, 0.0);
double smooth = get<double>(sym, keys::smooth, feature, common_.vars_, 0.0);
std::string filename = get<std::string, keys::file>(sym, feature, common_.vars_);
composite_mode_e comp_op = get<composite_mode_e, keys::comp_op>(sym, feature, common_.vars_);
value_bool clip = get<value_bool, keys::clip>(sym, feature, common_.vars_);
value_double offset = get<value_double, keys::offset>(sym, feature, common_.vars_);
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_);
boost::optional<marker_ptr> marker;
if ( !filename.empty() )
@ -63,7 +63,7 @@ void cairo_renderer<T>::process(line_pattern_symbolizer const& sym,
std::shared_ptr<cairo_pattern> pattern;
image_ptr image = nullptr;
// TODO - re-implement at renderer level like polygon_pattern symbolizer
double opacity = get<value_double>(sym, keys::opacity, feature, common_.vars_,1.0);
double opacity = get<value_double, keys::opacity>(sym, feature, common_.vars_);
if ((*marker)->is_bitmap())
{
pattern = std::make_unique<cairo_pattern>(**((*marker)->get_bitmap_data()), opacity);

View file

@ -36,19 +36,20 @@ void cairo_renderer<T>::process(line_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
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);
double offset = get<double>(sym, keys::offset, feature, common_.vars_, 0.0);
double simplify_tolerance = get<double>(sym, keys::simplify_tolerance, feature, common_.vars_, 0.0);
double smooth = get<double>(sym, keys::smooth, feature, common_.vars_, 0.0);
composite_mode_e comp_op = get<composite_mode_e, keys::comp_op>(sym, feature, common_.vars_);
value_bool clip = get<value_bool, keys::clip>(sym, feature, common_.vars_);
value_double offset = get<value_double, keys::offset>(sym, feature, common_.vars_);
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_);
color stroke = get<color, keys::stroke>(sym, feature, common_.vars_);
value_double stroke_opacity = get<value_double, keys::stroke_opacity>(sym, feature, common_.vars_);
line_join_enum stroke_join = get<line_join_enum, keys::stroke_linejoin>(sym, feature, common_.vars_);
line_cap_enum stroke_cap = get<line_cap_enum, keys::stroke_linecap>(sym, feature, common_.vars_);
value_double miterlimit = get<value_double, keys::stroke_miterlimit>(sym, feature, common_.vars_);
value_double width = get<value_double, keys::stroke_width>(sym, feature, common_.vars_);
mapnik::color stroke = get<mapnik::color>(sym, keys::stroke, feature, common_.vars_, mapnik::color(0,0,0));
double stroke_opacity = get<double>(sym, keys::stroke_opacity, feature, common_.vars_, 1.0);
line_join_enum stroke_join = get<line_join_enum>(sym, keys::stroke_linejoin, feature, common_.vars_, MITER_JOIN);
line_cap_enum stroke_cap = get<line_cap_enum>(sym, keys::stroke_linecap, feature, common_.vars_, BUTT_CAP);
auto dash = get_optional<dash_array>(sym, keys::stroke_dasharray, feature, common_.vars_);
double miterlimit = get<double>(sym, keys::stroke_miterlimit, feature, common_.vars_, 4.0);
double width = get<double>(sym, keys::stroke_width, feature, common_.vars_, 1.0);
cairo_save_restore guard(context_);
context_.set_operator(comp_op);

View file

@ -79,12 +79,12 @@ struct markers_dispatch : mapnik::noncopyable
{
marker_placement_enum placement_method = get<marker_placement_enum>(
sym_, keys::markers_placement_type, feature_, vars_, MARKER_POINT_PLACEMENT);
bool ignore_placement = get<bool>(sym_, keys::ignore_placement, feature_, vars_, false);
bool allow_overlap = get<bool>(sym_, keys::allow_overlap, feature_, vars_, false);
bool avoid_edges = get<bool>(sym_, keys::avoid_edges, feature_, vars_, false);
double opacity = get<double>(sym_, keys::opacity, feature_, vars_, 1.0);
double spacing = get<double>(sym_, keys::spacing, feature_, vars_, 100.0);
double max_error = get<double>(sym_, keys::max_error, feature_, vars_, 0.2);
value_bool ignore_placement = get<value_bool, keys::ignore_placement>(sym_, feature_, vars_);
value_bool allow_overlap = get<value_bool, keys::allow_overlap>(sym_, feature_, vars_);
value_bool avoid_edges = get<value_bool, keys::avoid_edges>(sym_, feature_, vars_);
value_double opacity = get<value_double, keys::opacity>(sym_, feature_, vars_);
value_double spacing = get<value_double, keys::spacing>(sym_, feature_, vars_);
value_double max_error = get<value_double, keys::max_error>(sym_, feature_, vars_);
coord2d center = bbox_.center();
agg::trans_affine_translation recenter(-center.x, -center.y);
agg::trans_affine tr = recenter * marker_trans_;
@ -145,12 +145,12 @@ struct raster_markers_dispatch : mapnik::noncopyable
void add_path(T & path)
{
marker_placement_enum placement_method = get<marker_placement_enum>(sym_, keys::markers_placement_type, feature_, vars_, MARKER_POINT_PLACEMENT);
double opacity = get<double>(sym_, keys::opacity, feature_, vars_, 1.0);
double spacing = get<double>(sym_, keys::spacing, feature_, vars_, 100.0);
double max_error = get<double>(sym_, keys::max_error, feature_, vars_, 0.2);
bool allow_overlap = get<bool>(sym_, keys::allow_overlap, feature_, vars_, false);
bool avoid_edges = get<bool>(sym_, keys::avoid_edges, feature_, vars_, false);
bool ignore_placement = get<bool>(sym_, keys::ignore_placement, feature_, vars_, false);
value_double opacity = get<value_double, keys::opacity>(sym_, feature_, vars_);
value_double spacing = get<value_double, keys::spacing>(sym_, feature_, vars_);
value_double max_error = get<value_double>(sym_, keys::max_error, feature_, vars_, 0.2); // overwrite default
value_bool allow_overlap = get<value_bool, keys::allow_overlap>(sym_, feature_, vars_);
value_bool avoid_edges = get<value_bool, keys::avoid_edges>(sym_, feature_, vars_);
value_bool ignore_placement = get<value_bool, keys::ignore_placement>(sym_, feature_, vars_);
box2d<double> bbox_(0,0, src_.width(),src_.height());
markers_placement_params params { bbox_, marker_trans_, spacing * scale_factor_, max_error, allow_overlap, avoid_edges };
markers_placement_finder<T, label_collision_detector4> placement_finder(

View file

@ -42,12 +42,12 @@ void cairo_renderer<T>::process(polygon_pattern_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
composite_mode_e comp_op = get<composite_mode_e>(sym, keys::comp_op, feature, common_.vars_, src_over);
std::string filename = get<std::string>(sym, keys::file, feature, common_.vars_);
bool clip = get<bool>(sym, keys::clip, feature, common_.vars_, false);
double simplify_tolerance = get<double>(sym, keys::simplify_tolerance, feature, common_.vars_, 0.0);
double smooth = get<double>(sym, keys::smooth, feature, common_.vars_, 0.0);
double opacity = get<double>(sym,keys::opacity, feature, common_.vars_, 1.0);
composite_mode_e comp_op = get<composite_mode_e, keys::comp_op>(sym, feature, common_.vars_);
std::string filename = get<std::string, keys::file>(sym, feature, common_.vars_);
value_bool clip = get<value_bool, keys::clip>(sym, feature, common_.vars_);
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_);
value_double opacity = get<value_double, keys::opacity>(sym, feature, common_.vars_);
agg::trans_affine image_tr = agg::trans_affine_scaling(common_.scale_factor_);
auto image_transform = get_optional<transform_type>(sym, keys::image_transform);
if (image_transform) evaluate_transform(image_tr, feature, common_.vars_, *image_transform);
@ -61,7 +61,7 @@ void cairo_renderer<T>::process(polygon_pattern_symbolizer const& sym,
unsigned offset_x=0;
unsigned offset_y=0;
box2d<double> const& clip_box = clipping_extent(common_);
pattern_alignment_enum alignment = get<pattern_alignment_enum>(sym, keys::alignment, feature, common_.vars_, GLOBAL_ALIGNMENT);
pattern_alignment_enum alignment = get<pattern_alignment_enum, keys::alignment>(sym, feature, common_.vars_);
if (alignment == LOCAL_ALIGNMENT)
{
double x0 = 0.0;

View file

@ -40,7 +40,7 @@ void cairo_renderer<T>::process(polygon_symbolizer const& sym,
{
using vertex_converter_type = vertex_converter<cairo_context,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>(sym, keys::comp_op, feature, common_.vars_, src_over);
composite_mode_e comp_op = get<composite_mode_e, keys::comp_op>(sym, feature, common_.vars_);
context_.set_operator(comp_op);
render_polygon_symbolizer<vertex_converter_type>(

View file

@ -51,7 +51,7 @@ void grid_renderer<T>::process(line_pattern_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
std::string filename = get<std::string>(sym, keys::file, feature, common_.vars_);
std::string filename = get<std::string, keys::file>(sym, feature, common_.vars_);
if (filename.empty()) return;
boost::optional<mapnik::marker_ptr> mark = marker_cache::instance().find(filename, true);
if (!mark) return;
@ -65,10 +65,10 @@ void grid_renderer<T>::process(line_pattern_symbolizer const& sym,
boost::optional<image_ptr> pat = (*mark)->get_bitmap_data();
if (!pat) return;
bool clip = get<value_bool>(sym, keys::clip, feature, common_.vars_, false);
double offset = get<value_double>(sym, keys::offset, feature, common_.vars_, 0.0);
double simplify_tolerance = get<value_double>(sym, keys::simplify_tolerance, feature, common_.vars_, 0.0);
double smooth = get<value_double>(sym, keys::smooth, feature, common_.vars_, false);
value_bool clip = get<value_bool, keys::clip>(sym, feature, common_.vars_);
value_double offset = get<value_double, keys::offset>(sym, feature, common_.vars_);
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_);
using pixfmt_type = typename grid_renderer_base_type::pixfmt_type;
using color_type = typename grid_renderer_base_type::pixfmt_type::color_type;

View file

@ -50,7 +50,7 @@ void grid_renderer<T>::process(polygon_pattern_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
std::string filename = get<std::string>(sym, keys::file, feature, common_.vars_);
std::string filename = get<std::string, keys::file>(sym, feature, common_.vars_);
if (filename.empty()) return;
boost::optional<mapnik::marker_ptr> mark = marker_cache::instance().find(filename, true);
if (!mark) return;
@ -66,9 +66,9 @@ void grid_renderer<T>::process(polygon_pattern_symbolizer const& sym,
ras_ptr->reset();
bool clip = get<value_bool>(sym, keys::clip, feature, common_.vars_, false);
double simplify_tolerance = get<value_double>(sym, keys::simplify_tolerance, feature, common_.vars_, 0.0);
double smooth = get<value_double>(sym, keys::smooth, feature, common_.vars_, false);
value_bool clip = get<value_bool, keys::clip>(sym, feature, common_.vars_);
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::trans_affine tr;
auto transform = get_optional<transform_type>(sym, keys::geometry_transform);

View file

@ -143,7 +143,7 @@ public:
void operator() ( mapnik::enumeration_wrapper const& e) const
{
auto const& convert_fun_ptr(std::get<2>(meta_));
auto const& convert_fun_ptr(std::get<1>(meta_));
if ( convert_fun_ptr )
{
node_.put("<xmlattr>." + std::string(std::get<0>(meta_)), convert_fun_ptr(e));

View file

@ -66,7 +66,7 @@ struct property_serializer : public util::static_visitor<>
void operator() (enumeration_wrapper const& val) const
{
std::string str = std::get<2>(get_meta(get_key(name_)))(val);
std::string str = std::get<1>(get_meta(get_key(name_)))(val);
node_.put("<xmlattr>." + name_, str);
}

View file

@ -58,7 +58,7 @@ base_symbolizer_helper::base_symbolizer_helper(
dims_(0, 0, width, height),
query_extent_(query_extent),
scale_factor_(scale_factor),
info_ptr_(get<text_placements_ptr>(sym_, keys::text_placements_)->get_placement_info(scale_factor)),
info_ptr_(mapnik::get<text_placements_ptr>(sym_, keys::text_placements_)->get_placement_info(scale_factor)),
text_props_(evaluate_text_properties(info_ptr_->properties,feature_,vars_))
{
initialize_geometries();
@ -189,9 +189,9 @@ text_symbolizer_helper::text_symbolizer_helper(
{
// setup vertex converter
bool clip = mapnik::get<bool>(sym_, keys::clip, feature_, vars_, false);
double simplify_tolerance = mapnik::get<double>(sym_, keys::simplify_tolerance, feature_, vars_, 0.0);
double smooth = mapnik::get<double>(sym_, keys::smooth, feature_, vars_, 0.0);
value_bool clip = mapnik::get<value_bool, keys::clip>(sym_, feature_, vars_);
value_double simplify_tolerance = mapnik::get<value_double, keys::simplify_tolerance>(sym_, feature_, vars_);
value_double smooth = mapnik::get<value_double, keys::smooth>(sym_, feature_, vars_);
if (clip) converter_.template set<clip_line_tag>(); //optional clip (default: true)
converter_.template set<transform_tag>(); //always transform
@ -280,9 +280,9 @@ text_symbolizer_helper::text_symbolizer_helper(
converter_(query_extent_, adapter_, sym_, t, prj_trans, affine_trans, feature, vars, scale_factor)
{
// setup vertex converter
bool clip = mapnik::get<bool>(sym_, keys::clip, feature_, vars_, false);
double simplify_tolerance = mapnik::get<double>(sym_, keys::simplify_tolerance, feature_, vars_, 0.0);
double smooth = mapnik::get<double>(sym_, keys::smooth, feature_, vars_, 0.0);
value_bool clip = mapnik::get<value_bool, keys::clip>(sym_, feature_, vars_);
value_double simplify_tolerance = mapnik::get<value_double, keys::simplify_tolerance>(sym_, feature_, vars_);
value_double smooth = mapnik::get<value_double, keys::smooth>(sym_, feature_, vars_);
if (clip) converter_.template set<clip_line_tag>(); //optional clip (default: true)
converter_.template set<transform_tag>(); //always transform
@ -299,7 +299,7 @@ text_symbolizer_helper::text_symbolizer_helper(
void text_symbolizer_helper::init_marker() const
{
std::string filename = mapnik::get<std::string>(sym_, keys::file, feature_, vars_);
std::string filename = mapnik::get<std::string,keys::file>(sym_, feature_, vars_);
if (filename.empty()) return;
boost::optional<mapnik::marker_ptr> marker = marker_cache::instance().find(filename, true);
if (!marker) return;
@ -323,9 +323,9 @@ void text_symbolizer_helper::init_marker() const
box2d<double> bbox(px0, py0, px1, py1);
bbox.expand_to_include(px2, py2);
bbox.expand_to_include(px3, py3);
bool unlock_image = mapnik::get<value_bool>(sym_, keys::unlock_image, feature_, vars_, false);
double shield_dx = mapnik::get<value_double>(sym_, keys::shield_dx, feature_, vars_, 0.0);
double shield_dy = mapnik::get<value_double>(sym_, keys::shield_dy, feature_, vars_, 0.0);
value_bool unlock_image = mapnik::get<value_bool, keys::unlock_image>(sym_, feature_, vars_);
value_double shield_dx = mapnik::get<value_double, keys::shield_dx>(sym_, feature_, vars_);
value_double shield_dy = mapnik::get<value_double, keys::shield_dy>(sym_, feature_, vars_);
pixel_position marker_displacement;
marker_displacement.set(shield_dx,shield_dy);
finder_.set_marker(std::make_shared<marker_info>(*marker, trans), bbox, unlock_image, marker_displacement);