diff --git a/include/boost/geometry/algorithms/detail/buffer/buffer_policies.hpp b/include/boost/geometry/algorithms/detail/buffer/buffer_policies.hpp index ba1c27076..b137fd35c 100644 --- a/include/boost/geometry/algorithms/detail/buffer/buffer_policies.hpp +++ b/include/boost/geometry/algorithms/detail/buffer/buffer_policies.hpp @@ -107,7 +107,20 @@ struct buffer_turn_info int turn_index; // TODO: this might go if partition can operate on non-const input RobustPoint robust_point; +#if BOOST_GEOMETRY_BUFFER_ENLARGED_CLUSTERS + // Will (most probably) be removed later RobustPoint mapped_robust_point; // alas... we still need to adapt our points, offsetting them 1 integer to be co-located with neighbours +#endif + + + inline RobustPoint const& get_robust_point() const + { +#if BOOST_GEOMETRY_BUFFER_ENLARGED_CLUSTERS + return mapped_robust_point; +#endif + return robust_point; + } + intersection_location_type location; diff --git a/include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp b/include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp index 723a181a8..ee90ae516 100644 --- a/include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp +++ b/include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp @@ -163,6 +163,8 @@ struct buffered_piece_collection {} +#if BOOST_GEOMETRY_BUFFER_ENLARGED_CLUSTERS + // Will (most probably) be removed later template inline void adapt_mapped_robust_point(OccupationMap const& map, buffer_turn_info_type& turn, int distance) const @@ -182,8 +184,13 @@ struct buffered_piece_collection } } } +#endif - inline void get_occupation(int distance = 0) + inline void get_occupation( +#if BOOST_GEOMETRY_BUFFER_ENLARGED_CLUSTERS + int distance = 0 +#endif + ) { typedef occupation_info > buffer_occupation_info; @@ -198,8 +205,6 @@ struct buffered_piece_collection occupation_map_type occupation_map; // 1: Add all intersection points to occupation map - typedef typename boost::range_iterator::type - const_iterator_type; typedef typename boost::range_iterator::type iterator_type; @@ -209,11 +214,13 @@ struct buffered_piece_collection { if (it->count_on_offsetted >= 1) { +#if BOOST_GEOMETRY_BUFFER_ENLARGED_CLUSTERS if (distance > 0 && ! occupation_map.empty()) { adapt_mapped_robust_point(occupation_map, *it, distance); } - occupation_map[it->mapped_robust_point].count++; +#endif + occupation_map[it->get_robust_point()].count++; } } @@ -256,7 +263,7 @@ struct buffered_piece_collection ++it, ++index) { typename occupation_map_type::iterator mit = - occupation_map.find(it->mapped_robust_point); + occupation_map.find(it->get_robust_point()); if (mit != occupation_map.end()) { @@ -264,7 +271,7 @@ struct buffered_piece_collection // a: for (int i = 0; i < 2; i++) { - add_incoming_and_outgoing_angles(it->mapped_robust_point, *it, + add_incoming_and_outgoing_angles(it->get_robust_point(), *it, m_pieces, index, i, it->operations[i].seg_id, info); @@ -283,6 +290,7 @@ struct buffered_piece_collection } } +#if BOOST_GEOMETRY_BUFFER_ENLARGED_CLUSTERS // X: Check rounding issues if (distance == 0) { @@ -299,6 +307,7 @@ struct buffered_piece_collection } } } +#endif // If, in a cluster, one turn is blocked, block them all for (typename occupation_map_type::const_iterator it = occupation_map.begin(); @@ -458,7 +467,9 @@ struct buffered_piece_collection boost::begin(m_turns); it != boost::end(m_turns); ++it, ++index) { geometry::recalculate(it->robust_point, it->point, m_robust_policy); +#if BOOST_GEOMETRY_BUFFER_ENLARGED_CLUSTERS it->mapped_robust_point = it->robust_point; +#endif robust_turn turn; it->turn_index = index;