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