adapt build to use BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
This commit is contained in:
parent
7b58b26df1
commit
87e0ae8124
36 changed files with 198 additions and 140 deletions
|
@ -1715,6 +1715,9 @@ if not preconfigured:
|
||||||
debug_defines = ['-DDEBUG', '-DMAPNIK_DEBUG']
|
debug_defines = ['-DDEBUG', '-DMAPNIK_DEBUG']
|
||||||
ndebug_defines = ['-DNDEBUG']
|
ndebug_defines = ['-DNDEBUG']
|
||||||
|
|
||||||
|
# faster compile
|
||||||
|
# http://www.boost.org/doc/libs/1_47_0/libs/spirit/doc/html/spirit/what_s_new/spirit_2_5.html#spirit.what_s_new.spirit_2_5.breaking_changes
|
||||||
|
env.Append(CPPDEFINES = '-DBOOST_SPIRIT_NO_PREDEFINED_TERMINALS=1 -DBOOST_PHOENIX_NO_PREDEFINED_TERMINALS=1')
|
||||||
# c++11 support / https://github.com/mapnik/mapnik/issues/1683
|
# c++11 support / https://github.com/mapnik/mapnik/issues/1683
|
||||||
# - upgrade to PHOENIX_V3 since that is needed for c++11 compile
|
# - upgrade to PHOENIX_V3 since that is needed for c++11 compile
|
||||||
env.Append(CPPDEFINES = '-DBOOST_SPIRIT_USE_PHOENIX_V3=1')
|
env.Append(CPPDEFINES = '-DBOOST_SPIRIT_USE_PHOENIX_V3=1')
|
||||||
|
|
|
@ -342,9 +342,9 @@ void box2d<T>::pad(T padding)
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool box2d<T>::from_string(std::string const& str)
|
bool box2d<T>::from_string(std::string const& str)
|
||||||
{
|
{
|
||||||
using boost::spirit::qi::lit;
|
boost::spirit::qi::lit_type lit;
|
||||||
using boost::spirit::qi::double_;
|
boost::spirit::qi::double_type double_;
|
||||||
using boost::spirit::ascii::space;
|
boost::spirit::ascii::space_type space;
|
||||||
bool r = boost::spirit::qi::phrase_parse(str.begin(),
|
bool r = boost::spirit::qi::phrase_parse(str.begin(),
|
||||||
str.end(),
|
str.end(),
|
||||||
double_ >> -lit(',') >> double_ >> -lit(',')
|
double_ >> -lit(',') >> double_ >> -lit(',')
|
||||||
|
|
|
@ -44,20 +44,20 @@ color::color(std::string const& str)
|
||||||
std::string color::to_string() const
|
std::string color::to_string() const
|
||||||
{
|
{
|
||||||
namespace karma = boost::spirit::karma;
|
namespace karma = boost::spirit::karma;
|
||||||
using boost::spirit::karma::_1;
|
boost::spirit::karma::_1_type _1;
|
||||||
using boost::spirit::karma::eps;
|
boost::spirit::karma::eps_type eps;
|
||||||
using boost::spirit::karma::double_;
|
boost::spirit::karma::double_type double_;
|
||||||
using boost::spirit::karma::string;
|
boost::spirit::karma::string_type kstring;
|
||||||
boost::spirit::karma::uint_generator<uint8_t,10> color_generator;
|
boost::spirit::karma::uint_generator<uint8_t,10> color_generator;
|
||||||
std::string str;
|
std::string str;
|
||||||
std::back_insert_iterator<std::string> sink(str);
|
std::back_insert_iterator<std::string> sink(str);
|
||||||
karma::generate(sink,
|
karma::generate(sink,
|
||||||
// begin grammar
|
// begin grammar
|
||||||
string[ phoenix::if_(alpha()==255) [_1="rgb("].else_[_1="rgba("]]
|
kstring[ phoenix::if_(alpha()==255) [_1="rgb("].else_[_1="rgba("]]
|
||||||
<< color_generator[_1 = red()] << ','
|
<< color_generator[_1 = red()] << ','
|
||||||
<< color_generator[_1 = green()] << ','
|
<< color_generator[_1 = green()] << ','
|
||||||
<< color_generator[_1 = blue()]
|
<< color_generator[_1 = blue()]
|
||||||
<< string[ phoenix::if_(alpha()==255) [_1 = ')'].else_[_1 =',']]
|
<< kstring[ phoenix::if_(alpha()==255) [_1 = ')'].else_[_1 =',']]
|
||||||
<< eps(alpha()<255) << double_ [_1 = alpha()/255.0]
|
<< eps(alpha()<255) << double_ [_1 = alpha()/255.0]
|
||||||
<< ')'
|
<< ')'
|
||||||
// end grammar
|
// end grammar
|
||||||
|
@ -68,10 +68,10 @@ std::string color::to_string() const
|
||||||
std::string color::to_hex_string() const
|
std::string color::to_hex_string() const
|
||||||
{
|
{
|
||||||
namespace karma = boost::spirit::karma;
|
namespace karma = boost::spirit::karma;
|
||||||
using boost::spirit::karma::_1;
|
boost::spirit::karma::_1_type _1;
|
||||||
using boost::spirit::karma::hex;
|
boost::spirit::karma::hex_type hex;
|
||||||
using boost::spirit::karma::eps;
|
boost::spirit::karma::eps_type eps;
|
||||||
using boost::spirit::karma::right_align;
|
boost::spirit::karma::right_align_type right_align;
|
||||||
std::string str;
|
std::string str;
|
||||||
std::back_insert_iterator<std::string> sink(str);
|
std::back_insert_iterator<std::string> sink(str);
|
||||||
karma::generate(sink,
|
karma::generate(sink,
|
||||||
|
|
|
@ -29,10 +29,6 @@
|
||||||
// boost
|
// boost
|
||||||
#include <boost/version.hpp>
|
#include <boost/version.hpp>
|
||||||
|
|
||||||
// stl
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
color parse_color(std::string const& str)
|
color parse_color(std::string const& str)
|
||||||
|
@ -45,19 +41,18 @@ color parse_color(std::string const& str,
|
||||||
css_color_grammar<std::string::const_iterator> const& g)
|
css_color_grammar<std::string::const_iterator> const& g)
|
||||||
{
|
{
|
||||||
color c;
|
color c;
|
||||||
|
|
||||||
std::string::const_iterator first = str.begin();
|
std::string::const_iterator first = str.begin();
|
||||||
std::string::const_iterator last = str.end();
|
std::string::const_iterator last = str.end();
|
||||||
|
boost::spirit::ascii::space_type space;
|
||||||
// boost 1.41 -> 1.44 compatibility, to be removed in mapnik 2.1 (dane)
|
// boost 1.41 -> 1.44 compatibility, to be removed in mapnik 2.1 (dane)
|
||||||
#if BOOST_VERSION >= 104500
|
#if BOOST_VERSION >= 104500
|
||||||
bool result = boost::spirit::qi::phrase_parse(first, last, g,
|
bool result = boost::spirit::qi::phrase_parse(first, last, g,
|
||||||
boost::spirit::ascii::space,
|
space,
|
||||||
c);
|
c);
|
||||||
#else
|
#else
|
||||||
mapnik::css css_;
|
mapnik::css css_;
|
||||||
bool result = boost::spirit::qi::phrase_parse(first, last, g,
|
bool result = boost::spirit::qi::phrase_parse(first, last, g,
|
||||||
boost::spirit::ascii::space,
|
space,
|
||||||
css_);
|
css_);
|
||||||
c.set_red(css_.r);
|
c.set_red(css_.r);
|
||||||
c.set_green(css_.g);
|
c.set_green(css_.g);
|
||||||
|
@ -67,9 +62,13 @@ color parse_color(std::string const& str,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (result && (first == last))
|
if (result && (first == last))
|
||||||
|
{
|
||||||
return c;
|
return c;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
throw config_error( "Failed to parse color: \"" + str + "\"" );
|
throw config_error( "Failed to parse color: \"" + str + "\"" );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,12 +58,12 @@ namespace util {
|
||||||
|
|
||||||
using namespace boost::spirit;
|
using namespace boost::spirit;
|
||||||
|
|
||||||
BOOST_SPIRIT_AUTO(qi, INTEGER, qi::int_)
|
BOOST_SPIRIT_AUTO(qi, INTEGER, qi::int_type())
|
||||||
#ifdef BIGINT
|
#ifdef BIGINT
|
||||||
BOOST_SPIRIT_AUTO(qi, LONGLONG, qi::long_long)
|
BOOST_SPIRIT_AUTO(qi, LONGLONG, qi::long_long_type())
|
||||||
#endif
|
#endif
|
||||||
BOOST_SPIRIT_AUTO(qi, FLOAT, qi::float_)
|
BOOST_SPIRIT_AUTO(qi, FLOAT, qi::float_type())
|
||||||
BOOST_SPIRIT_AUTO(qi, DOUBLE, qi::double_)
|
BOOST_SPIRIT_AUTO(qi, DOUBLE, qi::double_type())
|
||||||
|
|
||||||
struct bool_symbols : qi::symbols<char,bool>
|
struct bool_symbols : qi::symbols<char,bool>
|
||||||
{
|
{
|
||||||
|
@ -82,75 +82,85 @@ struct bool_symbols : qi::symbols<char,bool>
|
||||||
|
|
||||||
bool string2bool(const char * iter, const char * end, bool & result)
|
bool string2bool(const char * iter, const char * end, bool & result)
|
||||||
{
|
{
|
||||||
using boost::spirit::qi::no_case;
|
boost::spirit::qi::no_case_type no_case;
|
||||||
bool r = qi::phrase_parse(iter,end, no_case[bool_symbols()] ,ascii::space,result);
|
ascii::space_type space;
|
||||||
|
bool r = qi::phrase_parse(iter,end,no_case[bool_symbols()],space,result);
|
||||||
return r && (iter == end);
|
return r && (iter == end);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool string2bool(std::string const& value, bool & result)
|
bool string2bool(std::string const& value, bool & result)
|
||||||
{
|
{
|
||||||
using boost::spirit::qi::no_case;
|
boost::spirit::qi::no_case_type no_case;
|
||||||
|
ascii::space_type space;
|
||||||
std::string::const_iterator str_beg = value.begin();
|
std::string::const_iterator str_beg = value.begin();
|
||||||
std::string::const_iterator str_end = value.end();
|
std::string::const_iterator str_end = value.end();
|
||||||
bool r = qi::phrase_parse(str_beg,str_end,no_case[bool_symbols()],ascii::space,result);
|
bool r = qi::phrase_parse(str_beg,str_end,no_case[bool_symbols()],space,result);
|
||||||
return r && (str_beg == str_end);
|
return r && (str_beg == str_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool string2int(const char * iter, const char * end, int & result)
|
bool string2int(const char * iter, const char * end, int & result)
|
||||||
{
|
{
|
||||||
bool r = qi::phrase_parse(iter,end,INTEGER,ascii::space,result);
|
ascii::space_type space;
|
||||||
|
bool r = qi::phrase_parse(iter,end,INTEGER,space,result);
|
||||||
return r && (iter == end);
|
return r && (iter == end);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool string2int(std::string const& value, int & result)
|
bool string2int(std::string const& value, int & result)
|
||||||
{
|
{
|
||||||
|
ascii::space_type space;
|
||||||
std::string::const_iterator str_beg = value.begin();
|
std::string::const_iterator str_beg = value.begin();
|
||||||
std::string::const_iterator str_end = value.end();
|
std::string::const_iterator str_end = value.end();
|
||||||
bool r = qi::phrase_parse(str_beg,str_end,INTEGER,ascii::space,result);
|
bool r = qi::phrase_parse(str_beg,str_end,INTEGER,space,result);
|
||||||
return r && (str_beg == str_end);
|
return r && (str_beg == str_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BIGINT
|
#ifdef BIGINT
|
||||||
bool string2int(const char * iter, const char * end, mapnik::value_integer & result)
|
bool string2int(const char * iter, const char * end, mapnik::value_integer & result)
|
||||||
{
|
{
|
||||||
bool r = qi::phrase_parse(iter,end,LONGLONG,ascii::space,result);
|
ascii::space_type space;
|
||||||
|
bool r = qi::phrase_parse(iter,end,LONGLONG,space,result);
|
||||||
return r && (iter == end);
|
return r && (iter == end);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool string2int(std::string const& value, mapnik::value_integer & result)
|
bool string2int(std::string const& value, mapnik::value_integer & result)
|
||||||
{
|
{
|
||||||
|
ascii::space_type space;
|
||||||
std::string::const_iterator str_beg = value.begin();
|
std::string::const_iterator str_beg = value.begin();
|
||||||
std::string::const_iterator str_end = value.end();
|
std::string::const_iterator str_end = value.end();
|
||||||
bool r = qi::phrase_parse(str_beg,str_end,LONGLONG,ascii::space,result);
|
bool r = qi::phrase_parse(str_beg,str_end,LONGLONG,space,result);
|
||||||
return r && (str_beg == str_end);
|
return r && (str_beg == str_end);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool string2double(std::string const& value, double & result)
|
bool string2double(std::string const& value, double & result)
|
||||||
{
|
{
|
||||||
|
ascii::space_type space;
|
||||||
std::string::const_iterator str_beg = value.begin();
|
std::string::const_iterator str_beg = value.begin();
|
||||||
std::string::const_iterator str_end = value.end();
|
std::string::const_iterator str_end = value.end();
|
||||||
bool r = qi::phrase_parse(str_beg,str_end,DOUBLE,ascii::space,result);
|
bool r = qi::phrase_parse(str_beg,str_end,DOUBLE,space,result);
|
||||||
return r && (str_beg == str_end);
|
return r && (str_beg == str_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool string2double(const char * iter, const char * end, double & result)
|
bool string2double(const char * iter, const char * end, double & result)
|
||||||
{
|
{
|
||||||
bool r = qi::phrase_parse(iter,end,DOUBLE,ascii::space,result);
|
ascii::space_type space;
|
||||||
|
bool r = qi::phrase_parse(iter,end,DOUBLE,space,result);
|
||||||
return r && (iter == end);
|
return r && (iter == end);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool string2float(std::string const& value, float & result)
|
bool string2float(std::string const& value, float & result)
|
||||||
{
|
{
|
||||||
|
ascii::space_type space;
|
||||||
std::string::const_iterator str_beg = value.begin();
|
std::string::const_iterator str_beg = value.begin();
|
||||||
std::string::const_iterator str_end = value.end();
|
std::string::const_iterator str_end = value.end();
|
||||||
bool r = qi::phrase_parse(str_beg,str_end,FLOAT,ascii::space,result);
|
bool r = qi::phrase_parse(str_beg,str_end,FLOAT,space,result);
|
||||||
return r && (str_beg == str_end);
|
return r && (str_beg == str_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool string2float(const char * iter, const char * end, float & result)
|
bool string2float(const char * iter, const char * end, float & result)
|
||||||
{
|
{
|
||||||
bool r = qi::phrase_parse(iter,end,FLOAT,ascii::space,result);
|
ascii::space_type space;
|
||||||
|
bool r = qi::phrase_parse(iter,end,FLOAT,space,result);
|
||||||
return r && (iter == end);
|
return r && (iter == end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,10 +43,11 @@ expression_ptr parse_expression(std::string const& str, std::string const& encod
|
||||||
expression_ptr parse_expression(std::string const& str,
|
expression_ptr parse_expression(std::string const& str,
|
||||||
mapnik::expression_grammar<std::string::const_iterator> const& g)
|
mapnik::expression_grammar<std::string::const_iterator> const& g)
|
||||||
{
|
{
|
||||||
|
boost::spirit::standard_wide::space_type space;
|
||||||
expression_ptr node = std::make_shared<expr_node>();
|
expression_ptr node = std::make_shared<expr_node>();
|
||||||
std::string::const_iterator itr = str.begin();
|
std::string::const_iterator itr = str.begin();
|
||||||
std::string::const_iterator end = str.end();
|
std::string::const_iterator end = str.end();
|
||||||
bool r = boost::spirit::qi::phrase_parse(itr, end, g, boost::spirit::standard_wide::space, *node);
|
bool r = boost::spirit::qi::phrase_parse(itr, end, g, space, *node);
|
||||||
if (r && itr == end)
|
if (r && itr == end)
|
||||||
{
|
{
|
||||||
return node;
|
return node;
|
||||||
|
|
|
@ -21,6 +21,16 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
|
#if defined(SVG_RENDERER)
|
||||||
|
// FIXME: workaround incompatibility of karma with -DBOOST_SPIRIT_NO_PREDEFINED_TERMINALS=1
|
||||||
|
/*
|
||||||
|
boost/spirit/repository/home/karma/directive/confix.hpp:49:23: error: no member named
|
||||||
|
'confix' in namespace 'boost::spirit::repository'
|
||||||
|
using repository::confix;
|
||||||
|
*/
|
||||||
|
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <mapnik/feature_style_processor_impl.hpp>
|
#include <mapnik/feature_style_processor_impl.hpp>
|
||||||
#include <mapnik/agg_renderer.hpp>
|
#include <mapnik/agg_renderer.hpp>
|
||||||
#include <mapnik/graphics.hpp>
|
#include <mapnik/graphics.hpp>
|
||||||
|
|
|
@ -38,28 +38,26 @@ template <typename Iterator, typename ContType>
|
||||||
image_filter_grammar<Iterator,ContType>::image_filter_grammar()
|
image_filter_grammar<Iterator,ContType>::image_filter_grammar()
|
||||||
: image_filter_grammar::base_type(start)
|
: image_filter_grammar::base_type(start)
|
||||||
{
|
{
|
||||||
using qi::lit;
|
qi::lit_type lit;
|
||||||
using qi::_val;
|
qi::_val_type _val;
|
||||||
using qi::_1;
|
qi::_1_type _1;
|
||||||
using qi::_a;
|
qi::_a_type _a;
|
||||||
using qi::_b;
|
qi::_b_type _b;
|
||||||
using qi::_c;
|
qi::_c_type _c;
|
||||||
using qi::_d;
|
qi::_d_type _d;
|
||||||
using qi::_e;
|
qi::_e_type _e;
|
||||||
using qi::_f;
|
qi::_f_type _f;
|
||||||
using qi::_g;
|
qi::_g_type _g;
|
||||||
using qi::_h;
|
qi::_h_type _h;
|
||||||
using qi::_r1;
|
qi::_r1_type _r1;
|
||||||
using qi::eps;
|
qi::eps_type eps;
|
||||||
using qi::char_;
|
qi::char_type char_;
|
||||||
using qi::lexeme;
|
qi::double_type double_;
|
||||||
using qi::double_;
|
|
||||||
using boost::spirit::ascii::string;
|
|
||||||
using phoenix::push_back;
|
using phoenix::push_back;
|
||||||
using phoenix::construct;
|
using phoenix::construct;
|
||||||
using phoenix::at_c;
|
using phoenix::at_c;
|
||||||
#if BOOST_VERSION >= 104700
|
#if BOOST_VERSION >= 104700
|
||||||
using qi::no_skip;
|
qi::no_skip_type no_skip;
|
||||||
start = -(filter % no_skip[*char_(", ")])
|
start = -(filter % no_skip[*char_(", ")])
|
||||||
;
|
;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace filter {
|
||||||
|
|
||||||
bool generate_image_filters(std::back_insert_iterator<std::string>& sink, std::vector<filter_type> const& filters)
|
bool generate_image_filters(std::back_insert_iterator<std::string>& sink, std::vector<filter_type> const& filters)
|
||||||
{
|
{
|
||||||
using boost::spirit::karma::stream;
|
boost::spirit::karma::stream_type stream;
|
||||||
using boost::spirit::karma::generate;
|
using boost::spirit::karma::generate;
|
||||||
bool r = generate(sink, stream % ' ', filters);
|
bool r = generate(sink, stream % ' ', filters);
|
||||||
return r;
|
return r;
|
||||||
|
@ -48,9 +48,10 @@ bool parse_image_filters(std::string const& filters, std::vector<filter_type>& i
|
||||||
std::string::const_iterator end = filters.end();
|
std::string::const_iterator end = filters.end();
|
||||||
mapnik::image_filter_grammar<std::string::const_iterator,
|
mapnik::image_filter_grammar<std::string::const_iterator,
|
||||||
std::vector<mapnik::filter::filter_type> > filter_grammar;
|
std::vector<mapnik::filter::filter_type> > filter_grammar;
|
||||||
|
boost::spirit::qi::ascii::space_type space;
|
||||||
bool r = boost::spirit::qi::phrase_parse(itr,end,
|
bool r = boost::spirit::qi::phrase_parse(itr,end,
|
||||||
filter_grammar,
|
filter_grammar,
|
||||||
boost::spirit::qi::ascii::space,
|
space,
|
||||||
image_filters);
|
image_filters);
|
||||||
return r && itr==end;
|
return r && itr==end;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,8 @@ namespace mapnik { namespace json {
|
||||||
{
|
{
|
||||||
#if BOOST_VERSION >= 104700
|
#if BOOST_VERSION >= 104700
|
||||||
using namespace boost::spirit;
|
using namespace boost::spirit;
|
||||||
return qi::phrase_parse(first, last, *grammar_, standard_wide::space, features);
|
standard_wide::space_type space;
|
||||||
|
return qi::phrase_parse(first, last, *grammar_, space, features);
|
||||||
#else
|
#else
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100;
|
s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100;
|
||||||
|
|
|
@ -38,30 +38,26 @@ feature_grammar<Iterator,FeatureType>::feature_grammar(generic_json<Iterator> &
|
||||||
json_(json),
|
json_(json),
|
||||||
put_property_(put_property(tr))
|
put_property_(put_property(tr))
|
||||||
{
|
{
|
||||||
using qi::lit;
|
qi::lit_type lit;
|
||||||
using qi::long_long;
|
qi::long_long_type long_long;
|
||||||
using qi::double_;
|
qi::double_type double_;
|
||||||
#if BOOST_VERSION > 104200
|
#if BOOST_VERSION > 104200
|
||||||
using qi::no_skip;
|
qi::no_skip_type no_skip;
|
||||||
#else
|
#else
|
||||||
using qi::lexeme;
|
qi::lexeme_type lexeme;
|
||||||
#endif
|
#endif
|
||||||
using standard_wide::char_;
|
standard_wide::char_type char_;
|
||||||
using qi::_val;
|
qi::_val_type _val;
|
||||||
using qi::_1;
|
qi::_1_type _1;
|
||||||
using qi::_2;
|
qi::_2_type _2;
|
||||||
using qi::_3;
|
qi::_3_type _3;
|
||||||
using qi::_4;
|
qi::_4_type _4;
|
||||||
using qi::_a;
|
qi::_a_type _a;
|
||||||
using qi::_b;
|
qi::_r1_type _r1;
|
||||||
using qi::_r1;
|
qi::eps_type eps;
|
||||||
using qi::_r2;
|
|
||||||
using qi::fail;
|
using qi::fail;
|
||||||
using qi::on_error;
|
using qi::on_error;
|
||||||
using qi::_pass;
|
|
||||||
using qi::eps;
|
|
||||||
using qi::raw;
|
|
||||||
|
|
||||||
using phoenix::new_;
|
using phoenix::new_;
|
||||||
using phoenix::push_back;
|
using phoenix::push_back;
|
||||||
using phoenix::construct;
|
using phoenix::construct;
|
||||||
|
|
|
@ -47,7 +47,8 @@ namespace mapnik { namespace json {
|
||||||
{
|
{
|
||||||
#if BOOST_VERSION >= 104700
|
#if BOOST_VERSION >= 104700
|
||||||
using namespace boost::spirit;
|
using namespace boost::spirit;
|
||||||
return qi::phrase_parse(first, last, (*grammar_)(boost::phoenix::ref(f)), standard_wide::space);
|
standard_wide::space_type space;
|
||||||
|
return qi::phrase_parse(first, last, (*grammar_)(boost::phoenix::ref(f)), space);
|
||||||
#else
|
#else
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100;
|
s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100;
|
||||||
|
|
|
@ -41,20 +41,18 @@ geometry_grammar<Iterator>::geometry_grammar()
|
||||||
: geometry_grammar::base_type(geometry,"geometry")
|
: geometry_grammar::base_type(geometry,"geometry")
|
||||||
{
|
{
|
||||||
|
|
||||||
using qi::lit;
|
qi::lit_type lit;
|
||||||
using qi::int_;
|
qi::int_type int_;
|
||||||
using qi::double_;
|
qi::double_type double_;
|
||||||
using qi::_val;
|
qi::_1_type _1;
|
||||||
using qi::_1;
|
qi::_2_type _2;
|
||||||
using qi::_2;
|
qi::_3_type _3;
|
||||||
using qi::_3;
|
qi::_4_type _4;
|
||||||
using qi::_4;
|
qi::_a_type _a;
|
||||||
using qi::_a;
|
qi::_r1_type _r1;
|
||||||
using qi::_b;
|
qi::_r2_type _r2;
|
||||||
using qi::_r1;
|
qi::eps_type eps;
|
||||||
using qi::_r2;
|
qi::_pass_type _pass;
|
||||||
using qi::eps;
|
|
||||||
using qi::_pass;
|
|
||||||
using qi::fail;
|
using qi::fail;
|
||||||
using qi::on_error;
|
using qi::on_error;
|
||||||
using boost::phoenix::new_;
|
using boost::phoenix::new_;
|
||||||
|
|
|
@ -50,7 +50,8 @@ bool geometry_parser<Iterator>::parse(iterator_type first, iterator_type last, b
|
||||||
{
|
{
|
||||||
#if BOOST_VERSION >= 104700
|
#if BOOST_VERSION >= 104700
|
||||||
using namespace boost::spirit;
|
using namespace boost::spirit;
|
||||||
return qi::phrase_parse(first, last, (*grammar_)(boost::phoenix::ref(path)), standard_wide::space);
|
standard_wide::space_type space;
|
||||||
|
return qi::phrase_parse(first, last, (*grammar_)(boost::phoenix::ref(path)), space);
|
||||||
#else
|
#else
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100;
|
s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100;
|
||||||
|
|
|
@ -471,9 +471,10 @@ void map_parser::parse_style(Map & map, xml_node const& sty)
|
||||||
std::string filter_str = *direct_filters;
|
std::string filter_str = *direct_filters;
|
||||||
std::string::const_iterator itr = filter_str.begin();
|
std::string::const_iterator itr = filter_str.begin();
|
||||||
std::string::const_iterator end = filter_str.end();
|
std::string::const_iterator end = filter_str.end();
|
||||||
|
boost::spirit::qi::ascii::space_type space;
|
||||||
bool result = boost::spirit::qi::phrase_parse(itr,end,
|
bool result = boost::spirit::qi::phrase_parse(itr,end,
|
||||||
sty.get_tree().image_filters_grammar,
|
sty.get_tree().image_filters_grammar,
|
||||||
boost::spirit::qi::ascii::space,
|
space,
|
||||||
style.direct_image_filters());
|
style.direct_image_filters());
|
||||||
if (!result || itr!=end)
|
if (!result || itr!=end)
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,10 +48,10 @@ path_expression_ptr parse_path(std::string const& str,
|
||||||
path_expression_grammar<std::string::const_iterator> const& g)
|
path_expression_grammar<std::string::const_iterator> const& g)
|
||||||
{
|
{
|
||||||
path_expression path;
|
path_expression path;
|
||||||
|
boost::spirit::standard_wide::space_type space;
|
||||||
std::string::const_iterator itr = str.begin();
|
std::string::const_iterator itr = str.begin();
|
||||||
std::string::const_iterator end = str.end();
|
std::string::const_iterator end = str.end();
|
||||||
bool r = qi::phrase_parse(itr, end, g, boost::spirit::standard_wide::space, path);
|
bool r = qi::phrase_parse(itr, end, g, space, path);
|
||||||
if (r && itr == end)
|
if (r && itr == end)
|
||||||
{
|
{
|
||||||
return std::make_shared<path_expression>(path); //path;
|
return std::make_shared<path_expression>(path); //path;
|
||||||
|
|
|
@ -36,13 +36,13 @@ template <typename Iterator>
|
||||||
path_expression_grammar<Iterator>::path_expression_grammar()
|
path_expression_grammar<Iterator>::path_expression_grammar()
|
||||||
: path_expression_grammar::base_type(expr)
|
: path_expression_grammar::base_type(expr)
|
||||||
{
|
{
|
||||||
using boost::phoenix::construct;
|
standard_wide::char_type char_;
|
||||||
using standard_wide::char_;
|
qi::_1_type _1;
|
||||||
using qi::_1;
|
qi::_val_type _val;
|
||||||
using qi::_val;
|
qi::lit_type lit;
|
||||||
using qi::lit;
|
qi::lexeme_type lexeme;
|
||||||
using qi::lexeme;
|
|
||||||
using phoenix::push_back;
|
using phoenix::push_back;
|
||||||
|
using boost::phoenix::construct;
|
||||||
|
|
||||||
expr =
|
expr =
|
||||||
* (
|
* (
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
|
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||||
#include <mapnik/svg/output/svg_renderer.hpp>
|
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
|
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||||
#include <mapnik/svg/output/svg_renderer.hpp>
|
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
|
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||||
#include <mapnik/svg/output/svg_renderer.hpp>
|
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
|
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||||
#include <mapnik/svg/output/svg_renderer.hpp>
|
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
|
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||||
#include <mapnik/svg/output/svg_renderer.hpp>
|
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
|
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||||
#include <mapnik/svg/output/svg_renderer.hpp>
|
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
|
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||||
#include <mapnik/svg/output/svg_renderer.hpp>
|
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
|
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||||
#include <mapnik/svg/output/svg_renderer.hpp>
|
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
|
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||||
#include <mapnik/svg/output/svg_renderer.hpp>
|
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
|
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||||
#include <mapnik/svg/output/svg_renderer.hpp>
|
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
|
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||||
#include <mapnik/svg/output/svg_renderer.hpp>
|
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
|
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||||
#include <mapnik/svg/output/svg_generator.hpp>
|
#include <mapnik/svg/output/svg_generator.hpp>
|
||||||
#include <mapnik/geometry.hpp>
|
#include <mapnik/geometry.hpp>
|
||||||
#include <mapnik/util/conversions.hpp>
|
#include <mapnik/util/conversions.hpp>
|
||||||
|
@ -42,6 +43,7 @@ namespace mapnik { namespace svg {
|
||||||
template <typename OutputIterator>
|
template <typename OutputIterator>
|
||||||
void svg_generator<OutputIterator>::generate_header()
|
void svg_generator<OutputIterator>::generate_header()
|
||||||
{
|
{
|
||||||
|
karma::lit_type lit;
|
||||||
karma::generate(output_iterator_, lit("<?xml version=\"1.0\" standalone=\"no\"?>\n"));
|
karma::generate(output_iterator_, lit("<?xml version=\"1.0\" standalone=\"no\"?>\n"));
|
||||||
karma::generate(output_iterator_, lit("<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n"));
|
karma::generate(output_iterator_, lit("<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n"));
|
||||||
}
|
}
|
||||||
|
@ -50,12 +52,14 @@ namespace mapnik { namespace svg {
|
||||||
void svg_generator<OutputIterator>::generate_opening_root(root_output_attributes const& root_attributes)
|
void svg_generator<OutputIterator>::generate_opening_root(root_output_attributes const& root_attributes)
|
||||||
{
|
{
|
||||||
root_attributes_grammar attributes_grammar;
|
root_attributes_grammar attributes_grammar;
|
||||||
|
karma::lit_type lit;
|
||||||
karma::generate(output_iterator_, lit("<svg ") << attributes_grammar << lit(">\n"), root_attributes);
|
karma::generate(output_iterator_, lit("<svg ") << attributes_grammar << lit(">\n"), root_attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename OutputIterator>
|
template <typename OutputIterator>
|
||||||
void svg_generator<OutputIterator>::generate_closing_root()
|
void svg_generator<OutputIterator>::generate_closing_root()
|
||||||
{
|
{
|
||||||
|
karma::lit_type lit;
|
||||||
karma::generate(output_iterator_, lit("</svg>"));
|
karma::generate(output_iterator_, lit("</svg>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +67,7 @@ namespace mapnik { namespace svg {
|
||||||
void svg_generator<OutputIterator>::generate_rect(rect_output_attributes const& rect_attributes)
|
void svg_generator<OutputIterator>::generate_rect(rect_output_attributes const& rect_attributes)
|
||||||
{
|
{
|
||||||
rect_attributes_grammar attributes_grammar;
|
rect_attributes_grammar attributes_grammar;
|
||||||
|
karma::lit_type lit;
|
||||||
karma::generate(output_iterator_, lit("<rect ") << attributes_grammar << lit("/>\n"), rect_attributes);
|
karma::generate(output_iterator_, lit("<rect ") << attributes_grammar << lit("/>\n"), rect_attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +75,7 @@ namespace mapnik { namespace svg {
|
||||||
void svg_generator<OutputIterator>::generate_opening_group(mapnik::value_integer val)
|
void svg_generator<OutputIterator>::generate_opening_group(mapnik::value_integer val)
|
||||||
{
|
{
|
||||||
std::string string_val;
|
std::string string_val;
|
||||||
|
karma::lit_type lit;
|
||||||
mapnik::util::to_string(string_val,val);
|
mapnik::util::to_string(string_val,val);
|
||||||
karma::generate(output_iterator_, lit("<g id=\"")
|
karma::generate(output_iterator_, lit("<g id=\"")
|
||||||
<< lit(string_val)
|
<< lit(string_val)
|
||||||
|
@ -84,6 +90,7 @@ namespace mapnik { namespace svg {
|
||||||
template <typename OutputIterator>
|
template <typename OutputIterator>
|
||||||
void svg_generator<OutputIterator>::generate_opening_group(std::string const& val)
|
void svg_generator<OutputIterator>::generate_opening_group(std::string const& val)
|
||||||
{
|
{
|
||||||
|
karma::lit_type lit;
|
||||||
karma::generate(output_iterator_, lit("<g id=\"")
|
karma::generate(output_iterator_, lit("<g id=\"")
|
||||||
<< lit(val)
|
<< lit(val)
|
||||||
<< lit("\"")
|
<< lit("\"")
|
||||||
|
@ -97,6 +104,7 @@ namespace mapnik { namespace svg {
|
||||||
template <typename OutputIterator>
|
template <typename OutputIterator>
|
||||||
void svg_generator<OutputIterator>::generate_closing_group()
|
void svg_generator<OutputIterator>::generate_closing_group()
|
||||||
{
|
{
|
||||||
|
karma::lit_type lit;
|
||||||
karma::generate(output_iterator_, lit("</g>\n"));
|
karma::generate(output_iterator_, lit("</g>\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
|
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||||
#include <mapnik/svg/output/svg_output_attributes.hpp>
|
#include <mapnik/svg/output/svg_output_attributes.hpp>
|
||||||
|
|
||||||
namespace mapnik { namespace svg {
|
namespace mapnik { namespace svg {
|
||||||
|
|
|
@ -20,6 +20,14 @@
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
// FIXME: workaround incompatibility of karma with -DBOOST_SPIRIT_NO_PREDEFINED_TERMINALS=1
|
||||||
|
/*
|
||||||
|
boost/spirit/repository/home/karma/directive/confix.hpp:49:23: error: no member named
|
||||||
|
'confix' in namespace 'boost::spirit::repository'
|
||||||
|
using repository::confix;
|
||||||
|
*/
|
||||||
|
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
#include <mapnik/debug.hpp>
|
#include <mapnik/debug.hpp>
|
||||||
#include <mapnik/svg/output/svg_renderer.hpp>
|
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||||
|
|
|
@ -80,10 +80,12 @@ struct key_value_sequence_ordered
|
||||||
key_value_sequence_ordered()
|
key_value_sequence_ordered()
|
||||||
: key_value_sequence_ordered::base_type(query)
|
: key_value_sequence_ordered::base_type(query)
|
||||||
{
|
{
|
||||||
query = pair >> *( qi::lit(';') >> pair);
|
qi::lit_type lit;
|
||||||
|
qi::char_type char_;
|
||||||
|
query = pair >> *( lit(';') >> pair);
|
||||||
pair = key >> -(':' >> value);
|
pair = key >> -(':' >> value);
|
||||||
key = qi::char_("a-zA-Z_") >> *qi::char_("a-zA-Z_0-9-");
|
key = char_("a-zA-Z_") >> *char_("a-zA-Z_0-9-");
|
||||||
value = +(qi::char_ - qi::lit(';'));
|
value = +(char_ - lit(';'));
|
||||||
}
|
}
|
||||||
|
|
||||||
qi::rule<Iterator, pairs_type(), SkipType> query;
|
qi::rule<Iterator, pairs_type(), SkipType> query;
|
||||||
|
@ -108,6 +110,7 @@ agg::rgba8 parse_color(const char* str)
|
||||||
double parse_double(const char* str)
|
double parse_double(const char* str)
|
||||||
{
|
{
|
||||||
using namespace boost::spirit::qi;
|
using namespace boost::spirit::qi;
|
||||||
|
qi::double_type double_;
|
||||||
double val = 0.0;
|
double val = 0.0;
|
||||||
parse(str, str + std::strlen(str),double_,val);
|
parse(str, str + std::strlen(str),double_,val);
|
||||||
return val;
|
return val;
|
||||||
|
@ -121,7 +124,9 @@ double parse_double_optional_percent(const char* str, bool &percent)
|
||||||
{
|
{
|
||||||
using namespace boost::spirit::qi;
|
using namespace boost::spirit::qi;
|
||||||
using boost::phoenix::ref;
|
using boost::phoenix::ref;
|
||||||
using qi::_1;
|
qi::_1_type _1;
|
||||||
|
qi::double_type double_;
|
||||||
|
qi::char_type char_;
|
||||||
|
|
||||||
double val = 0.0;
|
double val = 0.0;
|
||||||
char unit='\0';
|
char unit='\0';
|
||||||
|
|
|
@ -39,9 +39,7 @@ namespace mapnik
|
||||||
namespace qi = boost::spirit::qi;
|
namespace qi = boost::spirit::qi;
|
||||||
namespace phoenix = boost::phoenix;
|
namespace phoenix = boost::phoenix;
|
||||||
using phoenix::push_back;
|
using phoenix::push_back;
|
||||||
using boost::spirit::ascii::space;
|
|
||||||
using phoenix::ref;
|
using phoenix::ref;
|
||||||
using qi::_1;
|
|
||||||
|
|
||||||
bool text_placement_info_simple::next()
|
bool text_placement_info_simple::next()
|
||||||
{
|
{
|
||||||
|
@ -140,10 +138,13 @@ void text_placements_simple::set_positions(std::string positions)
|
||||||
}
|
}
|
||||||
|
|
||||||
} direction_name;
|
} direction_name;
|
||||||
|
boost::spirit::ascii::space_type space;
|
||||||
|
qi::_1_type _1;
|
||||||
|
qi::float_type float_;
|
||||||
|
|
||||||
std::string::iterator first = positions.begin(), last = positions.end();
|
std::string::iterator first = positions.begin(), last = positions.end();
|
||||||
qi::phrase_parse(first, last,
|
qi::phrase_parse(first, last,
|
||||||
(direction_name[push_back(phoenix::ref(direction_), _1)] % ',') >> *(',' >> qi::float_[push_back(phoenix::ref(text_sizes_), _1)]),
|
(direction_name[push_back(phoenix::ref(direction_), _1)] % ',') >> *(',' >> float_[push_back(phoenix::ref(text_sizes_), _1)]),
|
||||||
space
|
space
|
||||||
);
|
);
|
||||||
if (first != last)
|
if (first != last)
|
||||||
|
|
|
@ -39,14 +39,17 @@ transform_expression_grammar<Iterator>::transform_expression_grammar(expression_
|
||||||
: transform_expression_grammar::base_type(start)
|
: transform_expression_grammar::base_type(start)
|
||||||
{
|
{
|
||||||
using boost::phoenix::construct;
|
using boost::phoenix::construct;
|
||||||
using qi::_a; using qi::_1; using qi::_4;
|
qi::_1_type _1;
|
||||||
using qi::_b; using qi::_2; using qi::_5;
|
qi::_4_type _4;
|
||||||
using qi::_c; using qi::_3; using qi::_6;
|
qi::_2_type _2;
|
||||||
using qi::_val;
|
qi::_5_type _5;
|
||||||
using qi::char_;
|
qi::_3_type _3;
|
||||||
using qi::double_;
|
qi::_6_type _6;
|
||||||
using qi::lit;
|
qi::_val_type _val;
|
||||||
using qi::no_case;
|
qi::char_type char_;
|
||||||
|
qi::double_type double_;
|
||||||
|
qi::lit_type lit;
|
||||||
|
qi::no_case_type no_case;
|
||||||
|
|
||||||
// [http://www.w3.org/TR/SVG/coords.html#TransformAttribute]
|
// [http://www.w3.org/TR/SVG/coords.html#TransformAttribute]
|
||||||
|
|
||||||
|
@ -56,10 +59,10 @@ transform_expression_grammar<Iterator>::transform_expression_grammar(expression_
|
||||||
// separated by whitespace and/or a comma.
|
// separated by whitespace and/or a comma.
|
||||||
|
|
||||||
#if BOOST_VERSION > 104200
|
#if BOOST_VERSION > 104200
|
||||||
using qi::no_skip;
|
qi::no_skip_type no_skip;
|
||||||
start = transform_ % no_skip[char_(", ")] ;
|
start = transform_ % no_skip[char_(", ")] ;
|
||||||
#else
|
#else
|
||||||
using qi::lexeme;
|
qi::lexeme_type lexeme;
|
||||||
start = transform_ % lexeme[char_(", ")] ;
|
start = transform_ % lexeme[char_(", ")] ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -44,9 +44,10 @@ wkt_parser::wkt_parser()
|
||||||
bool wkt_parser::parse(std::string const& wkt, boost::ptr_vector<geometry_type> & paths)
|
bool wkt_parser::parse(std::string const& wkt, boost::ptr_vector<geometry_type> & paths)
|
||||||
{
|
{
|
||||||
using namespace boost::spirit;
|
using namespace boost::spirit;
|
||||||
|
ascii::space_type space;
|
||||||
iterator_type first = wkt.begin();
|
iterator_type first = wkt.begin();
|
||||||
iterator_type last = wkt.end();
|
iterator_type last = wkt.end();
|
||||||
return qi::phrase_parse(first, last, *grammar_, ascii::space, paths);
|
return qi::phrase_parse(first, last, *grammar_, space, paths);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -58,35 +58,35 @@ template <typename OutputIterator, typename Geometry>
|
||||||
wkt_generator<OutputIterator, Geometry>::wkt_generator(bool single)
|
wkt_generator<OutputIterator, Geometry>::wkt_generator(bool single)
|
||||||
: wkt_generator::base_type(wkt)
|
: wkt_generator::base_type(wkt)
|
||||||
{
|
{
|
||||||
using boost::spirit::karma::uint_;
|
boost::spirit::karma::uint_type uint_;
|
||||||
using boost::spirit::karma::_val;
|
boost::spirit::karma::_val_type _val;
|
||||||
using boost::spirit::karma::_1;
|
boost::spirit::karma::_1_type _1;
|
||||||
using boost::spirit::karma::lit;
|
boost::spirit::karma::lit_type lit;
|
||||||
using boost::spirit::karma::_a;
|
boost::spirit::karma::_a_type _a;
|
||||||
using boost::spirit::karma::_b;
|
boost::spirit::karma::_b_type _b;
|
||||||
using boost::spirit::karma::_c;
|
boost::spirit::karma::_c_type _c;
|
||||||
using boost::spirit::karma::_r1;
|
boost::spirit::karma::_r1_type _r1;
|
||||||
using boost::spirit::karma::eps;
|
boost::spirit::karma::eps_type eps;
|
||||||
using boost::spirit::karma::string;
|
boost::spirit::karma::string_type kstring;
|
||||||
|
|
||||||
wkt = point | linestring | polygon
|
wkt = point | linestring | polygon
|
||||||
;
|
;
|
||||||
|
|
||||||
point = &uint_(mapnik::geometry_type::types::Point)[_1 = _type(_val)]
|
point = &uint_(mapnik::geometry_type::types::Point)[_1 = _type(_val)]
|
||||||
<< string[ phoenix::if_ (single) [_1 = "Point("]
|
<< kstring[ phoenix::if_ (single) [_1 = "Point("]
|
||||||
.else_[_1 = "("]]
|
.else_[_1 = "("]]
|
||||||
<< point_coord [_1 = _first(_val)] << lit(')')
|
<< point_coord [_1 = _first(_val)] << lit(')')
|
||||||
;
|
;
|
||||||
|
|
||||||
linestring = &uint_(mapnik::geometry_type::types::LineString)[_1 = _type(_val)]
|
linestring = &uint_(mapnik::geometry_type::types::LineString)[_1 = _type(_val)]
|
||||||
<< string[ phoenix::if_ (single) [_1 = "LineString("]
|
<< kstring[ phoenix::if_ (single) [_1 = "LineString("]
|
||||||
.else_[_1 = "("]]
|
.else_[_1 = "("]]
|
||||||
<< coords
|
<< coords
|
||||||
<< lit(')')
|
<< lit(')')
|
||||||
;
|
;
|
||||||
|
|
||||||
polygon = &uint_(mapnik::geometry_type::types::Polygon)[_1 = _type(_val)]
|
polygon = &uint_(mapnik::geometry_type::types::Polygon)[_1 = _type(_val)]
|
||||||
<< string[ phoenix::if_ (single) [_1 = "Polygon("]
|
<< kstring[ phoenix::if_ (single) [_1 = "Polygon("]
|
||||||
.else_[_1 = "("]]
|
.else_[_1 = "("]]
|
||||||
<< coords2
|
<< coords2
|
||||||
<< lit("))")
|
<< lit("))")
|
||||||
|
@ -97,7 +97,7 @@ wkt_generator<OutputIterator, Geometry>::wkt_generator(bool single)
|
||||||
|
|
||||||
polygon_coord %= ( &uint_(mapnik::SEG_MOVETO)
|
polygon_coord %= ( &uint_(mapnik::SEG_MOVETO)
|
||||||
<< eps[_r1 += 1][_a = _x(_val)][ _b = _y(_val)]
|
<< eps[_r1 += 1][_a = _x(_val)][ _b = _y(_val)]
|
||||||
<< string[ if_ (_r1 > 1) [_1 = "),("]
|
<< kstring[ if_ (_r1 > 1) [_1 = "),("]
|
||||||
.else_[_1 = "("]]
|
.else_[_1 = "("]]
|
||||||
|
|
|
|
||||||
&uint_(mapnik::SEG_LINETO)
|
&uint_(mapnik::SEG_LINETO)
|
||||||
|
@ -119,11 +119,11 @@ template <typename OutputIterator, typename GeometryContainer>
|
||||||
wkt_multi_generator<OutputIterator, GeometryContainer>::wkt_multi_generator()
|
wkt_multi_generator<OutputIterator, GeometryContainer>::wkt_multi_generator()
|
||||||
: wkt_multi_generator::base_type(wkt)
|
: wkt_multi_generator::base_type(wkt)
|
||||||
{
|
{
|
||||||
using boost::spirit::karma::lit;
|
boost::spirit::karma::lit_type lit;
|
||||||
using boost::spirit::karma::eps;
|
boost::spirit::karma::eps_type eps;
|
||||||
using boost::spirit::karma::_val;
|
boost::spirit::karma::_val_type _val;
|
||||||
using boost::spirit::karma::_1;
|
boost::spirit::karma::_1_type _1;
|
||||||
using boost::spirit::karma::_a;
|
boost::spirit::karma::_a_type _a;
|
||||||
|
|
||||||
geometry_types.add
|
geometry_types.add
|
||||||
(mapnik::geometry_type::types::Point,"Point")
|
(mapnik::geometry_type::types::Point,"Point")
|
||||||
|
|
Loading…
Reference in a new issue