Skip to content

Commit

Permalink
Merge branch 'textplacement-rename'
Browse files Browse the repository at this point in the history
  • Loading branch information
herm committed Feb 12, 2012
2 parents 57b8354 + 52702d3 commit afb2eed
Show file tree
Hide file tree
Showing 39 changed files with 695 additions and 498 deletions.
2 changes: 1 addition & 1 deletion bindings/python/mapnik_expression.cpp
Expand Up @@ -24,7 +24,7 @@
#include <boost/python.hpp>
// mapnik
#include <mapnik/feature.hpp>
#include <mapnik/filter_factory.hpp>
#include <mapnik/expression.hpp>
#include <mapnik/expression_string.hpp>
#include <mapnik/expression_evaluator.hpp>
#include <mapnik/parse_path.hpp>
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/mapnik_rule.cpp
Expand Up @@ -27,7 +27,7 @@
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>

#include <mapnik/rule.hpp>
#include <mapnik/filter_factory.hpp>
#include <mapnik/expression.hpp>
#include <mapnik/expression_string.hpp>

using mapnik::rule;
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/mapnik_text_placement.cpp
Expand Up @@ -23,7 +23,7 @@

#include <boost/python.hpp>

#include <mapnik/text_placements.hpp>
#include <mapnik/text_properties.hpp>
#include "mapnik_enumeration.hpp"
#include <mapnik/expression_string.hpp>

Expand Down
3 changes: 1 addition & 2 deletions demo/c++/rundemo.cpp
Expand Up @@ -19,13 +19,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
// $Id$

#include <mapnik/map.hpp>
#include <mapnik/datasource_cache.hpp>
#include <mapnik/font_engine_freetype.hpp>
#include <mapnik/agg_renderer.hpp>
#include <mapnik/filter_factory.hpp>
#include <mapnik/expression.hpp>
#include <mapnik/color_factory.hpp>
#include <mapnik/image_util.hpp>
#include <mapnik/config_error.hpp>
Expand Down
2 changes: 1 addition & 1 deletion include/mapnik/building_symbolizer.hpp
Expand Up @@ -26,7 +26,7 @@
// mapnik
#include <mapnik/color.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/filter_factory.hpp>
#include <mapnik/expression.hpp>

