From f1cf712d50c14c06e815dd61cb71717068f1c795 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Thu, 23 Jan 2020 14:48:43 +0000 Subject: [PATCH] Add support for BOOST >= 1_72 (backport relevant changes from master) --- SConstruct | 1 + deps/agg/src/agg_pixfmt_rgba.cpp | 4 +- include/mapnik/feature.hpp | 5 + .../geometry/boost_spirit_karma_adapter.hpp | 121 ++++++++++++++++++ .../mapnik/json/feature_generator_grammar.hpp | 31 +++-- .../json/feature_generator_grammar_impl.hpp | 9 +- .../json/geometry_generator_grammar.hpp | 59 +++------ .../json/geometry_generator_grammar_impl.hpp | 86 ++++++------- .../properties_generator_grammar_impl.hpp | 16 +-- include/mapnik/svg/geometry_svg_generator.hpp | 14 +- include/mapnik/wkt/wkt_generator_grammar.hpp | 59 +++------ .../mapnik/wkt/wkt_generator_grammar_impl.hpp | 95 ++++++-------- src/json/mapnik_json_generator_grammar.cpp | 3 +- src/wkt/mapnik_wkt_generator_grammar.cpp | 3 +- 14 files changed, 284 insertions(+), 222 deletions(-) create mode 100644 include/mapnik/geometry/boost_spirit_karma_adapter.hpp diff --git a/SConstruct b/SConstruct index 5cf48f290..960c9087e 100644 --- a/SConstruct +++ b/SConstruct @@ -1087,6 +1087,7 @@ int main() return False def boost_regex_has_icu(context): + context.env.Append(LIBS='icui18n') if env['RUNTIME_LINK'] == 'static': # re-order icu libs to ensure linux linker is happy for lib_name in ['icui18n',env['ICU_LIB_NAME'],'icudata']: diff --git a/deps/agg/src/agg_pixfmt_rgba.cpp b/deps/agg/src/agg_pixfmt_rgba.cpp index 0fa18b230..a0a79c68e 100644 --- a/deps/agg/src/agg_pixfmt_rgba.cpp +++ b/deps/agg/src/agg_pixfmt_rgba.cpp @@ -5,11 +5,13 @@ #include #if BOOST_VERSION >= 106900 #include +#include +#include #else #include -#endif #include #include +#endif #pragma GCC diagnostic pop namespace agg diff --git a/include/mapnik/feature.hpp b/include/mapnik/feature.hpp index 1300d3220..db0c5fe9d 100644 --- a/include/mapnik/feature.hpp +++ b/include/mapnik/feature.hpp @@ -208,6 +208,11 @@ public: return geom_; } + inline geometry::geometry & get_geometry() + { + return geom_; + } + inline box2d envelope() const { return mapnik::geometry::envelope(geom_); diff --git a/include/mapnik/geometry/boost_spirit_karma_adapter.hpp b/include/mapnik/geometry/boost_spirit_karma_adapter.hpp new file mode 100644 index 000000000..4e652f371 --- /dev/null +++ b/include/mapnik/geometry/boost_spirit_karma_adapter.hpp @@ -0,0 +1,121 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2017 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + + +#ifndef MAPNIK_BOOST_SPIRIT_KARMA_ADAPTER_HPP +#define MAPNIK_BOOST_SPIRIT_KARMA_ADAPTER_HPP + +#include + +namespace boost { using mapbox::util::get; } + +#include +#include + +namespace boost { namespace spirit { namespace traits +{ +template <> +struct not_is_variant, karma::domain> + : mpl::false_ +{}; + +template <> +struct not_is_variant, karma::domain> + : mpl::false_ +{}; + +template <> +struct variant_which< mapnik::geometry::geometry > +{ + static int call(mapnik::geometry::geometry const& v) + { + return v.which(); + } +}; + +template <> +struct variant_which< mapnik::geometry::geometry > +{ + static int call(mapnik::geometry::geometry const& v) + { + return v.which(); + } +}; + +namespace detail { + +template +struct has_type; + +template +struct has_type> : std::false_type {}; + +template +struct has_type> : has_type> {}; + +template +struct has_type> : std::true_type {}; + +template +struct index; + +template +struct index> +{ + static const std::size_t value = 0; +}; + +template +struct index> +{ + static const std::size_t value = 1 + index>::value; +}; + +} + +template +struct compute_compatible_component_variant, Expected> + : detail::has_type::types> +{ + using compatible_type = Expected; + static bool is_compatible(int index) + { + return (index == detail::index::types>::value); + } +}; + +template +struct compute_compatible_component_variant, Expected> + : detail::has_type::types> +{ + using compatible_type = Expected; + static bool is_compatible(int index) + { + return (index == detail::index::types>::value); + } +}; + +}}} + + + +#endif //MAPNIK_BOOST_SPIRIT_KARMA_ADAPTER_HPP diff --git a/include/mapnik/json/feature_generator_grammar.hpp b/include/mapnik/json/feature_generator_grammar.hpp index 9eaa3bb99..7bfbbc5e2 100644 --- a/include/mapnik/json/feature_generator_grammar.hpp +++ b/include/mapnik/json/feature_generator_grammar.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2015 Artem Pavlenko + * Copyright (C) 2017 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -63,17 +63,18 @@ struct end_container } }; +#if BOOST_VERSION >= 106900 template <> -struct transform_attribute, - mapnik::geometry::geometry const& , karma::domain> -{ - using type = mapnik::geometry::geometry const&; - static type pre(const boost::fusion::cons& f) - { - return boost::fusion::at >(f).get_geometry(); - } -}; +struct transform_attribute + : detail::transform_attribute_base +{}; +template <> +struct transform_attribute, const mapnik::feature_impl &, + boost::spirit::karma::domain, void> + : detail::transform_attribute_base, mapnik::feature_impl const&, boost::spirit::karma::domain> +{}; +#endif }}} namespace mapnik { namespace json { @@ -91,6 +92,15 @@ struct get_id } }; +struct extract_geometry +{ + using result_type = mapnik::geometry::geometry const&; + template + result_type operator() (T const& f) const + { + return f.get_geometry(); + } +}; template struct feature_generator_grammar : @@ -101,6 +111,7 @@ struct feature_generator_grammar : geometry_generator_grammar > geometry; properties_generator_grammar properties; boost::phoenix::function > id_; + boost::phoenix::function geom_; }; }} diff --git a/include/mapnik/json/feature_generator_grammar_impl.hpp b/include/mapnik/json/feature_generator_grammar_impl.hpp index f819baa80..baf4be853 100644 --- a/include/mapnik/json/feature_generator_grammar_impl.hpp +++ b/include/mapnik/json/feature_generator_grammar_impl.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2015 Artem Pavlenko + * Copyright (C) 2017 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,11 +22,6 @@ #include -#include -#include -#include -#include - namespace mapnik { namespace json { template @@ -40,7 +35,7 @@ feature_generator_grammar::feature_generator_gramma feature = lit("{\"type\":\"Feature\",\"id\":") << uint_[_1 = id_(_val)] - << lit(",\"geometry\":") << geometry + << lit(",\"geometry\":") << geometry[_1 = geom_(_val)] << lit(",\"properties\":") << properties << lit('}') ; diff --git a/include/mapnik/json/geometry_generator_grammar.hpp b/include/mapnik/json/geometry_generator_grammar.hpp index 0e314650b..cd879dab7 100644 --- a/include/mapnik/json/geometry_generator_grammar.hpp +++ b/include/mapnik/json/geometry_generator_grammar.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2015 Artem Pavlenko + * Copyright (C) 2017 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -26,13 +26,10 @@ // mapnik #include #include -#include // boost #pragma GCC diagnostic push #include #include -#include -#include #include // for vc++ and android whose c++11 libs lack std::trunc #include #pragma GCC diagnostic pop @@ -43,18 +40,6 @@ namespace karma = boost::spirit::karma; namespace detail { -template -struct get_type -{ - using result_type = mapnik::geometry::geometry_types; - template - result_type operator() (T const& geom) const - { - auto type = mapnik::geometry::geometry_type(geom); - return type; - } -}; - template struct json_coordinate_policy : karma::real_policies { @@ -88,30 +73,28 @@ struct json_coordinate_policy : karma::real_policies template struct geometry_generator_grammar : - karma::grammar + karma::grammar { + using coord_type = typename Geometry::coord_type; geometry_generator_grammar(); - karma::rule geometry; - karma::rule, Geometry const&() > geometry_dispatch; - karma::rule const&()> point; - karma::rule const&()> point_coord; - karma::rule const&()> linestring; - karma::rule const&()> linestring_coord; - karma::rule const&()> polygon; - karma::rule const&()> polygon_coord; - karma::rule const&()> exterior_ring_coord; - karma::rule::rings_container const&()> interior_ring_coord; - karma::rule const& ()> multi_point; - karma::rule const& ()> multi_point_coord; - karma::rule const& ()> multi_linestring; - karma::rule const& ()> multi_linestring_coord; - karma::rule const& ()> multi_polygon; - karma::rule const& ()> multi_polygon_coord; - karma::rule const& ()> geometry_collection; - karma::rule const& ()> geometries; - boost::phoenix::function > geometry_type; - karma::real_generator > coordinate; - + karma::rule geometry; + karma::rule()> point; + karma::rule()> point_coord; + karma::rule()> linestring; + karma::rule()> linestring_coord; + karma::rule()> polygon; + karma::rule()> polygon_coord; + karma::rule()> linear_ring_coord; + karma::rule()> multi_point; + karma::rule()> multi_point_coord; + karma::rule()> multi_linestring; + karma::rule ()> multi_linestring_coord; + karma::rule()> multi_polygon; + karma::rule()> multi_polygon_coord; + karma::rule()> geometry_collection; + karma::rule()> geometries; + // + karma::real_generator > coordinate; }; }} diff --git a/include/mapnik/json/geometry_generator_grammar_impl.hpp b/include/mapnik/json/geometry_generator_grammar_impl.hpp index cd4c5d7ef..8e470a5e8 100644 --- a/include/mapnik/json/geometry_generator_grammar_impl.hpp +++ b/include/mapnik/json/geometry_generator_grammar_impl.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2015 Artem Pavlenko + * Copyright (C) 2017 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,93 +22,79 @@ // mapnik #include -#include -#include #include -// boost -#pragma GCC diagnostic push -#include -#include -#include -#include -#include -#include -#pragma GCC diagnostic pop - namespace mapnik { namespace json { namespace karma = boost::spirit::karma; -namespace phoenix = boost::phoenix; template geometry_generator_grammar::geometry_generator_grammar() : geometry_generator_grammar::base_type(geometry) { - boost::spirit::karma::_val_type _val; - boost::spirit::karma::_1_type _1; - boost::spirit::karma::_a_type _a; boost::spirit::karma::lit_type lit; - boost::spirit::karma::uint_type uint_; - boost::spirit::karma::eps_type eps; - geometry = geometry_dispatch.alias() - ; - - geometry_dispatch = eps[_a = geometry_type(_val)] << - (&uint_(geometry::geometry_types::Point)[_1 = _a] << point) + geometry = + point | - (&uint_(geometry::geometry_types::LineString)[_1 = _a] - << (linestring | "{\"type\":\"LineString\",\"coordinates\":[]}")) + linestring | - (&uint_(geometry::geometry_types::Polygon)[_1 = _a] - << (polygon | "{\"type\":\"Polygon\",\"coordinates\":[[]]}")) + polygon | - (&uint_(geometry::geometry_types::MultiPoint)[_1 = _a] - << (multi_point | "{\"type\":\"MultiPoint\",\"coordinates\":[]}")) + multi_point | - (&uint_(geometry::geometry_types::MultiLineString)[_1 = _a] - << (multi_linestring | "{\"type\":\"MultiLineString\",\"coordinates\":[[]]}")) + multi_linestring | - (&uint_(geometry::geometry_types::MultiPolygon)[_1 = _a] - << (multi_polygon | "{\"type\":\"MultiPolygon\",\"coordinates\":[[[]]]}")) + multi_polygon | - (&uint_(geometry::geometry_types::GeometryCollection)[_1 = _a] << geometry_collection) + geometry_collection | - lit("null") + lit("null") // geometry_empty ; point = lit("{\"type\":\"Point\",\"coordinates\":") << point_coord << lit("}") ; - linestring = lit("{\"type\":\"LineString\",\"coordinates\":[") << linestring_coord << lit("]}") + + linestring = lit("{\"type\":\"LineString\",\"coordinates\":") << linestring_coord << lit("}") ; - polygon = lit("{\"type\":\"Polygon\",\"coordinates\":[") << polygon_coord << lit("]}") + + polygon = lit("{\"type\":\"Polygon\",\"coordinates\":") << polygon_coord << lit("}") ; - multi_point = lit("{\"type\":\"MultiPoint\",\"coordinates\":[") << multi_point_coord << lit("]}") + + multi_point = lit("{\"type\":\"MultiPoint\",\"coordinates\":") << multi_point_coord << lit("}") ; - multi_linestring = lit("{\"type\":\"MultiLineString\",\"coordinates\":[") << multi_linestring_coord << lit("]}") + + multi_linestring = lit("{\"type\":\"MultiLineString\",\"coordinates\":") << multi_linestring_coord << lit("}") ; - multi_polygon = lit("{\"type\":\"MultiPolygon\",\"coordinates\":[") << multi_polygon_coord << lit("]}") + + multi_polygon = lit("{\"type\":\"MultiPolygon\",\"coordinates\":") << multi_polygon_coord << lit("}") ; + geometry_collection = lit("{\"type\":\"GeometryCollection\",\"geometries\":[") << geometries << lit("]}") ; + point_coord = lit('[') << coordinate << lit(',') << coordinate << lit(']') ; - linestring_coord = (point_coord % lit(',')) + + linestring_coord = lit('[') << -(point_coord % lit(',')) << lit(']') ; - polygon_coord = lit('[') << exterior_ring_coord << lit(']') << interior_ring_coord + + linear_ring_coord = lit('[') << -(point_coord % lit(',')) << lit(']') ; - exterior_ring_coord = linestring_coord.alias() + + polygon_coord = lit('[') << linear_ring_coord << *(lit(',') << linear_ring_coord)<< lit(']'); ; - interior_ring_coord = *(lit(",[") << exterior_ring_coord << lit(']')) + + multi_point_coord = lit('[') << -(point_coord % lit(',')) << lit(']') ; - multi_point_coord = linestring_coord.alias() + + multi_linestring_coord = lit('[') << linestring_coord % lit(',') << lit(']') ; - multi_linestring_coord = (lit('[') << linestring_coord << lit(']')) % lit(',') + + multi_polygon_coord = lit('[') << polygon_coord % lit(',') << lit("]") ; - multi_polygon_coord = (lit('[') << polygon_coord << lit(']')) % lit(',') - ; - geometries = geometry % lit(',') + + geometries = geometry % lit(',') ; } diff --git a/include/mapnik/json/properties_generator_grammar_impl.hpp b/include/mapnik/json/properties_generator_grammar_impl.hpp index eff4565b5..8f694f6ca 100644 --- a/include/mapnik/json/properties_generator_grammar_impl.hpp +++ b/include/mapnik/json/properties_generator_grammar_impl.hpp @@ -23,6 +23,12 @@ #include +#pragma GCC diagnostic push +#include +#include +#include +#pragma GCC diagnostic pop + namespace mapnik { namespace json { namespace karma = boost::spirit::karma; @@ -63,14 +69,13 @@ properties_generator_grammar::properties_generator boost::spirit::karma::string_type kstring; boost::spirit::karma::eps_type eps; using boost::phoenix::at_c; - properties = lit('{') << -(pair % lit(',')) << lit('}') ; pair = lit('"') - << kstring[_1 = boost::phoenix::at_c<0>(_val)] << lit('"') + << kstring[_1 = at_c<0>(_val)] << lit('"') << lit(':') << value[_1 = extract_string_(at_c<1>(_val))] ; @@ -80,13 +85,6 @@ properties_generator_grammar::properties_generator kstring[_1 = at_c<0>(_val)] ; - // FIXME http://boost-spirit.com/home/articles/karma-examples/creating-your-own-generator-component-for-spirit-karma/ - //value = (value_null_| bool_ | int__ | double_ | ustring)//[_1 = value_base_(_r1)] - // ; - //value_null_ = kstring[_1 = "null"] - // ; - //ustring = escaped_string_(quote_.c_str())[_1 = utf8_(_val)] - // ; } }} diff --git a/include/mapnik/svg/geometry_svg_generator.hpp b/include/mapnik/svg/geometry_svg_generator.hpp index 7594c26dd..fcf379091 100644 --- a/include/mapnik/svg/geometry_svg_generator.hpp +++ b/include/mapnik/svg/geometry_svg_generator.hpp @@ -141,7 +141,7 @@ struct coordinate_policy : karma::real_policies template struct svg_path_generator : - karma::grammar + karma::grammar { using path_type = Path; @@ -149,12 +149,12 @@ struct svg_path_generator : svg_path_generator(); // rules - karma::rule svg; - karma::rule point; - karma::rule linestring; - karma::rule polygon; - karma::rule svg_point; - karma::rule svg_path; + karma::rule svg; + karma::rule point; + karma::rule linestring; + karma::rule polygon; + karma::rule svg_point; + karma::rule svg_path; // phoenix functions phoenix::function > _type; diff --git a/include/mapnik/wkt/wkt_generator_grammar.hpp b/include/mapnik/wkt/wkt_generator_grammar.hpp index f31fcc08e..6aaf91c96 100644 --- a/include/mapnik/wkt/wkt_generator_grammar.hpp +++ b/include/mapnik/wkt/wkt_generator_grammar.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2015 Artem Pavlenko + * Copyright (C) 2017 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -26,12 +26,10 @@ // mapnik #include #include -#include #pragma GCC diagnostic push #include #include -#include #include // for vc++ and android whose c++11 libs lack std::trunc #include #pragma GCC diagnostic pop @@ -39,22 +37,9 @@ namespace mapnik { namespace wkt { namespace karma = boost::spirit::karma; -namespace phoenix = boost::phoenix; namespace detail { -template -struct get_type -{ - using result_type = mapnik::geometry::geometry_types; - template - result_type operator() (T const& geom) const - { - auto type = mapnik::geometry::geometry_type(geom); - return type; - } -}; - template struct wkt_coordinate_policy : karma::real_policies { @@ -102,33 +87,29 @@ struct coordinate_generator template struct wkt_generator_grammar : - karma::grammar + karma::grammar { - using coord_type = typename Geometry::coord_type; + using coordinate_type = typename Geometry::coord_type; wkt_generator_grammar(); // rules - karma::rule geometry; - karma::rule, Geometry const&() > geometry_dispatch; - karma::rule const&()> point; - karma::rule const&()> point_coord; - karma::rule const&()> linestring; - karma::rule const&()> linestring_coord; - karma::rule const&()> polygon; - karma::rule const&()> polygon_coord; - karma::rule const&()> exterior_ring_coord; - karma::rule > const&()> interior_ring_coord; - karma::rule const& ()> multi_point; - karma::rule const& ()> multi_point_coord; - karma::rule const& ()> multi_linestring; - karma::rule const& ()> multi_linestring_coord; - karma::rule const& ()> multi_polygon; - karma::rule const& ()> multi_polygon_coord; - karma::rule const& ()> geometry_collection; - karma::rule const& ()> geometries; - boost::phoenix::function > geometry_type; - karma::symbols empty; + karma::rule geometry; + karma::rule()> point; + karma::rule()> point_coord; + karma::rule()> linestring; + karma::rule()> linestring_coord; + karma::rule()> polygon; + karma::rule()> polygon_coord; + karma::rule()> linear_ring_coord; + karma::rule()> multi_point; + karma::rule()> multi_point_coord; + karma::rule()> multi_linestring; + karma::rule()> multi_linestring_coord; + karma::rule()> multi_polygon; + karma::rule()> multi_polygon_coord; + karma::rule()> geometry_collection; + karma::rule()> geometries; // - typename detail::coordinate_generator::generator coordinate; + typename detail::coordinate_generator::generator coordinate; }; }} diff --git a/include/mapnik/wkt/wkt_generator_grammar_impl.hpp b/include/mapnik/wkt/wkt_generator_grammar_impl.hpp index 8d950edd0..8153d6b1c 100644 --- a/include/mapnik/wkt/wkt_generator_grammar_impl.hpp +++ b/include/mapnik/wkt/wkt_generator_grammar_impl.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2015 Artem Pavlenko + * Copyright (C) 2017 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,97 +22,76 @@ // mapnik #include -#include #include -#pragma GCC diagnostic push -#include -#include -#pragma GCC diagnostic pop - namespace mapnik { namespace wkt { template wkt_generator_grammar::wkt_generator_grammar() : wkt_generator_grammar::base_type(geometry) { - boost::spirit::karma::_val_type _val; - boost::spirit::karma::_1_type _1; - boost::spirit::karma::_a_type _a; boost::spirit::karma::lit_type lit; - boost::spirit::karma::uint_type uint_; - boost::spirit::karma::eps_type eps; - - empty.add - (geometry::geometry_types::Point, "POINT EMPTY") - (geometry::geometry_types::LineString, "LINESTRING EMPTY") - (geometry::geometry_types::Polygon, "POLYGON EMPTY") - (geometry::geometry_types::MultiPoint, "MULTIPOINT EMPTY") - (geometry::geometry_types::MultiLineString, "MULTILINESTRING EMPTY") - (geometry::geometry_types::MultiPolygon, "MULTIPOLYGON EMPTY") - (geometry::geometry_types::GeometryCollection, "GEOMETRYCOLLECTION EMPTY") - ; - - geometry = geometry_dispatch.alias() - ; - - geometry_dispatch = eps[_a = geometry_type(_val)] << - (&uint_(geometry::geometry_types::Point)[_1 = _a] - << point) + geometry = + point | - (&uint_(geometry::geometry_types::LineString)[_1 = _a] - << (linestring | empty[_1 = _a])) + linestring | - (&uint_(geometry::geometry_types::Polygon)[_1 = _a] - << (polygon | empty[_1 = _a])) + polygon | - (&uint_(geometry::geometry_types::MultiPoint)[_1 = _a] - << ( multi_point | empty[_1 = _a])) + multi_point | - (&uint_(geometry::geometry_types::MultiLineString)[_1 = _a] - << (multi_linestring | empty[_1 = _a])) + multi_linestring | - (&uint_(geometry::geometry_types::MultiPolygon)[_1 = _a] - << (multi_polygon | empty[_1 = _a])) + multi_polygon | - (&uint_(geometry::geometry_types::GeometryCollection)[_1 = _a] - << (geometry_collection | empty[_1 = _a])) + geometry_collection | - (&uint_(geometry::geometry_types::Unknown)[_1 = _a] - << lit("POINT EMPTY")) // special case for geometry_empty as mapnik::geometry::point can't be empty + lit("POINT EMPTY FAIL") // special case for geometry_empty ; point = lit("POINT(") << point_coord << lit(")") ; - linestring = lit("LINESTRING(") << linestring_coord << lit(")") + + linestring = lit("LINESTRING") << (linestring_coord | lit(" EMPTY")) ; - polygon = lit("POLYGON(") << polygon_coord << lit(")") + + polygon = lit("POLYGON") << (polygon_coord | lit(" EMPTY")) ; - multi_point = lit("MULTIPOINT(") << multi_point_coord << lit(")") + + multi_point = lit("MULTIPOINT") << (multi_point_coord | lit(" EMPTY")) ; - multi_linestring = lit("MULTILINESTRING(") << multi_linestring_coord << lit(")") + + multi_linestring = lit("MULTILINESTRING") << (multi_linestring_coord | lit(" EMPTY")) ; - multi_polygon = lit("MULTIPOLYGON(") << multi_polygon_coord << lit(")") + + multi_polygon = lit("MULTIPOLYGON") << (multi_polygon_coord | lit(" EMPTY")) ; - geometry_collection = lit("GEOMETRYCOLLECTION(") << geometries << lit(")") + + geometry_collection = lit("GEOMETRYCOLLECTION") << (lit("(") << geometries << lit(")") | lit(" EMPTY")) ; + point_coord = coordinate << lit(' ') << coordinate ; - linestring_coord = point_coord % lit(',') + + linestring_coord = lit('(') << point_coord % lit(',') << lit(')') ; - polygon_coord = lit('(') << exterior_ring_coord << lit(')') << interior_ring_coord + + linear_ring_coord = lit('(') << point_coord % lit(',') << lit(')') ; - exterior_ring_coord = linestring_coord.alias() + + polygon_coord = lit('(') << linear_ring_coord << *(lit(',') << linear_ring_coord)<< lit(')'); ; - interior_ring_coord = *(lit(",(") << exterior_ring_coord << lit(')')) + + multi_point_coord = lit('(') << point_coord % lit(',') << lit(')') ; - multi_point_coord = linestring_coord.alias() + + multi_linestring_coord = lit("(") << linestring_coord % lit(',') << lit(")") ; - multi_linestring_coord = (lit('(') << linestring_coord << lit(')')) % lit(',') + + multi_polygon_coord = lit("(") << polygon_coord % lit(',') << lit(")") ; - multi_polygon_coord = (lit('(') << polygon_coord << lit(')')) % lit(',') - ; - geometries = geometry % lit(',') + + geometries = geometry % lit(',') ; } diff --git a/src/json/mapnik_json_generator_grammar.cpp b/src/json/mapnik_json_generator_grammar.cpp index 2b0171f98..72a1a74c9 100644 --- a/src/json/mapnik_json_generator_grammar.cpp +++ b/src/json/mapnik_json_generator_grammar.cpp @@ -20,8 +20,7 @@ * *****************************************************************************/ -#include - +#include #include #include #include diff --git a/src/wkt/mapnik_wkt_generator_grammar.cpp b/src/wkt/mapnik_wkt_generator_grammar.cpp index 07813fcc8..f1bed936c 100644 --- a/src/wkt/mapnik_wkt_generator_grammar.cpp +++ b/src/wkt/mapnik_wkt_generator_grammar.cpp @@ -20,7 +20,8 @@ * *****************************************************************************/ -#include + +#include #include #include