added an attribute_collector visitor for glyph_symbolizer

This commit is contained in:
Alberto Valverde 2010-03-18 20:32:57 +00:00
parent d098c98c5e
commit be9f874bbc
2 changed files with 39 additions and 4 deletions

View File

@ -144,6 +144,44 @@ struct symbolizer_attributes : public boost::static_visitor<>
}
}
void operator () (glyph_symbolizer const& sym)
{
expression_ptr const& char_expr = sym.get_char();
if (char_expr)
{
expression_attributes f_attr(names_);
boost::apply_visitor(f_attr,*char_expr);
}
expression_ptr const& angle_expr = sym.get_angle();
if (angle_expr)
{
expression_attributes f_attr(names_);
boost::apply_visitor(f_attr,*angle_expr);
}
expression_ptr const& value_expr = sym.get_value();
if (value_expr)
{
expression_attributes f_attr(names_);
boost::apply_visitor(f_attr,*value_expr);
}
expression_ptr const& size_expr = sym.get_size();
if (size_expr)
{
expression_attributes f_attr(names_);
boost::apply_visitor(f_attr,*size_expr);
}
expression_ptr const& color_expr = sym.get_color();
if (color_expr)
{
expression_attributes f_attr(names_);
boost::apply_visitor(f_attr,*color_expr);
}
}
// TODO - support remaining syms
private:

View File

@ -50,12 +50,9 @@ def create_map_and_append_symbolyzer(sym):
_map = mapnik2.Map(256,256, srs)
style = mapnik2.Style()
rule = mapnik2.Rule()
#TODO Investigate why I need to add a filter which refers to the
# feature property that the symbolizer needs so they don't reach
# to it as nulls.
rule.filter = mapnik2.Filter('[azimuth]>=0 and [value]>=0') #XXX
rule.symbols.append(sym)
# put a test symbolizer to see what is the azimuth being read
ts = mapnik2.TextSymbolizer(mapnik2.Expression('[azimuth]'),
"DejaVu Sans Book",
10,