diff options
Diffstat (limited to 'boost/geometry/algorithms/detail/buffer')
4 files changed, 98 insertions, 26 deletions
diff --git a/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp b/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp index 8447532a6c..029053dda3 100644 --- a/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp +++ b/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp @@ -2,6 +2,10 @@ // Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands. +// This file was modified by Oracle on 2017. +// Modifications copyright (c) 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) @@ -449,13 +453,14 @@ struct buffer_inserter<point_tag, Point, RingOutput> } }; - +// Not a specialization, but called from specializations of ring and of polygon. +// Calling code starts/finishes ring before/after apply template < typename RingInput, typename RingOutput > -struct buffer_inserter<ring_tag, RingInput, RingOutput> +struct buffer_inserter_ring { typedef typename point_type<RingOutput>::type output_point_type; @@ -568,6 +573,43 @@ struct buffer_inserter<ring_tag, RingInput, RingOutput> template < + typename RingInput, + typename RingOutput +> +struct buffer_inserter<ring_tag, RingInput, RingOutput> +{ + template + < + typename Collection, + typename DistanceStrategy, + typename SideStrategy, + typename JoinStrategy, + typename EndStrategy, + typename PointStrategy, + typename RobustPolicy + > + static inline strategy::buffer::result_code apply(RingInput const& ring, + Collection& collection, + DistanceStrategy const& distance, + SideStrategy const& side_strategy, + JoinStrategy const& join_strategy, + EndStrategy const& end_strategy, + PointStrategy const& point_strategy, + RobustPolicy const& robust_policy) + { + collection.start_new_ring(); + strategy::buffer::result_code const code + = buffer_inserter_ring<RingInput, RingOutput>::apply(ring, + collection, distance, + side_strategy, join_strategy, end_strategy, point_strategy, + robust_policy); + collection.finish_ring(code); + return code; + } +}; + +template +< typename Linestring, typename Polygon > @@ -709,7 +751,7 @@ private: typedef typename ring_type<PolygonInput>::type input_ring_type; typedef typename ring_type<PolygonOutput>::type output_ring_type; - typedef buffer_inserter<ring_tag, input_ring_type, output_ring_type> policy; + typedef buffer_inserter_ring<input_ring_type, output_ring_type> policy; template @@ -854,6 +896,7 @@ template typename JoinStrategy, typename EndStrategy, typename PointStrategy, + typename IntersectionStrategy, typename RobustPolicy, typename VisitPiecesPolicy > @@ -863,6 +906,7 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator JoinStrategy const& join_strategy, EndStrategy const& end_strategy, PointStrategy const& point_strategy, + IntersectionStrategy const& intersection_strategy, RobustPolicy const& robust_policy, VisitPiecesPolicy& visit_pieces_policy ) @@ -872,9 +916,10 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator typedef detail::buffer::buffered_piece_collection < typename geometry::ring_type<GeometryOutput>::type, + IntersectionStrategy, RobustPolicy > collection_type; - collection_type collection(robust_policy); + collection_type collection(intersection_strategy, robust_policy); collection_type const& const_collection = collection; bool const areal = boost::is_same @@ -961,6 +1006,7 @@ template typename JoinStrategy, typename EndStrategy, typename PointStrategy, + typename IntersectionStrategy, typename RobustPolicy > inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator out, @@ -969,13 +1015,14 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator JoinStrategy const& join_strategy, EndStrategy const& end_strategy, PointStrategy const& point_strategy, + IntersectionStrategy const& intersection_strategy, RobustPolicy const& robust_policy) { detail::buffer::visit_pieces_default_policy visitor; buffer_inserter<GeometryOutput>(geometry_input, out, distance_strategy, side_strategy, join_strategy, end_strategy, point_strategy, - robust_policy, visitor); + intersection_strategy, robust_policy, visitor); } #endif // DOXYGEN_NO_DETAIL diff --git a/boost/geometry/algorithms/detail/buffer/buffer_policies.hpp b/boost/geometry/algorithms/detail/buffer/buffer_policies.hpp index c1f04f93b5..92dcdcc7b0 100644 --- a/boost/geometry/algorithms/detail/buffer/buffer_policies.hpp +++ b/boost/geometry/algorithms/detail/buffer/buffer_policies.hpp @@ -2,6 +2,10 @@ // Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands. +// This file was modified by Oracle on 2017. +// Modifications copyright (c) 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) @@ -52,6 +56,7 @@ public : typename Rings, typename Turns, typename Geometry, + typename Strategy, typename RobustPolicy, typename Visitor > @@ -63,6 +68,7 @@ public : detail::overlay::traverse_error_type /*traverse_error*/, Geometry const& , Geometry const& , + Strategy const& , RobustPolicy const& , state_type& state, Visitor& /*visitor*/ diff --git a/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp b/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp index e7214428e6..7fbbb790bb 100644 --- a/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp +++ b/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp @@ -2,8 +2,8 @@ // Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2016. -// Modifications copyright (c) 2016 Oracle and/or its affiliates. +// This file was modified by Oracle on 2016-2017. +// Modifications copyright (c) 2016-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, @@ -117,10 +117,13 @@ enum segment_relation_code */ -template <typename Ring, typename RobustPolicy> +template <typename Ring, typename IntersectionStrategy, typename RobustPolicy> struct buffered_piece_collection { - typedef buffered_piece_collection<Ring, RobustPolicy> this_type; + typedef buffered_piece_collection + < + Ring, IntersectionStrategy, RobustPolicy + > this_type; typedef typename geometry::point_type<Ring>::type point_type; typedef typename geometry::coordinate_type<Ring>::type coordinate_type; @@ -303,7 +306,7 @@ struct buffered_piece_collection cluster_type m_clusters; - + IntersectionStrategy const& m_intersection_strategy; RobustPolicy const& m_robust_policy; struct redundant_turn @@ -314,8 +317,10 @@ struct buffered_piece_collection } }; - buffered_piece_collection(RobustPolicy const& robust_policy) + buffered_piece_collection(IntersectionStrategy const& intersection_strategy, + RobustPolicy const& robust_policy) : m_first_piece_index(-1) + , m_intersection_strategy(intersection_strategy) , m_robust_policy(robust_policy) {} @@ -512,10 +517,11 @@ struct buffered_piece_collection geometry::partition < robust_box_type, - turn_get_box, turn_in_original_ovelaps_box, - original_get_box, original_ovelaps_box, - include_turn_policy, detail::partition::include_all_policy - >::apply(m_turns, robust_originals, visitor); + include_turn_policy, + detail::partition::include_all_policy + >::apply(m_turns, robust_originals, visitor, + turn_get_box(), turn_in_original_ovelaps_box(), + original_get_box(), original_ovelaps_box()); bool const deflate = distance_strategy.negative(); @@ -767,15 +773,17 @@ struct buffered_piece_collection piece_vector_type, buffered_ring_collection<buffered_ring<Ring> >, turn_vector_type, + IntersectionStrategy, RobustPolicy - > visitor(m_pieces, offsetted_rings, m_turns, m_robust_policy); + > visitor(m_pieces, offsetted_rings, m_turns, + m_intersection_strategy, m_robust_policy); geometry::partition < - robust_box_type, - detail::section::get_section_box, - detail::section::overlaps_section_box - >::apply(monotonic_sections, visitor); + robust_box_type + >::apply(monotonic_sections, visitor, + detail::section::get_section_box(), + detail::section::overlaps_section_box()); } insert_rescaled_piece_turns(); @@ -795,10 +803,10 @@ struct buffered_piece_collection geometry::partition < - robust_box_type, - turn_get_box, turn_ovelaps_box, - piece_get_box, piece_ovelaps_box - >::apply(m_turns, m_pieces, visitor); + robust_box_type + >::apply(m_turns, m_pieces, visitor, + turn_get_box(), turn_ovelaps_box(), + piece_get_box(), piece_ovelaps_box()); } } @@ -1354,7 +1362,8 @@ struct buffered_piece_collection traversed_rings.clear(); buffer_overlay_visitor visitor; traverser::apply(offsetted_rings, offsetted_rings, - m_robust_policy, m_turns, traversed_rings, + m_intersection_strategy, m_robust_policy, + m_turns, traversed_rings, m_clusters, visitor); } diff --git a/boost/geometry/algorithms/detail/buffer/get_piece_turns.hpp b/boost/geometry/algorithms/detail/buffer/get_piece_turns.hpp index 3425ee6ffd..178c7bcafe 100644 --- a/boost/geometry/algorithms/detail/buffer/get_piece_turns.hpp +++ b/boost/geometry/algorithms/detail/buffer/get_piece_turns.hpp @@ -2,6 +2,10 @@ // Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands. +// This file was modified by Oracle on 2017. +// Modifications copyright (c) 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) @@ -62,6 +66,7 @@ template typename Pieces, typename Rings, typename Turns, + typename IntersectionStrategy, typename RobustPolicy > class piece_turn_visitor @@ -69,6 +74,7 @@ class piece_turn_visitor Pieces const& m_pieces; Rings const& m_rings; Turns& m_turns; + IntersectionStrategy const& m_intersection_strategy; RobustPolicy const& m_robust_policy; template <typename Piece> @@ -243,7 +249,9 @@ class piece_turn_visitor turn_policy::apply(*prev1, *it1, *next1, *prev2, *it2, *next2, false, false, false, false, - the_model, m_robust_policy, + the_model, + m_intersection_strategy, + m_robust_policy, std::back_inserter(m_turns)); } } @@ -254,10 +262,12 @@ public: piece_turn_visitor(Pieces const& pieces, Rings const& ring_collection, Turns& turns, + IntersectionStrategy const& intersection_strategy, RobustPolicy const& robust_policy) : m_pieces(pieces) , m_rings(ring_collection) , m_turns(turns) + , m_intersection_strategy(intersection_strategy) , m_robust_policy(robust_policy) {} |