diff options
Diffstat (limited to 'boost/geometry/algorithms/detail/overlay/handle_colocations.hpp')
-rw-r--r-- | boost/geometry/algorithms/detail/overlay/handle_colocations.hpp | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/boost/geometry/algorithms/detail/overlay/handle_colocations.hpp b/boost/geometry/algorithms/detail/overlay/handle_colocations.hpp index c634fc450f..6bb30fcce5 100644 --- a/boost/geometry/algorithms/detail/overlay/handle_colocations.hpp +++ b/boost/geometry/algorithms/detail/overlay/handle_colocations.hpp @@ -1,6 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2015 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2017. // Modifications copyright (c) 2017 Oracle and/or its affiliates. @@ -30,6 +31,7 @@ #include <boost/geometry/algorithms/detail/overlay/turn_info.hpp> #include <boost/geometry/algorithms/detail/ring_identifier.hpp> #include <boost/geometry/algorithms/detail/overlay/segment_identifier.hpp> +#include <boost/geometry/util/condition.hpp> #if defined(BOOST_GEOMETRY_DEBUG_HANDLE_COLOCATIONS) # include <iostream> @@ -312,17 +314,17 @@ inline void assign_cluster_to_turns(Turns& turns, { turn_operation_type const& op = turn.operations[i]; segment_fraction_type seg_frac(op.seg_id, op.fraction); - typename ClusterPerSegment::const_iterator it = cluster_per_segment.find(seg_frac); - if (it != cluster_per_segment.end()) + typename ClusterPerSegment::const_iterator cit = cluster_per_segment.find(seg_frac); + if (cit != cluster_per_segment.end()) { #if defined(BOOST_GEOMETRY_DEBUG_HANDLE_COLOCATIONS) if (turn.is_clustered() - && turn.cluster_id != it->second) + && turn.cluster_id != cit->second) { std::cout << " CONFLICT " << std::endl; } #endif - turn.cluster_id = it->second; + turn.cluster_id = cit->second; clusters[turn.cluster_id].turn_indices.insert(turn_index); } } @@ -439,7 +441,6 @@ inline bool is_ie_turn(segment_identifier const& ext_seg_0, template < bool Reverse0, bool Reverse1, // Reverse interpretation interior/exterior - overlay_type OverlayType, typename Turns, typename Clusters > @@ -552,7 +553,7 @@ template typename Clusters > inline void check_colocation(bool& has_blocked, - int cluster_id, Turns const& turns, Clusters const& clusters) + signed_size_type cluster_id, Turns const& turns, Clusters const& clusters) { typedef typename boost::range_value<Turns>::type turn_type; @@ -598,6 +599,8 @@ template inline bool handle_colocations(Turns& turns, Clusters& clusters, Geometry1 const& geometry1, Geometry2 const& geometry2) { + static const detail::overlay::operation_type target_operation + = detail::overlay::operation_from_overlay<OverlayType>::value; typedef std::map < segment_identifier, @@ -610,7 +613,7 @@ inline bool handle_colocations(Turns& turns, Clusters& clusters, // that information can be used for the interior ring too map_type map; - int index = 0; + signed_size_type index = 0; for (typename boost::range_iterator<Turns>::type it = boost::begin(turns); it != boost::end(turns); @@ -677,12 +680,15 @@ inline bool handle_colocations(Turns& turns, Clusters& clusters, // Get colocated information here and not later, to keep information // on turns which are discarded afterwards set_colocation<OverlayType>(turns, clusters); - discard_interior_exterior_turns - < - do_reverse<geometry::point_order<Geometry1>::value>::value != Reverse1, - do_reverse<geometry::point_order<Geometry2>::value>::value != Reverse2, - OverlayType - >(turns, clusters); + + if (BOOST_GEOMETRY_CONDITION(target_operation == operation_intersection)) + { + discard_interior_exterior_turns + < + do_reverse<geometry::point_order<Geometry1>::value>::value != Reverse1, + do_reverse<geometry::point_order<Geometry2>::value>::value != Reverse2 + >(turns, clusters); + } #if defined(BOOST_GEOMETRY_DEBUG_HANDLE_COLOCATIONS) std::cout << "*** Colocations " << map.size() << std::endl; @@ -794,9 +800,7 @@ inline void gather_cluster_properties(Clusters& clusters, Turns& turns, cinfo.open_count = sbs.open_count(for_operation); - bool const set_startable - = OverlayType != overlay_dissolve_union - && OverlayType != overlay_dissolve_intersection; + bool const set_startable = OverlayType != overlay_dissolve; // Unset the startable flag for all 'closed' zones. This does not // apply for self-turns, because those counts are not from both |