From fad6c614e86e656f42daa6ecb5d38ed6485473b3 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Tue, 13 Dec 2011 16:47:45 +0000 Subject: [PATCH] remove title, abstract data members from mapnik::rule --- bindings/python/mapnik_rule.cpp | 21 +++++---------------- include/mapnik/rule.hpp | 32 +------------------------------- src/load_map.cpp | 8 ++------ src/save_map.cpp | 6 +----- 4 files changed, 9 insertions(+), 58 deletions(-) diff --git a/bindings/python/mapnik_rule.cpp b/bindings/python/mapnik_rule.cpp index b226dc865..b6f3e4bc8 100644 --- a/bindings/python/mapnik_rule.cpp +++ b/bindings/python/mapnik_rule.cpp @@ -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(state[0])); - } - - if (state[1]) { rule dfl; std::string filter = extract(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",init<>("default constructor")) .def(init >()) + boost::python::optional >()) .def_pickle(rule_pickle_suite()) .add_property("name",make_function (&rule::get_name, return_value_policy()), &rule::set_name) - .add_property("title",make_function - (&rule::get_title,return_value_policy()), - &rule::set_title) - .add_property("abstract",make_function - (&rule::get_abstract,return_value_policy()), - &rule::set_abstract) .add_property("filter",make_function (&rule::get_filter,return_value_policy()), &rule::set_filter) diff --git a/include/mapnik/rule.hpp b/include/mapnik/rule.hpp index 9664d1173..eb5a02c7e 100644 --- a/include/mapnik/rule.hpp +++ b/include/mapnik/rule.hpp @@ -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::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::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_; diff --git a/src/load_map.cpp b/src/load_map.cpp index 37231b790..bbb2ee641 100644 --- a/src/load_map.cpp +++ b/src/load_map.cpp @@ -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 filter_expr = get_opt_child( r, "Filter"); diff --git a/src/save_map.cpp b/src/save_map.cpp index 862925fb1..ae237a1c9 100644 --- a/src/save_map.cpp +++ b/src/save_map.cpp @@ -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(