various post-merge fixes

This commit is contained in:
Dane Springmeyer 2013-09-18 19:51:14 -07:00
parent 5cd2152866
commit 111bdccebc
12 changed files with 249 additions and 183 deletions

View file

@ -80,9 +80,13 @@ inline int clip_int(int val)
struct percent_conv_impl
{
typedef unsigned result_type;
template <typename T>
struct result
{
typedef unsigned type;
};
result_type operator() (double val) const
unsigned operator() (double val) const
{
return clip_int<0,255>(int((255.0 * val)/100.0 + 0.5));
}
@ -90,9 +94,13 @@ struct percent_conv_impl
struct alpha_conv_impl
{
typedef unsigned result_type;
template <typename T>
struct result
{
typedef unsigned type;
};
result_type operator() (double val) const
unsigned operator() (double val) const
{
return clip_int<0,255>(int((255.0 * val) + 0.5));
}
@ -100,10 +108,18 @@ struct alpha_conv_impl
struct hsl_conv_impl
{
typedef void result_type;
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
template<typename T>
#else
template<typename T0,typename T1, typename T2, typename T3>
#endif
struct result
{
typedef void type;
};
template <typename T0,typename T1, typename T2, typename T3>
result_type operator() (T0 & c, T1 h, T2 s, T3 l) const
void operator() (T0 & c, T1 h, T2 s, T3 l) const
{
double m1,m2;
// normalize values

View file

@ -46,12 +46,16 @@ using standard_wide::space_type;
struct unicode_impl
{
typedef mapnik::value_unicode_string result_type;
template <typename T>
struct result
{
typedef mapnik::value_unicode_string type;
};
explicit unicode_impl(mapnik::transcoder const& tr)
: tr_(tr) {}
result_type operator()(std::string const& str) const
mapnik::value_unicode_string operator()(std::string const& str) const
{
return tr_.transcode(str.c_str());
}
@ -61,26 +65,43 @@ struct unicode_impl
struct regex_match_impl
{
typedef expr_node result_type;
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
template <typename T>
#else
template <typename T0, typename T1>
#endif
struct result
{
typedef expr_node type;
};
explicit regex_match_impl(mapnik::transcoder const& tr)
: tr_(tr) {}
template <typename T0,typename T1>
result_type operator() (T0 & node, T1 const& pattern) const;
expr_node operator() (T0 & node, T1 const& pattern) const;
mapnik::transcoder const& tr_;
};
struct regex_replace_impl
{
typedef expr_node result_type;
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
template <typename T>
#else
template <typename T0, typename T1, typename T2>
#endif
struct result
{
typedef expr_node type;
};
explicit regex_replace_impl(mapnik::transcoder const& tr)
: tr_(tr) {}
template <typename T0,typename T1,typename T2>
result_type operator() (T0 & node, T1 const& pattern, T2 const& format) const;
expr_node operator() (T0 & node, T1 const& pattern, T2 const& format) const;
mapnik::transcoder const& tr_;
};

View file

@ -235,7 +235,6 @@ public:
{
if (first)
{
first = false;
box2d<double> box = geom.envelope();
result.init(box.minx(),box.miny(),box.maxx(),box.maxy());
first = false;

View file

@ -93,14 +93,16 @@ struct extract_geometry
#else
struct put_property
{
typedef void result_type;
template <typename T0,typename T1, typename T2>
struct result
{
typedef void type;
};
explicit put_property(mapnik::transcoder const& tr)
: tr_(tr) {}
template <typename T0,typename T1, typename T2>
result_type operator() (T0 & feature, T1 const& key, T2 const& val) const
void operator() (T0 & feature, T1 const& key, T2 const& val) const
{
mapnik::value v = boost::apply_visitor(attribute_value_visitor(tr_),val); // TODO: optimize
feature.put_new(key, v);
@ -111,10 +113,14 @@ struct put_property
struct extract_geometry
{
typedef boost::ptr_vector<mapnik::geometry_type>& result_type;
template <typename T>
struct result
{
typedef boost::ptr_vector<mapnik::geometry_type>& type;
};
template <typename T>
result_type operator() (T & feature) const
boost::ptr_vector<mapnik::geometry_type>& operator() (T & feature) const
{
return feature.paths();
}

View file

@ -106,8 +106,10 @@ struct multi_geometry_type
#else
struct get_type
{
typedef int result_type;
result_type operator() (geometry_type const& geom) const
template <typename T>
struct result { typedef int type; };
int operator() (geometry_type const& geom) const
{
return static_cast<int>(geom.type());
}
@ -115,8 +117,10 @@ struct get_type
struct get_first
{
typedef geometry_type::value_type const result_type;
result_type operator() (geometry_type const& geom) const
template <typename T>
struct result { typedef geometry_type::value_type const type; };
geometry_type::value_type const operator() (geometry_type const& geom) const
{
geometry_type::value_type coord;
boost::get<0>(coord) = geom.vertex(0,&boost::get<1>(coord),&boost::get<2>(coord));
@ -126,8 +130,10 @@ struct get_first
struct multi_geometry_type
{
typedef boost::tuple<unsigned,bool> result_type;
result_type operator() (geometry_container const& geom) const
template <typename T>
struct result { typedef boost::tuple<unsigned,bool> type; };
boost::tuple<unsigned,bool> operator() (geometry_container const& geom) const
{
unsigned type = 0u;
bool collection = false;
@ -276,7 +282,6 @@ struct multi_geometry_generator_grammar :
using boost::spirit::karma::_1;
using boost::spirit::karma::_a;
using boost::spirit::karma::_r1;
using boost::spirit::karma::string;
geometry_types.add
(mapnik::geometry_type::types::Point,"\"Point\"")
@ -300,9 +305,9 @@ struct multi_geometry_generator_grammar :
geometry = (lit("{\"type\":")
<< geometry_types[_1 = phoenix::at_c<0>(_a)][_a = _multi_type(_val)]
<< lit(",\"coordinates\":")
<< string[ phoenix::if_ (phoenix::at_c<0>(_a) > 3) [_1 = '['].else_[_1 = ""]]
<< karma::string[ phoenix::if_ (phoenix::at_c<0>(_a) > 3) [_1 = '['].else_[_1 = ""]]
<< coordinates
<< string[ phoenix::if_ (phoenix::at_c<0>(_a) > 3) [_1 = ']'].else_[_1 = ""]]
<< karma::string[ phoenix::if_ (phoenix::at_c<0>(_a) > 3) [_1 = ']'].else_[_1 = ""]]
<< lit('}')) | lit("null")
;

View file

@ -88,10 +88,14 @@ struct where_message
#else
struct push_vertex
{
typedef void result_type;
template <typename T0,typename T1, typename T2, typename T3>
struct result
{
typedef void type;
};
template <typename T0,typename T1, typename T2, typename T3>
result_type operator() (T0 c, T1 path, T2 x, T3 y) const
void operator() (T0 c, T1 path, T2 x, T3 y) const
{
BOOST_ASSERT( path!=0 );
path->push_vertex(x,y,c);
@ -100,10 +104,14 @@ struct push_vertex
struct close_path
{
typedef void result_type;
template <typename T>
struct result
{
typedef void type;
};
template <typename T>
result_type operator() (T path) const
void operator() (T path) const
{
BOOST_ASSERT( path!=0 );
path->close_path();
@ -112,7 +120,12 @@ struct close_path
struct cleanup
{
typedef void result_type;
template <typename T0>
struct result
{
typedef void type;
};
template <typename T0>
void operator() (T0 & path) const
{
@ -122,8 +135,11 @@ struct cleanup
struct where_message
{
typedef std::string result_type;
template <typename T0,typename T1,typename T2>
struct result
{
typedef std::string type;
};
template <typename Iterator>
std::string operator() (Iterator first, Iterator last, std::size_t size) const
@ -134,8 +150,8 @@ struct where_message
return str;
}
};
#endif
#endif // PHOENIX_V3
template <typename Iterator>
struct geometry_grammar :

View file

@ -164,11 +164,6 @@ protected:
MAPNIK_DECL std::string utf16_to_utf8(std::wstring const& wstr);
MAPNIK_DECL std::wstring utf8_to_utf16(std::string const& str);
// UTF8 <--> UTF16 conversion routines
MAPNIK_DECL std::string utf16_to_utf8(std::wstring const& wstr);
MAPNIK_DECL std::wstring utf8_to_utf16(std::string const& str);
#endif // _WINDOWS
}

View file

@ -43,6 +43,7 @@
#include <boost/fusion/container/vector.hpp>
#include <boost/fusion/include/at_c.hpp>
#include <boost/fusion/include/make_vector.hpp>
#include <boost/array.hpp>
// mapnik

View file

@ -36,6 +36,7 @@
// boost
#include <boost/scoped_array.hpp>
namespace mapnik {
template <typename T>
@ -83,7 +84,6 @@ void save_as_webp(T1& file,
}
// Add additional tuning
if (method >= 0) config.method = method;
#if (WEBP_ENCODER_ABI_VERSION >> 8) >= 1
config.lossless = !!lossless;

View file

@ -39,164 +39,182 @@
namespace mapnik { namespace wkt {
using namespace boost::spirit;
using namespace boost::fusion;
using namespace boost::phoenix;
using namespace boost::spirit;
using namespace boost::phoenix;
struct push_vertex
{
typedef void result_type;
template <typename T0,typename T1, typename T2, typename T3>
result_type operator() (T0 c, T1 path, T2 x, T3 y) const
struct push_vertex
{
BOOST_ASSERT( path!=0 );
path->push_vertex(x,y,c);
}
};
#ifdef BOOST_SPIRIT_USE_PHOENIX_V3
template <typename T>
#else
template <typename T0,typename T1, typename T2, typename T3>
#endif
struct result
{
typedef void type;
};
struct close_path
{
typedef void result_type;
template <typename T>
result_type operator() (T path) const
template <typename T0,typename T1, typename T2, typename T3>
void operator() (T0 c, T1 path, T2 x, T3 y) const
{
BOOST_ASSERT( path!=0 );
path->push_vertex(x,y,c);
}
};
struct close_path
{
BOOST_ASSERT( path!=0 );
path->close_path();
}
};
template <typename T>
struct result
{
typedef void type;
};
struct cleanup
{
typedef void result_type;
template <typename T0>
void operator() (T0 & path) const
template <typename T>
void operator() (T path) const
{
BOOST_ASSERT( path!=0 );
path->close_path();
}
};
struct cleanup
{
if (path) delete path,path=0;
}
};
template <typename T0>
struct result
{
typedef void type;
};
template <typename Iterator>
struct wkt_grammar : qi::grammar<Iterator, boost::ptr_vector<mapnik::geometry_type>() , ascii::space_type>
{
wkt_grammar()
: wkt_grammar::base_type(geometry_tagged_text)
template <typename T0>
void operator() (T0 & path) const
{
if (path) delete path,path=0;
}
};
template <typename Iterator>
struct wkt_grammar : qi::grammar<Iterator, boost::ptr_vector<mapnik::geometry_type>() , ascii::space_type>
{
using qi::no_case;
using qi::_1;
using qi::_2;
using boost::phoenix::push_back;
wkt_grammar()
: wkt_grammar::base_type(geometry_tagged_text)
{
using qi::no_case;
using qi::_1;
using qi::_2;
using boost::phoenix::push_back;
geometry_tagged_text = point_tagged_text
| linestring_tagged_text
| polygon_tagged_text
| multipoint_tagged_text
| multilinestring_tagged_text
| multipolygon_tagged_text
;
geometry_tagged_text = point_tagged_text
| linestring_tagged_text
| polygon_tagged_text
| multipoint_tagged_text
| multilinestring_tagged_text
| multipolygon_tagged_text
;
// <point tagged text> ::= point <point text>
point_tagged_text = no_case[lit("POINT")] [ _a = new_<geometry_type>(geometry_type::types::Point) ]
>> ( point_text(_a) [push_back(_val,_a)]
| eps[cleanup_(_a)][_pass = false])
;
// <point tagged text> ::= point <point text>
point_tagged_text = no_case[lit("POINT")] [ _a = new_<geometry_type>(geometry_type::types::Point) ]
>> ( point_text(_a) [push_back(_val,_a)]
| eps[cleanup_(_a)][_pass = false])
;
// <point text> ::= <empty set> | <left paren> <point> <right paren>
point_text = (lit("(") >> point(SEG_MOVETO,_r1) >> lit(')'))
| empty_set
;
// <point text> ::= <empty set> | <left paren> <point> <right paren>
point_text = (lit("(") >> point(SEG_MOVETO,_r1) >> lit(')'))
| empty_set
;
// <linestring tagged text> ::= linestring <linestring text>
linestring_tagged_text = no_case[lit("LINESTRING")] [ _a = new_<geometry_type>(geometry_type::types::LineString) ]
>> (linestring_text(_a)[push_back(_val,_a)]
| eps[cleanup_(_a)][_pass = false])
;
// <linestring tagged text> ::= linestring <linestring text>
linestring_tagged_text = no_case[lit("LINESTRING")] [ _a = new_<geometry_type>(geometry_type::types::LineString) ]
>> (linestring_text(_a)[push_back(_val,_a)]
| eps[cleanup_(_a)][_pass = false])
;
// <linestring text> ::= <empty set> | <left paren> <point> {<comma> <point>}* <right paren>
linestring_text = points(_r1) | empty_set
;
// <linestring text> ::= <empty set> | <left paren> <point> {<comma> <point>}* <right paren>
linestring_text = points(_r1) | empty_set
;
// <polygon tagged text> ::= polygon <polygon text>
polygon_tagged_text = no_case[lit("POLYGON")] [ _a = new_<geometry_type>(geometry_type::types::Polygon) ]
>> ( polygon_text(_a)[push_back(_val,_a)]
| eps[cleanup_(_a)][_pass = false])
;
// <polygon tagged text> ::= polygon <polygon text>
polygon_tagged_text = no_case[lit("POLYGON")] [ _a = new_<geometry_type>(geometry_type::types::Polygon) ]
>> ( polygon_text(_a)[push_back(_val,_a)]
| eps[cleanup_(_a)][_pass = false])
;
// <polygon text> ::= <empty set> | <left paren> <linestring text> {<comma> <linestring text>}* <right paren>
polygon_text = (lit('(') >> linestring_text(_r1)[close_path_(_r1)] % lit(',') >> lit(')')) | empty_set;
// <polygon text> ::= <empty set> | <left paren> <linestring text> {<comma> <linestring text>}* <right paren>
polygon_text = (lit('(') >> linestring_text(_r1)[close_path_(_r1)] % lit(',') >> lit(')')) | empty_set;
//<multipoint tagged text> ::= multipoint <multipoint text>
multipoint_tagged_text = no_case[lit("MULTIPOINT")]
>> multipoint_text
;
//<multipoint tagged text> ::= multipoint <multipoint text>
multipoint_tagged_text = no_case[lit("MULTIPOINT")]
>> multipoint_text
;
// <multipoint text> ::= <empty set> | <left paren> <point text> {<comma> <point text>}* <right paren>
multipoint_text = (lit('(')
>> ((eps[_a = new_<geometry_type>(geometry_type::types::Point)]
>> (point_text(_a) | empty_set) [push_back(_val,_a)]
| eps[cleanup_(_a)][_pass = false]) % lit(','))
>> lit(')')) | empty_set
;
// <multipoint text> ::= <empty set> | <left paren> <point text> {<comma> <point text>}* <right paren>
multipoint_text = (lit('(')
>> ((eps[_a = new_<geometry_type>(geometry_type::types::Point)]
>> (point_text(_a) | empty_set) [push_back(_val,_a)]
| eps[cleanup_(_a)][_pass = false]) % lit(','))
>> lit(')')) | empty_set
;
// <multilinestring tagged text> ::= multilinestring <multilinestring text>
multilinestring_tagged_text = no_case[lit("MULTILINESTRING")]
>> multilinestring_text ;
// <multilinestring tagged text> ::= multilinestring <multilinestring text>
multilinestring_tagged_text = no_case[lit("MULTILINESTRING")]
>> multilinestring_text ;
// <multilinestring text> ::= <empty set> | <left paren> <linestring text> {<comma> <linestring text>}* <right paren>
multilinestring_text = (lit('(')
>> ((eps[_a = new_<geometry_type>(geometry_type::types::LineString)]
>> ( points(_a)[push_back(_val,_a)]
| eps[cleanup_(_a)][_pass = false]))
% lit(','))
>> lit(')')) | empty_set;
// <multilinestring text> ::= <empty set> | <left paren> <linestring text> {<comma> <linestring text>}* <right paren>
multilinestring_text = (lit('(')
>> ((eps[_a = new_<geometry_type>(geometry_type::types::LineString)]
>> ( points(_a)[push_back(_val,_a)]
| eps[cleanup_(_a)][_pass = false]))
% lit(','))
>> lit(')')) | empty_set;
// <multipolygon tagged text> ::= multipolygon <multipolygon text>
multipolygon_tagged_text = no_case[lit("MULTIPOLYGON")]
>> multipolygon_text ;
// <multipolygon tagged text> ::= multipolygon <multipolygon text>
multipolygon_tagged_text = no_case[lit("MULTIPOLYGON")]
>> multipolygon_text ;
// <multipolygon text> ::= <empty set> | <left paren> <polygon text> {<comma> <polygon text>}* <right paren>
// <multipolygon text> ::= <empty set> | <left paren> <polygon text> {<comma> <polygon text>}* <right paren>
multipolygon_text = (lit('(')
>> ((eps[_a = new_<geometry_type>(geometry_type::types::Polygon)]
>> ( polygon_text(_a)[push_back(_val,_a)]
| eps[cleanup_(_a)][_pass = false]))
% lit(','))
>> lit(')')) | empty_set;
multipolygon_text = (lit('(')
>> ((eps[_a = new_<geometry_type>(geometry_type::types::Polygon)]
>> ( polygon_text(_a)[push_back(_val,_a)]
| eps[cleanup_(_a)][_pass = false]))
% lit(','))
>> lit(')')) | empty_set;
// points
points = lit('(')[_a = SEG_MOVETO] >> point (_a,_r1) % lit(',') [_a = SEG_LINETO] >> lit(')');
// point
point = (double_ >> double_) [push_vertex_(_r1,_r2,_1,_2)];
// points
points = lit('(')[_a = SEG_MOVETO] >> point (_a,_r1) % lit(',') [_a = SEG_LINETO] >> lit(')');
// point
point = (double_ >> double_) [push_vertex_(_r1,_r2,_1,_2)];
// <empty set>
empty_set = no_case[lit("EMPTY")];
// <empty set>
empty_set = no_case[lit("EMPTY")];
}
}
// start
qi::rule<Iterator,boost::ptr_vector<geometry_type>(),ascii::space_type> geometry_tagged_text;
// start
qi::rule<Iterator,boost::ptr_vector<geometry_type>(),ascii::space_type> geometry_tagged_text;
qi::rule<Iterator,qi::locals<geometry_type*>,boost::ptr_vector<geometry_type>(),ascii::space_type> point_tagged_text;
qi::rule<Iterator,qi::locals<geometry_type*>,boost::ptr_vector<geometry_type>(),ascii::space_type> linestring_tagged_text;
qi::rule<Iterator,qi::locals<geometry_type*>,boost::ptr_vector<geometry_type>(),ascii::space_type> polygon_tagged_text;
qi::rule<Iterator,boost::ptr_vector<geometry_type>(),ascii::space_type> multipoint_tagged_text;
qi::rule<Iterator,boost::ptr_vector<geometry_type>(),ascii::space_type> multilinestring_tagged_text;
qi::rule<Iterator,boost::ptr_vector<geometry_type>(),ascii::space_type> multipolygon_tagged_text;
//
qi::rule<Iterator,void(geometry_type*),ascii::space_type> point_text;
qi::rule<Iterator,void(geometry_type*),ascii::space_type> linestring_text;
qi::rule<Iterator,void(geometry_type*),ascii::space_type> polygon_text;
qi::rule<Iterator, qi::locals<geometry_type*>, boost::ptr_vector<geometry_type>(),ascii::space_type> multipoint_text;
qi::rule<Iterator, qi::locals<geometry_type*>, boost::ptr_vector<geometry_type>(),ascii::space_type> multilinestring_text;
qi::rule<Iterator, qi::locals<geometry_type*>, boost::ptr_vector<geometry_type>(),ascii::space_type> multipolygon_text;
//
qi::rule<Iterator,void(CommandType,geometry_type*),ascii::space_type> point;
qi::rule<Iterator,qi::locals<CommandType>,void(geometry_type*),ascii::space_type> points;
qi::rule<Iterator,ascii::space_type> empty_set;
boost::phoenix::function<push_vertex> push_vertex_;
boost::phoenix::function<close_path> close_path_;
boost::phoenix::function<cleanup> cleanup_;
};
qi::rule<Iterator,qi::locals<geometry_type*>,boost::ptr_vector<geometry_type>(),ascii::space_type> point_tagged_text;
qi::rule<Iterator,qi::locals<geometry_type*>,boost::ptr_vector<geometry_type>(),ascii::space_type> linestring_tagged_text;
qi::rule<Iterator,qi::locals<geometry_type*>,boost::ptr_vector<geometry_type>(),ascii::space_type> polygon_tagged_text;
qi::rule<Iterator,boost::ptr_vector<geometry_type>(),ascii::space_type> multipoint_tagged_text;
qi::rule<Iterator,boost::ptr_vector<geometry_type>(),ascii::space_type> multilinestring_tagged_text;
qi::rule<Iterator,boost::ptr_vector<geometry_type>(),ascii::space_type> multipolygon_tagged_text;
//
qi::rule<Iterator,void(geometry_type*),ascii::space_type> point_text;
qi::rule<Iterator,void(geometry_type*),ascii::space_type> linestring_text;
qi::rule<Iterator,void(geometry_type*),ascii::space_type> polygon_text;
qi::rule<Iterator, qi::locals<geometry_type*>, boost::ptr_vector<geometry_type>(),ascii::space_type> multipoint_text;
qi::rule<Iterator, qi::locals<geometry_type*>, boost::ptr_vector<geometry_type>(),ascii::space_type> multilinestring_text;
qi::rule<Iterator, qi::locals<geometry_type*>, boost::ptr_vector<geometry_type>(),ascii::space_type> multipolygon_text;
//
qi::rule<Iterator,void(CommandType,geometry_type*),ascii::space_type> point;
qi::rule<Iterator,qi::locals<CommandType>,void(geometry_type*),ascii::space_type> points;
qi::rule<Iterator,ascii::space_type> empty_set;
boost::phoenix::function<push_vertex> push_vertex_;
boost::phoenix::function<close_path> close_path_;
boost::phoenix::function<cleanup> cleanup_;
};
template <typename Iterator>

View file

@ -77,7 +77,6 @@ shape_datasource::shape_datasource(const parameters &params)
shape_name_ = *file;
boost::algorithm::ireplace_last(shape_name_,".shp","");
if (!mapnik::util::exists(shape_name_ + ".shp"))
{
throw datasource_exception("Shape Plugin: shapefile '" + shape_name_ + ".shp' does not exist");

View file

@ -80,9 +80,6 @@ if '-DHAVE_JPEG' in env['CPPDEFINES']:
lib_env['LIBS'].append('jpeg')
enabled_imaging_libraries.append('jpeg_reader.cpp')
if env['WEBP']:
lib_env['LIBS'].append('webp')
if len(env['EXTRA_FREETYPE_LIBS']):
lib_env['LIBS'].extend(copy(env['EXTRA_FREETYPE_LIBS']))
@ -269,13 +266,6 @@ if env['HAS_CAIRO']:
for cpp in enabled_imaging_libraries:
source.append(cpp)
if env['WEBP']:
source += Split(
"""
webp_reader.cpp
""")
# agg backend
source += Split(
"""