summaryrefslogtreecommitdiff
path: root/boost/geometry/algorithms/detail/disjoint/multipoint_geometry.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/geometry/algorithms/detail/disjoint/multipoint_geometry.hpp')
-rw-r--r--boost/geometry/algorithms/detail/disjoint/multipoint_geometry.hpp57
1 files changed, 26 insertions, 31 deletions
diff --git a/boost/geometry/algorithms/detail/disjoint/multipoint_geometry.hpp b/boost/geometry/algorithms/detail/disjoint/multipoint_geometry.hpp
index 9e3a57a29e..535c9006b5 100644
--- a/boost/geometry/algorithms/detail/disjoint/multipoint_geometry.hpp
+++ b/boost/geometry/algorithms/detail/disjoint/multipoint_geometry.hpp
@@ -2,7 +2,9 @@
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
-// Copyright (c) 2014-2020, Oracle and/or its affiliates.
+// Copyright (c) 2014-2023, Oracle and/or its affiliates.
+
+// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -31,7 +33,6 @@
#include <boost/geometry/algorithms/envelope.hpp>
#include <boost/geometry/algorithms/expand.hpp>
-#include <boost/geometry/algorithms/detail/check_iterator_range.hpp>
#include <boost/geometry/algorithms/detail/partition.hpp>
#include <boost/geometry/algorithms/detail/disjoint/box_box.hpp>
#include <boost/geometry/algorithms/detail/disjoint/multirange_geometry.hpp>
@@ -62,25 +63,25 @@ namespace detail { namespace disjoint
class multipoint_multipoint
{
private:
- template <typename Iterator, typename CSTag>
- class unary_disjoint_predicate
- : geometry::less<void, -1, CSTag>
+ template <typename Iterator, typename Strategy>
+ class unary_not_disjoint_predicate
+ : geometry::less<void, -1, Strategy>
{
private:
- typedef geometry::less<void, -1, CSTag> base_type;
+ using less_type = geometry::less<void, -1, Strategy>;
public:
- unary_disjoint_predicate(Iterator first, Iterator last)
- : base_type(), m_first(first), m_last(last)
+ unary_not_disjoint_predicate(Iterator first, Iterator last)
+ : less_type(), m_first(first), m_last(last)
{}
template <typename Point>
- inline bool apply(Point const& point) const
+ inline bool operator()(Point const& point) const
{
- return !std::binary_search(m_first,
- m_last,
- point,
- static_cast<base_type const&>(*this));
+ return std::binary_search(m_first,
+ m_last,
+ point,
+ static_cast<less_type const&>(*this));
}
private:
@@ -93,30 +94,25 @@ public:
MultiPoint2 const& multipoint2,
Strategy const&)
{
- typedef typename Strategy::cs_tag cs_tag;
- typedef geometry::less<void, -1, cs_tag> less_type;
-
BOOST_GEOMETRY_ASSERT( boost::size(multipoint1) <= boost::size(multipoint2) );
- typedef typename boost::range_value<MultiPoint1>::type point1_type;
+ using less_type = geometry::less<void, -1, Strategy>;
+ using point1_type = typename boost::range_value<MultiPoint1>::type;
std::vector<point1_type> points1(boost::begin(multipoint1),
boost::end(multipoint1));
std::sort(points1.begin(), points1.end(), less_type());
- typedef unary_disjoint_predicate
+ using predicate_type = unary_not_disjoint_predicate
<
typename std::vector<point1_type>::const_iterator,
- cs_tag
- > predicate_type;
+ Strategy
+ >;
- return check_iterator_range
- <
- predicate_type
- >::apply(boost::begin(multipoint2),
- boost::end(multipoint2),
- predicate_type(points1.begin(), points1.end()));
+ return none_of(boost::begin(multipoint2),
+ boost::end(multipoint2),
+ predicate_type(points1.begin(), points1.end()));
}
};
@@ -289,13 +285,12 @@ public:
typedef typename point_type<MultiPoint>::type point1_type;
typedef typename point_type<SingleGeometry>::type point2_type;
typedef model::box<point2_type> box2_type;
-
+
box2_type box2;
geometry::envelope(single_geometry, box2, strategy);
geometry::detail::expand_by_epsilon(box2);
- typedef typename boost::range_const_iterator<MultiPoint>::type iterator;
- for ( iterator it = boost::begin(multi_point) ; it != boost::end(multi_point) ; ++it )
+ for (auto it = boost::begin(multi_point) ; it != boost::end(multi_point) ; ++it)
{
// The default strategy is enough for Point/Box
if (! detail::disjoint::disjoint_point_box(*it, box2, strategy)
@@ -434,7 +429,7 @@ public:
typedef model::box<point1_type> box1_type;
typedef model::box<point2_type> box2_type;
typedef std::pair<box2_type, std::size_t> box_pair_type;
-
+
std::size_t count2 = boost::size(multi_geometry);
std::vector<box_pair_type> boxes(count2);
for (std::size_t i = 0 ; i < count2 ; ++i)
@@ -533,7 +528,7 @@ struct disjoint
{
return detail::disjoint::multipoint_multipoint
::apply(multipoint2, multipoint1, strategy);
- }
+ }
return detail::disjoint::multipoint_multipoint
::apply(multipoint1, multipoint2, strategy);