Merge branch 'master' into python-textplacement

Conflicts:
	include/mapnik/formatting/list.hpp
This commit is contained in:
Hermann Kraus 2012-02-12 22:58:02 +01:00
commit d3e191ff73
9 changed files with 48 additions and 43 deletions

View file

@ -19,8 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
#ifndef FORMATING_BASE_HPP
#define FORMATING_BASE_HPP
#ifndef FORMATTING_BASE_HPP
#define FORMATTING_BASE_HPP
// mapnik
#include <mapnik/feature.hpp>
@ -38,7 +38,7 @@ typedef std::set<expression_ptr> expression_set;
class processed_text;
struct char_properties;
namespace formating {
namespace formatting {
class node;
typedef boost::shared_ptr<node> node_ptr;
@ -52,6 +52,6 @@ public:
virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const = 0;
virtual void add_expressions(expression_set &output) const;
};
} //ns formating
} //ns formatting
} //ns mapnik
#endif // FORMATING_BASE_HPP
#endif // FORMATTING_BASE_HPP

View file

@ -20,14 +20,14 @@
*
*****************************************************************************/
#ifndef FORMAT_HPP
#define FORMAT_HPP
#ifndef FORMATTING_FORMAT_HPP
#define FORMATTING_FORMAT_HPP
#include <mapnik/formating/base.hpp>
#include <mapnik/formatting/base.hpp>
#include <mapnik/text_properties.hpp>
namespace mapnik {
namespace formating {
namespace formatting {
class format_node: public node {
public:
void to_xml(boost::property_tree::ptree &xml) const;
@ -53,7 +53,7 @@ public:
private:
node_ptr child_;
};
} //ns formating
} //ns formatting
} //ns mapnik
#endif // FORMAT_HPP
#endif // FORMATTING_FORMAT_HPP

View file

@ -19,13 +19,13 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
#ifndef FORMATING_LIST_HPP
#define FORMATING_LIST_HPP
#ifndef FORMATTING_LIST_HPP
#define FORMATTING_LIST_HPP
#include <mapnik/formating/base.hpp>
#include <mapnik/formatting/base.hpp>
namespace mapnik {
namespace formating {
namespace formatting {
class list_node: public node {
public:
list_node() : node(), children_() {}
@ -40,7 +40,8 @@ public:
protected:
std::vector<node_ptr> children_;
};
} //ns formating
} //ns formatting
} //ns mapnik
#endif // FORMATING_LIST_HPP
#endif // FORMATTING_LIST_HPP

View file

@ -19,13 +19,13 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
#ifndef TEXT_HPP
#define TEXT_HPP
#ifndef FORMATTING_TEXT_HPP
#define FORMATTING_TEXT_HPP
#include <mapnik/formating/base.hpp>
#include <mapnik/formatting/base.hpp>
namespace mapnik {
namespace formating {
namespace formatting {
class text_node: public node {
public:
text_node(expression_ptr text): node(), text_(text) {}
@ -40,7 +40,7 @@ public:
private:
expression_ptr text_;
};
} //ns formating
} //ns formatting
} //ns mapnik
#endif // TEXT_HPP
#endif // FORMATTING_TEXT_HPP

View file

@ -25,7 +25,7 @@
// mapnik
#include <mapnik/text_properties.hpp>
#include <mapnik/formating/base.hpp>
#include <mapnik/formatting/base.hpp>
#include <mapnik/text_path.hpp> //TODO: Remove this again after text_placement_info::placements is moved to a better place.
// stl

View file

@ -27,7 +27,7 @@
#include <mapnik/font_set.hpp>
#include <mapnik/enumeration.hpp>
#include <mapnik/expression.hpp>
#include <mapnik/formating/base.hpp>
#include <mapnik/formatting/base.hpp>
// stl
#include <map>
@ -117,7 +117,7 @@ typedef std::pair<double, double> position;
class processed_text;
/** Contains all text symbolizer properties which are not directly related to text formating. */
/** Contains all text symbolizer properties which are not directly related to text formatting. */
struct text_symbolizer_properties
{
text_symbolizer_properties();
@ -133,9 +133,9 @@ struct text_symbolizer_properties
/** Automatically create processing instructions for a single expression. */
void set_old_style_expression(expression_ptr expr);
/** Sets new format tree. */
void set_format_tree(formating::node_ptr tree);
void set_format_tree(formatting::node_ptr tree);
/** Get format tree. */
formating::node_ptr format_tree() const;
formatting::node_ptr format_tree() const;
/** Get a list of all expressions used in any placement.
* This function is used to collect attributes. */
void add_expressions(expression_set &output) const;
@ -164,8 +164,8 @@ struct text_symbolizer_properties
/** Default values for char_properties. */
char_properties default_format;
private:
/** A tree of formating::nodes which contain text and formating information. */
formating::node_ptr tree_;
/** A tree of formatting::nodes which contain text and formatting information. */
formatting::node_ptr tree_;
};
} //ns mapnik

