Merge branch 'master' of github.com:mapnik/mapnik

This commit is contained in:
Dane Springmeyer 2012-03-02 18:47:11 -08:00
commit e622c9548d
2 changed files with 8 additions and 6 deletions

View file

@ -453,6 +453,12 @@ inline boost::optional<color> get_optional(boost::property_tree::ptree const& no
return result;
}
static inline bool has_child(boost::property_tree::ptree const& node, std::string const& name)
{
boost::optional<std::string> str = node.get_optional<std::string>(name);
return str;
}
} // end of namespace mapnik
#endif // MAPNIK_PTREE_HELPERS_HPP

View file

@ -841,16 +841,12 @@ void map_parser::parse_rule( feature_type_style & style, ptree const & r )
rule.set_filter(parse_expr(*filter_expr));
}
optional<std::string> else_filter =
get_opt_child<std::string>(r, "ElseFilter");
if (else_filter)
if (has_child(r, "ElseFilter"))
{
rule.set_else(true);
}
optional<std::string> also_filter =
get_opt_child<std::string>(r, "AlsoFilter");
if (also_filter)
if (has_child(r, "AlsoFilter"))
{
rule.set_also(true);
}