From 76f68b1bb7d049764da972b8bf66bf37cdf56b66 Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Sat, 5 Mar 2011 23:27:06 +0000 Subject: [PATCH] Fixed error in new assemble approach, now both recursive_boxes as intersection_pies are completely running (again) for all combinations of open,cw,ccw,multi,box,triangle [SVN r69587] --- .../detail/overlay/assign_parents.hpp | 18 +++++------------- .../geometry/multi/algorithms/intersection.hpp | 3 ++- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/include/boost/geometry/algorithms/detail/overlay/assign_parents.hpp b/include/boost/geometry/algorithms/detail/overlay/assign_parents.hpp index a8eca3828..d18967f4a 100644 --- a/include/boost/geometry/algorithms/detail/overlay/assign_parents.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/assign_parents.hpp @@ -30,7 +30,7 @@ template typename Geometry1, typename Geometry2, typename RingCollection > -static inline bool contains(ring_identifier ring_id, Item const& item1, Item const& item2, +static inline bool within_selected_input(Item const& item2, ring_identifier ring_id, Geometry1 const& geometry1, Geometry2 const& geometry2, RingCollection const& collection) { @@ -49,19 +49,11 @@ static inline bool contains(ring_identifier ring_id, Item const& item1, Item con get_ring::apply(ring_id, geometry2)); break; case 2 : - // Within if it is within one of the collection - for (BOOST_AUTO(it, boost::begin(collection)); it != boost::end(collection); ++it) - { - int subcode = point_in_ring(item2.point, - get_ring::apply(ring_id, *it)); - if (subcode > code) - { - code = subcode; - } - } + code = point_in_ring(item2.point, + get_ring::apply(ring_id, collection)); break; } - return code == 0 ? item1.get_area() < 0 : code == 1; + return code == 1; } @@ -152,7 +144,7 @@ inline void assign_parents(Geometry1 const& geometry1, if ( (inner.get_area() < 0 || check_for_orientation) && geometry::within(inner.point, out_it->envelope) - && contains(out_it->id, outer, inner, geometry1, geometry2, collection)) + && within_selected_input(inner, out_it->id, geometry1, geometry2, collection)) { inner.parent = out_it->id; } diff --git a/include/boost/geometry/multi/algorithms/intersection.hpp b/include/boost/geometry/multi/algorithms/intersection.hpp index 33d85c23b..9b4174a68 100644 --- a/include/boost/geometry/multi/algorithms/intersection.hpp +++ b/include/boost/geometry/multi/algorithms/intersection.hpp @@ -9,7 +9,6 @@ #define BOOST_GEOMETRY_MULTI_ALGORITHMS_INTERSECTION_HPP -#include #include #include #include @@ -24,6 +23,8 @@ #include #include +#include + namespace boost { namespace geometry {