Merge branch 'master' of github.com:mapnik/mapnik

This commit is contained in:
Dane Springmeyer 2013-02-22 13:00:10 -08:00
commit edbe5aca32
18 changed files with 75 additions and 56 deletions

View file

@ -28,7 +28,6 @@
#include <mapnik/value_error.hpp>
#include "mapnik_enumeration.hpp"
#include <mapnik/feature_type_style.hpp>
#include <mapnik/image_filter_grammar.hpp> // image_filter_grammar
#include <mapnik/image_filter_types.hpp> // generate_image_filters
using mapnik::feature_type_style;
@ -45,18 +44,12 @@ std::string get_image_filters(feature_type_style & style)
void set_image_filters(feature_type_style & style, std::string const& filters)
{
std::string::const_iterator itr = filters.begin();
std::string::const_iterator end = filters.end();
mapnik::image_filter_grammar<std::string::const_iterator,
std::vector<mapnik::filter::filter_type> > filter_grammar;
std::vector<mapnik::filter::filter_type> new_filters;
bool result = boost::spirit::qi::phrase_parse(itr,end,
filter_grammar,
boost::spirit::qi::ascii::space,
new_filters);
if (!result || itr!=end)
bool result = parse_image_filters(filters, new_filters);
if (!result)
{
throw mapnik::value_error("failed to parse image-filters: '" + std::string(itr,end) + "'");
throw mapnik::value_error("failed to parse image-filters: '" + filters + "'");
}
style.image_filters().swap(new_filters);
}

View file

