1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2011 Mateusz Loskot, London, UK.
7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
10 // Use, modification and distribution is subject to the Boost Software License,
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
12 // http://www.boost.org/LICENSE_1_0.txt)
14 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_AS_RANGE_HPP
15 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_AS_RANGE_HPP
18 #include <boost/type_traits.hpp>
20 #include <boost/geometry/core/exterior_ring.hpp>
21 #include <boost/geometry/core/tag.hpp>
22 #include <boost/geometry/core/tags.hpp>
24 #include <boost/geometry/util/add_const_if_c.hpp>
27 namespace boost { namespace geometry
31 #ifndef DOXYGEN_NO_DISPATCH
36 template <typename GeometryTag, typename Geometry, typename Range, bool IsConst>
39 static inline typename add_const_if_c<IsConst, Range>::type& get(
40 typename add_const_if_c<IsConst, Geometry>::type& input)
47 template <typename Geometry, typename Range, bool IsConst>
48 struct as_range<polygon_tag, Geometry, Range, IsConst>
50 static inline typename add_const_if_c<IsConst, Range>::type& get(
51 typename add_const_if_c<IsConst, Geometry>::type& input)
53 return exterior_ring(input);
58 } // namespace dispatch
59 #endif // DOXYGEN_NO_DISPATCH
61 // Will probably be replaced by the more generic "view_as", therefore in detail
66 \brief Function getting either the range (ring, linestring) itself
67 or the outer ring (polygon)
68 \details Utility to handle polygon's outer ring as a range
71 template <typename Range, typename Geometry>
72 inline Range& as_range(Geometry& input)
74 return dispatch::as_range
76 typename tag<Geometry>::type,
85 \brief Function getting either the range (ring, linestring) itself
86 or the outer ring (polygon), const version
87 \details Utility to handle polygon's outer ring as a range
90 template <typename Range, typename Geometry>
91 inline Range const& as_range(Geometry const& input)
93 return dispatch::as_range
95 typename tag<Geometry>::type,
104 }} // namespace boost::geometry
107 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_AS_RANGE_HPP