]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/include/boost/geometry/algorithms/detail/as_range.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / algorithms / detail / as_range.hpp
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 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_AS_RANGE_HPP
15 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_AS_RANGE_HPP
16
17
18 #include <boost/geometry/core/exterior_ring.hpp>
19 #include <boost/geometry/core/tag.hpp>
20 #include <boost/geometry/core/tags.hpp>
21
22 #include <boost/geometry/util/add_const_if_c.hpp>
23
24
25 namespace boost { namespace geometry
26 {
27
28
29 #ifndef DOXYGEN_NO_DISPATCH
30 namespace dispatch
31 {
32
33
34 template <typename GeometryTag, typename Geometry, typename Range, bool IsConst>
35 struct as_range
36 {
37 static inline typename add_const_if_c<IsConst, Range>::type& get(
38 typename add_const_if_c<IsConst, Geometry>::type& input)
39 {
40 return input;
41 }
42 };
43
44
45 template <typename Geometry, typename Range, bool IsConst>
46 struct as_range<polygon_tag, Geometry, Range, IsConst>
47 {
48 static inline typename add_const_if_c<IsConst, Range>::type& get(
49 typename add_const_if_c<IsConst, Geometry>::type& input)
50 {
51 return exterior_ring(input);
52 }
53 };
54
55
56 } // namespace dispatch
57 #endif // DOXYGEN_NO_DISPATCH
58
59 // Will probably be replaced by the more generic "view_as", therefore in detail
60 namespace detail
61 {
62
63 /*!
64 \brief Function getting either the range (ring, linestring) itself
65 or the outer ring (polygon)
66 \details Utility to handle polygon's outer ring as a range
67 \ingroup utility
68 */
69 template <typename Range, typename Geometry>
70 inline Range& as_range(Geometry& input)
71 {
72 return dispatch::as_range
73 <
74 typename tag<Geometry>::type,
75 Geometry,
76 Range,
77 false
78 >::get(input);
79 }
80
81
82 /*!
83 \brief Function getting either the range (ring, linestring) itself
84 or the outer ring (polygon), const version
85 \details Utility to handle polygon's outer ring as a range
86 \ingroup utility
87 */
88 template <typename Range, typename Geometry>
89 inline Range const& as_range(Geometry const& input)
90 {
91 return dispatch::as_range
92 <
93 typename tag<Geometry>::type,
94 Geometry,
95 Range,
96 true
97 >::get(input);
98 }
99
100 }
101
102 }} // namespace boost::geometry
103
104
105 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_AS_RANGE_HPP