namespace mapnik
{
Expand Down
2 changes: 1 addition & 1 deletion include/mapnik/config_error.hpp
Expand Up @@ -37,7 +37,7 @@ class config_error : public std::exception
what_( what )
{
}
virtual ~config_error() throw() {};
virtual ~config_error() throw() {}

virtual const char * what() const throw()
{
Expand Down
Expand Up @@ -20,8 +20,8 @@
*
*****************************************************************************/

#ifndef MAPNIK_FILTER_FACTORY_HPP
#define MAPNIK_FILTER_FACTORY_HPP
#ifndef MAPNIK_EXPRESSION_HPP
#define MAPNIK_EXPRESSION_HPP

// mapnik
#include <mapnik/config.hpp>
Expand All @@ -40,4 +40,4 @@ MAPNIK_DECL expression_ptr parse_expression (std::string const& wkt);

}

#endif // MAPNIK_FILTER_FACTORY_HPP
#endif // MAPNIK_EXPRESSION_HPP
57 changes: 57 additions & 0 deletions include/mapnik/formating/base.hpp
@@ -0,0 +1,57 @@
/*****************************************************************************
*
* 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 FORMATING_BASE_HPP
#define FORMATING_BASE_HPP

// mapnik
#include <mapnik/feature.hpp>
#include <mapnik/expression.hpp>

// stl
#include <set>

// boost
#include <boost/property_tree/ptree.hpp>

namespace mapnik {

typedef std::set<expression_ptr> expression_set;
class processed_text;
struct char_properties;

namespace formating {

class node;
typedef boost::shared_ptr<node> node_ptr;

class node
{
public:
virtual ~node() {}
virtual void to_xml(boost::property_tree::ptree &xml) const;
static node_ptr from_xml(boost::property_tree::ptree const& xml);
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 mapnik
#endif // FORMATING_BASE_HPP
59 changes: 59 additions & 0 deletions include/mapnik/formating/format.hpp
@@ -0,0 +1,59 @@
/*****************************************************************************
*
* 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 FORMAT_HPP
#define FORMAT_HPP

#include <mapnik/formating/base.hpp>
#include <mapnik/text_properties.hpp>

namespace mapnik {
namespace formating {
class format_node: public node {
public:
void to_xml(boost::property_tree::ptree &xml) const;
static node_ptr from_xml(boost::property_tree::ptree const& xml);
virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const;
virtual void add_expressions(expression_set &output) const;

void set_child(node_ptr child);
node_ptr get_child() const;

boost::optional<std::string> face_name;
boost::optional<unsigned> text_size;
boost::optional<unsigned> character_spacing;
boost::optional<unsigned> line_spacing;
boost::optional<double> text_opacity;
boost::optional<bool> wrap_before;
boost::optional<unsigned> wrap_char;
boost::optional<text_transform_e> text_transform;
boost::optional<color> fill;
boost::optional<color> halo_fill;
boost::optional<double> halo_radius;

private:
node_ptr child_;
};
} //ns formating
} //ns mapnik

#endif // FORMAT_HPP
46 changes: 46 additions & 0 deletions include/mapnik/formating/list.hpp
@@ -0,0 +1,46 @@
/*****************************************************************************
*
* 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 LIST_HPP
#define LIST_HPP

#include <mapnik/formating/base.hpp>

namespace mapnik {
namespace formating {
class list_node: public node {
public:
list_node() : node(), children_() {}
virtual void to_xml(boost::property_tree::ptree &xml) const;
virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const;
virtual void add_expressions(expression_set &output) const;

void push_back(node_ptr n);
void set_children(std::vector<node_ptr> const& children);
std::vector<node_ptr> const& get_children() const;
void clear();
private:
std::vector<node_ptr> children_;
};
} //ns formating
} //ns mapnik

#endif // LIST_HPP
46 changes: 46 additions & 0 deletions include/mapnik/formating/text.hpp
@@ -0,0 +1,46 @@
/*****************************************************************************
*
* 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 TEXT_HPP
#define TEXT_HPP

#include <mapnik/formating/base.hpp>

namespace mapnik {
namespace formating {
class text_node: public node {
public:
text_node(expression_ptr text): node(), text_(text) {}
text_node(std::string text): node(), text_(parse_expression(text)) {}
void to_xml(boost::property_tree::ptree &xml) const;
static node_ptr from_xml(boost::property_tree::ptree const& xml);
virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const;
virtual void add_expressions(expression_set &output) const;

void set_text(expression_ptr text);
expression_ptr get_text() const;
private:
expression_ptr text_;
};
} //ns formating
} //ns mapnik

#endif // TEXT_HPP
8 changes: 4 additions & 4 deletions include/mapnik/metawriter.hpp
Expand Up @@ -77,7 +77,7 @@ class metawriter_properties : public std::set<std::string>
{
public:
metawriter_properties(boost::optional<std::string> str);
metawriter_properties() {};
metawriter_properties() {}
template <class InputIterator> metawriter_properties(
InputIterator first, InputIterator last) : std::set<std::string>(first, last) {}
std::string to_string() const;
Expand All @@ -92,7 +92,7 @@ class metawriter
dflt_properties_(dflt_properties),
width_(0),
height_(0) {}
virtual ~metawriter() {};
virtual ~metawriter() {}
/** Output a rectangular area.
* \param box Area (in pixel coordinates)
* \param feature The feature being processed
Expand Down Expand Up @@ -126,12 +126,12 @@ class metawriter
virtual void start(metawriter_property_map const& properties)
{
boost::ignore_unused_variable_warning(properties);
};
}

/** Stop processing.
* Write file footer, close database connection, ...
*/
virtual void stop() {};
virtual void stop() {}
/** Set output size (pixels).
* All features that are completely outside this size are discarded.
*/
Expand Down
6 changes: 5 additions & 1 deletion include/mapnik/placement_finder.hpp
Expand Up @@ -24,11 +24,15 @@
#define MAPNIK_PLACEMENT_FINDER_HPP

#include <mapnik/geometry.hpp>
#include <mapnik/text_placements.hpp>
#include <mapnik/text_properties.hpp>

namespace mapnik
{

class text_placement_info;
class string_info;
class text_path;

template <typename DetectorT>
class placement_finder : boost::noncopyable
{
Expand Down
1 change: 0 additions & 1 deletion include/mapnik/polygon_symbolizer.hpp
Expand Up @@ -26,7 +26,6 @@
// mapnik
#include <mapnik/color.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/filter_factory.hpp>
#include <mapnik/enumeration.hpp>
#include <mapnik/gamma_method.hpp>

Expand Down

0 comments on commit afb2eed

Please sign in to comment.