1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2012 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)
15 #ifndef BOOST_GEOMETRY_CORE_EXTERIOR_RING_HPP
16 #define BOOST_GEOMETRY_CORE_EXTERIOR_RING_HPP
19 #include <boost/mpl/assert.hpp>
20 #include <boost/type_traits/is_const.hpp>
21 #include <boost/type_traits/remove_const.hpp>
24 #include <boost/geometry/core/ring_type.hpp>
25 #include <boost/geometry/core/tag.hpp>
26 #include <boost/geometry/core/tags.hpp>
27 #include <boost/geometry/util/add_const_if_c.hpp>
30 namespace boost { namespace geometry
38 \brief Traits class defining access to exterior_ring of a polygon
39 \details Should define const and non const access
41 \tparam Polygon the polygon type
44 \par Specializations should provide:
45 - static inline RING& get(POLY& )
46 - static inline RING const& get(POLY const& )
48 template <typename Polygon>
53 false, NOT_IMPLEMENTED_FOR_THIS_POLYGON_TYPE
62 #ifndef DOXYGEN_NO_DISPATCH
63 namespace core_dispatch
67 template <typename Tag, typename Geometry>
72 false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
78 template <typename Polygon>
79 struct exterior_ring<polygon_tag, Polygon>
82 typename geometry::ring_return_type<Polygon>::type
83 apply(typename add_const_if_c
85 boost::is_const<Polygon>::type::value,
89 return traits::exterior_ring
91 typename boost::remove_const<Polygon>::type
97 } // namespace core_dispatch
98 #endif // DOXYGEN_NO_DISPATCH
102 \brief Function to get the exterior_ring ring of a polygon
103 \ingroup exterior_ring
104 \note OGC compliance: instead of ExteriorRing
105 \tparam Polygon polygon type
106 \param polygon the polygon to get the exterior ring from
107 \return a reference to the exterior ring
109 template <typename Polygon>
110 inline typename ring_return_type<Polygon>::type exterior_ring(Polygon& polygon)
112 return core_dispatch::exterior_ring
114 typename tag<Polygon>::type,
121 \brief Function to get the exterior ring of a polygon (const version)
122 \ingroup exterior_ring
123 \note OGC compliance: instead of ExteriorRing
124 \tparam Polygon polygon type
125 \param polygon the polygon to get the exterior ring from
126 \return a const reference to the exterior ring
128 \qbk{distinguish,const version}
130 template <typename Polygon>
131 inline typename ring_return_type<Polygon const>::type exterior_ring(
132 Polygon const& polygon)
134 return core_dispatch::exterior_ring
136 typename tag<Polygon>::type,
142 }} // namespace boost::geometry
145 #endif // BOOST_GEOMETRY_CORE_EXTERIOR_RING_HPP