use auto instead of iterator types, and related

This commit is contained in:
Barend Gehrels 2023-04-12 10:35:22 +02:00
parent b1bebca453
commit 83dab2d98c
84 changed files with 549 additions and 979 deletions

View File

@ -91,17 +91,15 @@ struct to_polygon_point
signed_size_type ring_index, signed_size_type = 0)
{
using ring_type = typename ring_type<Polygon>::type;
using exterior_ring_type = typename ring_return_type<Polygon>::type;
using interior_ring_range_type = typename interior_return_type<Polygon>::type;
if (ring_index == -1)
{
exterior_ring_type ext_ring = exterior_ring(polygon);
auto&& ext_ring = exterior_ring(polygon);
to_range_point::apply<ring_type, Point>(ext_ring, point);
}
else if (ring_index < signed_size_type(num_interior_rings(polygon)))
{
interior_ring_range_type int_rings = interior_rings(polygon);
auto&& int_rings = interior_rings(polygon);
to_range_point::apply<ring_type, Point>(range::at(int_rings, ring_index), point);
}
}

View File

@ -43,7 +43,6 @@
#include <boost/geometry/algorithms/assign.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/algorithms/detail/centroid/translating_transformer.hpp>
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
#include <boost/geometry/algorithms/detail/point_on_border.hpp>
#include <boost/geometry/algorithms/detail/visit.hpp>
#include <boost/geometry/algorithms/is_empty.hpp>
@ -255,11 +254,9 @@ struct centroid_polygon_state
{
centroid_range_state::apply(exterior_ring(poly), transformer, strategy, state);
typename interior_return_type<Polygon const>::type
rings = interior_rings(poly);
for (typename detail::interior_iterator<Polygon const>::type
it = boost::begin(rings); it != boost::end(rings); ++it)
auto const& rings = interior_rings(poly);
auto const end = boost::end(rings);
for (auto it = boost::begin(rings); it != end; ++it)
{
centroid_range_state::apply(*it, transformer, strategy, state);
}
@ -352,15 +349,12 @@ struct centroid_multi
Point
>::type state;
for (typename boost::range_iterator<Multi const>::type
it = boost::begin(multi);
it != boost::end(multi);
++it)
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
{
Policy::apply(*it, transformer, strategy, state);
}
if ( strategy.result(state, centroid) )
if (strategy.result(state, centroid))
{
// translate the result back
transformer.apply_reverse(centroid);

View File

@ -37,7 +37,6 @@
#include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
#include <boost/geometry/algorithms/detail/convert_point_to_point.hpp>
#include <boost/geometry/algorithms/detail/convert_indexed_to_indexed.hpp>
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
#include <boost/geometry/algorithms/not_implemented.hpp>
#include <boost/geometry/arithmetic/arithmetic.hpp>
@ -128,7 +127,7 @@ struct segment_to_range
{
traits::resize<Range>::apply(range, 2);
typename boost::range_iterator<Range>::type it = boost::begin(range);
auto it = boost::begin(range);
assign_point_from_index<0>(segment, *it);
++it;
@ -186,8 +185,7 @@ struct range_to_range
// but ok, sice below it == end()
size_type i = 0;
for (typename boost::range_iterator<view_type const>::type it
= boost::begin(view);
for (auto it = boost::begin(view);
it != boost::end(view) && i < n;
++it, ++i)
{
@ -227,15 +225,11 @@ struct polygon_to_polygon
>::type
>::apply(interior_rings(destination), num_interior_rings(source));
typename interior_return_type<Polygon1 const>::type
rings_source = interior_rings(source);
typename interior_return_type<Polygon2>::type
rings_dest = interior_rings(destination);
auto const& rings_source = interior_rings(source);
auto&& rings_dest = interior_rings(destination);
typename detail::interior_iterator<Polygon1 const>::type
it_source = boost::begin(rings_source);
typename detail::interior_iterator<Polygon2>::type
it_dest = boost::begin(rings_dest);
auto it_source = boost::begin(rings_source);
auto it_dest = boost::begin(rings_dest);
for ( ; it_source != boost::end(rings_source); ++it_source, ++it_dest)
{
@ -263,10 +257,8 @@ struct multi_to_multi: private Policy
{
traits::resize<Multi2>::apply(multi2, boost::size(multi1));
typename boost::range_iterator<Multi1 const>::type it1
= boost::begin(multi1);
typename boost::range_iterator<Multi2>::type it2
= boost::begin(multi2);
auto it1 = boost::begin(multi1);
auto it2 = boost::begin(multi2);
for (; it1 != boost::end(multi1); ++it1, ++it2)
{

View File

@ -30,7 +30,6 @@
#include <boost/geometry/algorithms/area.hpp>
#include <boost/geometry/algorithms/correct_closure.hpp>
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
#include <boost/geometry/algorithms/detail/multi_modify.hpp>
#include <boost/geometry/algorithms/detail/visit.hpp>

View File

@ -15,7 +15,6 @@
#include <cstddef>
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
#include <boost/geometry/algorithms/detail/multi_modify.hpp>
#include <boost/geometry/algorithms/disjoint.hpp>

View File

@ -78,11 +78,10 @@ struct densify_range
static inline void apply(FwdRng const& rng, MutRng & rng_out,
T const& len, Strategies const& strategies)
{
typedef typename boost::range_iterator<FwdRng const>::type iterator_t;
typedef typename boost::range_value<FwdRng>::type point_t;
iterator_t it = boost::begin(rng);
iterator_t end = boost::end(rng);
auto it = boost::begin(rng);
auto const end = boost::end(rng);
if (it == end) // empty(rng)
{
@ -92,7 +91,7 @@ struct densify_range
auto strategy = strategies.densify(rng);
push_back_policy<MutRng> policy(rng_out);
iterator_t prev = it;
auto prev = it;
for ( ++it ; it != end ; prev = it++)
{
point_t const& p0 = *prev;
@ -123,9 +122,8 @@ struct densify_ring
if (boost::size(ring) <= 1)
return;
typedef typename point_type<Geometry>::type point_t;
point_t const& p0 = range::back(ring);
point_t const& p1 = range::front(ring);
auto const& p0 = range::back(ring);
auto const& p1 = range::front(ring);
auto strategy = strategies.densify(ring);
push_back_policy<GeometryOut> policy(ring_out);

View File

@ -354,10 +354,7 @@ struct buffer_multi
RobustPolicy const& robust_policy,
Strategies const& strategies)
{
for (typename boost::range_iterator<Multi const>::type
it = boost::begin(multi);
it != boost::end(multi);
++it)
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
{
Policy::apply(*it, collection,
distance_strategy, segment_strategy,

View File

@ -59,6 +59,7 @@
#include <boost/geometry/algorithms/detail/sections/section_box_policies.hpp>
#include <boost/geometry/views/detail/closed_clockwise_view.hpp>
#include <boost/geometry/util/for_each_with_index.hpp>
#include <boost/geometry/util/range.hpp>
@ -295,12 +296,9 @@ struct buffered_piece_collection
// and only applicable for linear features
// (in a multi linestring with many short lines, the #endpoints can be
// much higher)
for (typename boost::range_iterator<std::vector<point_type> const>::type it
= boost::begin(m_linear_end_points);
it != boost::end(m_linear_end_points);
++it)
for (auto const& p : m_linear_end_points)
{
if (detail::equals::equals_point_point(turn.point, *it, m_strategy))
if (detail::equals::equals_point_point(turn.point, p, m_strategy))
{
turn.is_linear_end_point = true;
}
@ -324,12 +322,9 @@ struct buffered_piece_collection
enriched_map_buffer_include_policy());
// Sort turns over offsetted ring(s)
for (typename mapped_vector_type::iterator mit
= mapped_vector.begin();
mit != mapped_vector.end();
++mit)
for (auto& pair : mapped_vector)
{
std::sort(mit->second.begin(), mit->second.end(), buffer_less());
std::sort(pair.second.begin(), pair.second.end(), buffer_less());
}
}
@ -342,17 +337,14 @@ struct buffered_piece_collection
// Deflated rings may not travel to themselves, there should at least
// be three turns (which cannot be checked here - TODO: add to traverse)
for (typename boost::range_iterator<turn_vector_type>::type it =
boost::begin(m_turns); it != boost::end(m_turns); ++it)
for (auto& turn : m_turns)
{
buffer_turn_info_type& turn = *it;
if (! turn.is_turn_traversable)
{
continue;
}
for (int i = 0; i < 2; i++)
for (auto& op : turn.operations)
{
buffer_turn_operation_type& op = turn.operations[i];
if (op.enriched.get_next_turn_index() == static_cast<signed_size_type>(turn.turn_index)
&& m_pieces[op.seg_id.piece_index].is_deflated)
{
@ -385,10 +377,8 @@ struct buffered_piece_collection
bool const deflate = m_distance_strategy.negative();
for (typename boost::range_iterator<turn_vector_type>::type it =
boost::begin(m_turns); it != boost::end(m_turns); ++it)
for (auto& turn : m_turns)
{
buffer_turn_info_type& turn = *it;
if (turn.is_turn_traversable)
{
if (deflate && turn.count_in_original <= 0)
@ -408,13 +398,8 @@ struct buffered_piece_collection
inline void update_turn_administration()
{
std::size_t index = 0;
for (typename boost::range_iterator<turn_vector_type>::type it =
boost::begin(m_turns); it != boost::end(m_turns); ++it, ++index)
for_each_with_index(m_turns, [this](std::size_t index, auto& turn)
{
buffer_turn_info_type& turn = *it;
// Update member used
turn.turn_index = index;
// Verify if a turn is a linear endpoint
@ -422,7 +407,7 @@ struct buffered_piece_collection
{
check_linear_endpoints(turn);
}
}
});
}
// Calculate properties of piece borders which are not influenced
@ -434,11 +419,8 @@ struct buffered_piece_collection
// - (if pieces are reversed)
inline void update_piece_administration()
{
for (typename piece_vector_type::iterator it = boost::begin(m_pieces);
it != boost::end(m_pieces);
++it)
for (auto& pc : m_pieces)
{
piece& pc = *it;
piece_border_type& border = pc.m_piece_border;
buffered_ring<Ring> const& ring = offsetted_rings[pc.first_seg_id.multi_index];
@ -791,7 +773,7 @@ struct buffered_piece_collection
{
BOOST_GEOMETRY_ASSERT(boost::size(range) != 0u);
typename Range::const_iterator it = boost::begin(range);
auto it = boost::begin(range);
// If it follows a non-join (so basically the same piece-type) point b1 should be added.
// There should be two intersections later and it should be discarded.
@ -928,18 +910,17 @@ struct buffered_piece_collection
// Those can never be traversed and should not be part of the output.
inline void discard_rings()
{
for (typename boost::range_iterator<turn_vector_type const>::type it =
boost::begin(m_turns); it != boost::end(m_turns); ++it)
for (auto const& turn : m_turns)
{
if (it->is_turn_traversable)
if (turn.is_turn_traversable)
{
offsetted_rings[it->operations[0].seg_id.multi_index].has_accepted_intersections = true;
offsetted_rings[it->operations[1].seg_id.multi_index].has_accepted_intersections = true;
offsetted_rings[turn.operations[0].seg_id.multi_index].has_accepted_intersections = true;
offsetted_rings[turn.operations[1].seg_id.multi_index].has_accepted_intersections = true;
}
else
{
offsetted_rings[it->operations[0].seg_id.multi_index].has_discarded_intersections = true;
offsetted_rings[it->operations[1].seg_id.multi_index].has_discarded_intersections = true;
offsetted_rings[turn.operations[0].seg_id.multi_index].has_discarded_intersections = true;
offsetted_rings[turn.operations[1].seg_id.multi_index].has_discarded_intersections = true;
}
}
}
@ -952,12 +933,8 @@ struct buffered_piece_collection
// any of the robust original rings
// This can go quadratic if the input has many rings, and there
// are many untouched deflated rings around
for (typename std::vector<original_ring>::const_iterator it
= original_rings.begin();
it != original_rings.end();
++it)
for (auto const& original : original_rings)
{
original_ring const& original = *it;
if (original.m_ring.empty())
{
continue;
@ -999,12 +976,8 @@ struct buffered_piece_collection
// be discarded
inline void discard_nonintersecting_deflated_rings()
{
for(typename buffered_ring_collection<buffered_ring<Ring> >::iterator it
= boost::begin(offsetted_rings);
it != boost::end(offsetted_rings);
++it)
for (auto& ring : offsetted_rings)
{
buffered_ring<Ring>& ring = *it;
if (! ring.has_intersections()
&& boost::size(ring) > 0u
&& geometry::area(ring, m_strategy) < 0)
@ -1019,10 +992,8 @@ struct buffered_piece_collection
inline void block_turns()
{
for (typename boost::range_iterator<turn_vector_type>::type it =
boost::begin(m_turns); it != boost::end(m_turns); ++it)
for (auto& turn : m_turns)
{
buffer_turn_info_type& turn = *it;
if (! turn.is_turn_traversable)
{
// Discard this turn (don't set it to blocked to avoid colocated
@ -1055,21 +1026,16 @@ struct buffered_piece_collection
inline void reverse()
{
for(typename buffered_ring_collection<buffered_ring<Ring> >::iterator it = boost::begin(offsetted_rings);
it != boost::end(offsetted_rings);
++it)
for (auto& ring : offsetted_rings)
{
if (! it->has_intersections())
if (! ring.has_intersections())
{
std::reverse(it->begin(), it->end());
std::reverse(ring.begin(), ring.end());
}
}
for (typename boost::range_iterator<buffered_ring_collection<Ring> >::type
it = boost::begin(traversed_rings);
it != boost::end(traversed_rings);
++it)
for (auto& ring : traversed_rings)
{
std::reverse(it->begin(), it->end());
std::reverse(ring.begin(), ring.end());
}
}
@ -1091,37 +1057,30 @@ struct buffered_piece_collection
// Inner rings, for deflate, which do not have intersections, and
// which are outside originals, are skipped
// (other ones should be traversed)
signed_size_type index = 0;
for(typename buffered_ring_collection<buffered_ring<Ring> >::const_iterator it = boost::begin(offsetted_rings);
it != boost::end(offsetted_rings);
++it, ++index)
{
if (! it->has_intersections()
&& ! it->is_untouched_outside_original)
for_each_with_index(offsetted_rings, [&](std::size_t index, auto const& ring)
{
properties p = properties(*it, m_strategy);
if (p.valid)
if (! ring.has_intersections()
&& ! ring.is_untouched_outside_original)
{
ring_identifier id(0, index, -1);
selected[id] = p;
properties p = properties(ring, m_strategy);
if (p.valid)
{
ring_identifier id(0, index, -1);
selected[id] = p;
}
}
}
}
});
// Select all created rings
index = 0;
for (typename boost::range_iterator<buffered_ring_collection<Ring> const>::type
it = boost::begin(traversed_rings);
it != boost::end(traversed_rings);
++it, ++index)
{
properties p = properties(*it, m_strategy);
if (p.valid)
for_each_with_index(traversed_rings, [&](std::size_t index, auto const& ring)
{
ring_identifier id(2, index, -1);
selected[id] = p;
}
}
properties p = properties(ring, m_strategy);
if (p.valid)
{
ring_identifier id(2, index, -1);
selected[id] = p;
}
});
detail::overlay::assign_parents<overlay_buffer>(offsetted_rings, traversed_rings,
selected, m_strategy);

View File

@ -194,7 +194,6 @@ class piece_turn_visitor
{
typedef typename boost::range_value<Rings const>::type ring_type;
typedef typename boost::range_value<Turns const>::type turn_type;
typedef typename boost::range_iterator<ring_type const>::type iterator;
signed_size_type const piece1_first_index = piece1.first_seg_id.segment_index;
signed_size_type const piece2_first_index = piece2.first_seg_id.segment_index;
@ -213,12 +212,12 @@ class piece_turn_visitor
// get geometry and iterators over these sections
ring_type const& ring1 = m_rings[piece1.first_seg_id.multi_index];
iterator it1_first = boost::begin(ring1) + sec1_first_index;
iterator it1_beyond = boost::begin(ring1) + sec1_last_index + 1;
auto it1_first = boost::begin(ring1) + sec1_first_index;
auto it1_beyond = boost::begin(ring1) + sec1_last_index + 1;
ring_type const& ring2 = m_rings[piece2.first_seg_id.multi_index];
iterator it2_first = boost::begin(ring2) + sec2_first_index;
iterator it2_beyond = boost::begin(ring2) + sec2_last_index + 1;
auto it2_first = boost::begin(ring2) + sec2_first_index;
auto it2_beyond = boost::begin(ring2) + sec2_last_index + 1;
// Set begin/end of monotonic ranges, in both x/y directions
signed_size_type index1 = sec1_first_index;
@ -246,8 +245,8 @@ class piece_turn_visitor
the_model.operations[0].seg_id = piece1.first_seg_id;
the_model.operations[0].seg_id.segment_index = index1; // override
iterator it1 = it1_first;
for (iterator prev1 = it1++;
auto it1 = it1_first;
for (auto prev1 = it1++;
it1 != it1_beyond;
prev1 = it1++, the_model.operations[0].seg_id.segment_index++)
{
@ -257,8 +256,8 @@ class piece_turn_visitor
unique_sub_range_from_piece<ring_type> unique_sub_range1(ring1, prev1, it1);
iterator it2 = it2_first;
for (iterator prev2 = it2++;
auto it2 = it2_first;
for (auto prev2 = it2++;
it2 != it2_beyond;
prev2 = it2++, the_model.operations[1].seg_id.segment_index++)
{

View File

@ -190,20 +190,11 @@ inline int point_in_original(Point const& point, Original const& original,
return strategy.result(state);
}
typedef typename Original::sections_type sections_type;
typedef typename boost::range_iterator<sections_type const>::type iterator_type;
typedef typename boost::range_value<sections_type const>::type section_type;
typedef typename geometry::coordinate_type<Point>::type coordinate_type;
coordinate_type const point_x = geometry::get<0>(point);
auto const point_x = geometry::get<0>(point);
// Walk through all monotonic sections of this original
for (iterator_type it = boost::begin(original.m_sections);
it != boost::end(original.m_sections);
++it)
for (auto const& section : original.m_sections)
{
section_type const& section = *it;
if (! section.duplicate
&& section.begin_index < section.end_index
&& point_x >= geometry::get<min_corner, 0>(section.bounding_box)

View File

@ -36,7 +36,7 @@ struct clean_point
, m_is_azi_valid(false), m_is_azi_diff_valid(false)
{}
typename boost::iterators::iterator_reference<Iter>::type ref() const
decltype(auto) ref() const
{
return *m_iter;
}
@ -108,8 +108,6 @@ struct calculate_point_order_by_azimuth
typedef typename boost::range_iterator<Ring const>::type iter_t;
typedef typename Strategy::template result_type<Ring>::type calc_t;
typedef clean_point<iter_t, calc_t> clean_point_t;
typedef std::vector<clean_point_t> cleaned_container_t;
typedef typename cleaned_container_t::iterator cleaned_iter_t;
calc_t const zero = 0;
calc_t const pi = math::pi<calc_t>();
@ -121,7 +119,7 @@ struct calculate_point_order_by_azimuth
}
// non-duplicated, non-spike points
cleaned_container_t cleaned;
std::vector<clean_point_t> cleaned;
cleaned.reserve(count);
for (iter_t it = boost::begin(ring); it != boost::end(ring); ++it)
@ -131,9 +129,9 @@ struct calculate_point_order_by_azimuth
while (cleaned.size() >= 3)
{
cleaned_iter_t it0 = cleaned.end() - 3;
cleaned_iter_t it1 = cleaned.end() - 2;
cleaned_iter_t it2 = cleaned.end() - 1;
auto it0 = cleaned.end() - 3;
auto it1 = cleaned.end() - 2;
auto it2 = cleaned.end() - 1;
calc_t diff;
if (get_or_calculate_azimuths_difference(*it0, *it1, *it2, diff, strategy)
@ -156,8 +154,8 @@ struct calculate_point_order_by_azimuth
}
// filter-out duplicates and spikes at the front and back of cleaned
cleaned_iter_t cleaned_b = cleaned.begin();
cleaned_iter_t cleaned_e = cleaned.end();
auto cleaned_b = cleaned.begin();
auto cleaned_e = cleaned.end();
std::size_t cleaned_count = cleaned.size();
bool found = false;
do
@ -165,10 +163,10 @@ struct calculate_point_order_by_azimuth
found = false;
while(cleaned_count >= 3)
{
cleaned_iter_t it0 = cleaned_e - 2;
cleaned_iter_t it1 = cleaned_e - 1;
cleaned_iter_t it2 = cleaned_b;
cleaned_iter_t it3 = cleaned_b + 1;
auto it0 = cleaned_e - 2;
auto it1 = cleaned_e - 1;
auto it2 = cleaned_b;
auto it3 = cleaned_b + 1;
calc_t diff = 0;
if (! get_or_calculate_azimuths_difference(*it0, *it1, *it2, diff, strategy)
@ -212,10 +210,10 @@ struct calculate_point_order_by_azimuth
// calculate the sum of external angles
calc_t angles_sum = zero;
for (cleaned_iter_t it = cleaned_b; it != cleaned_e; ++it)
for (auto it = cleaned_b; it != cleaned_e; ++it)
{
cleaned_iter_t it0 = (it == cleaned_b ? cleaned_e - 1 : it - 1);
cleaned_iter_t it2 = (it == cleaned_e - 1 ? cleaned_b : it + 1);
auto it0 = (it == cleaned_b ? cleaned_e - 1 : it - 1);
auto it2 = (it == cleaned_e - 1 ? cleaned_b : it + 1);
calc_t diff = 0;
get_or_calculate_azimuths_difference(*it0, *it, *it2, diff, strategy);

View File

@ -37,8 +37,7 @@ class calculate_polygon_sum
static inline ReturnType sum_interior_rings(Rings const& rings, Strategy const& strategy)
{
ReturnType sum = ReturnType(0);
for (typename boost::range_iterator<Rings const>::type
it = boost::begin(rings); it != boost::end(rings); ++it)
for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
{
sum += Policy::apply(*it, strategy);
}

View File

@ -148,8 +148,6 @@ class graham_andrew
{
typedef InputPoint point_type;
typedef typename std::vector<point_type> container_type;
typedef typename std::vector<point_type>::const_iterator iterator;
typedef typename std::vector<point_type>::const_reverse_iterator rev_iterator;
class partitions
{
@ -228,9 +226,9 @@ private:
SideStrategy const& side)
{
output.push_back(left);
for(iterator it = input.begin(); it != input.end(); ++it)
for (auto const& i : input)
{
add_to_hull<Factor>(*it, output, side);
add_to_hull<Factor>(i, output, side);
}
add_to_hull<Factor>(right, output, side);
}
@ -244,7 +242,7 @@ private:
std::size_t output_size = output.size();
while (output_size >= 3)
{
rev_iterator rit = output.rbegin();
auto rit = output.rbegin();
point_type const last = *rit++;
point_type const& last2 = *rit++;

View File

@ -30,8 +30,6 @@
#include <boost/geometry/util/range.hpp>
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
namespace boost { namespace geometry
{
@ -67,10 +65,8 @@ struct polygon_count
{
std::size_t n = RangeCount::apply(exterior_ring(poly));
typename interior_return_type<Polygon const>::type
rings = interior_rings(poly);
for (typename detail::interior_iterator<Polygon const>::type
it = boost::begin(rings); it != boost::end(rings); ++it)
auto const& rings = interior_rings(poly);
for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
{
n += RangeCount::apply(*it);
}
@ -84,13 +80,10 @@ template <typename SingleCount>
struct multi_count
{
template <typename MultiGeometry>
static inline std::size_t apply(MultiGeometry const& geometry)
static inline std::size_t apply(MultiGeometry const& multi)
{
std::size_t n = 0;
for (typename boost::range_iterator<MultiGeometry const>::type
it = boost::begin(geometry);
it != boost::end(geometry);
++it)
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
{
n += SingleCount::apply(*it);
}

View File

@ -89,12 +89,11 @@ struct disjoint_no_intersections_policy<Geometry1, Geometry2, Tag1, multi_tag>
static inline bool apply(Geometry1 const& g1, Geometry2 const& g2, Strategy const& strategy)
{
// TODO: use partition or rtree on g2
typedef typename boost::range_iterator<Geometry1 const>::type iterator;
for ( iterator it = boost::begin(g1) ; it != boost::end(g1) ; ++it )
for (auto it = boost::begin(g1); it != boost::end(g1); ++it)
{
typedef typename boost::range_value<Geometry1 const>::type value_type;
if ( ! disjoint_no_intersections_policy<value_type const, Geometry2>
::apply(*it, g2, strategy) )
if (! disjoint_no_intersections_policy<value_type const, Geometry2>
::apply(*it, g2, strategy))
{
return false;
}

View File

@ -291,8 +291,7 @@ public:
geometry::envelope(single_geometry, box2, strategy);
geometry::detail::expand_by_epsilon(box2);
typedef typename boost::range_const_iterator<MultiPoint>::type iterator;
for ( iterator it = boost::begin(multi_point) ; it != boost::end(multi_point) ; ++it )
for (auto it = boost::begin(multi_point) ; it != boost::end(multi_point) ; ++it)
{
// The default strategy is enough for Point/Box
if (! detail::disjoint::disjoint_point_box(*it, box2, strategy)

View File

@ -163,17 +163,11 @@ public:
Strategies const& strategies,
bool check_intersection = true)
{
typedef geometry::point_iterator<Geometry const> point_iterator_type;
typedef geometry::segment_iterator
<
Geometry const
> segment_iterator_type;
typedef typename boost::range_const_iterator
<
std::vector<segment_or_box_point>
>::type seg_or_box_const_iterator;
typedef assign_new_min_iterator<SegmentOrBox> assign_new_value;
@ -203,25 +197,20 @@ public:
// consider all distances of the points in the geometry to the
// segment or box
comparable_return_type cd_min1(0);
point_iterator_type pit_min;
seg_or_box_const_iterator it_min1 = boost::const_begin(seg_or_box_points);
seg_or_box_const_iterator it_min2 = it_min1;
++it_min2;
auto pit_min = points_begin(geometry);
auto it_min1 = boost::const_begin(seg_or_box_points);
auto it_min2 = it_min1 + 1;
bool first = true;
for (point_iterator_type pit = points_begin(geometry);
for (auto pit = pit_min;
pit != points_end(geometry); ++pit, first = false)
{
comparable_return_type cd;
std::pair
<
seg_or_box_const_iterator, seg_or_box_const_iterator
> it_pair
= point_to_point_range::apply(*pit,
boost::const_begin(seg_or_box_points),
boost::const_end(seg_or_box_points),
cstrategy,
cd);
auto it_pair = point_to_point_range::apply(*pit,
boost::const_begin(seg_or_box_points),
boost::const_end(seg_or_box_points),
cstrategy,
cd);
if (first || cd < cd_min1)
{
@ -236,10 +225,10 @@ public:
// segments of the geometry
comparable_return_type cd_min2(0);
segment_iterator_type sit_min;
seg_or_box_const_iterator it_min;
auto it_min = boost::const_begin(seg_or_box_points);
first = true;
for (seg_or_box_const_iterator it = boost::const_begin(seg_or_box_points);
for (auto it = boost::const_begin(seg_or_box_points);
it != boost::const_end(seg_or_box_points); ++it, first = false)
{
comparable_return_type cd;
@ -299,14 +288,7 @@ class geometry_to_segment_or_box
{
private:
typedef detail::closest_feature::geometry_to_range base_type;
typedef typename boost::range_iterator
<
MultiPoint const
>::type iterator_type;
typedef detail::closest_feature::geometry_to_range geometry_to_range;
typedef distance::strategy_t<MultiPoint, SegmentOrBox, Strategies> strategy_type;
public:
@ -318,7 +300,7 @@ public:
{
distance::creturn_t<MultiPoint, SegmentOrBox, Strategies> cd_min;
iterator_type it_min
auto const it_min
= geometry_to_range::apply(segment_or_box,
boost::begin(multipoint),
boost::end(multipoint),

View File

@ -162,11 +162,6 @@ struct envelope_range_of_boxes_by_expansion
{
typedef typename boost::range_value<RangeOfBoxes>::type box_type;
typedef typename boost::range_iterator
<
RangeOfBoxes const
>::type iterator_type;
// first initialize MBR
detail::indexed_point_view<Box, min_corner> mbr_min(mbr);
detail::indexed_point_view<Box, max_corner> mbr_max(mbr);
@ -194,7 +189,7 @@ struct envelope_range_of_boxes_by_expansion
>::apply(first_box_max, mbr_max);
// now expand using the remaining boxes
iterator_type it = boost::begin(range_of_boxes);
auto it = boost::begin(range_of_boxes);
for (++it; it != boost::end(range_of_boxes); ++it)
{
detail::expand::indexed_loop
@ -237,10 +232,6 @@ struct envelope_range_of_boxes
typedef typename boost::range_value<RangeOfBoxes>::type box_type;
typedef typename coordinate_type<box_type>::type coordinate_type;
typedef typename detail::cs_angular_units<box_type>::type units_type;
typedef typename boost::range_iterator
<
RangeOfBoxes const
>::type iterator_type;
static const bool is_equatorial = ! std::is_same
<
@ -258,29 +249,30 @@ struct envelope_range_of_boxes
BOOST_GEOMETRY_ASSERT(! boost::empty(range_of_boxes));
iterator_type it_min = std::min_element(boost::begin(range_of_boxes),
boost::end(range_of_boxes),
latitude_less<min_corner>());
iterator_type it_max = std::max_element(boost::begin(range_of_boxes),
boost::end(range_of_boxes),
latitude_less<max_corner>());
auto const it_min = std::min_element(boost::begin(range_of_boxes),
boost::end(range_of_boxes),
latitude_less<min_corner>());
auto const it_max = std::max_element(boost::begin(range_of_boxes),
boost::end(range_of_boxes),
latitude_less<max_corner>());
coordinate_type const min_longitude = constants::min_longitude();
coordinate_type const max_longitude = constants::max_longitude();
coordinate_type const period = constants::period();
interval_range_type intervals;
for (iterator_type it = boost::begin(range_of_boxes);
for (auto it = boost::begin(range_of_boxes);
it != boost::end(range_of_boxes);
++it)
{
if (is_inverse_spheroidal_coordinates(*it))
auto const& box = *it;
if (is_inverse_spheroidal_coordinates(box))
{
continue;
}
coordinate_type lat_min = geometry::get<min_corner, 1>(*it);
coordinate_type lat_max = geometry::get<max_corner, 1>(*it);
coordinate_type lat_min = geometry::get<min_corner, 1>(box);
coordinate_type lat_max = geometry::get<max_corner, 1>(box);
if (math::equals(lat_min, constants::max_latitude())
|| math::equals(lat_max, constants::min_latitude()))
{
@ -289,8 +281,8 @@ struct envelope_range_of_boxes
continue;
}
coordinate_type lon_left = geometry::get<min_corner, 0>(*it);
coordinate_type lon_right = geometry::get<max_corner, 0>(*it);
coordinate_type lon_left = geometry::get<min_corner, 0>(box);
coordinate_type lon_right = geometry::get<max_corner, 0>(box);
if (math::larger(lon_right, max_longitude))
{

View File

@ -22,7 +22,6 @@
#include <boost/numeric/conversion/cast.hpp>
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
#include <boost/geometry/algorithms/detail/normalize.hpp>
#include <boost/geometry/algorithms/not_implemented.hpp>
@ -400,10 +399,8 @@ struct polygon_collect_vectors
typedef range_collect_vectors<ring_type, Collection> per_range;
per_range::apply(collection, exterior_ring(polygon));
typename interior_return_type<Polygon const>::type
rings = interior_rings(polygon);
for (typename detail::interior_iterator<Polygon const>::type
it = boost::begin(rings); it != boost::end(rings); ++it)
auto const& rings = interior_rings(polygon);
for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
{
per_range::apply(collection, *it);
}
@ -416,10 +413,7 @@ struct multi_collect_vectors
{
static inline void apply(Collection& collection, MultiGeometry const& multi)
{
for (typename boost::range_iterator<MultiGeometry const>::type
it = boost::begin(multi);
it != boost::end(multi);
++it)
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
{
SinglePolicy::apply(collection, *it);
}

View File

@ -26,7 +26,6 @@
#include <boost/range/value_type.hpp>
#include <boost/geometry/algorithms/detail/assign_box_corners.hpp>
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
#include <boost/geometry/arithmetic/arithmetic.hpp>
@ -124,7 +123,6 @@ struct extreme_points_on_ring
{
typedef typename geometry::coordinate_type<Ring>::type coordinate_type;
typedef typename boost::range_iterator<Ring const>::type range_iterator;
typedef typename geometry::point_type<Ring>::type point_type;
template <typename CirclingIterator, typename Points>
@ -288,8 +286,7 @@ struct extreme_points_on_ring
template <typename Iterator, typename SideStrategy>
static inline bool right_turn(Ring const& ring, Iterator it, SideStrategy const& strategy)
{
typename std::iterator_traits<Iterator>::difference_type const index
= std::distance(boost::begin(ring), it);
auto const index = std::distance(boost::begin(ring), it);
geometry::ever_circling_range_iterator<Ring const> left(ring);
geometry::ever_circling_range_iterator<Ring const> right(ring);
left += index;
@ -326,9 +323,9 @@ struct extreme_points_on_ring
// Get all maxima, usually one. In case of self-tangencies, or self-crossings,
// the max might be is not valid. A valid max should make a right turn
range_iterator max_it = boost::begin(ring);
auto max_it = boost::begin(ring);
compare<Dimension> smaller;
for (range_iterator it = max_it + 1; it != boost::end(ring); ++it)
for (auto it = max_it + 1; it != boost::end(ring); ++it)
{
if (smaller(*max_it, *it) && right_turn(ring, it, strategy))
{
@ -341,8 +338,7 @@ struct extreme_points_on_ring
return false;
}
typename std::iterator_traits<range_iterator>::difference_type const
index = std::distance(boost::begin(ring), max_it);
auto const index = std::distance(boost::begin(ring), max_it);
//std::cout << "Extreme point lies at " << index << " having " << geometry::wkt(*max_it) << std::endl;
geometry::ever_circling_range_iterator<Ring const> left(ring);
@ -429,10 +425,8 @@ struct extreme_points<Polygon, Dimension, polygon_tag>
}
// For a polygon, its interior rings can contain intruders
typename interior_return_type<Polygon const>::type
rings = interior_rings(polygon);
for (typename detail::interior_iterator<Polygon const>::type
it = boost::begin(rings); it != boost::end(rings); ++it)
auto const& rings = interior_rings(polygon);
for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
{
ring_implementation::get_intruders(*it, extremes, intruders, strategy);
}

View File

@ -91,10 +91,8 @@ inline bool has_self_intersections(Geometry const& geometry,
#ifdef BOOST_GEOMETRY_DEBUG_HAS_SELF_INTERSECTIONS
bool first = true;
#endif
for(typename std::deque<turn_info>::const_iterator it = boost::begin(turns);
it != boost::end(turns); ++it)
for (auto const& info : turns)
{
turn_info const& info = *it;
bool const both_union_turn =
info.operations[0].operation == detail::overlay::operation_union
&& info.operations[1].operation == detail::overlay::operation_union;

View File

@ -64,19 +64,9 @@ struct intersection_multi_linestring_multi_linestring_point
{
// Note, this loop is quadratic w.r.t. number of linestrings per input.
// Future Enhancement: first do the sections of each, then intersect.
for (typename boost::range_iterator
<
MultiLinestring1 const
>::type it1 = boost::begin(ml1);
it1 != boost::end(ml1);
++it1)
for (auto it1 = boost::begin(ml1); it1 != boost::end(ml1); ++it1)
{
for (typename boost::range_iterator
<
MultiLinestring2 const
>::type it2 = boost::begin(ml2);
it2 != boost::end(ml2);
++it2)
for (auto it2 = boost::begin(ml2); it2 != boost::end(ml2); ++it2)
{
out = intersection_linestring_linestring_point<PointOut>
::apply(*it1, *it2, robust_policy, out, strategy);
@ -103,12 +93,7 @@ struct intersection_linestring_multi_linestring_point
OutputIterator out,
Strategy const& strategy)
{
for (typename boost::range_iterator
<
MultiLinestring const
>::type it = boost::begin(ml);
it != boost::end(ml);
++it)
for (auto it = boost::begin(ml); it != boost::end(ml); ++it)
{
out = intersection_linestring_linestring_point<PointOut>
::apply(linestring, *it, robust_policy, out, strategy);
@ -141,12 +126,7 @@ struct intersection_of_multi_linestring_with_areal
OutputIterator out,
Strategy const& strategy)
{
for (typename boost::range_iterator
<
MultiLinestring const
>::type it = boost::begin(ml);
it != boost::end(ml);
++it)
for (auto it = boost::begin(ml); it != boost::end(ml); ++it)
{
out = intersection_of_linestring_with_areal
<
@ -205,9 +185,7 @@ struct clip_multi_linestring
{
typedef typename point_type<LinestringOut>::type point_type;
strategy::intersection::liang_barsky<Box, point_type> lb_strategy;
for (typename boost::range_iterator<MultiLinestring const>::type it
= boost::begin(multi_linestring);
it != boost::end(multi_linestring); ++it)
for (auto it = boost::begin(multi_linestring); it != boost::end(multi_linestring); ++it)
{
out = detail::intersection::clip_range_with_box
<LinestringOut>(box, *it, robust_policy, out, lb_strategy);

View File

@ -69,9 +69,7 @@ struct debug_boundary_points_printer<MultiLinestring, multi_linestring_tag>
typedef std::vector<point_type> point_vector;
point_vector boundary_points;
for (typename boost::range_iterator<MultiLinestring const>::type it
= boost::begin(multilinestring);
it != boost::end(multilinestring); ++it)
for (auto it = boost::begin(multilinestring); it != boost::end(multilinestring); ++it)
{
if ( boost::size(*it) > 1
&& !geometry::equals(range::front(*it), range::back(*it)) )
@ -85,11 +83,9 @@ struct debug_boundary_points_printer<MultiLinestring, multi_linestring_tag>
geometry::less<point_type>());
std::cout << "boundary points: ";
for (typename point_vector::const_iterator
pit = boundary_points.begin();
pit != boundary_points.end(); ++pit)
for (auto const& p : boundary_points)
{
std::cout << " " << geometry::dsv(*pit);
std::cout << " " << geometry::dsv(p);
}
std::cout << std::endl << std::endl;
}

View File

@ -56,7 +56,9 @@ struct has_spikes
Strategy const& strategy)
{
if (first == last)
{
return last;
}
auto const& front = *first;
++first;
return std::find_if(first, last, [&](auto const& pt) {
@ -71,18 +73,12 @@ struct has_spikes
{
boost::ignore_unused(visitor);
typedef typename boost::range_iterator<View const>::type iterator;
auto cur = boost::begin(view);
auto prev = find_different_from_first(boost::rbegin(view),
boost::rend(view),
strategy);
iterator cur = boost::begin(view);
typename boost::range_reverse_iterator
<
View const
>::type prev = find_different_from_first(boost::rbegin(view),
boost::rend(view),
strategy);
iterator next = find_different_from_first(cur, boost::end(view),
strategy);
auto next = find_different_from_first(cur, boost::end(view), strategy);
if (detail::is_spike_or_equal(*next, *cur, *prev, strategy.side()))
{
return ! visitor.template apply<failure_spikes>(is_linear, *cur);
@ -131,8 +127,7 @@ struct has_spikes
// also in geographic cases going over the pole
if (detail::is_spike_or_equal(*next, *cur, *prev, strategy.side()))
{
return
! visitor.template apply<failure_spikes>(is_linestring, *cur);
return ! visitor.template apply<failure_spikes>(is_linestring, *cur);
}
prev = cur;
cur = next;

View File

@ -36,10 +36,7 @@ struct multi_modify_with_predicate
{
static inline void apply(MultiGeometry& multi, Predicate const& predicate)
{
typedef typename boost::range_iterator<MultiGeometry>::type iterator_type;
for (iterator_type it = boost::begin(multi);
it != boost::end(multi);
++it)
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
{
Policy::apply(*it, predicate);
}

View File

@ -31,15 +31,10 @@ namespace detail
struct multi_sum
{
template <typename ReturnType, typename Policy, typename MultiGeometry, typename Strategy>
static inline ReturnType apply(MultiGeometry const& geometry, Strategy const& strategy)
static inline ReturnType apply(MultiGeometry const& multi, Strategy const& strategy)
{
ReturnType sum = ReturnType();
for (typename boost::range_iterator
<
MultiGeometry const
>::type it = boost::begin(geometry);
it != boost::end(geometry);
++it)
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
{
sum += Policy::apply(*it, strategy);
}

View File

@ -48,8 +48,6 @@ struct num_distinct_consecutive_points
template <typename Strategy>
static inline std::size_t apply(Range const& range, Strategy const& strategy)
{
typedef typename boost::range_iterator<Range const>::type iterator;
std::size_t const size = boost::size(range);
if ( size < 2u )
@ -57,13 +55,13 @@ struct num_distinct_consecutive_points
return (size < MaximumNumber) ? size : MaximumNumber;
}
iterator current = boost::begin(range);
iterator const end = boost::end(range);
auto current = boost::begin(range);
auto const end = boost::end(range);
std::size_t counter(0);
do
{
++counter;
iterator next = std::find_if(current, end, [&](auto const& pt) {
auto next = std::find_if(current, end, [&](auto const& pt) {
return ! equals::equals_point_point(pt, *current, strategy);
});
current = next;

View File

@ -96,8 +96,6 @@ inline OutputIterator add_rings(SelectionMap const& map,
Strategy const& strategy,
add_rings_error_handling error_handling = add_rings_ignore_unordered)
{
typedef typename SelectionMap::const_iterator iterator;
std::size_t const min_num_points = core_detail::closure::minimum_ring_size
<
geometry::closure
@ -110,29 +108,23 @@ inline OutputIterator add_rings(SelectionMap const& map,
>::value;
for (iterator it = boost::begin(map);
it != boost::end(map);
++it)
for (auto const& pair : map)
{
if (! it->second.discarded
&& it->second.parent.source_index == -1)
if (! pair.second.discarded
&& pair.second.parent.source_index == -1)
{
GeometryOut result;
convert_and_add(result, geometry1, geometry2, collection,
it->first, it->second.reversed, false);
pair.first, pair.second.reversed, false);
// Add children
for (typename std::vector<ring_identifier>::const_iterator child_it
= it->second.children.begin();
child_it != it->second.children.end();
++child_it)
for (auto const& child : pair.second.children)
{
iterator mit = map.find(*child_it);
if (mit != map.end()
&& ! mit->second.discarded)
auto mit = map.find(child);
if (mit != map.end() && ! mit->second.discarded)
{
convert_and_add(result, geometry1, geometry2, collection,
*child_it, mit->second.reversed, true);
child, mit->second.reversed, true);
}
}

View File

@ -174,7 +174,6 @@ inline void clean_closing_dups_and_spikes(Range& range,
return;
}
typedef typename boost::range_iterator<Range>::type iterator_type;
static bool const closed = geometry::closure<Range>::value == geometry::closed;
// TODO: the following algorithm could be rewritten to first look for spikes
@ -184,9 +183,9 @@ inline void clean_closing_dups_and_spikes(Range& range,
do
{
found = false;
iterator_type first = boost::begin(range);
iterator_type second = first + 1;
iterator_type ultimate = boost::end(range) - 1;
auto first = boost::begin(range);
auto second = first + 1;
auto ultimate = boost::end(range) - 1;
if (BOOST_GEOMETRY_CONDITION(closed))
{
ultimate--;

View File

@ -26,6 +26,7 @@
#include <boost/geometry/algorithms/detail/overlay/range_in_geometry.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/util/for_each_with_index.hpp>
namespace boost { namespace geometry
{
@ -260,38 +261,31 @@ inline void assign_parents(Geometry1 const& geometry1,
point_type, Strategy // TODO: point_type is technically incorrect
>::type area_result_type;
typedef typename RingMap::iterator map_iterator_type;
{
typedef ring_info_helper<point_type, area_result_type> helper;
typedef std::vector<helper> vector_type;
typedef typename boost::range_iterator<vector_type const>::type vector_iterator_type;
std::size_t count_total = ring_map.size();
std::size_t count_positive = 0;
std::size_t index_positive = 0; // only used if count_positive>0
std::size_t index = 0;
// Copy to vector (with new approach this might be obsolete as well, using the map directly)
vector_type vector(count_total);
// Copy to vector (this might be obsolete, using the map directly)
using helper = ring_info_helper<point_type, area_result_type>;
std::vector<helper> vector(count_total);
for (map_iterator_type it = boost::begin(ring_map);
it != boost::end(ring_map); ++it, ++index)
for_each_with_index(ring_map, [&](std::size_t index, auto const& pair)
{
vector[index] = helper(it->first, it->second.get_area());
vector[index] = helper(pair.first, pair.second.get_area());
helper& item = vector[index];
switch(it->first.source_index)
switch(pair.first.source_index)
{
case 0 :
geometry::envelope(get_ring<tag1>::apply(it->first, geometry1),
geometry::envelope(get_ring<tag1>::apply(pair.first, geometry1),
item.envelope, strategy);
break;
case 1 :
geometry::envelope(get_ring<tag2>::apply(it->first, geometry2),
geometry::envelope(get_ring<tag2>::apply(pair.first, geometry2),
item.envelope, strategy);
break;
case 2 :
geometry::envelope(get_ring<void>::apply(it->first, collection),
geometry::envelope(get_ring<void>::apply(pair.first, collection),
item.envelope, strategy);
break;
}
@ -304,7 +298,7 @@ inline void assign_parents(Geometry1 const& geometry1,
count_positive++;
index_positive = index;
}
}
});
if (! check_for_orientation)
{
@ -325,17 +319,15 @@ inline void assign_parents(Geometry1 const& geometry1,
// located outside the outer ring, this cannot be done
ring_identifier id_of_positive = vector[index_positive].id;
ring_info_type& outer = ring_map[id_of_positive];
index = 0;
for (vector_iterator_type it = boost::begin(vector);
it != boost::end(vector); ++it, ++index)
for_each_with_index(vector, [&](std::size_t index, auto const& item)
{
if (index != index_positive)
{
ring_info_type& inner = ring_map[it->id];
ring_info_type& inner = ring_map[item.id];
inner.parent = id_of_positive;
outer.children.push_back(it->id);
outer.children.push_back(item.id);
}
}
});
return;
}
}
@ -357,10 +349,9 @@ inline void assign_parents(Geometry1 const& geometry1,
if (check_for_orientation)
{
for (map_iterator_type it = boost::begin(ring_map);
it != boost::end(ring_map); ++it)
for (auto& pair : ring_map)
{
ring_info_type& info = it->second;
ring_info_type& info = pair.second;
if (geometry::math::equals(info.get_area(), 0))
{
info.discarded = true;
@ -397,12 +388,11 @@ inline void assign_parents(Geometry1 const& geometry1,
}
// Assign childlist
for (map_iterator_type it = boost::begin(ring_map);
it != boost::end(ring_map); ++it)
for (auto& pair : ring_map)
{
if (it->second.parent.source_index >= 0)
if (pair.second.parent.source_index >= 0)
{
ring_map[it->second.parent].children.push_back(it->first);
ring_map[pair.second.parent].children.push_back(pair.first);
}
}
}

View File

@ -38,21 +38,11 @@ namespace detail { namespace overlay
template <typename Turns>
inline void clear_visit_info(Turns& turns)
{
typedef typename boost::range_value<Turns>::type tp_type;
for (typename boost::range_iterator<Turns>::type
it = boost::begin(turns);
it != boost::end(turns);
++it)
for (auto& turn : turns)
{
for (typename boost::range_iterator
<
typename tp_type::container_type
>::type op_it = boost::begin(it->operations);
op_it != boost::end(it->operations);
++op_it)
for (auto& op : turn.operations)
{
op_it->visited.clear();
op.visited.clear();
}
}
}

View File

@ -127,37 +127,30 @@ inline bool check_graph(TurnPoints& turn_points, operation_type for_operation)
typedef typename boost::range_value<TurnPoints>::type turn_point_type;
bool error = false;
int index = 0;
std::vector<meta_turn<turn_point_type> > meta_turns;
for (typename boost::range_iterator<TurnPoints const>::type
it = boost::begin(turn_points);
it != boost::end(turn_points);
++it, ++index)
for_each_with_index(turn_points, [&](std::size_t index, auto const& point)
{
meta_turns.push_back(meta_turn<turn_point_type>(index, *it));
}
meta_turns.push_back(meta_turn<turn_point_type>(index, point));
});
int cycle = 0;
for (typename boost::range_iterator<std::vector<meta_turn<turn_point_type> > > ::type
it = boost::begin(meta_turns);
it != boost::end(meta_turns);
++it)
for (auto& meta_turn : meta_turns)
{
if (! (it->turn->blocked() || it->turn->discarded))
if (! (meta_turn.turn->blocked() || meta_turn.turn->discarded))
{
for (int i = 0 ; i < 2; i++)
{
if (! it->handled[i]
&& it->turn->operations[i].operation == for_operation)
if (! meta_turn.handled[i]
&& meta_turn.turn->operations[i].operation == for_operation)
{
#ifdef BOOST_GEOMETRY_DEBUG_ENRICH
std::cout << "CYCLE " << cycle << std::endl;
#endif
it->handled[i] = true;
check_detailed(meta_turns, *it, i, cycle++, it->index, for_operation, error);
meta_turn.handled[i] = true;
check_detailed(meta_turns, meta_turn, i, cycle++, meta_turn.index, for_operation, error);
#ifdef BOOST_GEOMETRY_DEBUG_ENRICH
std::cout <<" END CYCLE " << it->index << std::endl;
std::cout <<" END CYCLE " << meta_turn.index << std::endl;
#endif
}
}

View File

@ -197,9 +197,8 @@ OutputIterator clip_range_with_box(Box const& b, Range const& range,
OutputLinestring line_out;
typedef typename boost::range_iterator<Range const>::type iterator_type;
iterator_type vertex = boost::begin(range);
for(iterator_type previous = vertex++;
auto vertex = boost::begin(range);
for (auto previous = vertex++;
vertex != boost::end(range);
++previous, ++vertex)
{

View File

@ -67,16 +67,11 @@ private :
signed_size_type rank_index;
};
typedef typename std::vector<linked_turn_op_info>::const_iterator const_it_type;
typedef typename std::vector<linked_turn_op_info>::iterator it_type;
typedef typename std::set<signed_size_type>::const_iterator sit_type;
inline signed_size_type get_rank(Sbs const& sbs,
linked_turn_op_info const& info) const
{
for (std::size_t i = 0; i < sbs.m_ranked_points.size(); i++)
for (auto const& rp : sbs.m_ranked_points)
{
typename Sbs::rp const& rp = sbs.m_ranked_points[i];
if (rp.turn_index == info.turn_index
&& rp.operation_index == info.op_index
&& rp.direction == sort_by_side::dir_to)
@ -95,9 +90,8 @@ private :
bool collect(Turns const& turns)
{
for (sit_type it = m_ids.begin(); it != m_ids.end(); ++it)
for (auto cluster_turn_index : m_ids)
{
signed_size_type cluster_turn_index = *it;
turn_type const& cluster_turn = turns[cluster_turn_index];
if (cluster_turn.discarded)
{
@ -148,23 +142,19 @@ private :
return true;
}
for (it_type it = possibilities.begin(); it != possibilities.end(); ++it)
for (auto& info : possibilities)
{
linked_turn_op_info& info = *it;
info.rank_index = get_rank(sbs, info);
}
for (it_type it = blocked.begin(); it != blocked.end(); ++it)
for (auto& info : blocked)
{
linked_turn_op_info& info = *it;
info.rank_index = get_rank(sbs, info);
}
for (const_it_type it = possibilities.begin(); it != possibilities.end(); ++it)
for (auto const& lti : possibilities)
{
linked_turn_op_info const& lti = *it;
for (const_it_type bit = blocked.begin(); bit != blocked.end(); ++bit)
for (auto const& blti : blocked)
{
linked_turn_op_info const& blti = *bit;
if (blti.next_turn_index == lti.next_turn_index
&& blti.rank_index == lti.rank_index)
{
@ -198,10 +188,8 @@ public :
// If there is one (and only one) possibility pointing outside
// the cluster, take that one.
linked_turn_op_info target;
for (const_it_type it = possibilities.begin();
it != possibilities.end(); ++it)
for (auto const& lti : possibilities)
{
linked_turn_op_info const& lti = *it;
if (m_ids.count(lti.next_turn_index) == 0)
{
if (target.turn_index >= 0

View File

@ -86,6 +86,7 @@ struct convert_ring<polygon_tag>
if (geometry::num_points(source) >= min_num_points)
{
// TODO: resize and .size() and .back() should not be called here
interior_rings(destination).resize(
interior_rings(destination).size() + 1);
geometry::convert(source, interior_rings(destination).back());

View File

@ -167,10 +167,7 @@ public:
}
signed_size_type const count = to_index - from_index + 1;
typename boost::range_iterator<LineString const>::type
it = boost::begin(ls) + from_index;
auto it = boost::begin(ls) + from_index;
for (signed_size_type i = 0; i < count; ++i, ++it)
{
append_to_output(current_output, *it, strategy, robust_policy,

View File

@ -422,13 +422,6 @@ public :
OutputIterator out,
Strategy const& strategy)
{
typedef typename boost::range_iterator<Turns>::type turn_iterator;
typedef typename boost::range_value<Turns>::type turn_type;
typedef typename boost::range_iterator
<
typename turn_type::container_type
>::type turn_operation_iterator_type;
typedef following::action_selector<OverlayType, RemoveSpikes> action;
// Sort intersection points on segments-along-linestring, and distance
@ -448,51 +441,51 @@ public :
// Iterate through all intersection points (they are ordered along the line)
bool entered = false;
bool first = true;
for (turn_iterator it = boost::begin(turns); it != boost::end(turns); ++it)
for (auto const& turn : turns)
{
turn_operation_iterator_type iit = boost::begin(it->operations);
auto const& op = turn.operations[0];
if (following::was_entered(*it, *iit, first, linestring, polygon, strategy))
if (following::was_entered(turn, op, first, linestring, polygon, strategy))
{
debug_traverse(*it, *iit, "-> Was entered");
debug_traverse(turn, op, "-> Was entered");
entered = true;
}
if (following::is_staying_inside(*it, *iit, entered, first, linestring, polygon, strategy))
if (following::is_staying_inside(turn, op, entered, first, linestring, polygon, strategy))
{
debug_traverse(*it, *iit, "-> Staying inside");
debug_traverse(turn, op, "-> Staying inside");
entered = true;
}
else if (following::is_entering(*it, *iit))
else if (following::is_entering(turn, op))
{
debug_traverse(*it, *iit, "-> Entering");
debug_traverse(turn, op, "-> Entering");
entered = true;
action::enter(current_piece, linestring, current_segment_id,
iit->seg_id.segment_index, it->point, *iit,
op.seg_id.segment_index, turn.point, op,
strategy, robust_policy,
linear::get(out));
}
else if (following::is_leaving(*it, *iit, entered, first, linestring, polygon, strategy))
else if (following::is_leaving(turn, op, entered, first, linestring, polygon, strategy))
{
debug_traverse(*it, *iit, "-> Leaving");
debug_traverse(turn, op, "-> Leaving");
entered = false;
action::leave(current_piece, linestring, current_segment_id,
iit->seg_id.segment_index, it->point, *iit,
op.seg_id.segment_index, turn.point, op,
strategy, robust_policy,
linear::get(out));
}
else if (BOOST_GEOMETRY_CONDITION(FollowIsolatedPoints)
&& following::is_touching(*it, *iit, entered))
&& following::is_touching(turn, op, entered))
{
debug_traverse(*it, *iit, "-> Isolated point");
debug_traverse(turn, op, "-> Isolated point");
action::template isolated_point
<
typename pointlike::type
>(it->point, pointlike::get(out));
>(turn.point, pointlike::get(out));
}
first = false;

View File

@ -29,7 +29,6 @@
#include <boost/geometry/algorithms/detail/disjoint/box_box.hpp>
#include <boost/geometry/algorithms/detail/disjoint/point_point.hpp>
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turn_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turn_info_ll.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turn_info_la.hpp>
@ -842,10 +841,8 @@ struct get_turns_polygon_cs
signed_size_type i = 0;
typename interior_return_type<Polygon const>::type
rings = interior_rings(polygon);
for (typename detail::interior_iterator<Polygon const>::type
it = boost::begin(rings); it != boost::end(rings); ++it, ++i)
auto const& rings = interior_rings(polygon);
for (auto it = boost::begin(rings); it != boost::end(rings); ++it, ++i)
{
intersector_type::apply(
source_id1, *it,
@ -877,15 +874,8 @@ struct get_turns_multi_polygon_cs
Turns& turns,
InterruptPolicy& interrupt_policy)
{
typedef typename boost::range_iterator
<
Multi const
>::type iterator_type;
signed_size_type i = 0;
for (iterator_type it = boost::begin(multi);
it != boost::end(multi);
++it, ++i)
for (auto it = boost::begin(multi); it != boost::end(multi); ++it, ++i)
{
// Call its single version
get_turns_polygon_cs

View File

@ -82,8 +82,8 @@ inline void cleanup_clusters(Turns& turns, Clusters& clusters)
for (auto& pair : clusters)
{
auto& cinfo = pair.second;
auto& ids = cinfo.turn_indices;
for (auto sit = ids.begin(); sit != ids.end(); /* no increment */)
auto& indices = cinfo.turn_indices;
for (auto sit = indices.begin(); sit != indices.end(); /* no increment */)
{
auto current_it = sit;
++sit;
@ -91,7 +91,7 @@ inline void cleanup_clusters(Turns& turns, Clusters& clusters)
auto const turn_index = *current_it;
if (turns[turn_index].discarded)
{
ids.erase(current_it);
indices.erase(current_it);
}
}
}
@ -100,14 +100,14 @@ inline void cleanup_clusters(Turns& turns, Clusters& clusters)
colocate_clusters(clusters, turns);
}
template <typename Turn, typename IdSet>
inline void discard_colocated_turn(Turn& turn, IdSet& ids, signed_size_type id)
template <typename Turn, typename IndexSet>
inline void discard_colocated_turn(Turn& turn, IndexSet& indices, signed_size_type index)
{
turn.discarded = true;
// Set cluster id to -1, but don't clear colocated flags
turn.cluster_id = -1;
// To remove it later from clusters
ids.insert(id);
indices.insert(index);
}
template <bool Reverse>
@ -167,22 +167,17 @@ template
>
inline void discard_interior_exterior_turns(Turns& turns, Clusters& clusters)
{
typedef std::set<signed_size_type>::const_iterator set_iterator;
typedef typename boost::range_value<Turns>::type turn_type;
std::set<signed_size_type> indices_to_remove;
std::set<signed_size_type> ids_to_remove;
for (typename Clusters::iterator cit = clusters.begin();
cit != clusters.end(); ++cit)
for (auto& pair : clusters)
{
cluster_info& cinfo = cit->second;
std::set<signed_size_type>& ids = cinfo.turn_indices;
cluster_info& cinfo = pair.second;
ids_to_remove.clear();
indices_to_remove.clear();
for (set_iterator it = ids.begin(); it != ids.end(); ++it)
for (auto index : cinfo.turn_indices)
{
turn_type& turn = turns[*it];
auto& turn = turns[index];
segment_identifier const& seg_0 = turn.operations[0].seg_id;
segment_identifier const& seg_1 = turn.operations[1].seg_id;
@ -193,34 +188,33 @@ inline void discard_interior_exterior_turns(Turns& turns, Clusters& clusters)
continue;
}
for (set_iterator int_it = ids.begin(); int_it != ids.end(); ++int_it)
for (auto interior_index : cinfo.turn_indices)
{
if (*it == *int_it)
if (index == interior_index)
{
continue;
}
// Turn with, possibly, an interior ring involved
turn_type& int_turn = turns[*int_it];
segment_identifier const& int_seg_0 = int_turn.operations[0].seg_id;
segment_identifier const& int_seg_1 = int_turn.operations[1].seg_id;
auto& interior_turn = turns[interior_index];
segment_identifier const& int_seg_0 = interior_turn.operations[0].seg_id;
segment_identifier const& int_seg_1 = interior_turn.operations[1].seg_id;
if (is_ie_turn<Reverse0, Reverse1>(seg_0, seg_1, int_seg_0, int_seg_1))
{
discard_colocated_turn(int_turn, ids_to_remove, *int_it);
discard_colocated_turn(interior_turn, indices_to_remove, interior_index);
}
if (is_ie_turn<Reverse1, Reverse0>(seg_1, seg_0, int_seg_1, int_seg_0))
{
discard_colocated_turn(int_turn, ids_to_remove, *int_it);
discard_colocated_turn(interior_turn, indices_to_remove, interior_index);
}
}
}
// Erase from the ids (which cannot be done above)
for (set_iterator sit = ids_to_remove.begin();
sit != ids_to_remove.end(); ++sit)
// Erase from the indices (which cannot be done above)
for (auto index : indices_to_remove)
{
ids.erase(*sit);
cinfo.turn_indices.erase(index);
}
}
}
@ -233,19 +227,14 @@ template
>
inline void set_colocation(Turns& turns, Clusters const& clusters)
{
typedef std::set<signed_size_type>::const_iterator set_iterator;
typedef typename boost::range_value<Turns>::type turn_type;
for (typename Clusters::const_iterator cit = clusters.begin();
cit != clusters.end(); ++cit)
for (auto const& pair : clusters)
{
cluster_info const& cinfo = cit->second;
std::set<signed_size_type> const& ids = cinfo.turn_indices;
cluster_info const& cinfo = pair.second;
bool both_target = false;
for (set_iterator it = ids.begin(); it != ids.end(); ++it)
for (auto index : cinfo.turn_indices)
{
turn_type const& turn = turns[*it];
auto const& turn = turns[index];
if (turn.both(operation_from_overlay<OverlayType>::value))
{
both_target = true;
@ -255,9 +244,9 @@ inline void set_colocation(Turns& turns, Clusters const& clusters)
if (both_target)
{
for (set_iterator it = ids.begin(); it != ids.end(); ++it)
for (auto index : cinfo.turn_indices)
{
turn_type& turn = turns[*it];
auto& turn = turns[index];
turn.has_colocated_both = true;
}
}
@ -276,7 +265,7 @@ inline void check_colocation(bool& has_blocked,
has_blocked = false;
typename Clusters::const_iterator mit = clusters.find(cluster_id);
auto mit = clusters.find(cluster_id);
if (mit == clusters.end())
{
return;
@ -284,11 +273,9 @@ inline void check_colocation(bool& has_blocked,
cluster_info const& cinfo = mit->second;
for (std::set<signed_size_type>::const_iterator it
= cinfo.turn_indices.begin();
it != cinfo.turn_indices.end(); ++it)
for (auto index : cinfo.turn_indices)
{
turn_type const& turn = turns[*it];
turn_type const& turn = turns[index];
if (turn.any_blocked())
{
has_blocked = true;
@ -410,21 +397,15 @@ inline bool fill_sbs(Sbs& sbs, Point& turn_point,
Turns const& turns,
Geometry1 const& geometry1, Geometry2 const& geometry2)
{
typedef typename boost::range_value<Turns>::type turn_type;
std::set<signed_size_type> const& ids = cinfo.turn_indices;
if (ids.empty())
if (cinfo.turn_indices.empty())
{
return false;
}
bool first = true;
for (std::set<signed_size_type>::const_iterator sit = ids.begin();
sit != ids.end(); ++sit)
for (auto turn_index : cinfo.turn_indices)
{
signed_size_type turn_index = *sit;
turn_type const& turn = turns[turn_index];
auto const& turn = turns[turn_index];
if (first)
{
turn_point = turn.point;
@ -464,10 +445,9 @@ inline void gather_cluster_properties(Clusters& clusters, Turns& turns,
Reverse1, Reverse2, OverlayType, point_type, SideStrategy, std::less<int>
> sbs_type;
for (typename Clusters::iterator mit = clusters.begin();
mit != clusters.end(); ++mit)
for (auto& pair : clusters)
{
cluster_info& cinfo = mit->second;
cluster_info& cinfo = pair.second;
sbs_type sbs(strategy);
point_type turn_point; // should be all the same for all turns in cluster

View File

@ -106,15 +106,8 @@ struct discard_closed_turns<overlay_union, operation_union>
Geometry0 const& geometry0, Geometry1 const& geometry1,
Strategy const& strategy)
{
typedef typename boost::range_value<Turns>::type turn_type;
for (typename boost::range_iterator<Turns>::type
it = boost::begin(turns);
it != boost::end(turns);
++it)
for (auto& turn : turns)
{
turn_type& turn = *it;
if (! turn.discarded
&& is_self_turn<overlay_union>(turn)
&& check_within<overlay_union>::apply(turn, geometry0,
@ -137,18 +130,16 @@ private :
bool is_self_cluster(signed_size_type cluster_id,
const Turns& turns, Clusters const& clusters)
{
typename Clusters::const_iterator cit = clusters.find(cluster_id);
auto cit = clusters.find(cluster_id);
if (cit == clusters.end())
{
return false;
}
cluster_info const& cinfo = cit->second;
for (std::set<signed_size_type>::const_iterator it
= cinfo.turn_indices.begin();
it != cinfo.turn_indices.end(); ++it)
for (auto index : cinfo.turn_indices)
{
if (! is_self_turn<OverlayType>(turns[*it]))
if (! is_self_turn<OverlayType>(turns[index]))
{
return false;
}
@ -164,28 +155,25 @@ private :
Geometry0 const& geometry0, Geometry1 const& geometry1,
Strategy const& strategy)
{
for (typename Clusters::const_iterator cit = clusters.begin();
cit != clusters.end(); ++cit)
for (auto const& pair : clusters)
{
signed_size_type const cluster_id = cit->first;
signed_size_type const cluster_id = pair.first;
cluster_info const& cinfo = pair.second;
// If there are only self-turns in the cluster, the cluster should
// be located within the other geometry, for intersection
if (! cit->second.turn_indices.empty()
if (! cinfo.turn_indices.empty()
&& is_self_cluster(cluster_id, turns, clusters))
{
cluster_info const& cinfo = cit->second;
signed_size_type const index = *cinfo.turn_indices.begin();
if (! check_within<OverlayType>::apply(turns[index],
geometry0, geometry1,
strategy))
{
// Discard all turns in cluster
for (std::set<signed_size_type>::const_iterator sit
= cinfo.turn_indices.begin();
sit != cinfo.turn_indices.end(); ++sit)
for (auto index : cinfo.turn_indices)
{
turns[*sit].discarded = true;
turns[index].discarded = true;
}
}
}
@ -203,15 +191,8 @@ public :
{
discard_clusters(turns, clusters, geometry0, geometry1, strategy);
typedef typename boost::range_value<Turns>::type turn_type;
for (typename boost::range_iterator<Turns>::type
it = boost::begin(turns);
it != boost::end(turns);
++it)
for (auto& turn : turns)
{
turn_type& turn = *it;
// It is a ii self-turn
// Check if it is within the other geometry
if (! turn.discarded

View File

@ -59,6 +59,7 @@
#if defined(BOOST_GEOMETRY_DEBUG_FOLLOW)
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/util/for_each_with_index.hpp>
#endif
namespace boost { namespace geometry
@ -145,11 +146,10 @@ struct intersection_linestring_linestring_point
geometry::get_intersection_points(linestring1, linestring2,
robust_policy, turns, strategy);
for (typename boost::range_iterator<std::deque<turn_info> const>::type
it = boost::begin(turns); it != boost::end(turns); ++it)
for (auto const& turn : turns)
{
PointOut p;
geometry::convert(it->point, p);
geometry::convert(turn.point, p);
*out++ = p;
}
return out;
@ -212,11 +212,10 @@ struct intersection_of_linestring_with_areal
bool found_union = false;
bool found_front = false;
for (typename Turns::const_iterator it = turns.begin();
it != turns.end(); ++it)
for (auto const& turn : turns)
{
method_type const method = it->method;
operation_type const op = it->operations[0].operation;
method_type const method = turn.method;
operation_type const op = turn.operations[0].operation;
if (method == method_crosses)
{
@ -240,7 +239,7 @@ struct intersection_of_linestring_with_areal
return false;
}
if (it->operations[0].position == position_front)
if (turn.operations[0].position == position_front)
{
found_front = true;
}
@ -380,12 +379,10 @@ struct intersection_of_linestring_with_areal
}
#if defined(BOOST_GEOMETRY_DEBUG_FOLLOW)
int index = 0;
for(typename std::deque<turn_info>::const_iterator
it = turns.begin(); it != turns.end(); ++it)
for_each_with_index(turns, [](auto index, auto const& turn)
{
debug_follow(*it, it->operations[0], index++);
}
debug_follow(turn, turn.operations[0], index);
});
#endif
return follower::apply
@ -402,10 +399,9 @@ template <typename Turns, typename OutputIterator>
inline OutputIterator intersection_output_turn_points(Turns const& turns,
OutputIterator out)
{
for (typename Turns::const_iterator
it = turns.begin(); it != turns.end(); ++it)
for (auto const& turn : turns)
{
*out++ = it->point;
*out++ = turn.point;
}
return out;

View File

@ -82,9 +82,7 @@ struct linear_linear_no_intersections
static inline OutputIterator apply(MultiLineString const& multilinestring,
OutputIterator oit)
{
for (typename boost::range_iterator<MultiLineString const>::type
it = boost::begin(multilinestring);
it != boost::end(multilinestring); ++it)
for (auto it = boost::begin(multilinestring); it != boost::end(multilinestring); ++it)
{
LineStringOut ls_out;
geometry::convert(*it, ls_out);

View File

@ -103,10 +103,6 @@ template
>
inline void get_ring_turn_info(TurnInfoMap& turn_info_map, Turns const& turns, Clusters const& clusters)
{
typedef typename boost::range_value<Turns>::type turn_type;
typedef typename turn_type::turn_operation_type turn_operation_type;
typedef typename turn_type::container_type container_type;
static const operation_type target_operation
= operation_from_overlay<OverlayType>::value;
static const operation_type opposite_operation
@ -114,13 +110,8 @@ inline void get_ring_turn_info(TurnInfoMap& turn_info_map, Turns const& turns, C
? operation_intersection
: operation_union;
for (typename boost::range_iterator<Turns const>::type
it = boost::begin(turns);
it != boost::end(turns);
++it)
for (auto const& turn : turns)
{
turn_type const& turn = *it;
bool cluster_checked = false;
bool has_blocked = false;
@ -130,12 +121,8 @@ inline void get_ring_turn_info(TurnInfoMap& turn_info_map, Turns const& turns, C
continue;
}
for (typename boost::range_iterator<container_type const>::type
op_it = boost::begin(turn.operations);
op_it != boost::end(turn.operations);
++op_it)
for (auto const& op : turn.operations)
{
turn_operation_type const& op = *op_it;
ring_identifier const ring_id = ring_id_by_seg_id(op.seg_id);
if (! is_self_turn<OverlayType>(turn)

View File

@ -98,10 +98,7 @@ struct multipoint_single_point
OutputIterator oit,
Strategy const& strategy)
{
for (typename boost::range_iterator<MultiPoint const>::type
it = boost::begin(multipoint);
it != boost::end(multipoint);
++it)
for (auto it = boost::begin(multipoint); it != boost::end(multipoint); ++it)
{
action_selector_pl
<

View File

@ -75,9 +75,7 @@ struct copy_points<PointOut, MultiPointIn, multi_point_tag>
static inline void apply(MultiPointIn const& multi_point_in,
OutputIterator& oit)
{
for (typename boost::range_iterator<MultiPointIn const>::type
it = boost::begin(multi_point_in);
it != boost::end(multi_point_in); ++it)
for (auto it = boost::begin(multi_point_in); it != boost::end(multi_point_in); ++it)
{
PointOut point_out;
geometry::convert(*it, point_out);
@ -189,9 +187,7 @@ struct multipoint_point_point
{
BOOST_GEOMETRY_ASSERT( OverlayType == overlay_difference );
for (typename boost::range_iterator<MultiPoint const>::type
it = boost::begin(multipoint);
it != boost::end(multipoint); ++it)
for (auto it = boost::begin(multipoint); it != boost::end(multipoint); ++it)
{
action_selector_pl
<
@ -225,9 +221,7 @@ struct point_multipoint_point
{
typedef action_selector_pl<PointOut, OverlayType> action;
for (typename boost::range_iterator<MultiPoint const>::type
it = boost::begin(multipoint);
it != boost::end(multipoint); ++it)
for (auto it = boost::begin(multipoint); it != boost::end(multipoint); ++it)
{
if ( detail::equals::equals_point_point(*it, point, strategy) )
{
@ -279,9 +273,7 @@ struct multipoint_multipoint_point
less_type const less = less_type();
std::sort(points2.begin(), points2.end(), less);
for (typename boost::range_iterator<MultiPoint1 const>::type
it1 = boost::begin(multipoint1);
it1 != boost::end(multipoint1); ++it1)
for (auto it1 = boost::begin(multipoint1); it1 != boost::end(multipoint1); ++it1)
{
bool found = std::binary_search(points2.begin(), points2.end(),
*it1, less);

View File

@ -24,7 +24,6 @@
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/algorithms/detail/covered_by/implementation.hpp>
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
#include <boost/geometry/algorithms/detail/overlay/range_in_geometry.hpp>
#include <boost/geometry/algorithms/detail/overlay/ring_properties.hpp>
#include <boost/geometry/algorithms/detail/overlay/overlay_type.hpp>
@ -119,10 +118,8 @@ namespace dispatch
per_ring::apply(exterior_ring(polygon), geometry, id, ring_properties, strategy);
typename interior_return_type<Polygon const>::type
rings = interior_rings(polygon);
for (typename detail::interior_iterator<Polygon const>::type
it = boost::begin(rings); it != boost::end(rings); ++it)
auto const& rings = interior_rings(polygon);
for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
{
id.ring_index++;
per_ring::apply(*it, geometry, id, ring_properties, strategy);
@ -139,10 +136,8 @@ namespace dispatch
per_ring::apply(exterior_ring(polygon), id, ring_properties, strategy);
typename interior_return_type<Polygon const>::type
rings = interior_rings(polygon);
for (typename detail::interior_iterator<Polygon const>::type
it = boost::begin(rings); it != boost::end(rings); ++it)
auto const& rings = interior_rings(polygon);
for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
{
id.ring_index++;
per_ring::apply(*it, id, ring_properties, strategy);
@ -158,15 +153,10 @@ namespace dispatch
ring_identifier id, RingPropertyMap& ring_properties,
Strategy const& strategy)
{
typedef typename boost::range_iterator
<
Multi const
>::type iterator_type;
typedef select_rings<polygon_tag, typename boost::range_value<Multi>::type> per_polygon;
id.multi_index = 0;
for (iterator_type it = boost::begin(multi); it != boost::end(multi); ++it)
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
{
id.ring_index = -1;
per_polygon::apply(*it, geometry, id, ring_properties, strategy);
@ -254,15 +244,13 @@ inline void update_ring_selection(Geometry1 const& geometry1,
{
selected_ring_properties.clear();
for (typename RingPropertyMap::const_iterator it = boost::begin(all_ring_properties);
it != boost::end(all_ring_properties);
++it)
for (auto const& pair : all_ring_properties)
{
ring_identifier const& id = it->first;
ring_identifier const& id = pair.first;
ring_turn_info info;
typename TurnInfoMap::const_iterator tcit = turn_info_map.find(id);
auto tcit = turn_info_map.find(id);
if (tcit != turn_info_map.end())
{
info = tcit->second; // Copy by value
@ -281,12 +269,12 @@ inline void update_ring_selection(Geometry1 const& geometry1,
{
// within
case 0 :
info.within_other = range_in_geometry(it->second.point,
info.within_other = range_in_geometry(pair.second.point,
geometry1, geometry2,
strategy) > 0;
break;
case 1 :
info.within_other = range_in_geometry(it->second.point,
info.within_other = range_in_geometry(pair.second.point,
geometry2, geometry1,
strategy) > 0;
break;
@ -294,7 +282,7 @@ inline void update_ring_selection(Geometry1 const& geometry1,
if (decide<OverlayType>::include(id, info))
{
typename RingPropertyMap::mapped_type properties = it->second; // Copy by value
auto properties = pair.second; // Copy by value
properties.reversed = decide<OverlayType>::reversed(id, info);
selected_ring_properties[id] = properties;
}

View File

@ -475,7 +475,7 @@ public :
// Move iterator after rank==0
bool has_first = false;
typename container_type::iterator it = m_ranked_points.begin() + 1;
auto it = m_ranked_points.begin() + 1;
for (; it != m_ranked_points.end() && it->rank == 0; ++it)
{
has_first = true;
@ -486,8 +486,7 @@ public :
// Reverse first part (having rank == 0), if any,
// but skip the very first row
std::reverse(m_ranked_points.begin() + 1, it);
for (typename container_type::iterator fit = m_ranked_points.begin();
fit != it; ++fit)
for (auto fit = m_ranked_points.begin(); fit != it; ++fit)
{
BOOST_ASSERT(fit->rank == 0);
}

View File

@ -123,12 +123,8 @@ public :
template <typename TurnInfoMap>
inline void finalize_visit_info(TurnInfoMap& turn_info_map)
{
for (typename boost::range_iterator<Turns>::type
it = boost::begin(m_turns);
it != boost::end(m_turns);
++it)
for (auto& turn : m_turns)
{
turn_type& turn = *it;
for (int i = 0; i < 2; i++)
{
turn_operation_type& op = turn.operations[i];
@ -158,23 +154,18 @@ public :
inline void set_visited_in_cluster(signed_size_type cluster_id,
signed_size_type rank)
{
typename Clusters::const_iterator mit = m_clusters.find(cluster_id);
auto mit = m_clusters.find(cluster_id);
BOOST_ASSERT(mit != m_clusters.end());
cluster_info const& cinfo = mit->second;
std::set<signed_size_type> const& ids = cinfo.turn_indices;
for (typename std::set<signed_size_type>::const_iterator it = ids.begin();
it != ids.end(); ++it)
for (auto turn_index : cinfo.turn_indices)
{
signed_size_type const turn_index = *it;
turn_type& turn = m_turns[turn_index];
for (int i = 0; i < 2; i++)
for (auto& op : turn.operations)
{
turn_operation_type& op = turn.operations[i];
if (op.visited.none()
&& op.enriched.rank == rank)
if (op.visited.none() && op.enriched.rank == rank)
{
op.visited.set_visited();
}
@ -789,21 +780,19 @@ public :
turn_type const& turn = m_turns[turn_index];
BOOST_ASSERT(turn.is_clustered());
typename Clusters::const_iterator mit = m_clusters.find(turn.cluster_id);
auto mit = m_clusters.find(turn.cluster_id);
BOOST_ASSERT(mit != m_clusters.end());
cluster_info const& cinfo = mit->second;
std::set<signed_size_type> const& cluster_indices = cinfo.turn_indices;
sbs_type sbs(m_strategy);
if (! fill_sbs(sbs, turn_index, cluster_indices, previous_seg_id))
if (! fill_sbs(sbs, turn_index, cinfo.turn_indices, previous_seg_id))
{
return false;
}
cluster_exits<OverlayType, Turns, sbs_type> exits(m_turns, cluster_indices, sbs);
cluster_exits<OverlayType, Turns, sbs_type> exits(m_turns, cinfo.turn_indices, sbs);
if (exits.apply(turn_index, op_index))
{
@ -814,7 +803,7 @@ public :
if (is_union)
{
result = select_from_cluster_union(turn_index, cluster_indices,
result = select_from_cluster_union(turn_index, cinfo.turn_indices,
op_index, sbs,
start_turn_index, start_op_index);
if (! result)

View File

@ -42,14 +42,11 @@ class traverse
template <typename Turns>
static void reset_visits(Turns& turns)
{
for (typename boost::range_iterator<Turns>::type
it = boost::begin(turns);
it != boost::end(turns);
++it)
for (auto& turn : turns)
{
for (int i = 0; i < 2; i++)
for (auto& op : turn.operations)
{
it->operations[i].visited.reset();
op.visited.reset();
}
}
}

View File

@ -85,12 +85,7 @@ inline void divide_into_subsets(Box const& lower_box,
IteratorVector& exceeding,
OverlapsPolicy const& overlaps_policy)
{
typedef typename boost::range_iterator
<
IteratorVector const
>::type it_type;
for(it_type it = boost::begin(input); it != boost::end(input); ++it)
for (auto it = boost::begin(input); it != boost::end(input); ++it)
{
bool const lower_overlapping = overlaps_policy.apply(lower_box, **it);
bool const upper_overlapping = overlaps_policy.apply(upper_box, **it);
@ -124,10 +119,9 @@ template
inline void expand_with_elements(Box& total, IteratorVector const& input,
ExpandPolicy const& expand_policy)
{
typedef typename boost::range_iterator<IteratorVector const>::type it_type;
for(it_type it = boost::begin(input); it != boost::end(input); ++it)
for (auto const& it : input)
{
expand_policy.apply(total, **it);
expand_policy.apply(total, *it);
}
}
@ -141,12 +135,10 @@ inline bool handle_one(IteratorVector const& input, VisitPolicy& visitor)
return true;
}
typedef typename boost::range_iterator<IteratorVector const>::type it_type;
// Quadratic behaviour at lowest level (lowest quad, or all exceeding)
for (it_type it1 = boost::begin(input); it1 != boost::end(input); ++it1)
for (auto it1 = boost::begin(input); it1 != boost::end(input); ++it1)
{
it_type it2 = it1;
auto it2 = it1;
for (++it2; it2 != boost::end(input); ++it2)
{
if (! visitor.apply(**it1, **it2))
@ -170,30 +162,17 @@ inline bool handle_two(IteratorVector1 const& input1,
IteratorVector2 const& input2,
VisitPolicy& visitor)
{
typedef typename boost::range_iterator
<
IteratorVector1 const
>::type iterator_type1;
typedef typename boost::range_iterator
<
IteratorVector2 const
>::type iterator_type2;
if (boost::empty(input1) || boost::empty(input2))
{
return true;
}
for(iterator_type1 it1 = boost::begin(input1);
it1 != boost::end(input1);
++it1)
for (auto const& it1 : input1)
{
for(iterator_type2 it2 = boost::begin(input2);
it2 != boost::end(input2);
++it2)
for (auto const& it2 : input2)
{
if (! visitor.apply(**it1, **it2))
if (! visitor.apply(*it1, *it2))
{
return false; // interrupt
}
@ -629,10 +608,7 @@ class partition
IteratorVector& iterator_vector,
ExpandPolicy const& expand_policy)
{
for(typename boost::range_iterator<ForwardRange const>::type
it = boost::begin(forward_range);
it != boost::end(forward_range);
++it)
for (auto it = boost::begin(forward_range); it != boost::end(forward_range); ++it)
{
if (IncludePolicy::apply(*it))
{
@ -712,11 +688,11 @@ public:
}
else
{
for(iterator_type it1 = boost::begin(forward_range);
for(auto it1 = boost::begin(forward_range);
it1 != boost::end(forward_range);
++it1)
{
iterator_type it2 = it1;
auto it2 = it1;
for(++it2; it2 != boost::end(forward_range); ++it2)
{
if (! visitor.apply(*it1, *it2))
@ -849,11 +825,11 @@ public:
}
else
{
for(iterator_type1 it1 = boost::begin(forward_range1);
for (auto it1 = boost::begin(forward_range1);
it1 != boost::end(forward_range1);
++it1)
{
for(iterator_type2 it2 = boost::begin(forward_range2);
for (auto it2 = boost::begin(forward_range2);
it2 != boost::end(forward_range2);
++it2)
{

View File

@ -110,12 +110,7 @@ struct point_on_multi
{
// Take a point on the first multi-geometry
// (i.e. the first that is not empty)
for (typename boost::range_iterator
<
MultiGeometry const
>::type it = boost::begin(multi);
it != boost::end(multi);
++it)
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
{
if (Policy::apply(point, *it))
{

View File

@ -106,13 +106,10 @@ struct range_to_range
typedef recalculate_point<geometry::dimension<point_type>::value> per_point;
geometry::clear(destination);
for (typename boost::range_iterator<Range2 const>::type it
= boost::begin(source);
it != boost::end(source);
++it)
for (auto const& source_point : source)
{
point_type p;
per_point::apply(p, *it, strategy);
per_point::apply(p, source_point, strategy);
geometry::append(destination, p);
}
}

View File

@ -256,11 +256,10 @@ public:
segment_identifier const& other_id = turn.operations[other_op_id].seg_id;
overlay::operation_type exit_op = turn.operations[op_id].operation;
typedef typename std::vector<point_info>::iterator point_iterator;
// search for the entry point in the same range of other geometry
point_iterator entry_it = std::find_if(m_other_entry_points.begin(),
m_other_entry_points.end(),
same_single(other_id));
auto entry_it = std::find_if(m_other_entry_points.begin(),
m_other_entry_points.end(),
same_single(other_id));
// this end point has corresponding entry point
if ( entry_it != m_other_entry_points.end() )

View File

@ -277,7 +277,6 @@ inline bool calculate_from_inside(Geometry1 const& geometry1,
auto const& range1 = sub_range(geometry1, turn.operations[op_id].seg_id);
using range2_view = detail::closed_clockwise_view<typename ring_type<Geometry2>::type const>;
using range2_iterator = typename boost::range_iterator<range2_view const>::type;
range2_view const range2(sub_range(geometry2, turn.operations[other_op_id].seg_id));
BOOST_GEOMETRY_ASSERT(boost::size(range1));
@ -305,10 +304,10 @@ inline bool calculate_from_inside(Geometry1 const& geometry1,
std::size_t const q_seg_jk = (q_seg_ij + 1) % seg_count2;
// TODO: the following function should return immediately, however the worst case complexity is O(N)
// It would be good to replace it with some O(1) mechanism
range2_iterator qk_it = find_next_non_duplicated(boost::begin(range2),
range::pos(range2, q_seg_jk),
boost::end(range2),
strategy);
auto qk_it = find_next_non_duplicated(boost::begin(range2),
range::pos(range2, q_seg_jk),
boost::end(range2),
strategy);
// Calculate sides in a different point order for P and Q
// Will this sequence of points be always correct?

View File

@ -188,8 +188,7 @@ struct multi_point_single_geometry
geometry::envelope(single_geometry, box2, strategy);
geometry::detail::expand_by_epsilon(box2);
typedef typename boost::range_const_iterator<MultiPoint>::type iterator;
for ( iterator it = boost::begin(multi_point) ; it != boost::end(multi_point) ; ++it )
for (auto it = boost::begin(multi_point); it != boost::end(multi_point); ++it)
{
if (! (relate::may_update<interior, interior, '0', Transpose>(result)
|| relate::may_update<interior, boundary, '0', Transpose>(result)
@ -445,7 +444,6 @@ struct multi_point_multi_geometry_ii_ib_ie
typedef model::box<point2_type> box2_type;
typedef std::pair<box2_type, std::size_t> box_pair_type;
typedef std::vector<box_pair_type> boxes_type;
typedef typename boxes_type::const_iterator boxes_iterator;
template <typename Result, typename Strategy>
static inline void apply(MultiPoint const& multi_point,
@ -466,8 +464,7 @@ struct multi_point_multi_geometry_ii_ib_ie
rtree(boxes.begin(), boxes.end(),
index_parameters_type(index::rstar<4>(), strategy));
typedef typename boost::range_const_iterator<MultiPoint>::type iterator;
for ( iterator it = boost::begin(multi_point) ; it != boost::end(multi_point) ; ++it )
for (auto it = boost::begin(multi_point); it != boost::end(multi_point); ++it)
{
if (! (relate::may_update<interior, interior, '0', Transpose>(result)
|| relate::may_update<interior, boundary, '0', Transpose>(result)
@ -482,10 +479,10 @@ struct multi_point_multi_geometry_ii_ib_ie
rtree.query(index::intersects(point), std::back_inserter(boxes_found));
bool found_ii_or_ib = false;
for (boxes_iterator bi = boxes_found.begin() ; bi != boxes_found.end() ; ++bi)
for (auto const& box_found : boxes_found)
{
typename boost::range_value<MultiGeometry>::type const&
single = range::at(multi_geometry, bi->second);
single = range::at(multi_geometry, box_found.second);
int in_val = detail::within::point_in_geometry(point, single, strategy);

View File

@ -67,20 +67,25 @@ std::pair<bool, bool> point_multipoint_check(Point const& point,
// point_in_geometry could be used here but why iterate over MultiPoint twice?
// we must search for a point in the exterior because all points in MultiPoint can be equal
typedef typename boost::range_iterator<MultiPoint const>::type iterator;
iterator it = boost::begin(multi_point);
iterator last = boost::end(multi_point);
for ( ; it != last ; ++it )
auto const end = boost::end(multi_point);
for (auto it = boost::begin(multi_point); it != end; ++it)
{
bool ii = detail::equals::equals_point_point(point, *it, strategy);
if ( ii )
if (ii)
{
found_inside = true;
}
else
{
found_outside = true;
}
if ( found_inside && found_outside )
if (found_inside && found_outside)
{
break;
}
}
return std::make_pair(found_inside, found_outside);
@ -229,19 +234,22 @@ struct multipoint_multipoint
bool found_outside = false;
// for each point in the second MPt
typedef typename boost::range_iterator<IteratedMultiPoint const>::type iterator;
for ( iterator it = boost::begin(iterated_mpt) ;
it != boost::end(iterated_mpt) ; ++it )
for (auto it = boost::begin(iterated_mpt); it != boost::end(iterated_mpt); ++it)
{
bool ii =
std::binary_search(points.begin(), points.end(), *it, less);
if ( ii )
bool ii = std::binary_search(points.begin(), points.end(), *it, less);
if (ii)
{
found_inside = true;
}
else
{
found_outside = true;
}
if ( found_inside && found_outside )
if (found_inside && found_outside)
{
break;
}
}
if ( found_inside ) // some point of MP2 is equal to some of MP1

View File

@ -175,17 +175,17 @@ private:
void init() const
{
if (m_is_initialized)
{
return;
}
m_endpoints.reserve(boost::size(m_mls) * 2);
m_has_interior = false;
typedef typename boost::range_iterator<MultiLinestring const>::type ls_iterator;
for ( ls_iterator it = boost::begin(m_mls) ; it != boost::end(m_mls) ; ++it )
for (auto it = boost::begin(m_mls); it != boost::end(m_mls); ++it)
{
typename boost::range_reference<MultiLinestring const>::type
ls = *it;
auto const& ls = *it;
std::size_t count = boost::size(ls);
@ -196,13 +196,8 @@ private:
if (count > 1)
{
typedef typename boost::range_reference
<
typename boost::range_value<MultiLinestring const>::type const
>::type point_reference;
point_reference front_pt = range::front(ls);
point_reference back_pt = range::back(ls);
auto const& front_pt = range::front(ls);
auto const& back_pt = range::back(ls);
// don't store boundaries of linear rings, this doesn't change anything
if (! equals::equals_point_point(front_pt, back_pt, m_strategy))
@ -226,7 +221,7 @@ private:
m_has_boundary = false;
if (! m_endpoints.empty() )
if (! m_endpoints.empty())
{
std::sort(m_endpoints.begin(), m_endpoints.end(), less_type());
m_has_boundary = find_odd_count(m_endpoints.begin(), m_endpoints.end());

View File

@ -38,7 +38,6 @@
#include <boost/geometry/algorithms/envelope.hpp>
#include <boost/geometry/algorithms/expand.hpp>
#include <boost/geometry/algorithms/detail/expand_by_epsilon.hpp>
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
#include <boost/geometry/algorithms/detail/recalculate.hpp>
#include <boost/geometry/algorithms/detail/ring_identifier.hpp>
#include <boost/geometry/algorithms/detail/signed_size_type.hpp>
@ -710,10 +709,7 @@ struct sectionalize_multi
std::size_t max_count)
{
ring_id.multi_index = 0;
for (typename boost::range_iterator<MultiGeometry const>::type
it = boost::begin(multi);
it != boost::end(multi);
++it, ++ring_id.multi_index)
for (auto it = boost::begin(multi); it != boost::end(multi); ++it, ++ring_id.multi_index)
{
Policy::apply(*it, robust_policy, sections,
strategy,

View File

@ -157,19 +157,20 @@ struct areal_interrupt_policy
inline bool apply(Range const& range)
{
// if already rejected (temp workaround?)
if ( found_not_touch )
return true;
typedef typename boost::range_iterator<Range const>::type iterator;
for ( iterator it = boost::begin(range) ; it != boost::end(range) ; ++it )
if (found_not_touch)
{
if ( it->has(overlay::operation_intersection) )
return true;
}
for (auto it = boost::begin(range); it != boost::end(range); ++it)
{
if (it->has(overlay::operation_intersection))
{
found_not_touch = true;
return true;
}
switch(it->method)
switch (it->method)
{
case overlay::method_crosses:
found_not_touch = true;

View File

@ -593,8 +593,7 @@ struct convert_to_output<Geometry, SingleOut, true>
static OutputIterator apply(Geometry const& geometry,
OutputIterator oit)
{
typedef typename boost::range_iterator<Geometry const>::type iterator;
for (iterator it = boost::begin(geometry); it != boost::end(geometry); ++it)
for (auto it = boost::begin(geometry); it != boost::end(geometry); ++it)
{
SingleOut single_out;
geometry::convert(*it, single_out);

View File

@ -55,8 +55,7 @@ struct multi_point_point
{
auto const s = strategy.relate(multi_point, point);
typedef typename boost::range_const_iterator<MultiPoint>::type iterator;
for ( iterator it = boost::begin(multi_point) ; it != boost::end(multi_point) ; ++it )
for (auto it = boost::begin(multi_point); it != boost::end(multi_point); ++it)
{
if (! s.apply(*it, point))
{
@ -88,8 +87,7 @@ struct multi_point_multi_point
bool result = false;
typedef typename boost::range_const_iterator<MultiPoint1>::type iterator;
for ( iterator it = boost::begin(multi_point1) ; it != boost::end(multi_point1) ; ++it )
for (auto it = boost::begin(multi_point1); it != boost::end(multi_point1); ++it)
{
if (! std::binary_search(points2.begin(), points2.end(), *it, less))
{
@ -134,8 +132,7 @@ struct multi_point_single_geometry
// If in the exterior, break
bool result = false;
typedef typename boost::range_const_iterator<MultiPoint>::type iterator;
for ( iterator it = boost::begin(multi_point) ; it != boost::end(multi_point) ; ++it )
for (auto it = boost::begin(multi_point); it != boost::end(multi_point); ++it )
{
typedef decltype(strategy.covered_by(*it, box)) point_in_box_type;
@ -198,8 +195,7 @@ struct multi_point_multi_geometry
// If a point is in the exterior break
bool result = false;
typedef typename boost::range_const_iterator<MultiPoint>::type iterator;
for ( iterator it = boost::begin(multi_point) ; it != boost::end(multi_point) ; ++it )
for (auto it = boost::begin(multi_point); it != boost::end(multi_point); ++it)
{
// TODO: investigate the possibility of using satisfies
// TODO: investigate the possibility of using iterative queries (optimization below)

View File

@ -30,7 +30,6 @@
#include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
#include <boost/geometry/algorithms/detail/equals/point_point.hpp>
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/strategies/concepts/within_concept.hpp>
@ -49,13 +48,12 @@ int point_in_range(Point const& point, Range const& range, Strategy const& strat
{
typename Strategy::state_type state;
typedef typename boost::range_iterator<Range const>::type iterator_type;
iterator_type it = boost::begin(range);
iterator_type end = boost::end(range);
auto it = boost::begin(range);
auto const end = boost::end(range);
for ( iterator_type previous = it++ ; it != end ; ++previous, ++it )
for (auto previous = it++; it != end; ++previous, ++it)
{
if ( ! strategy.apply(point, *previous, *it, state) )
if (! strategy.apply(point, *previous, *it, state))
{
break;
}
@ -202,13 +200,8 @@ struct point_in_geometry<Polygon, polygon_tag>
if (code == 1)
{
typename interior_return_type<Polygon const>::type
rings = interior_rings(polygon);
for (typename detail::interior_iterator<Polygon const>::type
it = boost::begin(rings);
it != boost::end(rings);
++it)
auto const& rings = interior_rings(polygon);
for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
{
int const interior_code = point_in_geometry
<
@ -235,14 +228,16 @@ struct point_in_geometry<Geometry, multi_point_tag>
int apply(Point const& point, Geometry const& geometry, Strategy const& strategy)
{
typedef typename boost::range_value<Geometry>::type point_type;
typedef typename boost::range_const_iterator<Geometry>::type iterator;
for ( iterator it = boost::begin(geometry) ; it != boost::end(geometry) ; ++it )
for (auto it = boost::begin(geometry); it != boost::end(geometry); ++it)
{
int pip = point_in_geometry<point_type>::apply(point, *it, strategy);
//BOOST_GEOMETRY_ASSERT(pip != 0);
if ( pip > 0 ) // inside
if (pip > 0)
{
// inside
return 1;
}
}
return -1; // outside
@ -259,14 +254,13 @@ struct point_in_geometry<Geometry, multi_linestring_tag>
typedef typename boost::range_value<Geometry>::type linestring_type;
typedef typename boost::range_value<linestring_type>::type point_type;
typedef typename boost::range_iterator<Geometry const>::type iterator;
iterator it = boost::begin(geometry);
for ( ; it != boost::end(geometry) ; ++it )
auto it = boost::begin(geometry);
for ( ; it != boost::end(geometry); ++it)
{
pip = point_in_geometry<linestring_type>::apply(point, *it, strategy);
// inside or on the boundary
if ( pip >= 0 )
if (pip >= 0)
{
++it;
break;
@ -274,24 +268,30 @@ struct point_in_geometry<Geometry, multi_linestring_tag>
}
// outside
if ( pip < 0 )
if (pip < 0)
{
return -1;
}
// TODO: the following isn't needed for covered_by()
unsigned boundaries = pip == 0 ? 1 : 0;
for ( ; it != boost::end(geometry) ; ++it )
for (; it != boost::end(geometry); ++it)
{
if ( boost::size(*it) < 2 )
if (boost::size(*it) < 2)
{
continue;
}
point_type const& front = range::front(*it);
point_type const& back = range::back(*it);
// is closed_ring - no boundary
if ( detail::equals::equals_point_point(front, back, strategy) )
if (detail::equals::equals_point_point(front, back, strategy))
{
continue;
}
// is point on boundary
if ( detail::equals::equals_point_point(point, front, strategy)
@ -316,14 +316,15 @@ struct point_in_geometry<Geometry, multi_polygon_tag>
//int res = -1; // outside
typedef typename boost::range_value<Geometry>::type polygon_type;
typedef typename boost::range_const_iterator<Geometry>::type iterator;
for ( iterator it = boost::begin(geometry) ; it != boost::end(geometry) ; ++it )
for (auto it = boost::begin(geometry); it != boost::end(geometry); ++it)
{
int pip = point_in_geometry<polygon_type>::apply(point, *it, strategy);
// inside or on the boundary
if ( pip >= 0 )
if (pip >= 0)
{
return pip;
}
// For invalid multi-polygons
//if ( 1 == pip ) // inside polygon

View File

@ -41,8 +41,10 @@ struct within_no_turns
{
typedef typename geometry::point_type<Geometry1>::type point1_type;
point1_type p;
if ( !geometry::point_on_border(p, geometry1) )
if (! geometry::point_on_border(p, geometry1))
{
return false;
}
return detail::within::point_in_geometry(p, geometry2, strategy) >= 0;
}
@ -57,25 +59,28 @@ struct within_no_turns<Geometry1, Geometry2, ring_tag, polygon_tag>
typedef typename geometry::point_type<Geometry1>::type point1_type;
typedef typename geometry::point_type<Geometry2>::type point2_type;
point1_type p;
if ( !geometry::point_on_border(p, geometry1) )
if (! geometry::point_on_border(p, geometry1))
{
return false;
}
// check if one of ring points is outside the polygon
if ( detail::within::point_in_geometry(p, geometry2, strategy) < 0 )
if (detail::within::point_in_geometry(p, geometry2, strategy) < 0)
{
return false;
}
// Now check if holes of G2 aren't inside G1
typedef typename boost::range_const_iterator
<
typename geometry::interior_type<Geometry2>::type
>::type iterator;
for ( iterator it = boost::begin(geometry::interior_rings(geometry2)) ;
it != boost::end(geometry::interior_rings(geometry2)) ;
++it )
auto const& rings2 = geometry::interior_rings(geometry2);
for (auto it = boost::begin(rings2); it != boost::end(rings2); ++it)
{
point2_type p;
if ( !geometry::point_on_border(p, *it) )
if (! geometry::point_on_border(p, *it))
{
return false;
if ( detail::within::point_in_geometry(p, geometry1, strategy) > 0 )
}
if (detail::within::point_in_geometry(p, geometry1, strategy) > 0)
{
return false;
}
}
return true;
}
@ -90,44 +95,42 @@ struct within_no_turns<Geometry1, Geometry2, polygon_tag, polygon_tag>
typedef typename geometry::point_type<Geometry1>::type point1_type;
typedef typename geometry::point_type<Geometry2>::type point2_type;
point1_type p;
if ( !geometry::point_on_border(p, geometry1) )
if (! geometry::point_on_border(p, geometry1))
{
return false;
}
// check if one of ring points is outside the polygon
if ( detail::within::point_in_geometry(p, geometry2, strategy) < 0 )
if (detail::within::point_in_geometry(p, geometry2, strategy) < 0)
{
return false;
}
// Now check if holes of G2 aren't inside G1
typedef typename boost::range_const_iterator
<
typename geometry::interior_type<Geometry2>::type
>::type iterator2;
for ( iterator2 it = boost::begin(geometry::interior_rings(geometry2)) ;
it != boost::end(geometry::interior_rings(geometry2)) ;
++it )
auto const& rings2 = geometry::interior_rings(geometry2);
for (auto it2 = boost::begin(rings2); it != boost::end(rings2); ++it)
{
point2_type p2;
if ( !geometry::point_on_border(p2, *it) )
if (! geometry::point_on_border(p2, *it2))
{
return false;
}
// if the hole of G2 is inside G1
if ( detail::within::point_in_geometry(p2, geometry1, strategy) > 0 )
if (detail::within::point_in_geometry(p2, geometry1, strategy) > 0)
{
// if it's also inside one of the G1 holes, it's ok
bool ok = false;
typedef typename boost::range_const_iterator
<
typename geometry::interior_type<Geometry1>::type
>::type iterator1;
for ( iterator1 it1 = boost::begin(geometry::interior_rings(geometry1)) ;
it1 != boost::end(geometry::interior_rings(geometry1)) ;
++it1 )
auto const& rings1 = geometry::interior_rings(geometry1);
for (auto it1 = boost::begin(rings1); it1 != boost::end(rings1); ++it1)
{
if ( detail::within::point_in_geometry(p2, *it1, strategy) < 0 )
if (detail::within::point_in_geometry(p2, *it1, strategy) < 0)
{
ok = true;
break;
}
}
if ( !ok )
if (! ok)
{
return false;
}
}
}
return true;
@ -157,11 +160,12 @@ struct within_no_turns_multi<Geometry1, Geometry2, Tag1, Tag2, true, false>
{
// All values of G1 must be inside G2
typedef typename boost::range_value<Geometry1>::type subgeometry1;
typedef typename boost::range_const_iterator<Geometry1>::type iterator;
for ( iterator it = boost::begin(geometry1) ; it != boost::end(geometry1) ; ++it )
for (auto it = boost::begin(geometry1) ; it != boost::end(geometry1) ; ++it )
{
if ( !within_no_turns<subgeometry1, Geometry2>::apply(*it, geometry2, strategy) )
if (! within_no_turns<subgeometry1, Geometry2>::apply(*it, geometry2, strategy))
{
return false;
}
}
return true;
}
@ -175,11 +179,12 @@ struct within_no_turns_multi<Geometry1, Geometry2, Tag1, Tag2, false, true>
{
// G1 must be within at least one value of G2
typedef typename boost::range_value<Geometry2>::type subgeometry2;
typedef typename boost::range_const_iterator<Geometry2>::type iterator;
for ( iterator it = boost::begin(geometry2) ; it != boost::end(geometry2) ; ++it )
for (auto it = boost::begin(geometry2); it != boost::end(geometry2); ++it)
{
if ( within_no_turns<Geometry1, subgeometry2>::apply(geometry1, *it, strategy) )
if (within_no_turns<Geometry1, subgeometry2>::apply(geometry1, *it, strategy))
{
return true;
}
}
return false;
}
@ -193,11 +198,12 @@ struct within_no_turns_multi<Geometry1, Geometry2, Tag1, Tag2, true, true>
{
// each value of G1 must be inside at least one value of G2
typedef typename boost::range_value<Geometry1>::type subgeometry1;
typedef typename boost::range_const_iterator<Geometry1>::type iterator;
for ( iterator it = boost::begin(geometry1) ; it != boost::end(geometry1) ; ++it )
for (auto it = boost::begin(geometry1) ; it != boost::end(geometry1) ; ++it)
{
if ( !within_no_turns_multi<subgeometry1, Geometry2>::apply(*it, geometry2, strategy) )
if (! within_no_turns_multi<subgeometry1, Geometry2>::apply(*it, geometry2, strategy))
{
return false;
}
}
return true;
}

View File

@ -29,7 +29,6 @@
#include <boost/range/reference.hpp>
#include <boost/range/value_type.hpp>
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
#include <boost/geometry/algorithms/not_implemented.hpp>
#include <boost/geometry/core/closure.hpp>
#include <boost/geometry/core/exterior_ring.hpp>
@ -326,9 +325,7 @@ struct for_each_polygon
return false;
}
typename interior_return_type<Polygon>::type
rings = interior_rings(poly);
auto&& rings = interior_rings(poly);
auto const end = boost::end(rings);
for (auto it = boost::begin(rings); it != end; ++it)
{

View File

@ -139,6 +139,7 @@ struct multi_polygon_is_convex
static inline bool apply(MultiPolygon const& multi_polygon, Strategies const& strategies)
{
auto const size = boost::size(multi_polygon);
// TODO: this looks wrong, it should only return convex if all its rings are convex
return size == 0 // For consistency with ring_is_convex
|| (size == 1 && polygon_is_convex::apply(range::front(multi_polygon), strategies));
}
@ -272,7 +273,7 @@ struct is_convex
template <typename Strategy>
static bool apply(Geometry const& geometry, Strategy const& strategy)
{
concepts::check<Geometry>();
concepts::check<Geometry const>();
return resolve_strategy::is_convex<Strategy>::apply(geometry, strategy);
}
};

View File

@ -89,11 +89,10 @@ struct interpolate_range
PointLike & pointlike,
Strategies const& strategies)
{
typedef typename boost::range_iterator<Range const>::type iterator_t;
typedef typename boost::range_value<Range const>::type point_t;
iterator_t it = boost::begin(range);
iterator_t end = boost::end(range);
auto it = boost::begin(range);
auto const end = boost::end(range);
if (it == end) // empty(range)
{
@ -112,7 +111,7 @@ struct interpolate_range
typedef decltype(pp_strategy.apply(
std::declval<point_t>(), std::declval<point_t>())) distance_type;
iterator_t prev = it++;
auto prev = it++;
distance_type repeated_distance = max_distance;
distance_type prev_distance = 0;
distance_type current_distance = 0;

View File

@ -82,11 +82,11 @@ template <int Dimension, typename Collection, typename Value, typename Predicate
inline bool max_value(Collection const& collection, Value& the_max, Predicate const& predicate)
{
bool first = true;
for (typename Collection::const_iterator it = collection.begin(); it != collection.end(); ++it)
for (auto const& item : collection)
{
if (! it->empty())
if (! item.empty())
{
Value the_value = geometry::get<Dimension>(*std::max_element(it->begin(), it->end(), predicate));
Value the_value = geometry::get<Dimension>(*std::max_element(item.begin(), item.end(), predicate));
if (first || the_value > the_max)
{
the_max = the_value;
@ -153,16 +153,14 @@ template <typename Point, typename P>
inline void calculate_average(Point& point, std::vector<P> const& points)
{
typedef typename geometry::coordinate_type<Point>::type coordinate_type;
typedef typename std::vector<P>::const_iterator iterator_type;
coordinate_type x = 0;
coordinate_type y = 0;
iterator_type end = points.end();
for ( iterator_type it = points.begin() ; it != end ; ++it)
for (auto const& p : points)
{
x += geometry::get<0>(*it);
y += geometry::get<1>(*it);
x += geometry::get<0>(p);
y += geometry::get<1>(p);
}
signed_size_type const count = points.size();

View File

@ -37,7 +37,6 @@
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/algorithms/detail/point_is_spike_or_equal.hpp>
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
#include <boost/geometry/algorithms/clear.hpp>
#include <boost/geometry/strategies/default_strategy.hpp>
@ -88,11 +87,10 @@ struct range_remove_spikes
std::vector<point_type> cleaned;
cleaned.reserve(n);
for (typename boost::range_iterator<Range const>::type it = boost::begin(range);
it != boost::end(range); ++it)
for (auto const& p : range)
{
// Add point
cleaned.push_back(*it);
cleaned.push_back(p);
while(cleaned.size() >= 3
&& detail::is_spike_or_equal(range::at(cleaned, cleaned.size() - 3),
@ -105,9 +103,8 @@ struct range_remove_spikes
}
}
typedef typename std::vector<point_type>::iterator cleaned_iterator;
cleaned_iterator cleaned_b = cleaned.begin();
cleaned_iterator cleaned_e = cleaned.end();
auto cleaned_b = cleaned.begin();
auto cleaned_e = cleaned.end();
std::size_t cleaned_count = cleaned.size();
// For a closed-polygon, remove closing point, this makes checking first point(s) easier and consistent
@ -178,11 +175,9 @@ struct polygon_remove_spikes
typedef range_remove_spikes per_range;
per_range::apply(exterior_ring(polygon), strategy);
typename interior_return_type<Polygon>::type
rings = interior_rings(polygon);
auto&& rings = interior_rings(polygon);
for (typename detail::interior_iterator<Polygon>::type
it = boost::begin(rings); it != boost::end(rings); ++it)
for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
{
per_range::apply(*it, strategy);
}
@ -196,10 +191,7 @@ struct multi_remove_spikes
template <typename MultiGeometry, typename SideStrategy>
static inline void apply(MultiGeometry& multi, SideStrategy const& strategy)
{
for (typename boost::range_iterator<MultiGeometry>::type
it = boost::begin(multi);
it != boost::end(multi);
++it)
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
{
SingleVersion::apply(*it, strategy);
}

View File

@ -24,7 +24,6 @@
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
#include <boost/geometry/algorithms/detail/multi_modify.hpp>
#include <boost/geometry/algorithms/detail/visit.hpp>
#include <boost/geometry/core/interior_rings.hpp>

View File

@ -34,7 +34,6 @@
#include <boost/geometry/algorithms/assign.hpp>
#include <boost/geometry/algorithms/clear.hpp>
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
#include <boost/geometry/algorithms/num_interior_rings.hpp>
#include <boost/geometry/core/cs.hpp>
@ -143,10 +142,7 @@ inline bool transform_range_out(Range const& range,
OutputIterator out, Strategy const& strategy)
{
PointOut point_out;
for(typename boost::range_iterator<Range const>::type
it = boost::begin(range);
it != boost::end(range);
++it)
for (auto it = boost::begin(range); it != boost::end(range); ++it)
{
if (! transform_point::apply(*it, point_out, strategy))
{
@ -184,15 +180,11 @@ struct transform_polygon
>::apply(geometry::interior_rings(poly2),
geometry::num_interior_rings(poly1));
typename geometry::interior_return_type<Polygon1 const>::type
rings1 = geometry::interior_rings(poly1);
typename geometry::interior_return_type<Polygon2>::type
rings2 = geometry::interior_rings(poly2);
auto const& rings1 = geometry::interior_rings(poly1);
auto&& rings2 = geometry::interior_rings(poly2);
typename detail::interior_iterator<Polygon1 const>::type
it1 = boost::begin(rings1);
typename detail::interior_iterator<Polygon2>::type
it2 = boost::begin(rings2);
auto it1 = boost::begin(rings1);
auto it2 = boost::begin(rings2);
for ( ; it1 != boost::end(rings1); ++it1, ++it2)
{
if ( ! transform_range_out<point2_type>(*it1,
@ -251,10 +243,8 @@ struct transform_multi
{
traits::resize<Multi2>::apply(multi2, boost::size(multi1));
typename boost::range_iterator<Multi1 const>::type it1
= boost::begin(multi1);
typename boost::range_iterator<Multi2>::type it2
= boost::begin(multi2);
auto it1 = boost::begin(multi1);
auto it2 = boost::begin(multi2);
for (; it1 != boost::end(multi1); ++it1, ++it2)
{

View File

@ -24,7 +24,6 @@
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
#include <boost/geometry/core/interior_rings.hpp>
#include <boost/geometry/core/mutable_range.hpp>
#include <boost/geometry/core/tags.hpp>
@ -46,7 +45,7 @@ struct range_unique
template <typename Range, typename ComparePolicy>
static inline void apply(Range& range, ComparePolicy const& policy)
{
typename boost::range_iterator<Range>::type it
auto it
= std::unique
(
boost::begin(range),
@ -66,11 +65,9 @@ struct polygon_unique
{
range_unique::apply(exterior_ring(polygon), policy);
typename interior_return_type<Polygon>::type
rings = interior_rings(polygon);
auto&& rings = interior_rings(polygon);
for (typename detail::interior_iterator<Polygon>::type
it = boost::begin(rings); it != boost::end(rings); ++it)
for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
{
range_unique::apply(*it, policy);
}
@ -84,10 +81,7 @@ struct multi_unique
template <typename MultiGeometry, typename ComparePolicy>
static inline void apply(MultiGeometry& multi, ComparePolicy const& compare)
{
for (typename boost::range_iterator<MultiGeometry>::type
it = boost::begin(multi);
it != boost::end(multi);
++it)
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
{
Policy::apply(*it, compare);
}

View File

@ -82,6 +82,7 @@
#include <boost/geometry/algorithms/for_each.hpp>
#include <boost/geometry/algorithms/intersection.hpp>
#include <boost/geometry/algorithms/intersects.hpp>
#include <boost/geometry/algorithms/is_convex.hpp>
#include <boost/geometry/algorithms/is_empty.hpp>
#include <boost/geometry/algorithms/is_simple.hpp>
#include <boost/geometry/algorithms/is_valid.hpp>
@ -94,6 +95,7 @@
#include <boost/geometry/algorithms/num_segments.hpp>
#include <boost/geometry/algorithms/overlaps.hpp>
#include <boost/geometry/algorithms/perimeter.hpp>
#include <boost/geometry/algorithms/point_on_surface.hpp>
#include <boost/geometry/algorithms/relate.hpp>
#include <boost/geometry/algorithms/relation.hpp>
#include <boost/geometry/algorithms/remove_spikes.hpp>

View File

@ -28,8 +28,6 @@
#include <boost/range/end.hpp>
#include <boost/range/value_type.hpp>
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
#include <boost/geometry/core/exterior_ring.hpp>
#include <boost/geometry/core/interior_rings.hpp>
#include <boost/geometry/core/ring_type.hpp>
@ -170,15 +168,11 @@ struct dsv_range
Range const& range,
dsv_settings const& settings)
{
typedef typename boost::range_iterator<Range const>::type iterator_type;
bool first = true;
os << settings.list_open;
for (iterator_type it = boost::begin(range);
it != boost::end(range);
++it)
for (auto it = boost::begin(range); it != boost::end(range); ++it)
{
os << (first ? "" : settings.point_separator)
<< settings.point_open;
@ -218,10 +212,8 @@ struct dsv_poly
dsv_range<ring>::apply(os, exterior_ring(poly), settings);
typename interior_return_type<Polygon const>::type
rings = interior_rings(poly);
for (typename detail::interior_iterator<Polygon const>::type
it = boost::begin(rings); it != boost::end(rings); ++it)
auto const& rings = interior_rings(poly);
for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
{
os << settings.list_separator;
dsv_range<ring>::apply(os, *it, settings);
@ -362,12 +354,6 @@ struct dsv_multi
typename boost::range_value<MultiGeometry>::type
> dispatch_one;
typedef typename boost::range_iterator
<
MultiGeometry const
>::type iterator;
template <typename Char, typename Traits>
static inline void apply(std::basic_ostream<Char, Traits>& os,
MultiGeometry const& multi,
@ -376,9 +362,7 @@ struct dsv_multi
os << settings.list_open;
bool first = true;
for(iterator it = boost::begin(multi);
it != boost::end(multi);
++it, first = false)
for(auto it = boost::begin(multi); it != boost::end(multi); ++it, first = false)
{
os << (first ? "" : settings.list_separator);
dispatch_one::apply(os, *it, settings);

View File

@ -160,10 +160,7 @@ struct svg_map<multi_tag, Multi, SvgPoint>
std::string const& style, double size,
Multi const& multi, TransformStrategy const& strategy)
{
for (typename boost::range_iterator<Multi const>::type it
= boost::begin(multi);
it != boost::end(multi);
++it)
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
{
svg_map
<
@ -466,19 +463,17 @@ public :
{
// Multi-line modus
std::vector<std::string> splitted;
boost::split(splitted, s, boost::is_any_of("\n"));
for (std::vector<std::string>::const_iterator it
= splitted.begin();
it != splitted.end();
++it, offset_y += lineheight)
std::vector<std::string> split;
boost::split(split, s, boost::is_any_of("\n"));
for (auto const& item : split)
{
m_stream
<< "<tspan x=\"" << get<0>(map_point) + offset_x
<< "\""
<< " y=\"" << get<1>(map_point) + offset_y
<< "\""
<< ">" << *it << "</tspan>";
<< ">" << item << "</tspan>";
offset_y += lineheight;
}
}
m_stream << "</text>" << std::endl;

View File

@ -29,8 +29,6 @@
#include <boost/variant/static_visitor.hpp>
#include <boost/variant/variant_fwd.hpp>
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
#include <boost/geometry/core/exterior_ring.hpp>
#include <boost/geometry/core/interior_rings.hpp>
#include <boost/geometry/core/ring_type.hpp>
@ -117,15 +115,11 @@ struct svg_range
static inline void apply(std::basic_ostream<Char, Traits>& os,
Range const& range, std::string const& style, double)
{
typedef typename boost::range_iterator<Range const>::type iterator;
bool first = true;
os << "<" << Policy::prefix() << " points=\"";
for (iterator it = boost::begin(range);
it != boost::end(range);
++it, first = false)
for (auto it = boost::begin(range); it != boost::end(range); ++it, first = false)
{
os << (first ? "" : " " )
<< geometry::get<0>(*it)
@ -146,15 +140,12 @@ struct svg_poly
Polygon const& polygon, std::string const& style, double)
{
typedef typename geometry::ring_type<Polygon>::type ring_type;
typedef typename boost::range_iterator<ring_type const>::type iterator_type;
bool first = true;
os << "<g fill-rule=\"evenodd\"><path d=\"";
ring_type const& ring = geometry::exterior_ring(polygon);
for (iterator_type it = boost::begin(ring);
it != boost::end(ring);
++it, first = false)
for (auto it = boost::begin(ring); it != boost::end(ring); ++it, first = false)
{
os << (first ? "M" : " L") << " "
<< geometry::get<0>(*it)
@ -164,15 +155,11 @@ struct svg_poly
// Inner rings:
{
typename interior_return_type<Polygon const>::type
rings = interior_rings(polygon);
for (typename detail::interior_iterator<Polygon const>::type
rit = boost::begin(rings); rit != boost::end(rings); ++rit)
auto const& rings = interior_rings(polygon);
for (auto rit = boost::begin(rings); rit != boost::end(rings); ++rit)
{
first = true;
for (typename detail::interior_ring_iterator<Polygon const>::type
it = boost::begin(*rit); it != boost::end(*rit);
++it, first = false)
for (auto it = boost::begin(*rit); it != boost::end(*rit); ++it, first = false)
{
os << (first ? "M" : " L") << " "
<< geometry::get<0>(*it)
@ -209,14 +196,10 @@ struct svg_multi
static inline void apply(std::basic_ostream<Char, Traits>& os,
MultiGeometry const& multi, std::string const& style, double size)
{
for (typename boost::range_iterator<MultiGeometry const>::type
it = boost::begin(multi);
it != boost::end(multi);
++it)
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
{
Policy::apply(os, *it, style, size);
}
}
};

View File

@ -754,7 +754,7 @@ struct box_parser
{
auto const tokens{make_tokenizer(wkt)};
auto it = tokens.begin();
auto end = tokens.end();
auto const end = tokens.end();
apply(it, end, wkt, box);
@ -835,7 +835,7 @@ struct segment_parser
{
auto const tokens{make_tokenizer(wkt)};
auto it = tokens.begin();
auto end = tokens.end();
auto const end = tokens.end();
apply(it, end, wkt, segment);
@ -1122,7 +1122,7 @@ struct read_wkt<DynamicGeometry, dynamic_geometry_tag>
{
auto tokens{detail::wkt::make_tokenizer(wkt)};
auto it = tokens.begin();
auto end = tokens.end();
auto const end = tokens.end();
if (it == end)
{
BOOST_THROW_EXCEPTION(read_wkt_exception(

View File

@ -31,7 +31,6 @@
#include <boost/range/size.hpp>
#include <boost/range/value_type.hpp>
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
#include <boost/geometry/algorithms/assign.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/algorithms/detail/disjoint/point_point.hpp>
@ -136,7 +135,7 @@ struct wkt_range
os << "(";
}
auto begin = boost::begin(range);
auto end = boost::end(range);
auto const end = boost::end(range);
for (auto it = begin; it != end; ++it)
{
os << (first ? "" : ",");
@ -201,8 +200,8 @@ struct wkt_poly
{
using ring = typename ring_type<Polygon const>::type;
auto const exterior = exterior_ring(poly);
auto const rings = interior_rings(poly);
auto const& exterior = exterior_ring(poly);
auto const& rings = interior_rings(poly);
std::size_t point_count = boost::size(exterior);
for (auto it = boost::begin(rings); it != boost::end(rings); ++it)

View File

@ -9,8 +9,9 @@
#ifndef BOOST_GEOMETRY_UTIL_FOR_EACH_WITH_INDEX_HPP
#define BOOST_GEOMETRY_UTIL_FOR_EACH_WITH_INDEX_HPP
#include <boost/concept/requires.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/size_type.hpp>
namespace boost { namespace geometry
{
@ -23,8 +24,18 @@ namespace detail
template <typename Container, typename Function>
inline void for_each_with_index(Container const& container, Function func)
{
std::size_t index = 0;
for (auto it = std::begin(container); it != std::end(container); ++it, ++index)
typename boost::range_size<Container>::type index = 0;
for (auto it = boost::begin(container); it != boost::end(container); ++it, ++index)
{
func(index, *it);
}
}
template <typename Container, typename Function>
inline void for_each_with_index(Container& container, Function func)
{
typename boost::range_size<Container>::type index = 0;
for (auto it = boost::begin(container); it != boost::end(container); ++it, ++index)
{
func(index, *it);
}

View File

@ -146,10 +146,9 @@ public :
template <typename PieceCollection>
inline void apply(PieceCollection const& collection, int phase)
{
for(typename container_type::iterator it = mappers.begin();
it != mappers.end(); ++it)
for (auto& item : mappers)
{
it->apply(collection, phase);
item.apply(collection, phase);
}
}
@ -157,10 +156,9 @@ public :
void map_input_output(Geometry const& geometry,
GeometryBuffer const& buffered, bool negative)
{
for(typename container_type::iterator it = mappers.begin();
it != mappers.end(); ++it)
for (auto& item : mappers)
{
it->map_input_output(geometry, buffered, negative);
item.map_input_output(geometry, buffered, negative);
}
}
};

View File

@ -23,8 +23,7 @@
template <typename P, typename Functor, typename T>
void test_all(std::vector<T> const& expected, double precision = 0.01)
{
typename boost::range_const_iterator<std::vector<T> >::type iterator
= boost::begin(expected);
auto iterator = boost::begin(expected);
typedef bg::model::multi_polygon<bg::model::polygon<P> > mp;
typedef bg::model::box<P> box;

View File

@ -95,8 +95,7 @@ void test_all(std::vector<T> const& expected)
// compilation test only, will not output
//test_overlay<box, polygon, Functor>("", "", "", "");
typename boost::range_const_iterator<std::vector<T> >::type iterator
= boost::begin(expected);
auto iterator = boost::begin(expected);
#ifndef ONLY_CASE_BRANDON

View File

@ -147,9 +147,9 @@ void difference_output(std::string const& caseid, G1 const& g1, G2 const& g2, Ou
mapper.map(g2, "fill-opacity:0.5;fill:rgb(153,204,0);stroke:rgb(153,204,0);stroke-width:3");
for (typename Output::const_iterator it = output.begin(); it != output.end(); ++it)
for (auto const& item : output)
{
mapper.map(*it,
mapper.map(item,
//sym ? "fill-opacity:0.2;stroke-opacity:0.4;fill:rgb(255,255,0);stroke:rgb(255,0,255);stroke-width:8" :
"fill-opacity:0.2;stroke-opacity:0.4;fill:rgb(255,0,0);stroke:rgb(255,0,255);stroke-width:8");
}

View File

@ -256,10 +256,9 @@ typename bg::default_area_result<G1>::type test_intersection(std::string const&
mapper.map(g2, "fill-opacity:0.3;fill:rgb(51,51,153);"
"stroke:rgb(51,51,153);stroke-width:3");
for (typename result_type::const_iterator it = intersection_output.begin();
it != intersection_output.end(); ++it)
for (auto const& item : intersection_output)
{
mapper.map(*it, "fill-opacity:0.2;stroke-opacity:0.4;fill:rgb(255,0,0);"
mapper.map(item, "fill-opacity:0.2;stroke-opacity:0.4;fill:rgb(255,0,0);"
"stroke:rgb(255,0,255);stroke-width:8");
}
}

View File

@ -227,10 +227,9 @@ void test_union(std::string const& caseid, G1 const& g1, G2 const& g2,
//mapper.map(g1, "opacity:0.6;fill:rgb(0,0,255);stroke:rgb(0,0,0);stroke-width:1");
//mapper.map(g2, "opacity:0.6;fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:1");
for (typename result_type::const_iterator it = clip.begin();
it != clip.end(); ++it)
for (auto const& item : clip)
{
mapper.map(*it, "fill-opacity:0.2;stroke-opacity:0.4;fill:rgb(255,0,0);"
mapper.map(item, "fill-opacity:0.2;stroke-opacity:0.4;fill:rgb(255,0,0);"
"stroke:rgb(255,0,255);stroke-width:8");
//mapper.map(*it, "opacity:0.6;fill:none;stroke:rgb(255,0,0);stroke-width:5");
}