diff --git a/bindings/python/mapnik_text_placement.cpp b/bindings/python/mapnik_text_placement.cpp index cf39f136c..7abf019d9 100644 --- a/bindings/python/mapnik_text_placement.cpp +++ b/bindings/python/mapnik_text_placement.cpp @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/include/mapnik/text/formatting/expression_format.hpp b/include/mapnik/text/formatting/expression_format.hpp deleted file mode 100644 index 9c75571e3..000000000 --- a/include/mapnik/text/formatting/expression_format.hpp +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2012 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -#ifndef FORMATTING_EXPRESSION_HPP -#define FORMATTING_EXPRESSION_HPP - -#include -#include - -// boost -#include - -namespace mapnik { - -class feature_impl; -class xml_node; -struct char_properties; - -namespace formatting { -class MAPNIK_DECL expression_format: public node -{ -public: - void to_xml(boost::property_tree::ptree &xml) const; - static node_ptr from_xml(xml_node const& xml); - virtual void apply(char_properties_ptr p, feature_impl const& feature, attributes const& vars, text_layout &output) const; - virtual void add_expressions(expression_set &output) const; - - void set_child(node_ptr child); - node_ptr get_child() const; - - expression_ptr face_name; - expression_ptr text_size; - expression_ptr character_spacing; - expression_ptr line_spacing; - expression_ptr text_opacity; - expression_ptr wrap_char; - expression_ptr fill; - expression_ptr halo_fill; - expression_ptr halo_radius; - -private: - node_ptr child_; - static expression_ptr get_expression(xml_node const& xml, std::string name); -}; -} //ns formatting -} //ns mapnik -#endif // FORMATTING_EXPRESSION_HPP diff --git a/src/build.py b/src/build.py index 14d674f20..9b4341a12 100644 --- a/src/build.py +++ b/src/build.py @@ -213,7 +213,6 @@ source = Split( text/symbolizer_helpers.cpp text/text_properties.cpp text/formatting/base.cpp - text/formatting/expression.cpp text/formatting/list.cpp text/formatting/text.cpp text/formatting/format.cpp diff --git a/src/text/formatting/expression.cpp b/src/text/formatting/expression.cpp deleted file mode 100644 index 899a44a79..000000000 --- a/src/text/formatting/expression.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2012 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -// mapnik -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//boost -#include - -namespace mapnik { -namespace formatting { - -using boost::property_tree::ptree; -void expression_format::to_xml(boost::property_tree::ptree &xml) const -{ - ptree &new_node = xml.push_back(ptree::value_type("ExpressionFormat", ptree()))->second; - if (face_name) set_attr(new_node, "face-name", to_expression_string(*face_name)); - if (text_size) set_attr(new_node, "size", to_expression_string(*text_size)); - if (character_spacing) set_attr(new_node, "character-spacing", to_expression_string(*character_spacing)); - if (line_spacing) set_attr(new_node, "line-spacing", to_expression_string(*line_spacing)); - if (text_opacity) set_attr(new_node, "opacity", to_expression_string(*text_opacity)); - if (wrap_char) set_attr(new_node, "wrap-character", to_expression_string(*wrap_char)); - if (fill) set_attr(new_node, "fill", to_expression_string(*fill)); - if (halo_fill) set_attr(new_node, "halo-fill", to_expression_string(*halo_fill)); - if (halo_radius) set_attr(new_node, "halo-radius", to_expression_string(*halo_radius)); - if (child_) child_->to_xml(new_node); -} - -node_ptr expression_format::from_xml(xml_node const& xml) -{ - expression_format *n = new expression_format(); - node_ptr np(n); - - node_ptr child = node::from_xml(xml); - n->set_child(child); - - n->face_name = get_expression(xml, "face-name"); - n->text_size = get_expression(xml, "size"); - n->character_spacing = get_expression(xml, "character-spacing"); - n->line_spacing = get_expression(xml, "line-spacing"); - n->text_opacity = get_expression(xml, "opacity"); - n->wrap_char = get_expression(xml, "wrap-character"); - n->fill = get_expression(xml, "fill"); - n->halo_fill = get_expression(xml, "halo-fill"); - n->halo_radius = get_expression(xml, "halo-radius"); - return np; -} - -expression_ptr expression_format::get_expression(xml_node const& xml, std::string name) -{ - boost::optional tmp = xml.get_opt_attr(name); - if (tmp) return *tmp; - return expression_ptr(); -} - -void expression_format::apply(char_properties_ptr p, feature_impl const& feature, attributes const& vars, text_layout &output) const -{ - char_properties_ptr new_properties = std::make_shared(*p); - if (face_name) new_properties->face_name = - boost::apply_visitor(evaluate(feature,vars), *face_name).to_string(); - if (text_size) new_properties->text_size = - boost::apply_visitor(evaluate(feature,vars), *text_size).to_double(); - if (character_spacing) new_properties->character_spacing = - boost::apply_visitor(evaluate(feature,vars), *character_spacing).to_double(); - if (line_spacing) new_properties->line_spacing = - boost::apply_visitor(evaluate(feature,vars), *line_spacing).to_double(); - if (text_opacity) new_properties->text_opacity = - boost::apply_visitor(evaluate(feature,vars), *text_opacity).to_double(); - if (wrap_char) new_properties->wrap_char = - boost::apply_visitor(evaluate(feature,vars), *character_spacing).to_unicode()[0]; - if (fill) new_properties->fill = parse_color( - boost::apply_visitor(evaluate(feature,vars), *fill).to_string()); - if (halo_fill) new_properties->halo_fill = parse_color( - boost::apply_visitor(evaluate(feature,vars), *halo_fill).to_string()); - if (halo_radius) new_properties->halo_radius = - boost::apply_visitor(evaluate(feature,vars), *halo_radius).to_double(); - - if (child_) { - child_->apply(new_properties, feature, vars, output); - } else { - MAPNIK_LOG_WARN(expression) << "Useless format: No text to format"; - } -} - - -void expression_format::set_child(node_ptr child) -{ - child_ = child; -} - - -node_ptr expression_format::get_child() const -{ - return child_; -} - -void expression_format::add_expressions(expression_set &output) const -{ - if (child_) child_->add_expressions(output); - output.insert(face_name); - output.insert(text_size); - output.insert(character_spacing); - output.insert(line_spacing); - output.insert(text_opacity); - output.insert(wrap_char); - output.insert(fill); - output.insert(halo_fill); - output.insert(halo_radius); -} - -} //ns formatting -} //ns mapnik diff --git a/src/text/formatting/registry.cpp b/src/text/formatting/registry.cpp index e3edd10d0..f0bcc282e 100644 --- a/src/text/formatting/registry.cpp +++ b/src/text/formatting/registry.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -37,7 +36,6 @@ registry::registry() { register_name("", &text_node::from_xml); register_name("Format", &format_node::from_xml); - register_name("ExpressionFormat", &expression_format::from_xml); register_name("Layout", &layout_node::from_xml); }