diff --git a/include/mapnik/symbolizer_utils.hpp b/include/mapnik/symbolizer_utils.hpp index eb19641a6..d6bdd8939 100644 --- a/include/mapnik/symbolizer_utils.hpp +++ b/include/mapnik/symbolizer_utils.hpp @@ -314,8 +314,6 @@ inline void set_property(Symbolizer & sym, mapnik::keys key, T const& val) } } - - template inline void set_property_from_value(Symbolizer & sym, mapnik::keys key, T const& val) { @@ -371,7 +369,6 @@ struct set_symbolizer_property_impl } else { - ex.append_context(std::string("set_symbolizer_property '") + name + "'", node); throw; } } @@ -436,54 +433,46 @@ struct set_symbolizer_property_impl static void apply(Symbolizer & sym, keys key, std::string const& name, xml_node const & node) { using value_type = T; - try + boost::optional enum_str = node.get_opt_attr(name); + if (enum_str) { - boost::optional enum_str = node.get_opt_attr(name); - if (enum_str) + boost::optional enum_val = detail::enum_traits::from_string(*enum_str); + if (enum_val) { - boost::optional enum_val = detail::enum_traits::from_string(*enum_str); - if (enum_val) + put(sym, key, *enum_val); + } + else + { + boost::optional val = node.get_opt_attr(name); + if (val) { - put(sym, key, *enum_val); - } - else - { - boost::optional val = node.get_opt_attr(name); - if (val) + // first try pre-evaluating expression + auto result = pre_evaluate_expression(*val); + if (std::get<1>(result)) { - // first try pre-evaluating expression - auto result = pre_evaluate_expression(*val); - if (std::get<1>(result)) + boost::optional enum_val = detail::enum_traits::from_string(std::get<0>(result).to_string()); + if (enum_val) { - boost::optional enum_val = detail::enum_traits::from_string(std::get<0>(result).to_string()); - if (enum_val) - { - put(sym, key, *enum_val); - } - else - { - // can't evaluate - throw config_error("failed to parse symbolizer property: '" + name + "'"); - } + put(sym, key, *enum_val); } else { - // put expression_ptr - put(sym, key, *val); + // can't evaluate + throw config_error("failed to parse '" + name + "'"); } } else { - throw config_error("failed to parse symbolizer property: '" + name + "'"); + // put expression_ptr + put(sym, key, *val); } } + else + { + throw config_error("failed to parse '" + name + "'"); + } } } - catch (config_error const& ex) - { - ex.append_context(std::string("set_symbolizer_property '") + name + "'", node); - throw; - } } };