]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/include/boost/geometry/core/exterior_ring.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / core / exterior_ring.hpp
CommitLineData
7c673cae
FG
1// Boost.Geometry (aka GGL, Generic Geometry Library)
2
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.
6
7// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
8// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
9
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)
13
14
15#ifndef BOOST_GEOMETRY_CORE_EXTERIOR_RING_HPP
16#define BOOST_GEOMETRY_CORE_EXTERIOR_RING_HPP
17
18
19#include <boost/mpl/assert.hpp>
20#include <boost/type_traits/is_const.hpp>
21#include <boost/type_traits/remove_const.hpp>
22
23
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>
28
29
30namespace boost { namespace geometry
31{
32
33namespace traits
34{
35
36
37/*!
38 \brief Traits class defining access to exterior_ring of a polygon
39 \details Should define const and non const access
40 \ingroup traits
41 \tparam Polygon the polygon type
42 \par Geometries:
43 - polygon
44 \par Specializations should provide:
45 - static inline RING& get(POLY& )
46 - static inline RING const& get(POLY const& )
47*/
48template <typename Polygon>
49struct exterior_ring
50{
51 BOOST_MPL_ASSERT_MSG
52 (
53 false, NOT_IMPLEMENTED_FOR_THIS_POLYGON_TYPE
54 , (types<Polygon>)
55 );
56};
57
58
59} // namespace traits
60
61
62#ifndef DOXYGEN_NO_DISPATCH
63namespace core_dispatch
64{
65
66
67template <typename Tag, typename Geometry>
68struct exterior_ring
69{
70 BOOST_MPL_ASSERT_MSG
71 (
72 false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
73 , (types<Geometry>)
74 );
75};
76
77
78template <typename Polygon>
79struct exterior_ring<polygon_tag, Polygon>
80{
81 static
82 typename geometry::ring_return_type<Polygon>::type
83 apply(typename add_const_if_c
84 <
85 boost::is_const<Polygon>::type::value,
86 Polygon
87 >::type& polygon)
88 {
89 return traits::exterior_ring
90 <
91 typename boost::remove_const<Polygon>::type
92 >::get(polygon);
93 }
94};
95
96
97} // namespace core_dispatch
98#endif // DOXYGEN_NO_DISPATCH
99
100
101/*!
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
108*/
109template <typename Polygon>
110inline typename ring_return_type<Polygon>::type exterior_ring(Polygon& polygon)
111{
112 return core_dispatch::exterior_ring
113 <
114 typename tag<Polygon>::type,
115 Polygon
116 >::apply(polygon);
117}
118
119
120/*!
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
127
128\qbk{distinguish,const version}
129*/
130template <typename Polygon>
131inline typename ring_return_type<Polygon const>::type exterior_ring(
132 Polygon const& polygon)
133{
134 return core_dispatch::exterior_ring
135 <
136 typename tag<Polygon>::type,
137 Polygon const
138 >::apply(polygon);
139}
140
141
142}} // namespace boost::geometry
143
144
145#endif // BOOST_GEOMETRY_CORE_EXTERIOR_RING_HPP