]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/algorithms/detail/overlay/needs_self_turns.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / geometry / algorithms / detail / overlay / needs_self_turns.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2017-2017 Barend Gehrels, Amsterdam, the Netherlands.
4
5 // Use, modification and distribution is subject to the Boost Software License,
6 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8
9 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_NEEDS_SELF_TURNS_HPP
10 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_NEEDS_SELF_TURNS_HPP
11
12 #include <boost/range.hpp>
13
14 #include <boost/geometry/core/tags.hpp>
15 #include <boost/geometry/algorithms/num_interior_rings.hpp>
16
17
18 namespace boost { namespace geometry
19 {
20
21
22 #ifndef DOXYGEN_NO_DETAIL
23 namespace detail { namespace overlay
24 {
25
26 template
27 <
28 typename Geometry,
29 typename Tag = typename tag<Geometry>::type
30 >
31 struct needs_self_turns
32 {
33 };
34
35 template <typename Geometry>
36 struct needs_self_turns<Geometry, box_tag>
37 {
38 static inline bool apply(Geometry const&)
39 {
40 return false;
41 }
42 };
43
44 template <typename Geometry>
45 struct needs_self_turns<Geometry, ring_tag>
46 {
47 static inline bool apply(Geometry const&)
48 {
49 return false;
50 }
51 };
52
53 template <typename Geometry>
54 struct needs_self_turns<Geometry, polygon_tag>
55 {
56 static inline bool apply(Geometry const& polygon)
57 {
58 return geometry::num_interior_rings(polygon) > 0;
59 }
60 };
61
62 template <typename Geometry>
63 struct needs_self_turns<Geometry, multi_polygon_tag>
64 {
65 static inline bool apply(Geometry const& multi)
66 {
67 typedef typename boost::range_value<Geometry>::type polygon_type;
68 std::size_t const n = boost::size(multi);
69 return n > 1 || (n == 1
70 && needs_self_turns<polygon_type>
71 ::apply(*boost::begin(multi)));
72 }
73 };
74
75
76 }} // namespace detail::overlay
77 #endif // DOXYGEN_NO_DETAIL
78
79
80 }} // namespace boost::geometry
81
82
83 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_NEEDS_SELF_TURNS_HPP