mirror of
https://github.com/mapnik/mapnik.git
synced 2025-12-08 20:13:09 +00:00
add 0.7.2 forward compatibility with mapnik 2.x text/shield symbolizer change (although this is only a deprecation warning in 2.0.0) - closes #898
This commit is contained in:
parent
75813f71c0
commit
93ffb4c694
@ -894,7 +894,16 @@ void map_parser::parse_text_symbolizer( rule_type & rule, ptree const & sym )
|
||||
{
|
||||
try
|
||||
{
|
||||
std::string name = get_attr<string>(sym, "name");
|
||||
std::string name;
|
||||
// mapnik2 forward compatibility
|
||||
optional<std::string> old_name = get_opt_attr<std::string>(sym, "name");
|
||||
if (old_name) {
|
||||
//std::clog << ": ### WARNING: Using 'name' in TextSymbolizer is deprecated (http://trac.mapnik.org/wiki/TextSymbolizer)\n";
|
||||
name = *old_name;
|
||||
} else {
|
||||
name = get_own<std::string>(sym, "TextSymbolizer");
|
||||
if (name.empty()) throw config_error(std::string("TextSymbolizer needs a non-empty text"));
|
||||
}
|
||||
|
||||
// mapnik2 forward compatibility
|
||||
if (boost::algorithm::istarts_with(name,"[") && boost::algorithm::iends_with(name,"]"))
|
||||
@ -1118,7 +1127,18 @@ void map_parser::parse_shield_symbolizer( rule_type & rule, ptree const & sym )
|
||||
{
|
||||
try
|
||||
{
|
||||
std::string name = get_attr<string>(sym, "name");
|
||||
// mapnik2 forward compatibility
|
||||
std::string name;
|
||||
optional<std::string> old_name = get_opt_attr<std::string>(sym, "name");
|
||||
optional<boolean> no_text = get_opt_attr<boolean>(sym, "no-text");
|
||||
if (old_name) {
|
||||
//std::clog << ": ### WARNING: Using 'name' in ShieldSymbolizer is deprecated (http://trac.mapnik.org/wiki/TextSymbolizer)\n";
|
||||
name = *old_name;
|
||||
} else {
|
||||
name = get_own<std::string>(sym, "ShieldSymbolizer");
|
||||
if (name.empty() && (!no_text || !*no_text) ) throw config_error(std::string("ShieldSymbolizer needs a non-empty text"));
|
||||
if (name.empty()) throw config_error(std::string("ShieldSymbolizer needs a non-empty text"));
|
||||
}
|
||||
|
||||
// mapnik2 forward compatibility
|
||||
if (boost::algorithm::istarts_with(name,"[") && boost::algorithm::iends_with(name,"]"))
|
||||
@ -1341,8 +1361,6 @@ void map_parser::parse_shield_symbolizer( rule_type & rule, ptree const & sym )
|
||||
}
|
||||
|
||||
// no text
|
||||
optional<boolean> no_text =
|
||||
get_opt_attr<boolean>(sym, "no_text", "no-text");
|
||||
if (no_text)
|
||||
{
|
||||
shield_symbol.set_no_text( * no_text );
|
||||
|
||||
@ -249,7 +249,10 @@ namespace mapnik
|
||||
{
|
||||
const std::string & name = sym.get_name();
|
||||
if ( ! name.empty() ) {
|
||||
set_attr( node, "name", name );
|
||||
//set_attr( node, "name", name );
|
||||
// mapnik2 forward compatibility
|
||||
ptree& text_node = node.push_back(ptree::value_type("<xmltext>", ptree()))->second;
|
||||
text_node.put_own(name);
|
||||
}
|
||||
const std::string & face_name = sym.get_face_name();
|
||||
if ( ! face_name.empty() ) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user