diff --git a/include/mapnik/json/geometry_generator_grammar.hpp b/include/mapnik/json/geometry_generator_grammar.hpp index ba40913ae..2d0fbf4fc 100644 --- a/include/mapnik/json/geometry_generator_grammar.hpp +++ b/include/mapnik/json/geometry_generator_grammar.hpp @@ -25,7 +25,6 @@ // mapnik #include -#include #include #include #include @@ -39,99 +38,6 @@ #include #pragma GCC diagnostic pop -namespace boost { namespace spirit { namespace traits { - - template <> - struct transform_attribute - { - using type = mapnik::new_geometry::point const&; - static type pre(mapnik::new_geometry::geometry const& geom) - { - return mapnik::util::get(geom); - } - }; - - template <> - struct transform_attribute - { - using type = mapnik::new_geometry::line_string const&; - static type pre(mapnik::new_geometry::geometry const& geom) - { - return mapnik::util::get(geom); - } - }; - - template <> - struct transform_attribute - { - using type = mapnik::new_geometry::polygon const&; - static type pre(mapnik::new_geometry::geometry const& geom) - { - return mapnik::util::get(geom); - } - }; - - template <> - struct transform_attribute const&, karma::domain> - { - using type = std::vector const&; - static type pre(mapnik::new_geometry::polygon const& poly) - { - return poly.interior_rings; - } - }; - - template <> - struct transform_attribute - { - using type = mapnik::new_geometry::multi_point const&; - static type pre(mapnik::new_geometry::geometry const& geom) - { - return mapnik::util::get(geom); - } - }; - - template <> - struct transform_attribute - { - using type = mapnik::new_geometry::multi_line_string const&; - static type pre(mapnik::new_geometry::geometry const& geom) - { - return mapnik::util::get(geom); - } - }; - - template <> - struct transform_attribute - { - using type = mapnik::new_geometry::multi_polygon const&; - static type pre(mapnik::new_geometry::geometry const& geom) - { - return mapnik::util::get(geom); - } - }; - - template <> - struct transform_attribute - { - using type = mapnik::new_geometry::geometry_collection const&; - static type pre(mapnik::new_geometry::geometry const& geom) - { - return mapnik::util::get(geom); - } - }; - -}}} - - namespace mapnik { namespace json { namespace karma = boost::spirit::karma; diff --git a/include/mapnik/json/geometry_generator_grammar_impl.hpp b/include/mapnik/json/geometry_generator_grammar_impl.hpp index 95e74026b..e115c0188 100644 --- a/include/mapnik/json/geometry_generator_grammar_impl.hpp +++ b/include/mapnik/json/geometry_generator_grammar_impl.hpp @@ -22,6 +22,7 @@ // mapnik #include +#include // boost #include diff --git a/include/mapnik/util/spirit_transform_attribute.hpp b/include/mapnik/util/spirit_transform_attribute.hpp new file mode 100644 index 000000000..f6ebe3d8f --- /dev/null +++ b/include/mapnik/util/spirit_transform_attribute.hpp @@ -0,0 +1,120 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2015 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_UTIL_SPIRIT_TRANSFORM_ATTRIBUTE_HPP +#define MAPNIK_UTIL_SPIRIT_TRANSFORM_ATTRIBUTE_HPP + +#include + +namespace boost { namespace spirit { namespace traits { + + template <> + struct transform_attribute + { + using type = mapnik::new_geometry::point const&; + static type pre(mapnik::new_geometry::geometry const& geom) + { + return mapnik::util::get(geom); + } + }; + + template <> + struct transform_attribute + { + using type = mapnik::new_geometry::line_string const&; + static type pre(mapnik::new_geometry::geometry const& geom) + { + return mapnik::util::get(geom); + } + }; + + template <> + struct transform_attribute + { + using type = mapnik::new_geometry::polygon const&; + static type pre(mapnik::new_geometry::geometry const& geom) + { + return mapnik::util::get(geom); + } + }; + + template <> + struct transform_attribute const&, karma::domain> + { + using type = std::vector const&; + static type pre(mapnik::new_geometry::polygon const& poly) + { + return poly.interior_rings; + } + }; + + template <> + struct transform_attribute + { + using type = mapnik::new_geometry::multi_point const&; + static type pre(mapnik::new_geometry::geometry const& geom) + { + return mapnik::util::get(geom); + } + }; + + template <> + struct transform_attribute + { + using type = mapnik::new_geometry::multi_line_string const&; + static type pre(mapnik::new_geometry::geometry const& geom) + { + return mapnik::util::get(geom); + } + }; + + template <> + struct transform_attribute + { + using type = mapnik::new_geometry::multi_polygon const&; + static type pre(mapnik::new_geometry::geometry const& geom) + { + return mapnik::util::get(geom); + } + }; + + template <> + struct transform_attribute + { + using type = mapnik::new_geometry::geometry_collection const&; + static type pre(mapnik::new_geometry::geometry const& geom) + { + return mapnik::util::get(geom); + } + }; + +}}} + +#endif // MAPNIK_UTIL_SPIRIT_TRANSFORM_ATTRIBUTE_HPP