From 9ed4d83441b8843ad5f6571473980cd26fb7cf46 Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Mon, 14 Jul 2014 22:00:57 +0200 Subject: [PATCH] [extensions][offset] Let offset compile again. Note: it does not generate correct offsets! --- .../geometry/extensions/algorithms/offset.hpp | 42 ++++++++++++------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/include/boost/geometry/extensions/algorithms/offset.hpp b/include/boost/geometry/extensions/algorithms/offset.hpp index baf8f91ef..ec8943d2a 100644 --- a/include/boost/geometry/extensions/algorithms/offset.hpp +++ b/include/boost/geometry/extensions/algorithms/offset.hpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -39,43 +40,48 @@ template typename RangeOut > struct offset_range - : public geometry::detail::buffer::buffer_range - < - RangeOut, - linestring_tag - > { typedef geometry::detail::buffer::buffer_range < - RangeOut, - linestring_tag - > super; + Range + > per_range; + template < typename Collection, typename DistanceStrategy, + typename SideStrategy, typename JoinStrategy, - typename EndStrategy + typename EndStrategy, + typename RobustPolicy > static inline void apply(Collection& collection, Range const& range, DistanceStrategy const& distance_strategy, + SideStrategy const& side_strategy, JoinStrategy const& join_strategy, EndStrategy const& end_strategy, + RobustPolicy const& robust_policy, bool reverse) { collection.start_new_ring(); + typedef typename point_type::type output_point_type; + output_point_type first_p1, first_p2, last_p1, last_p2; + if (reverse) { - super::iterate(collection, boost::rbegin(range), boost::rend(range), - buffer_side_left, - distance_strategy, join_strategy, end_strategy); + per_range::iterate(collection, 0, boost::rbegin(range), boost::rend(range), + strategy::buffer::buffer_side_left, + distance_strategy, side_strategy, join_strategy, end_strategy, robust_policy, + first_p1, first_p2, last_p1, last_p2); } else { - super::iterate(collection, boost::begin(range), boost::end(range), - buffer_side_left, - distance_strategy, join_strategy, end_strategy); + per_range::iterate(collection, 0, boost::begin(range), boost::end(range), + strategy::buffer::buffer_side_left, + distance_strategy, side_strategy, join_strategy, end_strategy, robust_policy, + first_p1, first_p2, last_p1, last_p2); } + collection.finish_ring(); } }; @@ -160,6 +166,8 @@ inline void offset(Geometry const& geometry, GeometryOut& out, point_type > end_strategy; + strategy::buffer::buffer_side side_strategy; + dispatch::offset < typename tag::type, @@ -169,11 +177,13 @@ inline void offset(Geometry const& geometry, GeometryOut& out, >::apply(collection, geometry, distance_strategy, + side_strategy, join_strategy, end_strategy, + robust_policy, reverse); - collection.assign_offsetted_rings(out); + // TODO collection.template assign(out); }