]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/geometry/algorithms/detail/touches/implementation.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / geometry / algorithms / detail / touches / implementation.hpp
index 07b1d0523d8ffb0d545a629c09e3801d20bba0ef..d8a02d945cd8866e6e005fb7f3900a8c7b972da1 100644 (file)
@@ -5,8 +5,8 @@
 // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
 // Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
 
-// This file was modified by Oracle on 2013, 2014, 2015, 2017, 2019.
-// Modifications copyright (c) 2013-2019, Oracle and/or its affiliates.
+// This file was modified by Oracle on 2013-2020.
+// Modifications copyright (c) 2013-2020, Oracle and/or its affiliates.
 
 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
 
@@ -21,6 +21,8 @@
 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_TOUCHES_IMPLEMENTATION_HPP
 
 
+#include <type_traits>
+
 #include <boost/geometry/algorithms/detail/for_each_range.hpp>
 #include <boost/geometry/algorithms/detail/overlay/overlay.hpp>
 #include <boost/geometry/algorithms/detail/overlay/self_turn_points.hpp>
@@ -101,7 +103,7 @@ struct box_box
     template <typename Box1, typename Box2, typename Strategy>
     static inline bool apply(Box1 const& b1, Box2 const& b2, Strategy const& /*strategy*/)
     {
-        BOOST_STATIC_ASSERT((boost::is_same
+        BOOST_STATIC_ASSERT((std::is_same
                                 <
                                     typename geometry::coordinate_system<Box1>::type,
                                     typename geometry::coordinate_system<Box2>::type
@@ -179,6 +181,7 @@ struct areal_interrupt_policy
                         return true;
                     }
                     break;
+                case overlay::method_start :
                 case overlay::method_none :
                 case overlay::method_disjoint :
                 case overlay::method_error :
@@ -199,51 +202,30 @@ struct areal_interrupt_policy
     }
 };
 
-template<typename Geometry, typename PointInRingStrategy>
-struct check_each_ring_for_within
+template <typename Geometry1, typename Geometry2, typename Strategy>
+inline bool point_on_border_within(Geometry1 const& geometry1,
+                                   Geometry2 const& geometry2,
+                                   Strategy const& strategy)
 {
-    bool has_within;
-    Geometry const& m_geometry;
-    PointInRingStrategy const& m_strategy;
-
-    inline check_each_ring_for_within(Geometry const& g, PointInRingStrategy const& strategy)
-        : has_within(false)
-        , m_geometry(g)
-        , m_strategy(strategy)
-    {}
-
-    template <typename Range>
-    inline void apply(Range const& range)
-    {
-        typename geometry::point_type<Range>::type p;
-        geometry::point_on_border(p, range);
-        if ( !has_within && geometry::within(p, m_geometry, m_strategy) )
-        {
-            has_within = true;
-        }
-    }
-};
+    typename geometry::point_type<Geometry1>::type pt;
+    return geometry::point_on_border(pt, geometry1)
+        && geometry::within(pt, geometry2, strategy);
+}
 
 template <typename FirstGeometry, typename SecondGeometry, typename IntersectionStrategy>
 inline bool rings_containing(FirstGeometry const& geometry1,
                              SecondGeometry const& geometry2,
                              IntersectionStrategy const& strategy)
 {
-    // NOTE: This strategy could be defined inside IntersectionStrategy
-    typedef typename IntersectionStrategy::template point_in_geometry_strategy
-        <
-            FirstGeometry, SecondGeometry
-        >::type point_in_ring_strategy_type;
-
-    point_in_ring_strategy_type point_in_ring_strategy
+    // TODO: This will be removed when IntersectionStrategy is replaced with
+    //       UmbrellaStrategy
+    auto const point_in_ring_strategy
         = strategy.template get_point_in_geometry_strategy<FirstGeometry, SecondGeometry>();
 
-    check_each_ring_for_within
-        <
-            FirstGeometry, point_in_ring_strategy_type
-        > checker(geometry1, point_in_ring_strategy);
-    geometry::detail::for_each_range(geometry2, checker);
-    return checker.has_within;
+    return geometry::detail::any_range_of(geometry2, [&](auto const& range)
+    {
+        return point_on_border_within(range, geometry1, point_in_ring_strategy);
+    });
 }
 
 template <typename Geometry1, typename Geometry2>