remove title, abstract data members from mapnik::rule

This commit is contained in:
Artem Pavlenko 2011-12-13 16:47:45 +00:00
parent bf9dd32e2c
commit fad6c614e8
4 changed files with 9 additions and 58 deletions

View file

@ -86,7 +86,7 @@ struct rule_pickle_suite : boost::python::pickle_suite
static boost::python::tuple
getinitargs(const rule& r)
{
return boost::python::make_tuple(r.get_name(),r.get_title(),r.get_min_scale(),r.get_max_scale());
return boost::python::make_tuple(r.get_name(),r.get_min_scale(),r.get_max_scale());
}
static boost::python::tuple
@ -102,7 +102,7 @@ struct rule_pickle_suite : boost::python::pickle_suite
// We serialize filter expressions AST as strings
std::string filter_expr = to_expression_string(*r.get_filter());
return boost::python::make_tuple(r.get_abstract(),filter_expr,r.has_else_filter(),r.has_also_filter(),syms);
return boost::python::make_tuple(filter_expr,r.has_else_filter(),r.has_also_filter(),syms);
}
static void
@ -119,11 +119,6 @@ struct rule_pickle_suite : boost::python::pickle_suite
}
if (state[0])
{
r.set_title(extract<std::string>(state[0]));
}
if (state[1])
{
rule dfl;
std::string filter = extract<std::string>(state[1]);
@ -134,12 +129,12 @@ struct rule_pickle_suite : boost::python::pickle_suite
}
}
if (state[2])
if (state[1])
{
r.set_else(true);
}
if (state[3])
if (state[2])
{
r.set_also(true);
}
@ -176,18 +171,12 @@ void export_rule()
class_<rule>("Rule",init<>("default constructor"))
.def(init<std::string const&,
boost::python::optional<std::string const&,double,double> >())
boost::python::optional<double,double> >())
.def_pickle(rule_pickle_suite())
.add_property("name",make_function
(&rule::get_name,
return_value_policy<copy_const_reference>()),
&rule::set_name)
.add_property("title",make_function
(&rule::get_title,return_value_policy<copy_const_reference>()),
&rule::set_title)
.add_property("abstract",make_function
(&rule::get_abstract,return_value_policy<copy_const_reference>()),
&rule::set_abstract)
.add_property("filter",make_function
(&rule::get_filter,return_value_policy<copy_const_reference>()),
&rule::set_filter)

View file

@ -132,8 +132,6 @@ public:
private:
std::string name_;
std::string title_;
std::string abstract_;
double min_scale_;
double max_scale_;
symbolizers syms_;
@ -143,8 +141,6 @@ private:
public:
rule()
: name_(),
title_(),
abstract_(),
min_scale_(0),
max_scale_(std::numeric_limits<double>::infinity()),
syms_(),
@ -153,11 +149,9 @@ public:
also_filter_(false) {}
rule(const std::string& name,
const std::string& title="",
double min_scale_denominator=0,
double max_scale_denominator=std::numeric_limits<double>::infinity())
: name_(name),
title_(title),
min_scale_(min_scale_denominator),
max_scale_(max_scale_denominator),
syms_(),
@ -167,8 +161,6 @@ public:
rule(const rule& rhs, bool deep_copy = false)
: name_(rhs.name_),
title_(rhs.title_),
abstract_(rhs.abstract_),
min_scale_(rhs.min_scale_),
max_scale_(rhs.max_scale_),
syms_(rhs.syms_),
@ -263,27 +255,7 @@ public:
{
return name_;
}
std::string const& get_title() const
{
return title_;
}
void set_title(std::string const& title)
{
title_=title;
}
void set_abstract(std::string const& abstract)
{
abstract_=abstract;
}
std::string const& get_abstract() const
{
return abstract_;
}
void append(const symbolizer& sym)
{
syms_.push_back(sym);
@ -362,8 +334,6 @@ private:
void swap(rule& rhs) throw()
{
name_=rhs.name_;
title_=rhs.title_;
abstract_=rhs.abstract_;
min_scale_=rhs.min_scale_;
max_scale_=rhs.max_scale_;
syms_=rhs.syms_;

View file

@ -577,8 +577,6 @@ void map_parser::parse_layer( Map & map, ptree const & lay )
s << "name,"
<< "srs,"
<< "status,"
<< "title,"
<< "abstract,"
<< "minzoom,"
<< "maxzoom,"
<< "queryable,"
@ -753,14 +751,12 @@ void map_parser::parse_layer( Map & map, ptree const & lay )
void map_parser::parse_rule( feature_type_style & style, ptree const & r )
{
ensure_attrs(r, "Rule", "name,title");
ensure_attrs(r, "Rule", "name");
std::string name;
try
{
name = get_attr( r, "name", std::string());
std::string title = get_attr( r, "title", std::string());
rule rule(name,title);
rule rule(name);
optional<std::string> filter_expr =
get_opt_child<std::string>( r, "Filter");

View file

@ -647,11 +647,7 @@ void serialize_rule( ptree & style_node, const rule & r, bool explicit_defaults)
{
set_attr(rule_node, "name", r.get_name());
}
if ( r.get_title() != dfl.get_title() )
{
set_attr(rule_node, "title", r.get_title());
}
if ( r.has_else_filter() )
{
rule_node.push_back( ptree::value_type(