From ed572055bec4ff6ada6bfb7faf56ab82ebd42842 Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Sun, 9 Mar 2014 12:51:49 +0100 Subject: [PATCH] [geometry] buffer: fixed code inside BOOST_GEOMETRY_DEBUG_WITH_MAPPER for new changes for rescale strategies --- .../algorithms/buffer/buffer_inserter.hpp | 2 +- .../buffered_piece_collection_with_mapper.hpp | 44 +++++++++++++------ 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/include/boost/geometry/extensions/algorithms/buffer/buffer_inserter.hpp b/include/boost/geometry/extensions/algorithms/buffer/buffer_inserter.hpp index a7702c03b..d2973af94 100644 --- a/include/boost/geometry/extensions/algorithms/buffer/buffer_inserter.hpp +++ b/include/boost/geometry/extensions/algorithms/buffer/buffer_inserter.hpp @@ -498,7 +498,7 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator #ifdef BOOST_GEOMETRY_DEBUG_WITH_MAPPER //collection.map_turns(mapper); - collection.map_pieces(mapper); //, false, true); + collection.template map_pieces(mapper); //, false, true); //collection.map_traverse(mapper); #endif diff --git a/include/boost/geometry/extensions/algorithms/buffer/buffered_piece_collection_with_mapper.hpp b/include/boost/geometry/extensions/algorithms/buffer/buffered_piece_collection_with_mapper.hpp index 2cd7bb220..520894969 100644 --- a/include/boost/geometry/extensions/algorithms/buffer/buffered_piece_collection_with_mapper.hpp +++ b/include/boost/geometry/extensions/algorithms/buffer/buffered_piece_collection_with_mapper.hpp @@ -26,18 +26,24 @@ namespace detail { namespace buffer #ifdef BOOST_GEOMETRY_DEBUG_WITH_MAPPER -template +template struct buffered_piece_collection_with_mapper - : public buffered_piece_collection + : public buffered_piece_collection { + typedef buffered_piece_collection super_type; + + buffered_piece_collection_with_mapper(RescalePolicy const& rescale_policy) + : super_type(rescale_policy) + {} template inline void map_opposite_locations(Mapper& mapper) { + typedef typename super_type::occupation_map_type occupation_map_type; for (typename boost::range_iterator::type it = - boost::begin(m_occupation_map.map); - it != boost::end(m_occupation_map.map); ++it) + boost::begin(this->m_occupation_map.map); + it != boost::end(this->m_occupation_map.map); ++it) { mapper.map(it->first, it->second.occupied() ? "fill:rgb(255,0,255);" : "fill:rgb(0,192,0);", 7); @@ -55,6 +61,8 @@ struct buffered_piece_collection_with_mapper bool const incoming = it->second.angles[i].incoming; segment_identifier seg_id = it->second.angles[i].seg_id; + typedef typename super_type::point_type point_type; + geometry::model::linestring line; point_type p1, p2; geometry::set<0>(p1, geometry::get<0>(it->first) + cos(angle) * 0.1); @@ -90,13 +98,16 @@ struct buffered_piece_collection_with_mapper template inline void map_turns(Mapper& mapper) { + typedef typename super_type::point_type point_type; + typedef typename super_type::turn_vector_type turn_vector_type; + typedef typename geometry::coordinate_type::type coordinate_type; std::map, int> offsets; int index = 0; for (typename boost::range_iterator::type it = - boost::begin(m_turns); it != boost::end(m_turns); ++it) + boost::begin(this->m_turns); it != boost::end(this->m_turns); ++it) { if (! it->opposite()) { @@ -152,8 +163,9 @@ struct buffered_piece_collection_with_mapper template inline void map_pieces(Mapper& mapper, bool pieces = true, bool indices = true) { - for(typename piece_vector::const_iterator it = boost::begin(m_pieces); - it != boost::end(m_pieces); + typedef typename super_type::piece_vector piece_vector; + for(typename piece_vector::const_iterator it = boost::begin(this->m_pieces); + it != boost::end(this->m_pieces); ++it) { Ring corner; @@ -162,7 +174,7 @@ struct buffered_piece_collection_with_mapper if (seg_id.segment_index >= 0) { - buffered_ring const& ring = offsetted_rings[seg_id.multi_index]; + buffered_ring const& ring = this->offsetted_rings[seg_id.multi_index]; std::copy(boost::begin(ring) + seg_id.segment_index, boost::begin(ring) + it->last_segment_index, @@ -207,6 +219,8 @@ struct buffered_piece_collection_with_mapper { // Put starting piece_index / segment_index in centroid + typedef typename super_type::point_type point_type; + point_type centroid; if (corner.size() > 3) { @@ -227,8 +241,10 @@ struct buffered_piece_collection_with_mapper template inline void map_offsetted_points(Mapper& mapper) { - for(typename buffered_ring_collection >::const_iterator oit = boost::begin(offsetted_rings); - oit != boost::end(offsetted_rings); + typedef typename super_type::point_type point_type; + + for(typename buffered_ring_collection >::const_iterator oit = boost::begin(this->offsetted_rings); + oit != boost::end(this->offsetted_rings); ++oit) { int index = 0; @@ -245,8 +261,8 @@ struct buffered_piece_collection_with_mapper template inline void map_traverse(Mapper& mapper) { - for(typename buffered_ring_collection::const_iterator it = boost::begin(traversed_rings); - it != boost::end(traversed_rings); + for(typename buffered_ring_collection::const_iterator it = boost::begin(this->traversed_rings); + it != boost::end(this->traversed_rings); ++it) { mapper.map(*it, "opacity:0.4;fill:none;stroke:rgb(0,255,0);stroke-width:8"); @@ -256,8 +272,8 @@ struct buffered_piece_collection_with_mapper template inline void map_offsetted(Mapper& mapper) { - for(typename buffered_ring_collection >::const_iterator it = boost::begin(offsetted_rings); - it != boost::end(offsetted_rings); + for(typename buffered_ring_collection >::const_iterator it = boost::begin(this->offsetted_rings); + it != boost::end(this->offsetted_rings); ++it) { if (it->discarded())