]>
Commit | Line | Data |
---|---|---|
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 | ||
20effc67 TL |
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 | ||
7c673cae FG |
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 | ||
7c673cae FG |
26 | |
27 | namespace boost { namespace geometry | |
28 | { | |
29 | ||
30 | ||
31 | #ifndef DOXYGEN_NO_DISPATCH | |
32 | namespace dispatch | |
33 | { | |
34 | ||
35 | ||
20effc67 | 36 | template <typename GeometryTag, typename Geometry, typename Range> |
7c673cae FG |
37 | struct as_range |
38 | { | |
20effc67 | 39 | static inline Range& get(Geometry& input) |
7c673cae FG |
40 | { |
41 | return input; | |
42 | } | |
43 | }; | |
44 | ||
45 | ||
20effc67 TL |
46 | template <typename Geometry, typename Range> |
47 | struct as_range<polygon_tag, Geometry, Range> | |
7c673cae | 48 | { |
20effc67 | 49 | static inline Range& get(Geometry& input) |
7c673cae FG |
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, | |
20effc67 | 76 | Range |
7c673cae FG |
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, | |
20effc67 TL |
93 | Geometry const, |
94 | Range const | |
7c673cae FG |
95 | >::get(input); |
96 | } | |
97 | ||
98 | } | |
99 | ||
100 | }} // namespace boost::geometry | |
101 | ||
102 | ||
103 | #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_AS_RANGE_HPP |