diff --git a/include/mapnik/geometry_adapters.hpp b/include/mapnik/geometry_adapters.hpp index 1bbb3d8a8..f0c5506df 100644 --- a/include/mapnik/geometry_adapters.hpp +++ b/include/mapnik/geometry_adapters.hpp @@ -177,7 +177,7 @@ struct ring_mutable_type > template struct interior_const_type > { - using type = boost::iterator_range::const_iterator>; + using type = boost::iterator_range::const_iterator> const; }; template @@ -190,13 +190,15 @@ struct interior_mutable_type > template struct exterior_ring > { - static mapnik::geometry::linear_ring & get(mapnik::geometry::polygon & p) + using ring_const_type = typename ring_const_type >::type; + using ring_mutable_type = typename ring_mutable_type >::type; + static ring_mutable_type get(mapnik::geometry::polygon & p) { if (p.empty()) throw std::runtime_error("ring must be initialized 1"); return p[0]; } - static mapnik::geometry::linear_ring const& get(mapnik::geometry::polygon const& p) + static ring_const_type get(mapnik::geometry::polygon const& p) { if (p.empty()) throw std::runtime_error("ring must be initialized 2"); return p[0]; @@ -206,18 +208,19 @@ struct exterior_ring > template struct interior_rings > { - using const_ring_iterator = typename mapbox::geometry::polygon::const_iterator; - using interior_type = mapnik::detail::polygon_interior; - using const_interior_type = boost::iterator_range; - static interior_type get(mapnik::geometry::polygon & p) + using interior_const_type = typename interior_const_type >::type; + using interior_mutable_type = typename interior_mutable_type >::type; + + static interior_const_type get(mapnik::geometry::polygon const& p) + { + return boost::make_iterator_range(p.begin() + 1, p.end()); + } + + static interior_mutable_type get(mapnik::geometry::polygon& p) { return mapnik::detail::polygon_interior(p); } - static const_interior_type get(mapnik::geometry::polygon const& p) - { - return boost::make_iterator_range(p.begin() + 1, p.end()); - } }; }}}