From a4e26f8d212774b7057bdf81df72605111d303fe Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Sat, 18 Feb 2012 11:04:19 +0000 Subject: [PATCH] Boost.Geometry fixes for offset-extension w.r.t. new buffer approach (does not run yet but compiles) [SVN r77063] --- .../detail/overlay/get_turn_info.hpp | 5 +- .../buffer/buffered_piece_collection.hpp | 4 +- .../algorithms/buffer/buffered_ring.hpp | 5 +- .../geometry/extensions/algorithms/offset.hpp | 56 +++++++------------ test_extensions/algorithms/offset.cpp | 3 +- 5 files changed, 30 insertions(+), 43 deletions(-) diff --git a/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp b/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp index 663d70d9a..b3f26f9d8 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp @@ -763,8 +763,9 @@ struct get_turn_info typedef typename si::segment_intersection_strategy_type strategy; - - + // Intersect pi-pj with qi-qj + // The points pk and qk are only used do determine more information + // about the turn. template static inline OutputIterator apply( Point1 const& pi, Point1 const& pj, Point1 const& pk, diff --git a/include/boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp b/include/boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp index e54b93f62..a0cc47866 100644 --- a/include/boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp +++ b/include/boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp @@ -20,9 +20,11 @@ #include #include -#include +#include #include #include +#include +#include #include diff --git a/include/boost/geometry/extensions/algorithms/buffer/buffered_ring.hpp b/include/boost/geometry/extensions/algorithms/buffer/buffered_ring.hpp index 6a9367642..eb37914c7 100644 --- a/include/boost/geometry/extensions/algorithms/buffer/buffered_ring.hpp +++ b/include/boost/geometry/extensions/algorithms/buffer/buffered_ring.hpp @@ -16,13 +16,12 @@ #include #include -#include -#include #include -#include #include +#include #include +#include #include #include diff --git a/include/boost/geometry/extensions/algorithms/offset.hpp b/include/boost/geometry/extensions/algorithms/offset.hpp index 38194d597..744b721fb 100644 --- a/include/boost/geometry/extensions/algorithms/offset.hpp +++ b/include/boost/geometry/extensions/algorithms/offset.hpp @@ -14,9 +14,7 @@ #include #include -#include -#include -#include +#include #include #include @@ -34,26 +32,25 @@ namespace detail { namespace offset template < typename Range, - typename RangeOut, - typename JoinStrategy, - typename DistanceStrategy + typename RangeOut > struct offset_range - : public geometry::detail::buffer::range_buffer + : public geometry::detail::buffer::buffer_range < RangeOut, - DistanceStrategy, - JoinStrategy, linestring_tag > { - template - static inline void apply(Range const& range, - Appender& appender, + template + < + typename Collection, typename DistanceStrategy, typename JoinStrategy + > + static inline void apply(Collection& collection, Range const& range, DistanceStrategy const& distance, JoinStrategy const& join) { - iterate(appender, boost::begin(range), boost::end(range), + collection.add_input(); + iterate(collection, boost::begin(range), boost::end(range), buffer_side_left, distance, join); } @@ -73,9 +70,7 @@ template typename GeometryTag, typename GeometryOutTag, typename Geometry, - typename GeometryOut, - typename JoinStrategy, - typename DistanceStrategy + typename GeometryOut > struct offset {}; @@ -84,25 +79,19 @@ struct offset template < typename Geometry, - typename GeometryOut, - typename JoinStrategy, - typename DistanceStrategy + typename GeometryOut > struct offset < linestring_tag, linestring_tag, Geometry, - GeometryOut, - JoinStrategy, - DistanceStrategy + GeometryOut > : detail::offset::offset_range < Geometry, - GeometryOut, - JoinStrategy, - DistanceStrategy + GeometryOut > {}; @@ -131,23 +120,20 @@ inline void offset(Geometry const& geometry, GeometryOut& out, > distance_strategy_type; distance_strategy_type distance_strategy(distance, distance); - - typedef detail::offset::offset_appender + detail::buffer::buffered_piece_collection < - GeometryOut - > appender_type; - - appender_type appender(out); + //typename geometry::ring_type::type + // TODO the piece collection will not require a polygonal argument + model::ring::type> + > collection; dispatch::offset < typename tag::type, typename tag::type, Geometry, - GeometryOut, - JoinStrategy, - distance_strategy_type - >::apply(geometry, appender, distance_strategy, join); + GeometryOut + >::apply(collection, geometry, distance_strategy, join); } diff --git a/test_extensions/algorithms/offset.cpp b/test_extensions/algorithms/offset.cpp index c484c85d0..768ea3ea6 100644 --- a/test_extensions/algorithms/offset.cpp +++ b/test_extensions/algorithms/offset.cpp @@ -45,8 +45,7 @@ void test_offset(std::string const& caseid, Geometry const& geometry, typedef bg::strategy::buffer::join_round < point_type, - point_type, - false + point_type > join_strategy; GeometryOut moved_by_offset;