repair serialization of XML filters and Text/ShieldSymbolizer 'name' attribute, which are how properly converted from expressions into strings

This commit is contained in:
Dane Springmeyer 2010-01-30 00:47:06 +00:00
parent c6a29690ce
commit aef4d350be

View file

@ -231,18 +231,16 @@ namespace mapnik
serialize_symbolizer(); serialize_symbolizer();
void add_image_attributes(ptree & node, const symbolizer_with_image & sym) void add_image_attributes(ptree & node, const symbolizer_with_image & sym)
{ {
std::string filename = path_processor_type::to_string( *sym.get_filename()); const std::string & filename = path_processor_type::to_string( *sym.get_filename());
// FIXME pls if ( ! filename.empty() ) {
//if ( ! filename.empty() ) {
set_attr( node, "file", filename ); set_attr( node, "file", filename );
//set_attr( node, "type", guess_type( filename ) ); }
//}
} }
void add_font_attributes(ptree & node, const text_symbolizer & sym) void add_font_attributes(ptree & node, const text_symbolizer & sym)
{ {
std::string name = to_expression_string(sym.get_name()); expression_ptr const& expr = sym.get_name();
const std::string & name = to_expression_string(*expr);
//const std::string & name = sym.get_name();
if ( ! name.empty() ) { if ( ! name.empty() ) {
set_attr( node, "name", name ); set_attr( node, "name", name );
} }
@ -378,17 +376,17 @@ namespace mapnik
} }
else else
{ {
// filters are not comparable, so compare strings for now // filters were not comparable, perhaps should now compare expressions?
// TODO !!!!! expression_ptr const& expr = rule.get_filter();
/* std::string filter = mapnik::to_expression_string(*expr);
std::string filter = rule.get_filter()->to_string(); std::clog << "filter=" << filter << "\n";
std::string default_filter = dfl.get_filter()->to_string(); std::string default_filter = mapnik::to_expression_string(*dfl.get_filter());
if ( filter != default_filter) if ( filter != default_filter)
{ {
rule_node.push_back( ptree::value_type( rule_node.push_back( ptree::value_type(
"Filter", ptree()))->second.put_value( filter ); "Filter", ptree()))->second.put_value( filter );
} }
*/
} }
if (rule.get_min_scale() != dfl.get_min_scale() ) if (rule.get_min_scale() != dfl.get_min_scale() )