]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/algorithms/detail/as_range.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / 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 // This file was modified by Oracle on 2020.
8 // Modifications copyright (c) 2020 Oracle and/or its affiliates.
9 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
10
11 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
12 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
13
14 // Use, modification and distribution is subject to the Boost Software License,
15 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
16 // http://www.boost.org/LICENSE_1_0.txt)
17
18 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_AS_RANGE_HPP
19 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_AS_RANGE_HPP
20
21
22 #include <boost/geometry/core/exterior_ring.hpp>
23 #include <boost/geometry/core/tag.hpp>
24 #include <boost/geometry/core/tags.hpp>
25
26
27 namespace boost { namespace geometry
28 {
29
30
31 #ifndef DOXYGEN_NO_DISPATCH
32 namespace dispatch
33 {
34
35
36 template <typename GeometryTag, typename Geometry, typename Range>
37 struct as_range
38 {
39 static inline Range& get(Geometry& input)
40 {
41 return input;
42 }
43 };
44
45
46 template <typename Geometry, typename Range>
47 struct as_range<polygon_tag, Geometry, Range>
48 {
49 static inline Range& get(Geometry& 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 >::get(input);
78 }
79
80
81 /*!
82 \brief Function getting either the range (ring, linestring) itself
83 or the outer ring (polygon), const version
84 \details Utility to handle polygon's outer ring as a range
85 \ingroup utility
86 */
87 template <typename Range, typename Geometry>
88 inline Range const& as_range(Geometry const& input)
89 {
90 return dispatch::as_range
91 <
92 typename tag<Geometry>::type,
93 Geometry const,
94 Range const
95 >::get(input);
96 }
97
98 }
99
100 }} // namespace boost::geometry
101
102
103 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_AS_RANGE_HPP