View file

@ -1355,7 +1355,9 @@ void map_parser::parse_shield_symbolizer( rule & rule, ptree const & sym )
}
placement_finder->properties.from_xml(sym, fontsets_);
if (strict_) ensure_font_face(placement_finder->properties.default_format.face_name);
if (strict_ &&
!placement_finder->properties.default_format.fontset.size())
ensure_font_face(placement_finder->properties.default_format.face_name);
if (list) {
ptree::const_iterator symIter = sym.begin();
ptree::const_iterator endSym = sym.end();
@ -1369,7 +1371,9 @@ void map_parser::parse_shield_symbolizer( rule & rule, ptree const & sym )
ensure_attrs(symIter->second, "TextSymbolizer/Placement", s_common);
text_symbolizer_properties & p = list->add();
p.from_xml(symIter->second, fontsets_);
if (strict_) ensure_font_face(p.default_format.face_name);
if (strict_&&
!placement_finder->properties.default_format.fontset.size())
ensure_font_face(p.default_format.face_name);
}
}

View file

@ -25,7 +25,7 @@
#include <mapnik/text_placements/dummy.hpp>
#include <mapnik/expression_string.hpp>
#include <mapnik/ptree_helpers.hpp>
#include <mapnik/formating/text.hpp>
#include <mapnik/formatting/text.hpp>
#include <mapnik/processed_text.hpp>
#include <boost/tuple/tuple.hpp>
@ -71,17 +71,17 @@ void text_symbolizer_properties::process(processed_text &output, Feature const&
tree_->apply(default_format, feature, output);
} else {
#ifdef MAPNIK_DEBUG
std::cerr << "Warning: text_symbolizer_properties can't produce text: No formating tree!\n";
std::cerr << "Warning: text_symbolizer_properties can't produce text: No formatting tree!\n";
#endif
}
}
void text_symbolizer_properties::set_format_tree(formating::node_ptr tree)
void text_symbolizer_properties::set_format_tree(formatting::node_ptr tree)
{
tree_ = tree;
}
formating::node_ptr text_symbolizer_properties::format_tree() const
formatting::node_ptr text_symbolizer_properties::format_tree() const
{
return tree_;
}
@ -131,7 +131,7 @@ void text_symbolizer_properties::from_xml(boost::property_tree::ptree const &sym
}
default_format.from_xml(sym, fontsets);
formating::node_ptr n(formating::node::from_xml(sym));
formatting::node_ptr n(formatting::node::from_xml(sym));
if (n) set_format_tree(n);
}
@ -226,7 +226,7 @@ void text_symbolizer_properties::add_expressions(expression_set &output) const
void text_symbolizer_properties::set_old_style_expression(expression_ptr expr)
{
tree_ = formating::node_ptr(new formating::text_node(expr));
tree_ = formatting::node_ptr(new formatting::text_node(expr));
}
char_properties::char_properties() :

View file

@ -19,9 +19,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
#include <mapnik/formating/text.hpp>
#include <mapnik/formating/list.hpp>
#include <mapnik/formating/format.hpp>
#include <mapnik/formatting/text.hpp>
#include <mapnik/formatting/list.hpp>
#include <mapnik/formatting/format.hpp>
#include <mapnik/processed_text.hpp>
#include <mapnik/color.hpp>
#include <mapnik/feature.hpp>
@ -40,7 +40,7 @@ namespace mapnik {
using boost::property_tree::ptree;
using boost::optional;
namespace formating {
namespace formatting {
void node::to_xml(boost::property_tree::ptree &xml) const
{
@ -283,7 +283,7 @@ void format_node::add_expressions(expression_set &output) const
if (child_) child_->add_expressions(output);
}
} //namespace formating
} //namespace formatting
/************************************************************/