summaryrefslogtreecommitdiff
path: root/boost/geometry/algorithms/detail/relate/areal_areal.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/geometry/algorithms/detail/relate/areal_areal.hpp')
-rw-r--r--boost/geometry/algorithms/detail/relate/areal_areal.hpp63
1 files changed, 28 insertions, 35 deletions
diff --git a/boost/geometry/algorithms/detail/relate/areal_areal.hpp b/boost/geometry/algorithms/detail/relate/areal_areal.hpp
index 99df598da8..41366e3167 100644
--- a/boost/geometry/algorithms/detail/relate/areal_areal.hpp
+++ b/boost/geometry/algorithms/detail/relate/areal_areal.hpp
@@ -2,8 +2,8 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
-// This file was modified by Oracle on 2013, 2014, 2015, 2017, 2018, 2019.
-// Modifications copyright (c) 2013-2019 Oracle and/or its affiliates.
+// This file was modified by Oracle on 2013-2022.
+// Modifications copyright (c) 2013-2022 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -29,12 +29,14 @@
#include <boost/geometry/algorithms/detail/relate/boundary_checker.hpp>
#include <boost/geometry/algorithms/detail/relate/follow_helpers.hpp>
+#include <boost/geometry/geometries/helper_geometry.hpp>
+
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace relate {
-
+
// WARNING!
// TODO: In the worst case calling this Pred in a loop for MultiPolygon/MultiPolygon may take O(NM)
// Use the rtree in this case!
@@ -85,9 +87,9 @@ public:
return false;
}
- typedef typename geometry::point_type<Areal>::type point_type;
- point_type pt;
- bool const ok = boost::geometry::point_on_border(pt, areal);
+ using point_type = typename geometry::point_type<Areal>::type;
+ typename helper_geometry<point_type>::type pt;
+ bool const ok = geometry::point_on_border(pt, areal);
// TODO: for now ignore, later throw an exception?
if ( !ok )
@@ -102,7 +104,7 @@ public:
m_other_areal,
m_point_in_areal_strategy);
//BOOST_GEOMETRY_ASSERT( pig != 0 );
-
+
// inside
if ( pig > 0 )
{
@@ -185,7 +187,7 @@ public:
}
}
}
-
+
return m_flags != 3 && !m_result.interrupt;
}
@@ -206,9 +208,6 @@ struct areal_areal
static const bool interruption_enabled = true;
- typedef typename geometry::point_type<Geometry1>::type point1_type;
- typedef typename geometry::point_type<Geometry2>::type point2_type;
-
template <typename Result, typename Strategy>
static inline void apply(Geometry1 const& geometry1, Geometry2 const& geometry2,
Result & result,
@@ -216,17 +215,16 @@ struct areal_areal
{
// TODO: If Areal geometry may have infinite size, change the following line:
- // The result should be FFFFFFFFF
- relate::set<exterior, exterior, result_dimension<Geometry2>::value>(result);// FFFFFFFFd, d in [1,9] or T
+ update<exterior, exterior, result_dimension<Geometry2>::value>(result);// FFFFFFFFd, d in [1,9] or T
if ( BOOST_GEOMETRY_CONDITION(result.interrupt) )
return;
// get and analyse turns
- typedef typename turns::get_turns
+ using turn_type = typename turns::get_turns
<
Geometry1, Geometry2
- >::template turn_info_type<Strategy>::type turn_type;
+ >::template turn_info_type<Strategy>::type;
std::vector<turn_type> turns;
interrupt_policy_areal_areal<Result> interrupt_policy(geometry1, geometry2, result);
@@ -235,8 +233,6 @@ struct areal_areal
if ( BOOST_GEOMETRY_CONDITION(result.interrupt) )
return;
- typedef typename Strategy::cs_tag cs_tag;
-
no_turns_aa_pred<Geometry2, Result, Strategy, false>
pred1(geometry2, result, strategy);
for_each_disjoint_geometry_if<0, Geometry1>::apply(turns.begin(), turns.end(), geometry1, pred1);
@@ -248,7 +244,7 @@ struct areal_areal
for_each_disjoint_geometry_if<1, Geometry2>::apply(turns.begin(), turns.end(), geometry2, pred2);
if ( BOOST_GEOMETRY_CONDITION(result.interrupt) )
return;
-
+
if ( turns.empty() )
return;
@@ -259,8 +255,8 @@ struct areal_areal
|| may_update<exterior, interior, '2'>(result) )
{
// sort turns
- typedef turns::less<0, turns::less_op_areal_areal<0>, cs_tag> less;
- std::sort(turns.begin(), turns.end(), less());
+ using less_t = turns::less<0, turns::less_op_areal_areal<0>, Strategy>;
+ std::sort(turns.begin(), turns.end(), less_t());
/*if ( may_update<interior, exterior, '2'>(result)
|| may_update<boundary, exterior, '1'>(result)
@@ -299,8 +295,8 @@ struct areal_areal
|| may_update<exterior, interior, '2', true>(result) )
{
// sort turns
- typedef turns::less<1, turns::less_op_areal_areal<1>, cs_tag> less;
- std::sort(turns.begin(), turns.end(), less());
+ using less_t = turns::less<1, turns::less_op_areal_areal<1>, Strategy>;
+ std::sort(turns.begin(), turns.end(), less_t());
/*if ( may_update<interior, exterior, '2', true>(result)
|| may_update<boundary, exterior, '1', true>(result)
@@ -352,9 +348,7 @@ struct areal_areal
template <typename Range>
inline bool apply(Range const& turns)
{
- typedef typename boost::range_iterator<Range const>::type iterator;
-
- for (iterator it = boost::begin(turns) ; it != boost::end(turns) ; ++it)
+ for (auto it = boost::begin(turns) ; it != boost::end(turns) ; ++it)
{
per_turn<0>(*it);
per_turn<1>(*it);
@@ -469,7 +463,7 @@ struct areal_areal
{
m_exit_detected = false;
}
- }
+ }
/*else*/
if ( m_enter_detected /*m_previous_operation == overlay::operation_intersection*/ )
{
@@ -652,15 +646,14 @@ struct areal_areal
return;
}
- typename detail::sub_range_return_type<Geometry const>::type
- range_ref = detail::sub_range(geometry, seg_id);
+ auto const& sub_range = detail::sub_range(geometry, seg_id);
- if ( boost::empty(range_ref) )
+ if ( boost::empty(sub_range) )
{
// TODO: throw an exception?
return; // ignore
}
-
+
// TODO: possible optimization
// if the range is an interior ring we may use other IPs generated for this single geometry
// to know which other single geometries should be checked
@@ -668,7 +661,7 @@ struct areal_areal
// TODO: optimize! e.g. use spatial index
// O(N) - running it in a loop gives O(NM)
using detail::within::point_in_geometry;
- int const pig = point_in_geometry(range::front(range_ref),
+ int const pig = point_in_geometry(range::front(sub_range),
other_geometry,
m_point_in_areal_strategy);
@@ -713,12 +706,12 @@ struct areal_areal
for ( TurnIt it = first ; it != last ; ++it )
{
- if ( it->operations[0].operation == overlay::operation_intersection
+ if ( it->operations[0].operation == overlay::operation_intersection
&& it->operations[1].operation == overlay::operation_intersection )
{
found_ii = true;
}
- else if ( it->operations[0].operation == overlay::operation_union
+ else if ( it->operations[0].operation == overlay::operation_union
&& it->operations[1].operation == overlay::operation_union )
{
found_uu = true;
@@ -735,7 +728,7 @@ struct areal_areal
update<interior, interior, '2', transpose_result>(m_result);
m_flags |= 1;
- //update<boundary, boundary, '0', transpose_result>(m_result);
+ //update<boundary, boundary, '0', transpose_result>(m_result);
update<boundary, interior, '1', transpose_result>(m_result);
update<exterior, interior, '2', transpose_result>(m_result);
@@ -846,7 +839,7 @@ struct areal_areal
count = boost::numeric_cast<signed_size_type>(
geometry::num_interior_rings(
detail::single_geometry(analyser.geometry, seg_id)));
-
+
for_no_turns_rings(analyser, turn, seg_id.ring_index + 1, count);
}