1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2014-2021, Oracle and/or its affiliates.
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
9 // Licensed under the Boost Software License version 1.0.
10 // http://www.boost.org/users/license.html
12 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_MULTIRANGE_GEOMETRY_HPP
13 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_MULTIRANGE_GEOMETRY_HPP
16 #include <boost/range/begin.hpp>
17 #include <boost/range/end.hpp>
18 #include <boost/range/value_type.hpp>
20 #include <boost/geometry/algorithms/dispatch/disjoint.hpp>
23 namespace boost { namespace geometry
27 #ifndef DOXYGEN_NO_DETAIL
28 namespace detail { namespace disjoint
32 template <typename Geometry, typename Strategy, typename BinaryPredicate>
33 class unary_disjoint_geometry_to_query_geometry
36 unary_disjoint_geometry_to_query_geometry(Geometry const& geometry,
37 Strategy const& strategy)
38 : m_geometry(geometry)
39 , m_strategy(strategy)
42 template <typename QueryGeometry>
43 inline bool operator()(QueryGeometry const& query_geometry) const
45 return BinaryPredicate::apply(query_geometry, m_geometry, m_strategy);
49 Geometry const& m_geometry;
50 Strategy const& m_strategy;
54 template<typename MultiRange, typename ConstantSizeGeometry>
55 struct multirange_constant_size_geometry
57 template <typename Strategy>
58 static inline bool apply(MultiRange const& multirange,
59 ConstantSizeGeometry const& constant_size_geometry,
60 Strategy const& strategy)
62 using disjoint = unary_disjoint_geometry_to_query_geometry
68 typename boost::range_value<MultiRange>::type,
73 return std::all_of(boost::begin(multirange),
74 boost::end(multirange),
75 disjoint(constant_size_geometry, strategy));
78 template <typename Strategy>
79 static inline bool apply(ConstantSizeGeometry const& constant_size_geometry,
80 MultiRange const& multirange,
81 Strategy const& strategy)
83 return apply(multirange, constant_size_geometry, strategy);
88 }} // namespace detail::disjoint
89 #endif // DOXYGEN_NO_DETAIL
92 }} // namespace boost::geometry
95 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_MULTIRANGE_GEOMETRY_HPP