From 3f040a3422a3019219d969a8ba7e728bae2cd8e4 Mon Sep 17 00:00:00 2001 From: artemp Date: Wed, 2 Jul 2014 10:29:05 +0100 Subject: [PATCH] set_symbolizer_property : specialization for transform_type --- src/load_map.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/load_map.cpp b/src/load_map.cpp index 2fb09d51a..f181362f7 100644 --- a/src/load_map.cpp +++ b/src/load_map.cpp @@ -860,7 +860,7 @@ struct set_symbolizer_property_impl { // try parsing as an expression optional val = node.get_opt_attr(name); - if (val && *val) put(sym, key, *val); + if (val) put(sym, key, *val); else { ex.append_context(std::string("set_symbolizer_property '") + name + "'", node); @@ -870,6 +870,17 @@ struct set_symbolizer_property_impl } }; +template +struct set_symbolizer_property_impl +{ + static void apply(Symbolizer & sym, keys key, xml_node const & node) + { + std::string const& name = std::get<0>(get_meta(key)); + optional transform = node.get_opt_attr(name); + if (transform) put(sym, key, mapnik::parse_transform(*transform)); + } +}; + template struct set_symbolizer_property_impl { @@ -891,9 +902,8 @@ struct set_symbolizer_property_impl else { optional val = node.get_opt_attr(name); - if (val && *val) + if (val) { - std::cerr << *val << std::endl; put(sym, key, *val); } else @@ -920,13 +930,10 @@ void set_symbolizer_property(Symbolizer & sym, keys key, xml_node const& node) void map_parser::parse_symbolizer_base(symbolizer_base &sym, xml_node const& node) { + // comp-op set_symbolizer_property(sym, keys::comp_op, node); - optional geometry_transform_wkt = node.get_opt_attr("geometry-transform"); - if (geometry_transform_wkt) - { - put(sym, keys::geometry_transform, mapnik::parse_transform(*geometry_transform_wkt)); - } - + // geometry transform + set_symbolizer_property(sym, keys::geometry_transform, node); // clip set_symbolizer_property(sym, keys::clip, node); // simplify algorithm