From 111bdccebc9c14bd8d059d5426343db258c9661e Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 18 Sep 2013 19:51:14 -0700 Subject: [PATCH] various post-merge fixes --- include/mapnik/css_color_grammar.hpp | 28 +- include/mapnik/expression_grammar.hpp | 33 ++- include/mapnik/feature.hpp | 1 - include/mapnik/json/feature_grammar.hpp | 18 +- .../json/geometry_generator_grammar.hpp | 23 +- include/mapnik/json/geometry_grammar.hpp | 32 +- include/mapnik/utils.hpp | 5 - include/mapnik/vertex_converters.hpp | 1 + include/mapnik/webp_io.hpp | 2 +- include/mapnik/wkt/wkt_grammar.hpp | 278 ++++++++++-------- plugins/input/shape/shape_datasource.cpp | 1 - src/build.py | 10 - 12 files changed, 249 insertions(+), 183 deletions(-) diff --git a/include/mapnik/css_color_grammar.hpp b/include/mapnik/css_color_grammar.hpp index 58e2f0c70..e5dd849b1 100644 --- a/include/mapnik/css_color_grammar.hpp +++ b/include/mapnik/css_color_grammar.hpp @@ -80,9 +80,13 @@ inline int clip_int(int val) struct percent_conv_impl { - typedef unsigned result_type; + template + 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 + 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 +#else + template +#endif + struct result + { + typedef void type; + }; template - 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 diff --git a/include/mapnik/expression_grammar.hpp b/include/mapnik/expression_grammar.hpp index 97e619041..b0da07f76 100644 --- a/include/mapnik/expression_grammar.hpp +++ b/include/mapnik/expression_grammar.hpp @@ -46,12 +46,16 @@ using standard_wide::space_type; struct unicode_impl { - typedef mapnik::value_unicode_string result_type; + template + 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 +#else + template +#endif + struct result + { + typedef expr_node type; + }; explicit regex_match_impl(mapnik::transcoder const& tr) : tr_(tr) {} template - 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 +#else + template +#endif + struct result + { + typedef expr_node type; + }; explicit regex_replace_impl(mapnik::transcoder const& tr) : tr_(tr) {} template - 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_; }; diff --git a/include/mapnik/feature.hpp b/include/mapnik/feature.hpp index 1484c86b0..067b34cff 100644 --- a/include/mapnik/feature.hpp +++ b/include/mapnik/feature.hpp @@ -235,7 +235,6 @@ public: { if (first) { - first = false; box2d box = geom.envelope(); result.init(box.minx(),box.miny(),box.maxx(),box.maxy()); first = false; diff --git a/include/mapnik/json/feature_grammar.hpp b/include/mapnik/json/feature_grammar.hpp index 119c5d063..38bba2453 100644 --- a/include/mapnik/json/feature_grammar.hpp +++ b/include/mapnik/json/feature_grammar.hpp @@ -93,14 +93,16 @@ struct extract_geometry #else struct put_property { - - typedef void result_type; - + template + struct result + { + typedef void type; + }; explicit put_property(mapnik::transcoder const& tr) : tr_(tr) {} template - 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& result_type; + template + struct result + { + typedef boost::ptr_vector& type; + }; template - result_type operator() (T & feature) const + boost::ptr_vector& operator() (T & feature) const { return feature.paths(); } diff --git a/include/mapnik/json/geometry_generator_grammar.hpp b/include/mapnik/json/geometry_generator_grammar.hpp index f79f9decf..27d5acab0 100644 --- a/include/mapnik/json/geometry_generator_grammar.hpp +++ b/include/mapnik/json/geometry_generator_grammar.hpp @@ -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 + struct result { typedef int type; }; + + int operator() (geometry_type const& geom) const { return static_cast(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 + 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 result_type; - result_type operator() (geometry_container const& geom) const + template + struct result { typedef boost::tuple type; }; + + boost::tuple 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") ; diff --git a/include/mapnik/json/geometry_grammar.hpp b/include/mapnik/json/geometry_grammar.hpp index a0e2c9580..821ab9646 100644 --- a/include/mapnik/json/geometry_grammar.hpp +++ b/include/mapnik/json/geometry_grammar.hpp @@ -88,10 +88,14 @@ struct where_message #else struct push_vertex { - typedef void result_type; + template + struct result + { + typedef void type; + }; template - 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 + struct result + { + typedef void type; + }; template - 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 + struct result + { + typedef void type; + }; + template void operator() (T0 & path) const { @@ -122,8 +135,11 @@ struct cleanup struct where_message { - - typedef std::string result_type; + template + struct result + { + typedef std::string type; + }; template 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 struct geometry_grammar : diff --git a/include/mapnik/utils.hpp b/include/mapnik/utils.hpp index b820b3cef..0dbe28b6d 100644 --- a/include/mapnik/utils.hpp +++ b/include/mapnik/utils.hpp @@ -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 } diff --git a/include/mapnik/vertex_converters.hpp b/include/mapnik/vertex_converters.hpp index 2817e4baf..1d7d4b26f 100644 --- a/include/mapnik/vertex_converters.hpp +++ b/include/mapnik/vertex_converters.hpp @@ -43,6 +43,7 @@ #include #include #include + #include // mapnik diff --git a/include/mapnik/webp_io.hpp b/include/mapnik/webp_io.hpp index f3ed036c7..a697b39c9 100644 --- a/include/mapnik/webp_io.hpp +++ b/include/mapnik/webp_io.hpp @@ -36,6 +36,7 @@ // boost #include + namespace mapnik { template @@ -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; diff --git a/include/mapnik/wkt/wkt_grammar.hpp b/include/mapnik/wkt/wkt_grammar.hpp index b70943997..09d634531 100644 --- a/include/mapnik/wkt/wkt_grammar.hpp +++ b/include/mapnik/wkt/wkt_grammar.hpp @@ -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 - 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 +#else + template +#endif + struct result + { + typedef void type; + }; -struct close_path -{ - typedef void result_type; - template - result_type operator() (T path) const + template + 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 + struct result + { + typedef void type; + }; -struct cleanup -{ - typedef void result_type; - template - void operator() (T0 & path) const + template + void operator() (T path) const + { + BOOST_ASSERT( path!=0 ); + path->close_path(); + } + }; + + struct cleanup { - if (path) delete path,path=0; - } -}; + template + struct result + { + typedef void type; + }; -template -struct wkt_grammar : qi::grammar() , ascii::space_type> -{ - wkt_grammar() - : wkt_grammar::base_type(geometry_tagged_text) + template + void operator() (T0 & path) const + { + if (path) delete path,path=0; + } + }; + + template + struct wkt_grammar : qi::grammar() , 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 - point_tagged_text = no_case[lit("POINT")] [ _a = new_(geometry_type::types::Point) ] - >> ( point_text(_a) [push_back(_val,_a)] - | eps[cleanup_(_a)][_pass = false]) - ; + // ::= point + point_tagged_text = no_case[lit("POINT")] [ _a = new_(geometry_type::types::Point) ] + >> ( point_text(_a) [push_back(_val,_a)] + | eps[cleanup_(_a)][_pass = false]) + ; - // ::= | - point_text = (lit("(") >> point(SEG_MOVETO,_r1) >> lit(')')) - | empty_set - ; + // ::= | + point_text = (lit("(") >> point(SEG_MOVETO,_r1) >> lit(')')) + | empty_set + ; - // ::= linestring - linestring_tagged_text = no_case[lit("LINESTRING")] [ _a = new_(geometry_type::types::LineString) ] - >> (linestring_text(_a)[push_back(_val,_a)] - | eps[cleanup_(_a)][_pass = false]) - ; + // ::= linestring + linestring_tagged_text = no_case[lit("LINESTRING")] [ _a = new_(geometry_type::types::LineString) ] + >> (linestring_text(_a)[push_back(_val,_a)] + | eps[cleanup_(_a)][_pass = false]) + ; - // ::= | { }* - linestring_text = points(_r1) | empty_set - ; + // ::= | { }* + linestring_text = points(_r1) | empty_set + ; - // ::= polygon - polygon_tagged_text = no_case[lit("POLYGON")] [ _a = new_(geometry_type::types::Polygon) ] - >> ( polygon_text(_a)[push_back(_val,_a)] - | eps[cleanup_(_a)][_pass = false]) - ; + // ::= polygon + polygon_tagged_text = no_case[lit("POLYGON")] [ _a = new_(geometry_type::types::Polygon) ] + >> ( polygon_text(_a)[push_back(_val,_a)] + | eps[cleanup_(_a)][_pass = false]) + ; - // ::= | { }* - polygon_text = (lit('(') >> linestring_text(_r1)[close_path_(_r1)] % lit(',') >> lit(')')) | empty_set; + // ::= | { }* + polygon_text = (lit('(') >> linestring_text(_r1)[close_path_(_r1)] % lit(',') >> lit(')')) | empty_set; - // ::= multipoint - multipoint_tagged_text = no_case[lit("MULTIPOINT")] - >> multipoint_text - ; + // ::= multipoint + multipoint_tagged_text = no_case[lit("MULTIPOINT")] + >> multipoint_text + ; - // ::= | { }* - multipoint_text = (lit('(') - >> ((eps[_a = new_(geometry_type::types::Point)] - >> (point_text(_a) | empty_set) [push_back(_val,_a)] - | eps[cleanup_(_a)][_pass = false]) % lit(',')) - >> lit(')')) | empty_set - ; + // ::= | { }* + multipoint_text = (lit('(') + >> ((eps[_a = new_(geometry_type::types::Point)] + >> (point_text(_a) | empty_set) [push_back(_val,_a)] + | eps[cleanup_(_a)][_pass = false]) % lit(',')) + >> lit(')')) | empty_set + ; - // ::= multilinestring - multilinestring_tagged_text = no_case[lit("MULTILINESTRING")] - >> multilinestring_text ; + // ::= multilinestring + multilinestring_tagged_text = no_case[lit("MULTILINESTRING")] + >> multilinestring_text ; - // ::= | { }* - multilinestring_text = (lit('(') - >> ((eps[_a = new_(geometry_type::types::LineString)] - >> ( points(_a)[push_back(_val,_a)] - | eps[cleanup_(_a)][_pass = false])) - % lit(',')) - >> lit(')')) | empty_set; + // ::= | { }* + multilinestring_text = (lit('(') + >> ((eps[_a = new_(geometry_type::types::LineString)] + >> ( points(_a)[push_back(_val,_a)] + | eps[cleanup_(_a)][_pass = false])) + % lit(',')) + >> lit(')')) | empty_set; - // ::= multipolygon - multipolygon_tagged_text = no_case[lit("MULTIPOLYGON")] - >> multipolygon_text ; + // ::= multipolygon + multipolygon_tagged_text = no_case[lit("MULTIPOLYGON")] + >> multipolygon_text ; - // ::= | { }* + // ::= | { }* - multipolygon_text = (lit('(') - >> ((eps[_a = new_(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::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 = no_case[lit("EMPTY")]; + // + empty_set = no_case[lit("EMPTY")]; - } + } - // start - qi::rule(),ascii::space_type> geometry_tagged_text; + // start + qi::rule(),ascii::space_type> geometry_tagged_text; - qi::rule,boost::ptr_vector(),ascii::space_type> point_tagged_text; - qi::rule,boost::ptr_vector(),ascii::space_type> linestring_tagged_text; - qi::rule,boost::ptr_vector(),ascii::space_type> polygon_tagged_text; - qi::rule(),ascii::space_type> multipoint_tagged_text; - qi::rule(),ascii::space_type> multilinestring_tagged_text; - qi::rule(),ascii::space_type> multipolygon_tagged_text; - // - qi::rule point_text; - qi::rule linestring_text; - qi::rule polygon_text; - qi::rule, boost::ptr_vector(),ascii::space_type> multipoint_text; - qi::rule, boost::ptr_vector(),ascii::space_type> multilinestring_text; - qi::rule, boost::ptr_vector(),ascii::space_type> multipolygon_text; - // - qi::rule point; - qi::rule,void(geometry_type*),ascii::space_type> points; - qi::rule empty_set; - boost::phoenix::function push_vertex_; - boost::phoenix::function close_path_; - boost::phoenix::function cleanup_; -}; + qi::rule,boost::ptr_vector(),ascii::space_type> point_tagged_text; + qi::rule,boost::ptr_vector(),ascii::space_type> linestring_tagged_text; + qi::rule,boost::ptr_vector(),ascii::space_type> polygon_tagged_text; + qi::rule(),ascii::space_type> multipoint_tagged_text; + qi::rule(),ascii::space_type> multilinestring_tagged_text; + qi::rule(),ascii::space_type> multipolygon_tagged_text; + // + qi::rule point_text; + qi::rule linestring_text; + qi::rule polygon_text; + qi::rule, boost::ptr_vector(),ascii::space_type> multipoint_text; + qi::rule, boost::ptr_vector(),ascii::space_type> multilinestring_text; + qi::rule, boost::ptr_vector(),ascii::space_type> multipolygon_text; + // + qi::rule point; + qi::rule,void(geometry_type*),ascii::space_type> points; + qi::rule empty_set; + boost::phoenix::function push_vertex_; + boost::phoenix::function close_path_; + boost::phoenix::function cleanup_; + }; template diff --git a/plugins/input/shape/shape_datasource.cpp b/plugins/input/shape/shape_datasource.cpp index d4911a4a2..f147bb5a9 100644 --- a/plugins/input/shape/shape_datasource.cpp +++ b/plugins/input/shape/shape_datasource.cpp @@ -77,7 +77,6 @@ shape_datasource::shape_datasource(const parameters ¶ms) 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"); diff --git a/src/build.py b/src/build.py index 292d779f8..0dba64a0e 100644 --- a/src/build.py +++ b/src/build.py @@ -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( """