]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Boost.Geometry (aka GGL, Generic Geometry Library) |
2 | ||
1e59de90 | 3 | // Copyright (c) 2014-2021, Oracle and/or its affiliates. |
7c673cae | 4 | |
1e59de90 | 5 | // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle |
7c673cae | 6 | // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle |
b32b8144 | 7 | // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle |
7c673cae FG |
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 | ||
20effc67 TL |
15 | |
16 | #include <boost/range/begin.hpp> | |
17 | #include <boost/range/end.hpp> | |
18 | #include <boost/range/value_type.hpp> | |
7c673cae | 19 | |
7c673cae FG |
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 | ||
b32b8144 | 32 | template <typename Geometry, typename Strategy, typename BinaryPredicate> |
7c673cae FG |
33 | class unary_disjoint_geometry_to_query_geometry |
34 | { | |
35 | public: | |
b32b8144 | 36 | unary_disjoint_geometry_to_query_geometry(Geometry const& geometry, |
1e59de90 | 37 | Strategy const& strategy) |
7c673cae | 38 | : m_geometry(geometry) |
b32b8144 | 39 | , m_strategy(strategy) |
7c673cae FG |
40 | {} |
41 | ||
42 | template <typename QueryGeometry> | |
1e59de90 | 43 | inline bool operator()(QueryGeometry const& query_geometry) const |
7c673cae | 44 | { |
b32b8144 | 45 | return BinaryPredicate::apply(query_geometry, m_geometry, m_strategy); |
7c673cae FG |
46 | } |
47 | ||
48 | private: | |
49 | Geometry const& m_geometry; | |
b32b8144 | 50 | Strategy const& m_strategy; |
7c673cae FG |
51 | }; |
52 | ||
53 | ||
54 | template<typename MultiRange, typename ConstantSizeGeometry> | |
55 | struct multirange_constant_size_geometry | |
56 | { | |
b32b8144 | 57 | template <typename Strategy> |
7c673cae | 58 | static inline bool apply(MultiRange const& multirange, |
b32b8144 FG |
59 | ConstantSizeGeometry const& constant_size_geometry, |
60 | Strategy const& strategy) | |
7c673cae | 61 | { |
1e59de90 | 62 | using disjoint = unary_disjoint_geometry_to_query_geometry |
7c673cae FG |
63 | < |
64 | ConstantSizeGeometry, | |
b32b8144 | 65 | Strategy, |
7c673cae FG |
66 | dispatch::disjoint |
67 | < | |
68 | typename boost::range_value<MultiRange>::type, | |
69 | ConstantSizeGeometry | |
70 | > | |
1e59de90 | 71 | >; |
7c673cae | 72 | |
1e59de90 TL |
73 | return std::all_of(boost::begin(multirange), |
74 | boost::end(multirange), | |
75 | disjoint(constant_size_geometry, strategy)); | |
7c673cae FG |
76 | } |
77 | ||
b32b8144 | 78 | template <typename Strategy> |
7c673cae | 79 | static inline bool apply(ConstantSizeGeometry const& constant_size_geometry, |
b32b8144 FG |
80 | MultiRange const& multirange, |
81 | Strategy const& strategy) | |
7c673cae | 82 | { |
b32b8144 | 83 | return apply(multirange, constant_size_geometry, strategy); |
7c673cae FG |
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 |