@ -45,7 +45,7 @@ namespace mapnik {
template <typename T>
void grid2utf(T const& grid_type,
boost::python::list& l,
std::vector<grid::lookup_type>& key_order)
std::vector<typename T::lookup_type>& key_order)
{
typedef std::map< typename T::lookup_type, typename T::value_type> keys_type;
typedef typename keys_type::const_iterator keys_iterator;

View file

@ -320,8 +320,14 @@ operator>>(std::istream & is, mapnik::enumeration<ENUM, THE_MAX> & e)
/** Helper macro. Creates a typedef.
* @relates mapnik::enumeration
*/
#ifdef _MSC_VER_
#define DEFINE_ENUM( name, e) \
template enumeration<e, e ## _MAX>; \
typedef enumeration<e, e ## _MAX> name
#else
#define DEFINE_ENUM( name, e) \
typedef enumeration<e, e ## _MAX> name
#endif
/** Helper macro. Runs the verify_mapnik_enum() method during static initialization.
* @relates mapnik::enumeration

View file

@ -40,7 +40,7 @@ namespace formatting {
class node;
typedef boost::shared_ptr<node> node_ptr;
class node
class MAPNIK_DECL node
{
public:
virtual ~node() {}

View file

@ -37,7 +37,7 @@ class xml_node;
struct char_properties;
namespace formatting {
class expression_format: public node {
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);

View file

@ -32,7 +32,7 @@
namespace mapnik {
namespace formatting {
class format_node: public node {
class MAPNIK_DECL format_node: public node {
public:
void to_xml(boost::property_tree::ptree &xml) const;
static node_ptr from_xml(xml_node const& xml);

View file

@ -31,7 +31,7 @@
namespace mapnik {
namespace formatting {
class list_node: public node {
class MAPNIK_DECL list_node: public node {
public:
list_node() : node(), children_() {}
virtual void to_xml(boost::property_tree::ptree &xml) const;

View file

@ -30,7 +30,7 @@
namespace mapnik {
namespace formatting {
class text_node: public node {
class MAPNIK_DECL text_node: public node {
public:
text_node(expression_ptr text): node(), text_(text) {}
text_node(std::string text): node(), text_(parse_expression(text)) {}

View file

@ -23,6 +23,9 @@
#ifndef MAPNIK_IMAGE_FILTER_TYPES_HPP
#define MAPNIK_IMAGE_FILTER_TYPES_HPP
// mapnik
#include <mapnik/config.hpp>
// boost
#include <boost/variant/variant_fwd.hpp>
@ -125,7 +128,9 @@ inline std::ostream& operator<< (std::ostream& os, invert)
inline std::ostream& operator<< (std::ostream& os, filter_type const& filter);
bool generate_image_filters(std::back_insert_iterator<std::string> & sink, std::vector<filter_type> const& v);
MAPNIK_DECL bool generate_image_filters(std::back_insert_iterator<std::string> & sink, std::vector<filter_type> const& v);
MAPNIK_DECL bool parse_image_filters(std::string const& filters, std::vector<filter_type>& image_filters);
}}

View file

@ -41,14 +41,14 @@ MAPNIK_DECL path_expression_ptr parse_path(std::string const & str);
MAPNIK_DECL path_expression_ptr parse_path(std::string const & str,
path_expression_grammar<std::string::const_iterator> const& g);
struct path_processor
struct MAPNIK_DECL path_processor
{
static std::string evaluate(path_expression const& path, feature_impl const& f);
static std::string to_string(path_expression const& path);
static void collect_attributes(path_expression const& path, std::set<std::string>& names);
};
typedef mapnik::path_processor path_processor_type;
typedef MAPNIK_DECL mapnik::path_processor path_processor_type;
}

View file

@ -37,7 +37,7 @@ namespace mapnik
class freetype_engine;
template <typename T> class face_manager;
class processed_text : mapnik::noncopyable
class MAPNIK_DECL processed_text : mapnik::noncopyable
{
public:
class processed_expression

View file

@ -37,7 +37,7 @@ class MAPNIK_DECL text_placements;
* This placement has first to be tested by placement_finder to verify it
* can actually be used.
*/
class text_placement_info : mapnik::noncopyable
class MAPNIK_DECL text_placement_info : mapnik::noncopyable
{
public:
/** Constructor. Takes the parent text_placements object as a parameter
@ -77,7 +77,7 @@ typedef boost::shared_ptr<text_placement_info> text_placement_info_ptr;
* semantics. Basically this class just makes sure a pointer of the right
* class is returned by the get_placement_info call.
*/
class text_placements
class MAPNIK_DECL text_placements
{
public:
text_placements();

View file

@ -54,7 +54,7 @@ DEFINE_ENUM(text_transform_e, text_transform);
typedef std::map<std::string, font_set> fontset_map;
struct char_properties
struct MAPNIK_DECL char_properties
{
char_properties();
/** Construct object from XML. */
@ -125,7 +125,7 @@ class processed_text;
/** Contains all text symbolizer properties which are not directly related to text formatting. */
struct text_symbolizer_properties
struct MAPNIK_DECL text_symbolizer_properties
{
text_symbolizer_properties();
/** Load all values from XML ptree. */

View file

@ -24,34 +24,14 @@
#define MAPNIK_GEOMETRY_TO_WKT_HPP
// mapnik
#include <mapnik/global.hpp>
#include <mapnik/config.hpp>
#include <mapnik/geometry.hpp>
#include <mapnik/util/geometry_wkt_generator.hpp>
// boost
#include <boost/spirit/include/karma.hpp>
namespace mapnik { namespace util {
namespace karma = boost::spirit::karma;
MAPNIK_DECL bool to_wkt(std::string & wkt, mapnik::geometry_type const& geom);
bool to_wkt(std::string & wkt, mapnik::geometry_type const& geom)
{
typedef std::back_insert_iterator<std::string> sink_type;
sink_type sink(wkt);
wkt_generator<sink_type, mapnik::geometry_type> generator(true);
bool result = karma::generate(sink, generator, geom);
return result;
}
bool to_wkt(std::string & wkt, mapnik::geometry_container const& geom)
{
typedef std::back_insert_iterator<std::string> sink_type;
sink_type sink(wkt);
wkt_multi_generator<sink_type, mapnik::geometry_container> generator;
bool result = karma::generate(sink, generator, geom);
return result;
}
MAPNIK_DECL bool to_wkt(std::string & wkt, mapnik::geometry_container const& geom);
}}

View file

@ -34,6 +34,14 @@ static const char * gradient_strings[] = {
IMPLEMENT_ENUM( gradient_e, gradient_strings )
static const char * gradient_unit_strings[] = {
"user-space-on-use",
"user-space-on-use-bounding-box",
"object-bounding-box",
""
};
IMPLEMENT_ENUM( gradient_unit_e, gradient_unit_strings )
gradient::gradient()
: gradient_type_(NO_GRADIENT),

View file

@ -21,6 +21,7 @@
*****************************************************************************/
// mapnik
#include <mapnik/image_filter_types.hpp>
#include <mapnik/image_filter_grammar.hpp> // image_filter_grammar
// boost
#include <boost/spirit/include/karma.hpp>
@ -63,4 +64,17 @@ bool generate_image_filters(std::back_insert_iterator<std::string>& sink, std::v
return r;
}
bool parse_image_filters(std::string const& filters, std::vector<filter_type>& image_filters)
{
std::string::const_iterator itr = filters.begin();
std::string::const_iterator end = filters.end();
mapnik::image_filter_grammar<std::string::const_iterator,
std::vector<mapnik::filter::filter_type> > filter_grammar;
bool r = boost::spirit::qi::phrase_parse(itr,end,
filter_grammar,
boost::spirit::qi::ascii::space,
image_filters);
return r && itr==end;
}
}}

View file

@ -425,15 +425,10 @@ void map_parser::parse_style(Map & map, xml_node const& sty)
if (filters)
{
std::string filter_str = *filters;
std::string::const_iterator itr = filter_str.begin();
std::string::const_iterator end = filter_str.end();
bool result = boost::spirit::qi::phrase_parse(itr,end,
sty.get_tree().image_filters_grammar,
boost::spirit::qi::ascii::space,
style.image_filters());
if (!result || itr!=end)
bool result = filter::parse_image_filters(filter_str, style.image_filters());
if (!result)
{
throw config_error("failed to parse image-filters: '" + std::string(itr,end) + "'");
throw config_error("failed to parse image-filters: '" + filter_str + "'");
}
}

View file

@ -26,6 +26,7 @@
#include <mapnik/geometry.hpp>
#include <mapnik/util/geometry_wkt_generator.hpp>
#include <mapnik/util/geometry_to_wkt.hpp>
#include <mapnik/util/path_iterator.hpp>
#include <mapnik/util/container_adapter.hpp>
@ -156,6 +157,23 @@ wkt_multi_generator<OutputIterator, GeometryContainer>::wkt_multi_generator()
template struct mapnik::util::wkt_generator<std::back_insert_iterator<std::string>, mapnik::geometry_type>;
template struct mapnik::util::wkt_multi_generator<std::back_insert_iterator<std::string>, mapnik::geometry_container >;
bool to_wkt(std::string & wkt, mapnik::geometry_type const& geom)
{
typedef std::back_insert_iterator<std::string> sink_type;
sink_type sink(wkt);
wkt_generator<sink_type, mapnik::geometry_type> generator(true);
bool result = karma::generate(sink, generator, geom);
return result;
}
bool to_wkt(std::string & wkt, mapnik::geometry_container const& geom)
{
typedef std::back_insert_iterator<std::string> sink_type;
sink_type sink(wkt);
wkt_multi_generator<sink_type, mapnik::geometry_container> generator;
bool result = karma::generate(sink, generator, geom);
return result;
}
}}