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.hpp52
1 files changed, 27 insertions, 25 deletions
diff --git a/boost/geometry/algorithms/detail/relate/areal_areal.hpp b/boost/geometry/algorithms/detail/relate/areal_areal.hpp
index 31d206ac99..2859841de4 100644
--- a/boost/geometry/algorithms/detail/relate/areal_areal.hpp
+++ b/boost/geometry/algorithms/detail/relate/areal_areal.hpp
@@ -2,19 +2,21 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
-// This file was modified by Oracle on 2013, 2014.
-// Modifications copyright (c) 2013-2014 Oracle and/or its affiliates.
+// This file was modified by Oracle on 2013, 2014, 2015.
+// Modifications copyright (c) 2013-2015 Oracle and/or its affiliates.
+
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
-
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_AREAL_AREAL_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_AREAL_AREAL_HPP
#include <boost/geometry/core/topological_dimension.hpp>
+
+#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/util/range.hpp>
#include <boost/geometry/algorithms/num_interior_rings.hpp>
@@ -197,7 +199,7 @@ struct areal_areal
// The result should be FFFFFFFFF
relate::set<exterior, exterior, result_dimension<Geometry2>::value>(result);// FFFFFFFFd, d in [1,9] or T
- if ( result.interrupt )
+ if ( BOOST_GEOMETRY_CONDITION(result.interrupt) )
return;
// get and analyse turns
@@ -207,17 +209,17 @@ struct areal_areal
interrupt_policy_areal_areal<Result> interrupt_policy(geometry1, geometry2, result);
turns::get_turns<Geometry1, Geometry2>::apply(turns, geometry1, geometry2, interrupt_policy);
- if ( result.interrupt )
+ if ( BOOST_GEOMETRY_CONDITION(result.interrupt) )
return;
no_turns_aa_pred<Geometry2, Result, false> pred1(geometry2, result);
for_each_disjoint_geometry_if<0, Geometry1>::apply(turns.begin(), turns.end(), geometry1, pred1);
- if ( result.interrupt )
+ if ( BOOST_GEOMETRY_CONDITION(result.interrupt) )
return;
no_turns_aa_pred<Geometry1, Result, true> pred2(geometry1, result);
for_each_disjoint_geometry_if<1, Geometry2>::apply(turns.begin(), turns.end(), geometry2, pred2);
- if ( result.interrupt )
+ if ( BOOST_GEOMETRY_CONDITION(result.interrupt) )
return;
if ( turns.empty() )
@@ -242,7 +244,7 @@ struct areal_areal
turns_analyser<turn_type, 0> analyser;
analyse_each_turn(result, analyser, turns.begin(), turns.end());
- if ( result.interrupt )
+ if ( BOOST_GEOMETRY_CONDITION(result.interrupt) )
return;
}
@@ -257,7 +259,7 @@ struct areal_areal
uncertain_rings_analyser<0, Result, Geometry1, Geometry2> rings_analyser(result, geometry1, geometry2);
analyse_uncertain_rings<0>::apply(rings_analyser, turns.begin(), turns.end());
- if ( result.interrupt )
+ if ( BOOST_GEOMETRY_CONDITION(result.interrupt) )
return;
}
}
@@ -281,7 +283,7 @@ struct areal_areal
turns_analyser<turn_type, 1> analyser;
analyse_each_turn(result, analyser, turns.begin(), turns.end());
- if ( result.interrupt )
+ if ( BOOST_GEOMETRY_CONDITION(result.interrupt) )
return;
}
@@ -549,7 +551,7 @@ struct areal_areal
{
analyser.apply(res, it);
- if ( res.interrupt )
+ if ( BOOST_GEOMETRY_CONDITION(res.interrupt) )
return;
}
@@ -573,8 +575,7 @@ struct areal_areal
{
// check which relations must be analysed
- if ( ! may_update<interior, interior, '2', transpose_result>(m_result)
- && ! may_update<boundary, interior, '1', transpose_result>(m_result) )
+ if ( ! may_update<interior, interior, '2', transpose_result>(m_result) )
{
m_flags |= 1;
}
@@ -595,7 +596,7 @@ struct areal_areal
inline void no_turns(segment_identifier const& seg_id)
{
// if those flags are set nothing will change
- if ( (m_flags & 3) == 3 )
+ if ( m_flags == 7 )
{
return;
}
@@ -614,15 +615,18 @@ struct areal_areal
// to know which other single geometries should be checked
// TODO: optimize! e.g. use spatial index
- // O(N) - running it in a loop would gives O(NM)
+ // O(N) - running it in a loop gives O(NM)
int const pig = detail::within::point_in_geometry(range::front(range_ref), other_geometry);
//BOOST_ASSERT(pig != 0);
if ( pig > 0 )
{
- update<boundary, interior, '1', transpose_result>(m_result);
update<interior, interior, '2', transpose_result>(m_result);
m_flags |= 1;
+
+ update<boundary, interior, '1', transpose_result>(m_result);
+ update<exterior, interior, '2', transpose_result>(m_result);
+ m_flags |= 4;
}
else
{
@@ -696,12 +700,6 @@ struct areal_areal
update<boundary, exterior, '1', transpose_result>(m_result);
update<interior, exterior, '2', transpose_result>(m_result);
m_flags |= 2;
-
- // not necessary since this will be checked in the next iteration
- // but increases the pruning strength
- // WARNING: this is not reflected in flags
- update<exterior, boundary, '1', transpose_result>(m_result);
- update<exterior, interior, '2', transpose_result>(m_result);
}
interrupt = m_flags == 7 || m_result.interrupt; // interrupt if the result won't be changed in the future
@@ -795,7 +793,8 @@ struct areal_areal
{
segment_identifier const& seg_id = turn.operations[OpId].seg_id;
- int count = boost::numeric_cast<int>(
+ signed_index_type
+ count = boost::numeric_cast<signed_index_type>(
geometry::num_interior_rings(
detail::single_geometry(analyser.geometry, seg_id)));
@@ -803,7 +802,10 @@ struct areal_areal
}
template <typename Analyser, typename Turn>
- static inline void for_no_turns_rings(Analyser & analyser, Turn const& turn, int first, int last)
+ static inline void for_no_turns_rings(Analyser & analyser,
+ Turn const& turn,
+ signed_index_type first,
+ signed_index_type last)
{
segment_identifier seg_id = turn.operations[OpId].seg_id;