]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/algorithms/detail/disjoint/multirange_geometry.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / geometry / algorithms / detail / disjoint / multirange_geometry.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2014-2021, Oracle and/or its affiliates.
4
5 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
6 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
7 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
8
9 // Licensed under the Boost Software License version 1.0.
10 // http://www.boost.org/users/license.html
11
12 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_MULTIRANGE_GEOMETRY_HPP
13 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_MULTIRANGE_GEOMETRY_HPP
14
15
16 #include <boost/range/begin.hpp>
17 #include <boost/range/end.hpp>
18 #include <boost/range/value_type.hpp>
19
20 #include <boost/geometry/algorithms/dispatch/disjoint.hpp>
21
22
23 namespace boost { namespace geometry
24 {
25
26
27 #ifndef DOXYGEN_NO_DETAIL
28 namespace detail { namespace disjoint
29 {
30
31
32 template <typename Geometry, typename Strategy, typename BinaryPredicate>
33 class unary_disjoint_geometry_to_query_geometry
34 {
35 public:
36 unary_disjoint_geometry_to_query_geometry(Geometry const& geometry,
37 Strategy const& strategy)
38 : m_geometry(geometry)
39 , m_strategy(strategy)
40 {}
41
42 template <typename QueryGeometry>
43 inline bool operator()(QueryGeometry const& query_geometry) const
44 {
45 return BinaryPredicate::apply(query_geometry, m_geometry, m_strategy);
46 }
47
48 private:
49 Geometry const& m_geometry;
50 Strategy const& m_strategy;
51 };
52
53
54 template<typename MultiRange, typename ConstantSizeGeometry>
55 struct multirange_constant_size_geometry
56 {
57 template <typename Strategy>
58 static inline bool apply(MultiRange const& multirange,
59 ConstantSizeGeometry const& constant_size_geometry,
60 Strategy const& strategy)
61 {
62 using disjoint = unary_disjoint_geometry_to_query_geometry
63 <
64 ConstantSizeGeometry,
65 Strategy,
66 dispatch::disjoint
67 <
68 typename boost::range_value<MultiRange>::type,
69 ConstantSizeGeometry
70 >
71 >;
72
73 return std::all_of(boost::begin(multirange),
74 boost::end(multirange),
75 disjoint(constant_size_geometry, strategy));
76 }
77
78 template <typename Strategy>
79 static inline bool apply(ConstantSizeGeometry const& constant_size_geometry,
80 MultiRange const& multirange,
81 Strategy const& strategy)
82 {
83 return apply(multirange, constant_size_geometry, strategy);
84 }
85 };
86
87
88 }} // namespace detail::disjoint
89 #endif // DOXYGEN_NO_DETAIL
90
91
92 }} // namespace boost::geometry
93
94
95 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_MULTIRANGE_GEOMETRY_HPP