Last Summer of Code changes: Support metawriter in upgrade_map_xml.py, fix attribute collector.

This commit is contained in:
Hermann Kraus 2010-08-16 19:14:21 +00:00
parent 55d9bf3290
commit d3bb11456f
3 changed files with 29 additions and 2 deletions

View file

@ -120,6 +120,11 @@ struct symbolizer_attributes : public boost::static_visitor<>
}
void operator () (line_symbolizer const& sym)
{
collect_metawriter(sym);
}
void operator () (line_pattern_symbolizer const& sym)
{
path_expression_ptr const& filename_expr = sym.get_filename();
@ -130,6 +135,11 @@ struct symbolizer_attributes : public boost::static_visitor<>
collect_metawriter(sym);
}
void operator () (polygon_symbolizer const& sym)
{
collect_metawriter(sym);
}
void operator () (polygon_pattern_symbolizer const& sym)
{
path_expression_ptr const& filename_expr = sym.get_filename();
@ -195,6 +205,16 @@ struct symbolizer_attributes : public boost::static_visitor<>
}
collect_metawriter(sym);
}
void operator () (markers_symbolizer const& sym)
{
collect_metawriter(sym);
}
void operator () (building_symbolizer const& sym)
{
collect_metawriter(sym);
}
// TODO - support remaining syms
private:

View file

@ -114,9 +114,9 @@ void metawriter_json_stream::write_properties(Feature const& feature, metawriter
{
//Property found
text = boost::replace_all_copy(boost::replace_all_copy(itr->second.to_string(), "\\", "\\\\"), "\"", "\\\"");
if (i++) *f_ << ",";
*f_ << "\n \"" << p << "\":\"" << text << "\"";
}
if (i++) *f_ << ",";
*f_ << "\n \"" << p << "\":\"" << text << "\"";
}
*f_ << "\n} }";

View file

@ -24,6 +24,13 @@ def fixup_sym_attributes(sym):
if not hasattr(sym,'CssParameter'):
return
attrib = {}
metawriter = sym.attrib.get('meta-writer')
if metawriter:
attrib['meta-writer'] = metawriter
metaoutput = sym.attrib.get('meta-output')
if metaoutput:
attrib['meta-output'] = metaoutput
for css in sym.CssParameter:
key = css.attrib.get('name')
value = css.text