summaryrefslogtreecommitdiff
path: root/boost/geometry/algorithms/detail/relate
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:08:07 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:09:00 +0900
commitb5c87084afaef42b2d058f68091be31988a6a874 (patch)
treeadef9a65870a41181687e11d57fdf98e7629de3c /boost/geometry/algorithms/detail/relate
parent34bd32e225e2a8a94104489b31c42e5801cc1f4a (diff)
downloadboost-b5c87084afaef42b2d058f68091be31988a6a874.tar.gz
boost-b5c87084afaef42b2d058f68091be31988a6a874.tar.bz2
boost-b5c87084afaef42b2d058f68091be31988a6a874.zip
Imported Upstream version 1.64.0upstream/1.64.0
Change-Id: Id9212edd016dd55f21172c427aa7894d1d24148b Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/geometry/algorithms/detail/relate')
-rw-r--r--boost/geometry/algorithms/detail/relate/areal_areal.hpp87
-rw-r--r--boost/geometry/algorithms/detail/relate/implementation.hpp7
-rw-r--r--boost/geometry/algorithms/detail/relate/interface.hpp135
-rw-r--r--boost/geometry/algorithms/detail/relate/linear_areal.hpp79
-rw-r--r--boost/geometry/algorithms/detail/relate/linear_linear.hpp16
-rw-r--r--boost/geometry/algorithms/detail/relate/point_geometry.hpp16
-rw-r--r--boost/geometry/algorithms/detail/relate/point_point.hpp34
-rw-r--r--boost/geometry/algorithms/detail/relate/relate_impl.hpp5
-rw-r--r--boost/geometry/algorithms/detail/relate/result.hpp4
-rw-r--r--boost/geometry/algorithms/detail/relate/turns.hpp24
10 files changed, 293 insertions, 114 deletions
diff --git a/boost/geometry/algorithms/detail/relate/areal_areal.hpp b/boost/geometry/algorithms/detail/relate/areal_areal.hpp
index a74954326b..800fbb2e96 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.
-// Modifications copyright (c) 2013-2015 Oracle and/or its affiliates.
+// This file was modified by Oracle on 2013, 2014, 2015, 2017.
+// Modifications copyright (c) 2013-2017 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -40,12 +40,21 @@ namespace detail { namespace relate {
// Use the rtree in this case!
// may be used to set EI and EB for an Areal geometry for which no turns were generated
-template <typename OtherAreal, typename Result, bool TransposeResult>
+template
+<
+ typename OtherAreal,
+ typename Result,
+ typename PointInArealStrategy,
+ bool TransposeResult
+>
class no_turns_aa_pred
{
public:
- no_turns_aa_pred(OtherAreal const& other_areal, Result & res)
+ no_turns_aa_pred(OtherAreal const& other_areal,
+ Result & res,
+ PointInArealStrategy const& point_in_areal_strategy)
: m_result(res)
+ , m_point_in_areal_strategy(point_in_areal_strategy)
, m_other_areal(other_areal)
, m_flags(0)
{
@@ -68,6 +77,8 @@ public:
template <typename Areal>
bool operator()(Areal const& areal)
{
+ using detail::within::point_in_geometry;
+
// if those flags are set nothing will change
if ( m_flags == 3 )
{
@@ -87,7 +98,9 @@ public:
// check if the areal is inside the other_areal
// TODO: This is O(N)
// Run in a loop O(NM) - optimize!
- int const pig = detail::within::point_in_geometry(pt, m_other_areal);
+ int const pig = point_in_geometry(pt,
+ m_other_areal,
+ m_point_in_areal_strategy);
//BOOST_GEOMETRY_ASSERT( pig != 0 );
// inside
@@ -119,7 +132,9 @@ public:
// TODO: O(N)
// Optimize!
- int const hpig = detail::within::point_in_geometry(range::front(range_ref), m_other_areal);
+ int const hpig = point_in_geometry(range::front(range_ref),
+ m_other_areal,
+ m_point_in_areal_strategy);
// hole outside
if ( hpig < 0 )
@@ -155,7 +170,9 @@ public:
// TODO: O(N)
// Optimize!
- int const hpig = detail::within::point_in_geometry(range::front(range_ref), m_other_areal);
+ int const hpig = point_in_geometry(range::front(range_ref),
+ m_other_areal,
+ m_point_in_areal_strategy);
// hole inside
if ( hpig > 0 )
@@ -174,6 +191,7 @@ public:
private:
Result & m_result;
+ PointInArealStrategy const& m_point_in_areal_strategy;
OtherAreal const& m_other_areal;
int m_flags;
};
@@ -191,8 +209,10 @@ struct areal_areal
typedef typename geometry::point_type<Geometry1>::type point1_type;
typedef typename geometry::point_type<Geometry2>::type point2_type;
- template <typename Result>
- static inline void apply(Geometry1 const& geometry1, Geometry2 const& geometry2, Result & result)
+ template <typename Result, typename IntersectionStrategy>
+ static inline void apply(Geometry1 const& geometry1, Geometry2 const& geometry2,
+ Result & result,
+ IntersectionStrategy const& intersection_strategy)
{
// TODO: If Areal geometry may have infinite size, change the following line:
@@ -208,16 +228,31 @@ struct areal_areal
interrupt_policy_areal_areal<Result> interrupt_policy(geometry1, geometry2, result);
- turns::get_turns<Geometry1, Geometry2>::apply(turns, geometry1, geometry2, interrupt_policy);
+ turns::get_turns<Geometry1, Geometry2>::apply(turns, geometry1, geometry2, interrupt_policy, intersection_strategy);
if ( BOOST_GEOMETRY_CONDITION(result.interrupt) )
return;
- no_turns_aa_pred<Geometry2, Result, false> pred1(geometry2, result);
+ typedef typename IntersectionStrategy::template point_in_geometry_strategy
+ <
+ Geometry1, Geometry2
+ >::type point_in_areal_strategy12_type;
+ point_in_areal_strategy12_type point_in_areal_strategy12
+ = intersection_strategy.template get_point_in_geometry_strategy<Geometry1, Geometry2>();
+ typedef typename IntersectionStrategy::template point_in_geometry_strategy
+ <
+ Geometry2, Geometry1
+ >::type point_in_areal_strategy21_type;
+ point_in_areal_strategy21_type point_in_areal_strategy21
+ = intersection_strategy.template get_point_in_geometry_strategy<Geometry2, Geometry1>();
+
+ no_turns_aa_pred<Geometry2, Result, point_in_areal_strategy12_type, false>
+ pred1(geometry2, result, point_in_areal_strategy12);
for_each_disjoint_geometry_if<0, Geometry1>::apply(turns.begin(), turns.end(), geometry1, pred1);
if ( BOOST_GEOMETRY_CONDITION(result.interrupt) )
return;
- no_turns_aa_pred<Geometry1, Result, true> pred2(geometry1, result);
+ no_turns_aa_pred<Geometry1, Result, point_in_areal_strategy21_type, true>
+ pred2(geometry1, result, point_in_areal_strategy21);
for_each_disjoint_geometry_if<1, Geometry2>::apply(turns.begin(), turns.end(), geometry2, pred2);
if ( BOOST_GEOMETRY_CONDITION(result.interrupt) )
return;
@@ -256,7 +291,8 @@ struct areal_areal
{
// analyse rings for which turns were not generated
// or only i/i or u/u was generated
- uncertain_rings_analyser<0, Result, Geometry1, Geometry2> rings_analyser(result, geometry1, geometry2);
+ uncertain_rings_analyser<0, Result, Geometry1, Geometry2, point_in_areal_strategy12_type>
+ rings_analyser(result, geometry1, geometry2, point_in_areal_strategy12);
analyse_uncertain_rings<0>::apply(rings_analyser, turns.begin(), turns.end());
if ( BOOST_GEOMETRY_CONDITION(result.interrupt) )
@@ -295,7 +331,8 @@ struct areal_areal
{
// analyse rings for which turns were not generated
// or only i/i or u/u was generated
- uncertain_rings_analyser<1, Result, Geometry2, Geometry1> rings_analyser(result, geometry2, geometry1);
+ uncertain_rings_analyser<1, Result, Geometry2, Geometry1, point_in_areal_strategy21_type>
+ rings_analyser(result, geometry2, geometry1, point_in_areal_strategy21);
analyse_uncertain_rings<1>::apply(rings_analyser, turns.begin(), turns.end());
//if ( result.interrupt )
@@ -565,7 +602,14 @@ struct areal_areal
analyser.apply(res);
}
- template <std::size_t OpId, typename Result, typename Geometry, typename OtherGeometry>
+ template
+ <
+ std::size_t OpId,
+ typename Result,
+ typename Geometry,
+ typename OtherGeometry,
+ typename PointInArealStrategy
+ >
class uncertain_rings_analyser
{
static const bool transpose_result = OpId != 0;
@@ -574,10 +618,13 @@ struct areal_areal
public:
inline uncertain_rings_analyser(Result & result,
Geometry const& geom,
- OtherGeometry const& other_geom)
- : geometry(geom), other_geometry(other_geom)
+ OtherGeometry const& other_geom,
+ PointInArealStrategy const& point_in_areal_strategy)
+ : geometry(geom)
+ , other_geometry(other_geom)
, interrupt(result.interrupt) // just in case, could be false as well
, m_result(result)
+ , m_point_in_areal_strategy(point_in_areal_strategy)
, m_flags(0)
{
// check which relations must be analysed
@@ -624,7 +671,10 @@ struct areal_areal
// TODO: optimize! e.g. use spatial index
// O(N) - running it in a loop gives O(NM)
- int const pig = detail::within::point_in_geometry(range::front(range_ref), other_geometry);
+ using detail::within::point_in_geometry;
+ int const pig = point_in_geometry(range::front(range_ref),
+ other_geometry,
+ m_point_in_areal_strategy);
//BOOST_GEOMETRY_ASSERT(pig != 0);
if ( pig > 0 )
@@ -713,6 +763,7 @@ struct areal_areal
private:
Result & m_result;
+ PointInArealStrategy const& m_point_in_areal_strategy;
int m_flags;
};
diff --git a/boost/geometry/algorithms/detail/relate/implementation.hpp b/boost/geometry/algorithms/detail/relate/implementation.hpp
index a6f1545ed1..3bd0f806c1 100644
--- a/boost/geometry/algorithms/detail/relate/implementation.hpp
+++ b/boost/geometry/algorithms/detail/relate/implementation.hpp
@@ -2,8 +2,8 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
-// This file was modified by Oracle on 2013, 2014, 2015.
-// Modifications copyright (c) 2013-2015 Oracle and/or its affiliates.
+// This file was modified by Oracle on 2013, 2014, 2015, 2017.
+// Modifications copyright (c) 2013-2017 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -25,6 +25,9 @@
#include <boost/geometry/algorithms/detail/relate/linear_areal.hpp>
#include <boost/geometry/algorithms/detail/relate/areal_areal.hpp>
+#include <boost/geometry/strategies/intersection.hpp>
+#include <boost/geometry/strategies/within.hpp>
+
namespace boost { namespace geometry {
diff --git a/boost/geometry/algorithms/detail/relate/interface.hpp b/boost/geometry/algorithms/detail/relate/interface.hpp
index 95d452931c..3575fe2bc4 100644
--- a/boost/geometry/algorithms/detail/relate/interface.hpp
+++ b/boost/geometry/algorithms/detail/relate/interface.hpp
@@ -2,8 +2,8 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
-// This file was modified by Oracle on 2013, 2014, 2015.
-// Modifications copyright (c) 2013-2015 Oracle and/or its affiliates.
+// This file was modified by Oracle on 2013, 2014, 2015, 2017.
+// Modifications copyright (c) 2013-2017 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -29,6 +29,7 @@
#include <boost/geometry/algorithms/not_implemented.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/strategies/default_strategy.hpp>
+#include <boost/geometry/strategies/relate.hpp>
namespace boost { namespace geometry {
@@ -186,18 +187,59 @@ struct result_handler_type<Geometry1, Geometry2, StaticSequence, true>
> type;
};
+
}} // namespace detail::relate
#endif // DOXYGEN_NO_DETAIL
+namespace resolve_strategy {
+
+struct relate
+{
+ template <typename Geometry1, typename Geometry2, typename ResultHandler, typename Strategy>
+ static inline void apply(Geometry1 const& geometry1,
+ Geometry2 const& geometry2,
+ ResultHandler & handler,
+ Strategy const& strategy)
+ {
+ dispatch::relate
+ <
+ Geometry1,
+ Geometry2
+ >::apply(geometry1, geometry2, handler, strategy);
+ }
+
+ template <typename Geometry1, typename Geometry2, typename ResultHandler>
+ static inline void apply(Geometry1 const& geometry1,
+ Geometry2 const& geometry2,
+ ResultHandler & handler,
+ default_strategy)
+ {
+ typedef typename strategy::relate::services::default_strategy
+ <
+ Geometry1,
+ Geometry2
+ >::type strategy_type;
+
+ dispatch::relate
+ <
+ Geometry1,
+ Geometry2
+ >::apply(geometry1, geometry2, handler, strategy_type());
+ }
+};
+
+} // resolve_strategy
+
namespace resolve_variant {
template <typename Geometry1, typename Geometry2>
struct relate
{
- template <typename Mask>
+ template <typename Mask, typename Strategy>
static inline bool apply(Geometry1 const& geometry1,
Geometry2 const& geometry2,
- Mask const& mask)
+ Mask const& mask,
+ Strategy const& strategy)
{
concepts::check<Geometry1 const>();
concepts::check<Geometry2 const>();
@@ -210,11 +252,7 @@ struct relate
Mask
>::type handler(mask);
- dispatch::relate
- <
- Geometry1,
- Geometry2
- >::apply(geometry1, geometry2, handler);
+ resolve_strategy::relate::apply(geometry1, geometry2, handler, strategy);
return handler.result();
}
@@ -223,60 +261,64 @@ struct relate
template <BOOST_VARIANT_ENUM_PARAMS(typename T), typename Geometry2>
struct relate<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Geometry2>
{
- template <typename Mask>
+ template <typename Mask, typename Strategy>
struct visitor : boost::static_visitor<bool>
{
Geometry2 const& m_geometry2;
Mask const& m_mask;
+ Strategy const& m_strategy;
- visitor(Geometry2 const& geometry2, Mask const& mask)
- : m_geometry2(geometry2), m_mask(mask) {}
+ visitor(Geometry2 const& geometry2, Mask const& mask, Strategy const& strategy)
+ : m_geometry2(geometry2), m_mask(mask), m_strategy(strategy) {}
template <typename Geometry1>
bool operator()(Geometry1 const& geometry1) const
{
return relate<Geometry1, Geometry2>
- ::apply(geometry1, m_geometry2, m_mask);
+ ::apply(geometry1, m_geometry2, m_mask, m_strategy);
}
};
- template <typename Mask>
+ template <typename Mask, typename Strategy>
static inline bool
apply(boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> const& geometry1,
Geometry2 const& geometry2,
- Mask const& mask)
+ Mask const& mask,
+ Strategy const& strategy)
{
- return boost::apply_visitor(visitor<Mask>(geometry2, mask), geometry1);
+ return boost::apply_visitor(visitor<Mask, Strategy>(geometry2, mask, strategy), geometry1);
}
};
template <typename Geometry1, BOOST_VARIANT_ENUM_PARAMS(typename T)>
struct relate<Geometry1, boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
{
- template <typename Mask>
+ template <typename Mask, typename Strategy>
struct visitor : boost::static_visitor<bool>
{
Geometry1 const& m_geometry1;
Mask const& m_mask;
+ Strategy const& m_strategy;
- visitor(Geometry1 const& geometry1, Mask const& mask)
- : m_geometry1(geometry1), m_mask(mask) {}
+ visitor(Geometry1 const& geometry1, Mask const& mask, Strategy const& strategy)
+ : m_geometry1(geometry1), m_mask(mask), m_strategy(strategy) {}
template <typename Geometry2>
bool operator()(Geometry2 const& geometry2) const
{
return relate<Geometry1, Geometry2>
- ::apply(m_geometry1, geometry2, m_mask);
+ ::apply(m_geometry1, geometry2, m_mask, m_strategy);
}
};
- template <typename Mask>
+ template <typename Mask, typename Strategy>
static inline bool
apply(Geometry1 const& geometry1,
boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> const& geometry2,
- Mask const& mask)
+ Mask const& mask,
+ Strategy const& strategy)
{
- return boost::apply_visitor(visitor<Mask>(geometry1, mask), geometry2);
+ return boost::apply_visitor(visitor<Mask, Strategy>(geometry1, mask, strategy), geometry2);
}
};
@@ -289,30 +331,32 @@ struct relate<
boost::variant<BOOST_VARIANT_ENUM_PARAMS(T2)>
>
{
- template <typename Mask>
+ template <typename Mask, typename Strategy>
struct visitor : boost::static_visitor<bool>
{
Mask const& m_mask;
+ Strategy const& m_strategy;
- visitor(Mask const& mask)
- : m_mask(mask) {}
+ visitor(Mask const& mask, Strategy const& strategy)
+ : m_mask(mask), m_strategy(strategy) {}
template <typename Geometry1, typename Geometry2>
bool operator()(Geometry1 const& geometry1,
Geometry2 const& geometry2) const
{
return relate<Geometry1, Geometry2>
- ::apply(geometry1, geometry2, m_mask);
+ ::apply(geometry1, geometry2, m_mask, m_strategy);
}
};
- template <typename Mask>
+ template <typename Mask, typename Strategy>
static inline bool
apply(boost::variant<BOOST_VARIANT_ENUM_PARAMS(T1)> const& geometry1,
boost::variant<BOOST_VARIANT_ENUM_PARAMS(T2)> const& geometry2,
- Mask const& mask)
+ Mask const& mask,
+ Strategy const& strategy)
{
- return boost::apply_visitor(visitor<Mask>(mask), geometry1, geometry2);
+ return boost::apply_visitor(visitor<Mask, Strategy>(mask, strategy), geometry1, geometry2);
}
};
@@ -324,6 +368,35 @@ struct relate<
\tparam Geometry1 \tparam_geometry
\tparam Geometry2 \tparam_geometry
\tparam Mask An intersection model Mask type.
+\tparam Strategy \tparam_strategy{Relate}
+\param geometry1 \param_geometry
+\param geometry2 \param_geometry
+\param mask An intersection model mask object.
+\param strategy \param_strategy{relate}
+\return true if the relation is compatible with the mask, false otherwise.
+
+\qbk{distinguish,with strategy}
+\qbk{[include reference/algorithms/relate.qbk]}
+ */
+template <typename Geometry1, typename Geometry2, typename Mask, typename Strategy>
+inline bool relate(Geometry1 const& geometry1,
+ Geometry2 const& geometry2,
+ Mask const& mask,
+ Strategy const& strategy)
+{
+ return resolve_variant::relate
+ <
+ Geometry1,
+ Geometry2
+ >::apply(geometry1, geometry2, mask, strategy);
+}
+
+/*!
+\brief Checks relation between a pair of geometries defined by a mask.
+\ingroup relate
+\tparam Geometry1 \tparam_geometry
+\tparam Geometry2 \tparam_geometry
+\tparam Mask An intersection model Mask type.
\param geometry1 \param_geometry
\param geometry2 \param_geometry
\param mask An intersection model mask object.
@@ -340,7 +413,7 @@ inline bool relate(Geometry1 const& geometry1,
<
Geometry1,
Geometry2
- >::apply(geometry1, geometry2, mask);
+ >::apply(geometry1, geometry2, mask, default_strategy());
}
}} // namespace boost::geometry
diff --git a/boost/geometry/algorithms/detail/relate/linear_areal.hpp b/boost/geometry/algorithms/detail/relate/linear_areal.hpp
index 58ba7bd1af..f1b4fdf81a 100644
--- a/boost/geometry/algorithms/detail/relate/linear_areal.hpp
+++ b/boost/geometry/algorithms/detail/relate/linear_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.
-// Modifications copyright (c) 2013-2015 Oracle and/or its affiliates.
+// This file was modified by Oracle on 2013, 2014, 2015, 2017.
+// Modifications copyright (c) 2013-2017 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -46,15 +46,24 @@ namespace detail { namespace relate {
// Use the rtree in this case!
// may be used to set IE and BE for a Linear geometry for which no turns were generated
-template <typename Geometry2, typename Result, typename BoundaryChecker, bool TransposeResult>
+template
+<
+ typename Geometry2,
+ typename Result,
+ typename PointInArealStrategy,
+ typename BoundaryChecker,
+ bool TransposeResult
+>
class no_turns_la_linestring_pred
{
public:
no_turns_la_linestring_pred(Geometry2 const& geometry2,
Result & res,
+ PointInArealStrategy const& point_in_areal_strategy,
BoundaryChecker const& boundary_checker)
: m_geometry2(geometry2)
, m_result(res)
+ , m_point_in_areal_strategy(point_in_areal_strategy)
, m_boundary_checker(boundary_checker)
, m_interrupt_flags(0)
{
@@ -98,7 +107,9 @@ public:
return false;
}
- int const pig = detail::within::point_in_geometry(range::front(linestring), m_geometry2);
+ int const pig = detail::within::point_in_geometry(range::front(linestring),
+ m_geometry2,
+ m_point_in_areal_strategy);
//BOOST_GEOMETRY_ASSERT_MSG(pig != 0, "There should be no IPs");
if ( pig > 0 )
@@ -138,6 +149,7 @@ public:
private:
Geometry2 const& m_geometry2;
Result & m_result;
+ PointInArealStrategy const& m_point_in_areal_strategy;
BoundaryChecker const& m_boundary_checker;
unsigned m_interrupt_flags;
};
@@ -225,8 +237,10 @@ struct linear_areal
>
{};
- template <typename Result>
- static inline void apply(Geometry1 const& geometry1, Geometry2 const& geometry2, Result & result)
+ template <typename Result, typename IntersectionStrategy>
+ static inline void apply(Geometry1 const& geometry1, Geometry2 const& geometry2,
+ Result & result,
+ IntersectionStrategy const& intersection_strategy)
{
// TODO: If Areal geometry may have infinite size, change the following line:
@@ -242,7 +256,7 @@ struct linear_areal
interrupt_policy_linear_areal<Geometry2, Result> interrupt_policy(geometry2, result);
- turns::get_turns<Geometry1, Geometry2>::apply(turns, geometry1, geometry2, interrupt_policy);
+ turns::get_turns<Geometry1, Geometry2>::apply(turns, geometry1, geometry2, interrupt_policy, intersection_strategy);
if ( BOOST_GEOMETRY_CONDITION( result.interrupt ) )
return;
@@ -251,9 +265,13 @@ struct linear_areal
<
Geometry2,
Result,
+ typename IntersectionStrategy::template point_in_geometry_strategy<Geometry1, Geometry2>::type,
boundary_checker<Geometry1>,
TransposeResult
- > pred1(geometry2, result, boundary_checker1);
+ > pred1(geometry2,
+ result,
+ intersection_strategy.template get_point_in_geometry_strategy<Geometry1, Geometry2>(),
+ boundary_checker1);
for_each_disjoint_geometry_if<0, Geometry1>::apply(turns.begin(), turns.end(), geometry1, pred1);
if ( BOOST_GEOMETRY_CONDITION( result.interrupt ) )
return;
@@ -279,7 +297,8 @@ struct linear_areal
analyse_each_turn(result, analyser,
turns.begin(), turns.end(),
geometry1, geometry2,
- boundary_checker1);
+ boundary_checker1,
+ intersection_strategy.get_side_strategy());
if ( BOOST_GEOMETRY_CONDITION( result.interrupt ) )
return;
@@ -615,11 +634,13 @@ struct linear_areal
typename TurnIt,
typename Geometry,
typename OtherGeometry,
- typename BoundaryChecker>
+ typename BoundaryChecker,
+ typename SideStrategy>
void apply(Result & res, TurnIt it,
Geometry const& geometry,
OtherGeometry const& other_geometry,
- BoundaryChecker const& boundary_checker)
+ BoundaryChecker const& boundary_checker,
+ SideStrategy const& side_strategy)
{
overlay::operation_type op = it->operations[op_id].operation;
@@ -856,7 +877,8 @@ struct linear_areal
bool const from_inside = first_point
&& calculate_from_inside(geometry,
other_geometry,
- *it);
+ *it,
+ side_strategy);
if ( from_inside )
update<interior, interior, '1', TransposeResult>(res);
@@ -956,7 +978,8 @@ struct linear_areal
bool const first_from_inside = first_point
&& calculate_from_inside(geometry,
other_geometry,
- *it);
+ *it,
+ side_strategy);
if ( first_from_inside )
{
update<interior, interior, '1', TransposeResult>(res);
@@ -1144,10 +1167,11 @@ struct linear_areal
// check if the passed turn's segment of Linear geometry arrived
// from the inside or the outside of the Areal geometry
- template <typename Turn>
+ template <typename Turn, typename SideStrategy>
static inline bool calculate_from_inside(Geometry1 const& geometry1,
Geometry2 const& geometry2,
- Turn const& turn)
+ Turn const& turn,
+ SideStrategy const& side_strategy)
{
typedef typename cs_tag<typename Turn::point_type>::type cs_tag;
@@ -1194,16 +1218,18 @@ struct linear_areal
boost::end(range2));
// Will this sequence of points be always correct?
- overlay::side_calculator<cs_tag, point1_type, point2_type> side_calc(qi_conv, new_pj, pi, qi, qj, *qk_it);
+ overlay::side_calculator<cs_tag, point1_type, point2_type, SideStrategy>
+ side_calc(qi_conv, new_pj, pi, qi, qj, *qk_it, side_strategy);
return calculate_from_inside_sides(side_calc);
}
else
{
- point1_type new_qj;
+ point2_type new_qj;
geometry::convert(turn.point, new_qj);
- overlay::side_calculator<cs_tag, point1_type, point2_type> side_calc(qi_conv, new_pj, pi, qi, new_qj, qj);
+ overlay::side_calculator<cs_tag, point1_type, point2_type, SideStrategy>
+ side_calc(qi_conv, new_pj, pi, qi, new_qj, qj, side_strategy);
return calculate_from_inside_sides(side_calc);
}
@@ -1270,13 +1296,15 @@ struct linear_areal
typename Analyser,
typename Geometry,
typename OtherGeometry,
- typename BoundaryChecker>
+ typename BoundaryChecker,
+ typename SideStrategy>
static inline void analyse_each_turn(Result & res,
Analyser & analyser,
TurnIt first, TurnIt last,
Geometry const& geometry,
OtherGeometry const& other_geometry,
- BoundaryChecker const& boundary_checker)
+ BoundaryChecker const& boundary_checker,
+ SideStrategy const& side_strategy)
{
if ( first == last )
return;
@@ -1285,7 +1313,8 @@ struct linear_areal
{
analyser.apply(res, it,
geometry, other_geometry,
- boundary_checker);
+ boundary_checker,
+ side_strategy);
if ( BOOST_GEOMETRY_CONDITION( res.interrupt ) )
return;
@@ -1420,10 +1449,12 @@ struct areal_linear
static const bool interruption_enabled = linear_areal_type::interruption_enabled;
- template <typename Result>
- static inline void apply(Geometry1 const& geometry1, Geometry2 const& geometry2, Result & result)
+ template <typename Result, typename IntersectionStrategy>
+ static inline void apply(Geometry1 const& geometry1, Geometry2 const& geometry2,
+ Result & result,
+ IntersectionStrategy const& intersection_strategy)
{
- linear_areal_type::apply(geometry2, geometry1, result);
+ linear_areal_type::apply(geometry2, geometry1, result, intersection_strategy);
}
};
diff --git a/boost/geometry/algorithms/detail/relate/linear_linear.hpp b/boost/geometry/algorithms/detail/relate/linear_linear.hpp
index 7a3f373e03..520f2bd775 100644
--- a/boost/geometry/algorithms/detail/relate/linear_linear.hpp
+++ b/boost/geometry/algorithms/detail/relate/linear_linear.hpp
@@ -2,15 +2,15 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
-// This file was modified by Oracle on 2013, 2014, 2015.
-// Modifications copyright (c) 2013-2015 Oracle and/or its affiliates.
+// This file was modified by Oracle on 2013, 2014, 2015, 2017.
+// Modifications copyright (c) 2013-2017 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_LINEAR_LINEAR_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_LINEAR_LINEAR_HPP
@@ -119,8 +119,10 @@ struct linear_linear
typedef typename geometry::point_type<Geometry1>::type point1_type;
typedef typename geometry::point_type<Geometry2>::type point2_type;
- template <typename Result>
- static inline void apply(Geometry1 const& geometry1, Geometry2 const& geometry2, Result & result)
+ template <typename Result, typename IntersectionStrategy>
+ static inline void apply(Geometry1 const& geometry1, Geometry2 const& geometry2,
+ Result & result,
+ IntersectionStrategy const& intersection_strategy)
{
// The result should be FFFFFFFFF
relate::set<exterior, exterior, result_dimension<Geometry1>::value>(result);// FFFFFFFFd, d in [1,9] or T
@@ -138,7 +140,7 @@ struct linear_linear
Geometry1,
Geometry2,
detail::get_turns::get_turn_info_type<Geometry1, Geometry2, turns::assign_policy<true> >
- >::apply(turns, geometry1, geometry2, interrupt_policy);
+ >::apply(turns, geometry1, geometry2, interrupt_policy, intersection_strategy);
if ( BOOST_GEOMETRY_CONDITION( result.interrupt ) )
return;
diff --git a/boost/geometry/algorithms/detail/relate/point_geometry.hpp b/boost/geometry/algorithms/detail/relate/point_geometry.hpp
index be08016a16..a0c6c0d49b 100644
--- a/boost/geometry/algorithms/detail/relate/point_geometry.hpp
+++ b/boost/geometry/algorithms/detail/relate/point_geometry.hpp
@@ -2,8 +2,8 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
-// This file was modified by Oracle on 2013, 2014, 2015.
-// Modifications copyright (c) 2013-2015 Oracle and/or its affiliates.
+// This file was modified by Oracle on 2013, 2014, 2015, 2017.
+// Modifications copyright (c) 2013-2017 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -37,10 +37,10 @@ struct point_geometry
static const bool interruption_enabled = true;
- template <typename Result>
- static inline void apply(Point const& point, Geometry const& geometry, Result & result)
+ template <typename Result, typename Strategy>
+ static inline void apply(Point const& point, Geometry const& geometry, Result & result, Strategy const& strategy)
{
- int pig = detail::within::point_in_geometry(point, geometry);
+ int pig = detail::within::point_in_geometry(point, geometry, strategy);
if ( pig > 0 ) // within
{
@@ -95,10 +95,10 @@ struct geometry_point
static const bool interruption_enabled = true;
- template <typename Result>
- static inline void apply(Geometry const& geometry, Point const& point, Result & result)
+ template <typename Result, typename Strategy>
+ static inline void apply(Geometry const& geometry, Point const& point, Result & result, Strategy const& strategy)
{
- point_geometry<Point, Geometry, true>::apply(point, geometry, result);
+ point_geometry<Point, Geometry, true>::apply(point, geometry, result, strategy);
}
};
diff --git a/boost/geometry/algorithms/detail/relate/point_point.hpp b/boost/geometry/algorithms/detail/relate/point_point.hpp
index e55be08225..b41d346f0b 100644
--- a/boost/geometry/algorithms/detail/relate/point_point.hpp
+++ b/boost/geometry/algorithms/detail/relate/point_point.hpp
@@ -2,15 +2,15 @@
// 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, 2017.
+// Modifications copyright (c) 2013-2017, 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_POINT_POINT_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_POINT_POINT_HPP
@@ -35,8 +35,10 @@ struct point_point
{
static const bool interruption_enabled = false;
- template <typename Result>
- static inline void apply(Point1 const& point1, Point2 const& point2, Result & result)
+ template <typename Result, typename Strategy>
+ static inline void apply(Point1 const& point1, Point2 const& point2,
+ Result & result,
+ Strategy const& /*strategy*/)
{
bool equal = detail::equals::equals_point_point(point1, point2);
if ( equal )
@@ -86,8 +88,10 @@ struct point_multipoint
{
static const bool interruption_enabled = false;
- template <typename Result>
- static inline void apply(Point const& point, MultiPoint const& multi_point, Result & result)
+ template <typename Result, typename Strategy>
+ static inline void apply(Point const& point, MultiPoint const& multi_point,
+ Result & result,
+ Strategy const& /*strategy*/)
{
if ( boost::empty(multi_point) )
{
@@ -122,10 +126,12 @@ struct multipoint_point
{
static const bool interruption_enabled = false;
- template <typename Result>
- static inline void apply(MultiPoint const& multi_point, Point const& point, Result & result)
+ template <typename Result, typename Strategy>
+ static inline void apply(MultiPoint const& multi_point, Point const& point,
+ Result & result,
+ Strategy const& strategy)
{
- point_multipoint<Point, MultiPoint, true>::apply(point, multi_point, result);
+ point_multipoint<Point, MultiPoint, true>::apply(point, multi_point, result, strategy);
}
};
@@ -134,8 +140,10 @@ struct multipoint_multipoint
{
static const bool interruption_enabled = true;
- template <typename Result>
- static inline void apply(MultiPoint1 const& multi_point1, MultiPoint2 const& multi_point2, Result & result)
+ template <typename Result, typename Strategy>
+ static inline void apply(MultiPoint1 const& multi_point1, MultiPoint2 const& multi_point2,
+ Result & result,
+ Strategy const& /*strategy*/)
{
{
// TODO: throw on empty input?
diff --git a/boost/geometry/algorithms/detail/relate/relate_impl.hpp b/boost/geometry/algorithms/detail/relate/relate_impl.hpp
index e8e422993d..2ec2361c03 100644
--- a/boost/geometry/algorithms/detail/relate/relate_impl.hpp
+++ b/boost/geometry/algorithms/detail/relate/relate_impl.hpp
@@ -57,7 +57,8 @@ struct relate_impl
implemented_tag
>::type
{
- static inline bool apply(Geometry1 const& g1, Geometry2 const& g2)
+ template <typename Strategy>
+ static inline bool apply(Geometry1 const& g1, Geometry2 const& g2, Strategy const& strategy)
{
typename detail::relate::result_handler_type
<
@@ -66,7 +67,7 @@ struct relate_impl
typename StaticMaskTrait<Geometry1, Geometry2>::type
>::type handler;
- dispatch::relate<Geometry1, Geometry2>::apply(g1, g2, handler);
+ dispatch::relate<Geometry1, Geometry2>::apply(g1, g2, handler, strategy);
return handler.result();
}
diff --git a/boost/geometry/algorithms/detail/relate/result.hpp b/boost/geometry/algorithms/detail/relate/result.hpp
index a92badf65b..07287dc625 100644
--- a/boost/geometry/algorithms/detail/relate/result.hpp
+++ b/boost/geometry/algorithms/detail/relate/result.hpp
@@ -1,6 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2013-2016.
// Modifications copyright (c) 2013-2016 Oracle and/or its affiliates.
@@ -24,6 +25,7 @@
#include <boost/mpl/is_sequence.hpp>
#include <boost/mpl/next.hpp>
#include <boost/static_assert.hpp>
+#include <boost/throw_exception.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/type_traits/integral_constant.hpp>
@@ -266,7 +268,7 @@ private:
|| ( c >= '0' && c <= '9' );
if ( !is_valid )
{
- throw geometry::invalid_input_exception();
+ BOOST_THROW_EXCEPTION(geometry::invalid_input_exception());
}
}
diff --git a/boost/geometry/algorithms/detail/relate/turns.hpp b/boost/geometry/algorithms/detail/relate/turns.hpp
index 09d74dec3a..6fa05eaf21 100644
--- a/boost/geometry/algorithms/detail/relate/turns.hpp
+++ b/boost/geometry/algorithms/detail/relate/turns.hpp
@@ -2,8 +2,8 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
-// This file was modified by Oracle on 2013, 2014, 2015.
-// Modifications copyright (c) 2013-2015 Oracle and/or its affiliates.
+// This file was modified by Oracle on 2013, 2014, 2015, 2017.
+// Modifications copyright (c) 2013-2017 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
@@ -75,28 +75,35 @@ struct get_turns
{
detail::get_turns::no_interrupt_policy interrupt_policy;
- apply(turns, geometry1, geometry2, interrupt_policy);
+ typename strategy::intersection::services::default_strategy
+ <
+ typename cs_tag<Geometry1>::type
+ >::type intersection_strategy;
+
+ apply(turns, geometry1, geometry2, interrupt_policy, intersection_strategy);
}
- template <typename Turns, typename InterruptPolicy>
+ template <typename Turns, typename InterruptPolicy, typename IntersectionStrategy>
static inline void apply(Turns & turns,
Geometry1 const& geometry1,
Geometry2 const& geometry2,
- InterruptPolicy & interrupt_policy)
+ InterruptPolicy & interrupt_policy,
+ IntersectionStrategy const& intersection_strategy)
{
RobustPolicy robust_policy = geometry::get_rescale_policy
<
RobustPolicy
>(geometry1, geometry2);
- apply(turns, geometry1, geometry2, interrupt_policy, robust_policy);
+ apply(turns, geometry1, geometry2, interrupt_policy, intersection_strategy, robust_policy);
}
- template <typename Turns, typename InterruptPolicy>
+ template <typename Turns, typename InterruptPolicy, typename IntersectionStrategy>
static inline void apply(Turns & turns,
Geometry1 const& geometry1,
Geometry2 const& geometry2,
InterruptPolicy & interrupt_policy,
+ IntersectionStrategy const& intersection_strategy,
RobustPolicy const& robust_policy)
{
static const bool reverse1 = detail::overlay::do_reverse
@@ -119,7 +126,8 @@ struct get_turns
reverse2,
GetTurnPolicy
>::apply(0, geometry1, 1, geometry2,
- robust_policy, turns, interrupt_policy);
+ intersection_strategy, robust_policy,
+ turns, interrupt_policy);
}
};