From 2d69e93a5dc429cd3740f4c215cda2a817f4d9bc Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Wed, 15 Dec 2010 19:52:49 +0000 Subject: [PATCH] Changed BOOST_AUTO by typename interior_rings in loops through interior rings [SVN r67244] --- doc/doxygen_input/sourcecode/boost.vsprops | 2 +- .../boost/geometry/algorithms/centroid.hpp | 6 ++-- include/boost/geometry/algorithms/correct.hpp | 6 ++-- .../algorithms/detail/calculate_sum.hpp | 5 ++-- .../detail/equals/collect_vectors.hpp | 6 ++-- .../detail/overlay/add_to_containment.hpp | 6 ++-- .../algorithms/detail/overlay/get_turns.hpp | 8 +++-- .../algorithms/detail/overlay/split_rings.hpp | 6 ++-- .../detail/sections/sectionalize.hpp | 6 ++-- .../boost/geometry/algorithms/distance.hpp | 6 ++-- .../boost/geometry/algorithms/for_each.hpp | 24 +++++++-------- .../boost/geometry/algorithms/num_points.hpp | 6 ++-- include/boost/geometry/algorithms/reverse.hpp | 6 ++-- .../boost/geometry/algorithms/simplify.hpp | 10 +++++-- .../boost/geometry/algorithms/transform.hpp | 8 +++-- include/boost/geometry/algorithms/unique.hpp | 6 ++-- include/boost/geometry/algorithms/within.hpp | 8 +++-- .../algorithms/buffer/polygon_buffer.hpp | 6 ++-- .../extensions/algorithms/remove_spikes.hpp | 6 ++-- .../gis/io/shapelib/shp_create_object.hpp | 6 ++-- .../extensions/gis/io/wkt/write_wkt.hpp | 9 +++--- .../geometry/extensions/io/svg/write_svg.hpp | 7 +++-- include/boost/geometry/util/write_dsv.hpp | 7 +++-- test/util/reversible_view.cpp | 30 ------------------- 24 files changed, 92 insertions(+), 104 deletions(-) diff --git a/doc/doxygen_input/sourcecode/boost.vsprops b/doc/doxygen_input/sourcecode/boost.vsprops index c1d185173..7adfcc0b3 100644 --- a/doc/doxygen_input/sourcecode/boost.vsprops +++ b/doc/doxygen_input/sourcecode/boost.vsprops @@ -15,6 +15,6 @@ /> diff --git a/include/boost/geometry/algorithms/centroid.hpp b/include/boost/geometry/algorithms/centroid.hpp index e882d85d2..e9a9d113a 100644 --- a/include/boost/geometry/algorithms/centroid.hpp +++ b/include/boost/geometry/algorithms/centroid.hpp @@ -255,9 +255,9 @@ struct centroid_polygon_state per_ring::apply(exterior_ring(poly), strategy, state); - for (BOOST_AUTO(it, boost::begin(interior_rings(poly))); - it != boost::end(interior_rings(poly)); - ++it) + typename interior_return_type::type rings + = interior_rings(poly); + for (BOOST_AUTO(it, boost::begin(rings)); it != boost::end(rings); ++it) { per_ring::apply(*it, strategy, state); } diff --git a/include/boost/geometry/algorithms/correct.hpp b/include/boost/geometry/algorithms/correct.hpp index 0ae2d84f1..4f70aa5f7 100644 --- a/include/boost/geometry/algorithms/correct.hpp +++ b/include/boost/geometry/algorithms/correct.hpp @@ -164,9 +164,9 @@ struct correct_polygon std::less >::apply(exterior_ring(poly)); - for (BOOST_AUTO(it, boost::begin(interior_rings(poly))); - it != boost::end(interior_rings(poly)); - ++it) + typename interior_return_type::type rings + = interior_rings(poly); + for (BOOST_AUTO(it, boost::begin(rings)); it != boost::end(rings); ++it) { correct_ring < diff --git a/include/boost/geometry/algorithms/detail/calculate_sum.hpp b/include/boost/geometry/algorithms/detail/calculate_sum.hpp index 91a485a9e..c861e6fc6 100644 --- a/include/boost/geometry/algorithms/detail/calculate_sum.hpp +++ b/include/boost/geometry/algorithms/detail/calculate_sum.hpp @@ -33,9 +33,8 @@ struct calculate_polygon_sum { ReturnType sum = Policy::apply(exterior_ring(poly), strategy); - for (BOOST_AUTO(it, boost::begin(interior_rings(poly))); - it != boost::end(interior_rings(poly)); - ++it) + typename interior_return_type::type rings = interior_rings(poly); + for (BOOST_AUTO(it, boost::begin(rings)); it != boost::end(rings); ++it) { sum += Policy::apply(*it, strategy); } diff --git a/include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp b/include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp index 5a75b8e79..7d24decec 100644 --- a/include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp +++ b/include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp @@ -181,9 +181,9 @@ struct polygon_collect_vectors typedef range_collect_vectors per_range; per_range::apply(collection, exterior_ring(polygon)); - for (BOOST_AUTO(it, boost::begin(interior_rings(polygon))); - it != boost::end(interior_rings(polygon)); - ++it) + typename interior_return_type::type rings + = interior_rings(polygon); + for (BOOST_AUTO(it, boost::begin(rings)); it != boost::end(rings); ++it) { per_range::apply(collection, *it); } diff --git a/include/boost/geometry/algorithms/detail/overlay/add_to_containment.hpp b/include/boost/geometry/algorithms/detail/overlay/add_to_containment.hpp index 2563063af..990987663 100644 --- a/include/boost/geometry/algorithms/detail/overlay/add_to_containment.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/add_to_containment.hpp @@ -96,8 +96,10 @@ struct add_to_containment policy::apply(container, copy, exterior_ring(polygon), map, dissolve); copy.ring_index = 0; - for (BOOST_AUTO(it, boost::begin(interior_rings(polygon))); - it != boost::end(interior_rings(polygon)); + + typename interior_return_type::type rings + = interior_rings(polygon); + for (BOOST_AUTO(it, boost::begin(rings)); it != boost::end(rings); ++it, ++copy.ring_index) { policy::apply(container, copy, *it, map, dissolve); diff --git a/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp b/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp index 890108379..7762567e7 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp @@ -695,9 +695,11 @@ struct get_turns_polygon_cs multi_index, -1); int i = 0; - for (BOOST_AUTO(it, boost::begin(interior_rings(polygon))); - it != boost::end(interior_rings(polygon)); - ++it, ++i) + + typename interior_return_type::type rings + = interior_rings(polygon); + for (BOOST_AUTO(it, boost::begin(rings)); it != boost::end(rings); + ++it, ++i) { intersector_type::apply( source_id1, *it, diff --git a/include/boost/geometry/algorithms/detail/overlay/split_rings.hpp b/include/boost/geometry/algorithms/detail/overlay/split_rings.hpp index d6ffa822e..41000e973 100644 --- a/include/boost/geometry/algorithms/detail/overlay/split_rings.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/split_rings.hpp @@ -184,9 +184,9 @@ struct insert_rings { ring_collection.push_back(exterior_ring(polygon)); - for (BOOST_AUTO(it, boost::begin(interior_rings(polygon))); - it != boost::end(interior_rings(polygon)); - ++it) + typename interior_return_type::type rings + = interior_rings(polygon); + for (BOOST_AUTO(it, boost::begin(rings)); it != boost::end(rings); ++it) { #ifdef BOOST_GEOMETRY_DEBUG_SPLIT_RINGS std::cout << geometry::wkt(*it) diff --git a/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp b/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp index 24a5296d9..f7b01226e 100644 --- a/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp +++ b/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp @@ -419,8 +419,10 @@ struct sectionalize_polygon sectionalizer_type::apply(exterior_ring(poly), sections, -1, multi_index); int i = 0; - for (BOOST_AUTO(it, boost::begin(interior_rings(poly))); - it != boost::end(interior_rings(poly)); + + typename interior_return_type::type rings + = interior_rings(poly); + for (BOOST_AUTO(it, boost::begin(rings)); it != boost::end(rings); ++it, ++i) { sectionalizer_type::apply(*it, sections, i, multi_index); diff --git a/include/boost/geometry/algorithms/distance.hpp b/include/boost/geometry/algorithms/distance.hpp index 93498d7af..3bb0326ae 100644 --- a/include/boost/geometry/algorithms/distance.hpp +++ b/include/boost/geometry/algorithms/distance.hpp @@ -209,9 +209,9 @@ struct point_to_polygon distance_containment dc = per_ring::apply(point, exterior_ring(polygon), pp_strategy, ps_strategy); - for (BOOST_AUTO(it, boost::begin(interior_rings(polygon))); - it != boost::end(interior_rings(polygon)); - ++it) + typename interior_return_type::type rings + = interior_rings(polygon); + for (BOOST_AUTO(it, boost::begin(rings)); it != boost::end(rings); ++it) { distance_containment dcr = per_ring::apply(point, *it, pp_strategy, ps_strategy); diff --git a/include/boost/geometry/algorithms/for_each.hpp b/include/boost/geometry/algorithms/for_each.hpp index 7ebee52ea..907016bf2 100644 --- a/include/boost/geometry/algorithms/for_each.hpp +++ b/include/boost/geometry/algorithms/for_each.hpp @@ -99,9 +99,9 @@ struct fe_range_per_segment template struct fe_polygon_per_point { - static inline Functor apply( - typename add_const_if_c::type& poly, - Functor f) + typedef typename add_const_if_c::type poly_type; + + static inline Functor apply(poly_type& poly, Functor f) { typedef fe_range_per_point < @@ -112,9 +112,9 @@ struct fe_polygon_per_point f = per_ring::apply(exterior_ring(poly), f); - for (BOOST_AUTO(it, boost::begin(interior_rings(poly))); - it != boost::end(interior_rings(poly)); - ++it) + typename interior_return_type::type rings + = interior_rings(poly); + for (BOOST_AUTO(it, boost::begin(rings)); it != boost::end(rings); ++it) { f = per_ring::apply(*it, f); } @@ -128,9 +128,9 @@ struct fe_polygon_per_point template struct fe_polygon_per_segment { - static inline Functor apply( - typename add_const_if_c::type& poly, - Functor f) + typedef typename add_const_if_c::type poly_type; + + static inline Functor apply(poly_type& poly, Functor f) { typedef fe_range_per_segment < @@ -141,9 +141,9 @@ struct fe_polygon_per_segment f = per_ring::apply(exterior_ring(poly), f); - for (BOOST_AUTO(it, boost::begin(interior_rings(poly))); - it != boost::end(interior_rings(poly)); - ++it) + typename interior_return_type::type rings + = interior_rings(poly); + for (BOOST_AUTO(it, boost::begin(rings)); it != boost::end(rings); ++it) { f = per_ring::apply(*it, f); } diff --git a/include/boost/geometry/algorithms/num_points.hpp b/include/boost/geometry/algorithms/num_points.hpp index 6ae8ec0b4..ab64f9449 100644 --- a/include/boost/geometry/algorithms/num_points.hpp +++ b/include/boost/geometry/algorithms/num_points.hpp @@ -74,9 +74,9 @@ struct polygon_count std::size_t n = range_count::apply( exterior_ring(poly), add_for_open); - for (BOOST_AUTO(it, boost::begin(interior_rings(poly))); - it != boost::end(interior_rings(poly)); - ++it) + typename interior_return_type::type rings + = interior_rings(poly); + for (BOOST_AUTO(it, boost::begin(rings)); it != boost::end(rings); ++it) { n += range_count::apply(*it, add_for_open); } diff --git a/include/boost/geometry/algorithms/reverse.hpp b/include/boost/geometry/algorithms/reverse.hpp index 0b7ed4865..524807455 100644 --- a/include/boost/geometry/algorithms/reverse.hpp +++ b/include/boost/geometry/algorithms/reverse.hpp @@ -46,9 +46,9 @@ struct polygon_reverse typedef range_reverse per_range; per_range::apply(exterior_ring(polygon)); - for (BOOST_AUTO(it, boost::begin(interior_rings(polygon))); - it != boost::end(interior_rings(polygon)); - ++it) + typename interior_return_type::type rings + = interior_rings(polygon); + for (BOOST_AUTO(it, boost::begin(rings)); it != boost::end(rings); ++it) { per_range::apply(*it); } diff --git a/include/boost/geometry/algorithms/simplify.hpp b/include/boost/geometry/algorithms/simplify.hpp index 1c44f49e2..4a942880b 100644 --- a/include/boost/geometry/algorithms/simplify.hpp +++ b/include/boost/geometry/algorithms/simplify.hpp @@ -127,9 +127,13 @@ struct simplify_polygon // TODO: we should make this part of the concept. interior_rings(poly_out).resize(num_interior_rings(poly_in)); - BOOST_AUTO(it_out, boost::begin(interior_rings(poly_out))); - for (BOOST_AUTO(it_in, boost::begin(interior_rings(poly_in))); - it_in != boost::end(interior_rings(poly_in)); + typename interior_return_type::type rings_in + = interior_rings(poly_in); + typename interior_return_type::type rings_out + = interior_rings(poly_out); + BOOST_AUTO(it_out, boost::begin(rings_out)); + for (BOOST_AUTO(it_in, boost::begin(rings_in)); + it_in != boost::end(rings_in); ++it_in, ++it_out) { simplify_range::apply(*it_in, diff --git a/include/boost/geometry/algorithms/transform.hpp b/include/boost/geometry/algorithms/transform.hpp index f60c2bbe3..e13408aa1 100644 --- a/include/boost/geometry/algorithms/transform.hpp +++ b/include/boost/geometry/algorithms/transform.hpp @@ -137,8 +137,12 @@ struct transform_polygon // TODO: we should make this part of the concept. interior_rings(poly2).resize(num_interior_rings(poly1)); - BOOST_AUTO(it1, boost::begin(interior_rings(poly1))); - BOOST_AUTO(it2, boost::begin(interior_rings(poly2))); + typename interior_return_type::type rings1 + = interior_rings(poly1); + typename interior_return_type::type rings2 + = interior_rings(poly2); + BOOST_AUTO(it1, boost::begin(rings1)); + BOOST_AUTO(it2, boost::begin(rings2)); for ( ; it1 != boost::end(interior_rings(poly1)); ++it1, ++it2) { if (!transform_range_out(*it1, diff --git a/include/boost/geometry/algorithms/unique.hpp b/include/boost/geometry/algorithms/unique.hpp index 51f015111..74b645c42 100644 --- a/include/boost/geometry/algorithms/unique.hpp +++ b/include/boost/geometry/algorithms/unique.hpp @@ -57,9 +57,9 @@ struct polygon_unique typedef range_unique per_range; per_range::apply(exterior_ring(polygon), policy); - for (BOOST_AUTO(it, boost::begin(interior_rings(polygon))); - it != boost::end(interior_rings(polygon)); - ++it) + typename interior_return_type::type rings + = interior_rings(polygon); + for (BOOST_AUTO(it, boost::begin(rings)); it != boost::end(rings); ++it) { per_range::apply(*it, policy); } diff --git a/include/boost/geometry/algorithms/within.hpp b/include/boost/geometry/algorithms/within.hpp index ae19860af..57bd47057 100644 --- a/include/boost/geometry/algorithms/within.hpp +++ b/include/boost/geometry/algorithms/within.hpp @@ -216,9 +216,11 @@ struct point_in_polygon if (code == 1) { - for (BOOST_AUTO(it, boost::begin(interior_rings(poly))); - it != boost::end(interior_rings(poly)); - ++it) + typename interior_return_type::type rings + = interior_rings(poly); + for (BOOST_AUTO(it, boost::begin(rings)); + it != boost::end(rings); + ++it) { int const interior_code = point_in_ring < diff --git a/include/boost/geometry/extensions/algorithms/buffer/polygon_buffer.hpp b/include/boost/geometry/extensions/algorithms/buffer/polygon_buffer.hpp index 5e4679430..d4355229a 100644 --- a/include/boost/geometry/extensions/algorithms/buffer/polygon_buffer.hpp +++ b/include/boost/geometry/extensions/algorithms/buffer/polygon_buffer.hpp @@ -204,9 +204,9 @@ struct polygon_buffer #endif ); - for (BOOST_AUTO(it, boost::begin(interior_rings(polygon))); - it != boost::end(interior_rings(polygon)); - ++it) + typename interior_return_type::type rings + = interior_rings(polygon); + for (BOOST_AUTO(it, boost::begin(rings); it != boost::end(rings); ++it) { output_ring_type ring; policy::apply(*it, ring, distance, join_strategy diff --git a/include/boost/geometry/extensions/algorithms/remove_spikes.hpp b/include/boost/geometry/extensions/algorithms/remove_spikes.hpp index 695558501..963bf13ce 100644 --- a/include/boost/geometry/extensions/algorithms/remove_spikes.hpp +++ b/include/boost/geometry/extensions/algorithms/remove_spikes.hpp @@ -128,9 +128,9 @@ struct polygon_remove_spikes typedef range_remove_spikes per_range; per_range::apply(exterior_ring(polygon), policy); - for (BOOST_AUTO(it, boost::begin(interior_rings(polygon))); - it != boost::end(interior_rings(polygon)); - ++it) + typename interior_return_type::type rings + = interior_rings(polygon); + for (BOOST_AUTO(it, boost::begin(rings)); it != boost::end(rings); ++it) { per_range::apply(*it, policy); } diff --git a/include/boost/geometry/extensions/gis/io/shapelib/shp_create_object.hpp b/include/boost/geometry/extensions/gis/io/shapelib/shp_create_object.hpp index 7ab75531b..d943ba83d 100644 --- a/include/boost/geometry/extensions/gis/io/shapelib/shp_create_object.hpp +++ b/include/boost/geometry/extensions/gis/io/shapelib/shp_create_object.hpp @@ -100,9 +100,9 @@ struct shape_create_polygon parts[ring++] = offset; offset = range_to_part(geometry::exterior_ring(polygon), xp, yp, offset); - for (BOOST_AUTO(it, boost::begin(interior_rings(polygon))); - it != boost::end(interior_rings(polygon)); - ++it) + typename interior_return_type::type rings + = interior_rings(polygon); + for (BOOST_AUTO(it, boost::begin(rings)); it != boost::end(rings); ++it) { parts[ring++] = offset; offset = range_to_part(*it, xp, yp, offset); diff --git a/include/boost/geometry/extensions/gis/io/wkt/write_wkt.hpp b/include/boost/geometry/extensions/gis/io/wkt/write_wkt.hpp index 6129151d2..031cb305e 100644 --- a/include/boost/geometry/extensions/gis/io/wkt/write_wkt.hpp +++ b/include/boost/geometry/extensions/gis/io/wkt/write_wkt.hpp @@ -166,9 +166,10 @@ struct wkt_poly // TODO: check EMPTY here os << "("; wkt_sequence::apply(os, exterior_ring(poly)); - for (BOOST_AUTO(it, boost::begin(interior_rings(poly))); - it != boost::end(interior_rings(poly)); - ++it) + + typename interior_return_type::type rings + = interior_rings(poly); + for (BOOST_AUTO(it, boost::begin(rings)); it != boost::end(rings); ++it) { os << ","; wkt_sequence::apply(os, *it); @@ -214,7 +215,7 @@ namespace dispatch { template -struct wkt +struct wkt { BOOST_MPL_ASSERT_MSG ( diff --git a/include/boost/geometry/extensions/io/svg/write_svg.hpp b/include/boost/geometry/extensions/io/svg/write_svg.hpp index dfa7825a4..8d1466464 100644 --- a/include/boost/geometry/extensions/io/svg/write_svg.hpp +++ b/include/boost/geometry/extensions/io/svg/write_svg.hpp @@ -132,9 +132,10 @@ struct svg_poly // Inner rings: { - for (BOOST_AUTO(rit, boost::begin(interior_rings(polygon))); - rit != boost::end(interior_rings(polygon)); - ++rit) + typename interior_return_type::type rings + = interior_rings(polygon); + for (BOOST_AUTO(rit, boost::begin(rings)); + rit != boost::end(rings); ++rit) { first = true; for (BOOST_AUTO(it, boost::begin(*rit)); it != boost::end(*rit); diff --git a/include/boost/geometry/util/write_dsv.hpp b/include/boost/geometry/util/write_dsv.hpp index c49e0a4da..1ec80d3ee 100644 --- a/include/boost/geometry/util/write_dsv.hpp +++ b/include/boost/geometry/util/write_dsv.hpp @@ -211,9 +211,10 @@ struct dsv_poly os << settings.list_open; dsv_range::apply(os, exterior_ring(poly), settings); - for (BOOST_AUTO(it, boost::begin(interior_rings(poly))); - it != boost::end(interior_rings(poly)); - ++it) + + typename interior_return_type::type rings + = interior_rings(poly); + for (BOOST_AUTO(it, boost::begin(rings)); it != boost::end(rings); ++it) { os << settings.list_separator; dsv_range::apply(os, *it, settings); diff --git a/test/util/reversible_view.cpp b/test/util/reversible_view.cpp index 2067ce536..17b646feb 100644 --- a/test/util/reversible_view.cpp +++ b/test/util/reversible_view.cpp @@ -19,23 +19,6 @@ #include #include -namespace boost { namespace geometry -{ - -namespace traits -{ - -template -struct tag > -{ - typedef typename geometry::tag::type type; -}; - -} - -}} - - template void test_forward_or_reverse(Range const& range, std::string const& expected) { @@ -72,22 +55,9 @@ void test_geometry(std::string const& wkt, test_forward_or_reverse(geo, expected_reverse); } - -template -void test_range_adaptor() -{ - bg::model::linestring

ls; - bg::read_wkt("linestring(1 1,2 2,3 3, 4 4)", ls); - std::cout << bg::wkt(ls) << std::endl; - std::cout << bg::wkt(ls | boost::adaptors::reversed) << std::endl; - std::cout << bg::wkt(boost::range_detail::reverse_range >(ls)) << std::endl; -} - - template void test_all() { - //test_range_adaptor

(); test_geometry >( "linestring(1 1,2 2,3 3)", "(1, 1) (2, 2) (3, 3)",