mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-11 05:24:02 +00:00
use auto instead of iterator types, and related
This commit is contained in:
parent
b1bebca453
commit
83dab2d98c
@ -91,17 +91,15 @@ struct to_polygon_point
|
|||||||
signed_size_type ring_index, signed_size_type = 0)
|
signed_size_type ring_index, signed_size_type = 0)
|
||||||
{
|
{
|
||||||
using ring_type = typename ring_type<Polygon>::type;
|
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)
|
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);
|
to_range_point::apply<ring_type, Point>(ext_ring, point);
|
||||||
}
|
}
|
||||||
else if (ring_index < signed_size_type(num_interior_rings(polygon)))
|
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);
|
to_range_point::apply<ring_type, Point>(range::at(int_rings, ring_index), point);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,6 @@
|
|||||||
#include <boost/geometry/algorithms/assign.hpp>
|
#include <boost/geometry/algorithms/assign.hpp>
|
||||||
#include <boost/geometry/algorithms/convert.hpp>
|
#include <boost/geometry/algorithms/convert.hpp>
|
||||||
#include <boost/geometry/algorithms/detail/centroid/translating_transformer.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/point_on_border.hpp>
|
||||||
#include <boost/geometry/algorithms/detail/visit.hpp>
|
#include <boost/geometry/algorithms/detail/visit.hpp>
|
||||||
#include <boost/geometry/algorithms/is_empty.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);
|
centroid_range_state::apply(exterior_ring(poly), transformer, strategy, state);
|
||||||
|
|
||||||
typename interior_return_type<Polygon const>::type
|
auto const& rings = interior_rings(poly);
|
||||||
rings = interior_rings(poly);
|
auto const end = boost::end(rings);
|
||||||
|
for (auto it = boost::begin(rings); it != end; ++it)
|
||||||
for (typename detail::interior_iterator<Polygon const>::type
|
|
||||||
it = boost::begin(rings); it != boost::end(rings); ++it)
|
|
||||||
{
|
{
|
||||||
centroid_range_state::apply(*it, transformer, strategy, state);
|
centroid_range_state::apply(*it, transformer, strategy, state);
|
||||||
}
|
}
|
||||||
@ -352,15 +349,12 @@ struct centroid_multi
|
|||||||
Point
|
Point
|
||||||
>::type state;
|
>::type state;
|
||||||
|
|
||||||
for (typename boost::range_iterator<Multi const>::type
|
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
|
||||||
it = boost::begin(multi);
|
|
||||||
it != boost::end(multi);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
Policy::apply(*it, transformer, strategy, state);
|
Policy::apply(*it, transformer, strategy, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( strategy.result(state, centroid) )
|
if (strategy.result(state, centroid))
|
||||||
{
|
{
|
||||||
// translate the result back
|
// translate the result back
|
||||||
transformer.apply_reverse(centroid);
|
transformer.apply_reverse(centroid);
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
#include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
|
#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_point_to_point.hpp>
|
||||||
#include <boost/geometry/algorithms/detail/convert_indexed_to_indexed.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/algorithms/not_implemented.hpp>
|
||||||
|
|
||||||
#include <boost/geometry/arithmetic/arithmetic.hpp>
|
#include <boost/geometry/arithmetic/arithmetic.hpp>
|
||||||
@ -128,7 +127,7 @@ struct segment_to_range
|
|||||||
{
|
{
|
||||||
traits::resize<Range>::apply(range, 2);
|
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);
|
assign_point_from_index<0>(segment, *it);
|
||||||
++it;
|
++it;
|
||||||
@ -186,8 +185,7 @@ struct range_to_range
|
|||||||
// but ok, sice below it == end()
|
// but ok, sice below it == end()
|
||||||
|
|
||||||
size_type i = 0;
|
size_type i = 0;
|
||||||
for (typename boost::range_iterator<view_type const>::type it
|
for (auto it = boost::begin(view);
|
||||||
= boost::begin(view);
|
|
||||||
it != boost::end(view) && i < n;
|
it != boost::end(view) && i < n;
|
||||||
++it, ++i)
|
++it, ++i)
|
||||||
{
|
{
|
||||||
@ -227,15 +225,11 @@ struct polygon_to_polygon
|
|||||||
>::type
|
>::type
|
||||||
>::apply(interior_rings(destination), num_interior_rings(source));
|
>::apply(interior_rings(destination), num_interior_rings(source));
|
||||||
|
|
||||||
typename interior_return_type<Polygon1 const>::type
|
auto const& rings_source = interior_rings(source);
|
||||||
rings_source = interior_rings(source);
|
auto&& rings_dest = interior_rings(destination);
|
||||||
typename interior_return_type<Polygon2>::type
|
|
||||||
rings_dest = interior_rings(destination);
|
|
||||||
|
|
||||||
typename detail::interior_iterator<Polygon1 const>::type
|
auto it_source = boost::begin(rings_source);
|
||||||
it_source = boost::begin(rings_source);
|
auto it_dest = boost::begin(rings_dest);
|
||||||
typename detail::interior_iterator<Polygon2>::type
|
|
||||||
it_dest = boost::begin(rings_dest);
|
|
||||||
|
|
||||||
for ( ; it_source != boost::end(rings_source); ++it_source, ++it_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));
|
traits::resize<Multi2>::apply(multi2, boost::size(multi1));
|
||||||
|
|
||||||
typename boost::range_iterator<Multi1 const>::type it1
|
auto it1 = boost::begin(multi1);
|
||||||
= boost::begin(multi1);
|
auto it2 = boost::begin(multi2);
|
||||||
typename boost::range_iterator<Multi2>::type it2
|
|
||||||
= boost::begin(multi2);
|
|
||||||
|
|
||||||
for (; it1 != boost::end(multi1); ++it1, ++it2)
|
for (; it1 != boost::end(multi1); ++it1, ++it2)
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
#include <boost/geometry/algorithms/area.hpp>
|
#include <boost/geometry/algorithms/area.hpp>
|
||||||
#include <boost/geometry/algorithms/correct_closure.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/multi_modify.hpp>
|
||||||
#include <boost/geometry/algorithms/detail/visit.hpp>
|
#include <boost/geometry/algorithms/detail/visit.hpp>
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
|
|
||||||
#include <boost/geometry/algorithms/detail/multi_modify.hpp>
|
#include <boost/geometry/algorithms/detail/multi_modify.hpp>
|
||||||
#include <boost/geometry/algorithms/disjoint.hpp>
|
#include <boost/geometry/algorithms/disjoint.hpp>
|
||||||
|
|
||||||
|
@ -78,11 +78,10 @@ struct densify_range
|
|||||||
static inline void apply(FwdRng const& rng, MutRng & rng_out,
|
static inline void apply(FwdRng const& rng, MutRng & rng_out,
|
||||||
T const& len, Strategies const& strategies)
|
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;
|
typedef typename boost::range_value<FwdRng>::type point_t;
|
||||||
|
|
||||||
iterator_t it = boost::begin(rng);
|
auto it = boost::begin(rng);
|
||||||
iterator_t end = boost::end(rng);
|
auto const end = boost::end(rng);
|
||||||
|
|
||||||
if (it == end) // empty(rng)
|
if (it == end) // empty(rng)
|
||||||
{
|
{
|
||||||
@ -92,7 +91,7 @@ struct densify_range
|
|||||||
auto strategy = strategies.densify(rng);
|
auto strategy = strategies.densify(rng);
|
||||||
push_back_policy<MutRng> policy(rng_out);
|
push_back_policy<MutRng> policy(rng_out);
|
||||||
|
|
||||||
iterator_t prev = it;
|
auto prev = it;
|
||||||
for ( ++it ; it != end ; prev = it++)
|
for ( ++it ; it != end ; prev = it++)
|
||||||
{
|
{
|
||||||
point_t const& p0 = *prev;
|
point_t const& p0 = *prev;
|
||||||
@ -123,9 +122,8 @@ struct densify_ring
|
|||||||
if (boost::size(ring) <= 1)
|
if (boost::size(ring) <= 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
typedef typename point_type<Geometry>::type point_t;
|
auto const& p0 = range::back(ring);
|
||||||
point_t const& p0 = range::back(ring);
|
auto const& p1 = range::front(ring);
|
||||||
point_t const& p1 = range::front(ring);
|
|
||||||
|
|
||||||
auto strategy = strategies.densify(ring);
|
auto strategy = strategies.densify(ring);
|
||||||
push_back_policy<GeometryOut> policy(ring_out);
|
push_back_policy<GeometryOut> policy(ring_out);
|
||||||
|
@ -354,10 +354,7 @@ struct buffer_multi
|
|||||||
RobustPolicy const& robust_policy,
|
RobustPolicy const& robust_policy,
|
||||||
Strategies const& strategies)
|
Strategies const& strategies)
|
||||||
{
|
{
|
||||||
for (typename boost::range_iterator<Multi const>::type
|
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
|
||||||
it = boost::begin(multi);
|
|
||||||
it != boost::end(multi);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
Policy::apply(*it, collection,
|
Policy::apply(*it, collection,
|
||||||
distance_strategy, segment_strategy,
|
distance_strategy, segment_strategy,
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
#include <boost/geometry/algorithms/detail/sections/section_box_policies.hpp>
|
#include <boost/geometry/algorithms/detail/sections/section_box_policies.hpp>
|
||||||
|
|
||||||
#include <boost/geometry/views/detail/closed_clockwise_view.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>
|
#include <boost/geometry/util/range.hpp>
|
||||||
|
|
||||||
|
|
||||||
@ -295,12 +296,9 @@ struct buffered_piece_collection
|
|||||||
// and only applicable for linear features
|
// and only applicable for linear features
|
||||||
// (in a multi linestring with many short lines, the #endpoints can be
|
// (in a multi linestring with many short lines, the #endpoints can be
|
||||||
// much higher)
|
// much higher)
|
||||||
for (typename boost::range_iterator<std::vector<point_type> const>::type it
|
for (auto const& p : m_linear_end_points)
|
||||||
= boost::begin(m_linear_end_points);
|
|
||||||
it != boost::end(m_linear_end_points);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
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;
|
turn.is_linear_end_point = true;
|
||||||
}
|
}
|
||||||
@ -324,12 +322,9 @@ struct buffered_piece_collection
|
|||||||
enriched_map_buffer_include_policy());
|
enriched_map_buffer_include_policy());
|
||||||
|
|
||||||
// Sort turns over offsetted ring(s)
|
// Sort turns over offsetted ring(s)
|
||||||
for (typename mapped_vector_type::iterator mit
|
for (auto& pair : mapped_vector)
|
||||||
= mapped_vector.begin();
|
|
||||||
mit != mapped_vector.end();
|
|
||||||
++mit)
|
|
||||||
{
|
{
|
||||||
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
|
// Deflated rings may not travel to themselves, there should at least
|
||||||
// be three turns (which cannot be checked here - TODO: add to traverse)
|
// be three turns (which cannot be checked here - TODO: add to traverse)
|
||||||
for (typename boost::range_iterator<turn_vector_type>::type it =
|
for (auto& turn : m_turns)
|
||||||
boost::begin(m_turns); it != boost::end(m_turns); ++it)
|
|
||||||
{
|
{
|
||||||
buffer_turn_info_type& turn = *it;
|
|
||||||
if (! turn.is_turn_traversable)
|
if (! turn.is_turn_traversable)
|
||||||
{
|
{
|
||||||
continue;
|
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)
|
if (op.enriched.get_next_turn_index() == static_cast<signed_size_type>(turn.turn_index)
|
||||||
&& m_pieces[op.seg_id.piece_index].is_deflated)
|
&& m_pieces[op.seg_id.piece_index].is_deflated)
|
||||||
{
|
{
|
||||||
@ -385,10 +377,8 @@ struct buffered_piece_collection
|
|||||||
|
|
||||||
bool const deflate = m_distance_strategy.negative();
|
bool const deflate = m_distance_strategy.negative();
|
||||||
|
|
||||||
for (typename boost::range_iterator<turn_vector_type>::type it =
|
for (auto& turn : m_turns)
|
||||||
boost::begin(m_turns); it != boost::end(m_turns); ++it)
|
|
||||||
{
|
{
|
||||||
buffer_turn_info_type& turn = *it;
|
|
||||||
if (turn.is_turn_traversable)
|
if (turn.is_turn_traversable)
|
||||||
{
|
{
|
||||||
if (deflate && turn.count_in_original <= 0)
|
if (deflate && turn.count_in_original <= 0)
|
||||||
@ -408,13 +398,8 @@ struct buffered_piece_collection
|
|||||||
|
|
||||||
inline void update_turn_administration()
|
inline void update_turn_administration()
|
||||||
{
|
{
|
||||||
std::size_t index = 0;
|
for_each_with_index(m_turns, [this](std::size_t index, auto& turn)
|
||||||
for (typename boost::range_iterator<turn_vector_type>::type it =
|
|
||||||
boost::begin(m_turns); it != boost::end(m_turns); ++it, ++index)
|
|
||||||
{
|
{
|
||||||
buffer_turn_info_type& turn = *it;
|
|
||||||
|
|
||||||
// Update member used
|
|
||||||
turn.turn_index = index;
|
turn.turn_index = index;
|
||||||
|
|
||||||
// Verify if a turn is a linear endpoint
|
// Verify if a turn is a linear endpoint
|
||||||
@ -422,7 +407,7 @@ struct buffered_piece_collection
|
|||||||
{
|
{
|
||||||
check_linear_endpoints(turn);
|
check_linear_endpoints(turn);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate properties of piece borders which are not influenced
|
// Calculate properties of piece borders which are not influenced
|
||||||
@ -434,11 +419,8 @@ struct buffered_piece_collection
|
|||||||
// - (if pieces are reversed)
|
// - (if pieces are reversed)
|
||||||
inline void update_piece_administration()
|
inline void update_piece_administration()
|
||||||
{
|
{
|
||||||
for (typename piece_vector_type::iterator it = boost::begin(m_pieces);
|
for (auto& pc : m_pieces)
|
||||||
it != boost::end(m_pieces);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
piece& pc = *it;
|
|
||||||
piece_border_type& border = pc.m_piece_border;
|
piece_border_type& border = pc.m_piece_border;
|
||||||
buffered_ring<Ring> const& ring = offsetted_rings[pc.first_seg_id.multi_index];
|
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);
|
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.
|
// 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.
|
// 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.
|
// Those can never be traversed and should not be part of the output.
|
||||||
inline void discard_rings()
|
inline void discard_rings()
|
||||||
{
|
{
|
||||||
for (typename boost::range_iterator<turn_vector_type const>::type it =
|
for (auto const& turn : m_turns)
|
||||||
boost::begin(m_turns); it != boost::end(m_turns); ++it)
|
|
||||||
{
|
{
|
||||||
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[turn.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[1].seg_id.multi_index].has_accepted_intersections = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
offsetted_rings[it->operations[0].seg_id.multi_index].has_discarded_intersections = true;
|
offsetted_rings[turn.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[1].seg_id.multi_index].has_discarded_intersections = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -952,12 +933,8 @@ struct buffered_piece_collection
|
|||||||
// any of the robust original rings
|
// any of the robust original rings
|
||||||
// This can go quadratic if the input has many rings, and there
|
// This can go quadratic if the input has many rings, and there
|
||||||
// are many untouched deflated rings around
|
// are many untouched deflated rings around
|
||||||
for (typename std::vector<original_ring>::const_iterator it
|
for (auto const& original : original_rings)
|
||||||
= original_rings.begin();
|
|
||||||
it != original_rings.end();
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
original_ring const& original = *it;
|
|
||||||
if (original.m_ring.empty())
|
if (original.m_ring.empty())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@ -999,12 +976,8 @@ struct buffered_piece_collection
|
|||||||
// be discarded
|
// be discarded
|
||||||
inline void discard_nonintersecting_deflated_rings()
|
inline void discard_nonintersecting_deflated_rings()
|
||||||
{
|
{
|
||||||
for(typename buffered_ring_collection<buffered_ring<Ring> >::iterator it
|
for (auto& ring : offsetted_rings)
|
||||||
= boost::begin(offsetted_rings);
|
|
||||||
it != boost::end(offsetted_rings);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
buffered_ring<Ring>& ring = *it;
|
|
||||||
if (! ring.has_intersections()
|
if (! ring.has_intersections()
|
||||||
&& boost::size(ring) > 0u
|
&& boost::size(ring) > 0u
|
||||||
&& geometry::area(ring, m_strategy) < 0)
|
&& geometry::area(ring, m_strategy) < 0)
|
||||||
@ -1019,10 +992,8 @@ struct buffered_piece_collection
|
|||||||
|
|
||||||
inline void block_turns()
|
inline void block_turns()
|
||||||
{
|
{
|
||||||
for (typename boost::range_iterator<turn_vector_type>::type it =
|
for (auto& turn : m_turns)
|
||||||
boost::begin(m_turns); it != boost::end(m_turns); ++it)
|
|
||||||
{
|
{
|
||||||
buffer_turn_info_type& turn = *it;
|
|
||||||
if (! turn.is_turn_traversable)
|
if (! turn.is_turn_traversable)
|
||||||
{
|
{
|
||||||
// Discard this turn (don't set it to blocked to avoid colocated
|
// Discard this turn (don't set it to blocked to avoid colocated
|
||||||
@ -1055,21 +1026,16 @@ struct buffered_piece_collection
|
|||||||
|
|
||||||
inline void reverse()
|
inline void reverse()
|
||||||
{
|
{
|
||||||
for(typename buffered_ring_collection<buffered_ring<Ring> >::iterator it = boost::begin(offsetted_rings);
|
for (auto& ring : offsetted_rings)
|
||||||
it != boost::end(offsetted_rings);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
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
|
for (auto& ring : traversed_rings)
|
||||||
it = boost::begin(traversed_rings);
|
|
||||||
it != boost::end(traversed_rings);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
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
|
// Inner rings, for deflate, which do not have intersections, and
|
||||||
// which are outside originals, are skipped
|
// which are outside originals, are skipped
|
||||||
// (other ones should be traversed)
|
// (other ones should be traversed)
|
||||||
signed_size_type index = 0;
|
for_each_with_index(offsetted_rings, [&](std::size_t index, auto const& ring)
|
||||||
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()
|
if (! ring.has_intersections()
|
||||||
&& ! it->is_untouched_outside_original)
|
&& ! ring.is_untouched_outside_original)
|
||||||
{
|
{
|
||||||
properties p = properties(*it, m_strategy);
|
properties p = properties(ring, m_strategy);
|
||||||
if (p.valid)
|
if (p.valid)
|
||||||
{
|
{
|
||||||
ring_identifier id(0, index, -1);
|
ring_identifier id(0, index, -1);
|
||||||
selected[id] = p;
|
selected[id] = p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
// Select all created rings
|
// Select all created rings
|
||||||
index = 0;
|
for_each_with_index(traversed_rings, [&](std::size_t index, auto const& ring)
|
||||||
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);
|
properties p = properties(ring, m_strategy);
|
||||||
if (p.valid)
|
if (p.valid)
|
||||||
{
|
{
|
||||||
ring_identifier id(2, index, -1);
|
ring_identifier id(2, index, -1);
|
||||||
selected[id] = p;
|
selected[id] = p;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
detail::overlay::assign_parents<overlay_buffer>(offsetted_rings, traversed_rings,
|
detail::overlay::assign_parents<overlay_buffer>(offsetted_rings, traversed_rings,
|
||||||
selected, m_strategy);
|
selected, m_strategy);
|
||||||
|
@ -194,7 +194,6 @@ class piece_turn_visitor
|
|||||||
{
|
{
|
||||||
typedef typename boost::range_value<Rings const>::type ring_type;
|
typedef typename boost::range_value<Rings const>::type ring_type;
|
||||||
typedef typename boost::range_value<Turns const>::type turn_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 piece1_first_index = piece1.first_seg_id.segment_index;
|
||||||
signed_size_type const piece2_first_index = piece2.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
|
// get geometry and iterators over these sections
|
||||||
ring_type const& ring1 = m_rings[piece1.first_seg_id.multi_index];
|
ring_type const& ring1 = m_rings[piece1.first_seg_id.multi_index];
|
||||||
iterator it1_first = boost::begin(ring1) + sec1_first_index;
|
auto it1_first = boost::begin(ring1) + sec1_first_index;
|
||||||
iterator it1_beyond = boost::begin(ring1) + sec1_last_index + 1;
|
auto it1_beyond = boost::begin(ring1) + sec1_last_index + 1;
|
||||||
|
|
||||||
ring_type const& ring2 = m_rings[piece2.first_seg_id.multi_index];
|
ring_type const& ring2 = m_rings[piece2.first_seg_id.multi_index];
|
||||||
iterator it2_first = boost::begin(ring2) + sec2_first_index;
|
auto it2_first = boost::begin(ring2) + sec2_first_index;
|
||||||
iterator it2_beyond = boost::begin(ring2) + sec2_last_index + 1;
|
auto it2_beyond = boost::begin(ring2) + sec2_last_index + 1;
|
||||||
|
|
||||||
// Set begin/end of monotonic ranges, in both x/y directions
|
// Set begin/end of monotonic ranges, in both x/y directions
|
||||||
signed_size_type index1 = sec1_first_index;
|
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 = piece1.first_seg_id;
|
||||||
the_model.operations[0].seg_id.segment_index = index1; // override
|
the_model.operations[0].seg_id.segment_index = index1; // override
|
||||||
|
|
||||||
iterator it1 = it1_first;
|
auto it1 = it1_first;
|
||||||
for (iterator prev1 = it1++;
|
for (auto prev1 = it1++;
|
||||||
it1 != it1_beyond;
|
it1 != it1_beyond;
|
||||||
prev1 = it1++, the_model.operations[0].seg_id.segment_index++)
|
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);
|
unique_sub_range_from_piece<ring_type> unique_sub_range1(ring1, prev1, it1);
|
||||||
|
|
||||||
iterator it2 = it2_first;
|
auto it2 = it2_first;
|
||||||
for (iterator prev2 = it2++;
|
for (auto prev2 = it2++;
|
||||||
it2 != it2_beyond;
|
it2 != it2_beyond;
|
||||||
prev2 = it2++, the_model.operations[1].seg_id.segment_index++)
|
prev2 = it2++, the_model.operations[1].seg_id.segment_index++)
|
||||||
{
|
{
|
||||||
|
@ -190,20 +190,11 @@ inline int point_in_original(Point const& point, Original const& original,
|
|||||||
return strategy.result(state);
|
return strategy.result(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef typename Original::sections_type sections_type;
|
auto const point_x = geometry::get<0>(point);
|
||||||
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);
|
|
||||||
|
|
||||||
// Walk through all monotonic sections of this original
|
// Walk through all monotonic sections of this original
|
||||||
for (iterator_type it = boost::begin(original.m_sections);
|
for (auto const& section : original.m_sections)
|
||||||
it != boost::end(original.m_sections);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
section_type const& section = *it;
|
|
||||||
|
|
||||||
if (! section.duplicate
|
if (! section.duplicate
|
||||||
&& section.begin_index < section.end_index
|
&& section.begin_index < section.end_index
|
||||||
&& point_x >= geometry::get<min_corner, 0>(section.bounding_box)
|
&& point_x >= geometry::get<min_corner, 0>(section.bounding_box)
|
||||||
|
@ -36,7 +36,7 @@ struct clean_point
|
|||||||
, m_is_azi_valid(false), m_is_azi_diff_valid(false)
|
, 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;
|
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 boost::range_iterator<Ring const>::type iter_t;
|
||||||
typedef typename Strategy::template result_type<Ring>::type calc_t;
|
typedef typename Strategy::template result_type<Ring>::type calc_t;
|
||||||
typedef clean_point<iter_t, calc_t> clean_point_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 zero = 0;
|
||||||
calc_t const pi = math::pi<calc_t>();
|
calc_t const pi = math::pi<calc_t>();
|
||||||
@ -121,7 +119,7 @@ struct calculate_point_order_by_azimuth
|
|||||||
}
|
}
|
||||||
|
|
||||||
// non-duplicated, non-spike points
|
// non-duplicated, non-spike points
|
||||||
cleaned_container_t cleaned;
|
std::vector<clean_point_t> cleaned;
|
||||||
cleaned.reserve(count);
|
cleaned.reserve(count);
|
||||||
|
|
||||||
for (iter_t it = boost::begin(ring); it != boost::end(ring); ++it)
|
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)
|
while (cleaned.size() >= 3)
|
||||||
{
|
{
|
||||||
cleaned_iter_t it0 = cleaned.end() - 3;
|
auto it0 = cleaned.end() - 3;
|
||||||
cleaned_iter_t it1 = cleaned.end() - 2;
|
auto it1 = cleaned.end() - 2;
|
||||||
cleaned_iter_t it2 = cleaned.end() - 1;
|
auto it2 = cleaned.end() - 1;
|
||||||
|
|
||||||
calc_t diff;
|
calc_t diff;
|
||||||
if (get_or_calculate_azimuths_difference(*it0, *it1, *it2, diff, strategy)
|
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
|
// filter-out duplicates and spikes at the front and back of cleaned
|
||||||
cleaned_iter_t cleaned_b = cleaned.begin();
|
auto cleaned_b = cleaned.begin();
|
||||||
cleaned_iter_t cleaned_e = cleaned.end();
|
auto cleaned_e = cleaned.end();
|
||||||
std::size_t cleaned_count = cleaned.size();
|
std::size_t cleaned_count = cleaned.size();
|
||||||
bool found = false;
|
bool found = false;
|
||||||
do
|
do
|
||||||
@ -165,10 +163,10 @@ struct calculate_point_order_by_azimuth
|
|||||||
found = false;
|
found = false;
|
||||||
while(cleaned_count >= 3)
|
while(cleaned_count >= 3)
|
||||||
{
|
{
|
||||||
cleaned_iter_t it0 = cleaned_e - 2;
|
auto it0 = cleaned_e - 2;
|
||||||
cleaned_iter_t it1 = cleaned_e - 1;
|
auto it1 = cleaned_e - 1;
|
||||||
cleaned_iter_t it2 = cleaned_b;
|
auto it2 = cleaned_b;
|
||||||
cleaned_iter_t it3 = cleaned_b + 1;
|
auto it3 = cleaned_b + 1;
|
||||||
|
|
||||||
calc_t diff = 0;
|
calc_t diff = 0;
|
||||||
if (! get_or_calculate_azimuths_difference(*it0, *it1, *it2, diff, strategy)
|
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
|
// calculate the sum of external angles
|
||||||
calc_t angles_sum = zero;
|
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);
|
auto it0 = (it == cleaned_b ? cleaned_e - 1 : it - 1);
|
||||||
cleaned_iter_t it2 = (it == cleaned_e - 1 ? cleaned_b : it + 1);
|
auto it2 = (it == cleaned_e - 1 ? cleaned_b : it + 1);
|
||||||
|
|
||||||
calc_t diff = 0;
|
calc_t diff = 0;
|
||||||
get_or_calculate_azimuths_difference(*it0, *it, *it2, diff, strategy);
|
get_or_calculate_azimuths_difference(*it0, *it, *it2, diff, strategy);
|
||||||
|
@ -37,8 +37,7 @@ class calculate_polygon_sum
|
|||||||
static inline ReturnType sum_interior_rings(Rings const& rings, Strategy const& strategy)
|
static inline ReturnType sum_interior_rings(Rings const& rings, Strategy const& strategy)
|
||||||
{
|
{
|
||||||
ReturnType sum = ReturnType(0);
|
ReturnType sum = ReturnType(0);
|
||||||
for (typename boost::range_iterator<Rings const>::type
|
for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
|
||||||
it = boost::begin(rings); it != boost::end(rings); ++it)
|
|
||||||
{
|
{
|
||||||
sum += Policy::apply(*it, strategy);
|
sum += Policy::apply(*it, strategy);
|
||||||
}
|
}
|
||||||
|
@ -148,8 +148,6 @@ class graham_andrew
|
|||||||
{
|
{
|
||||||
typedef InputPoint point_type;
|
typedef InputPoint point_type;
|
||||||
typedef typename std::vector<point_type> container_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
|
class partitions
|
||||||
{
|
{
|
||||||
@ -228,9 +226,9 @@ private:
|
|||||||
SideStrategy const& side)
|
SideStrategy const& side)
|
||||||
{
|
{
|
||||||
output.push_back(left);
|
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);
|
add_to_hull<Factor>(right, output, side);
|
||||||
}
|
}
|
||||||
@ -244,7 +242,7 @@ private:
|
|||||||
std::size_t output_size = output.size();
|
std::size_t output_size = output.size();
|
||||||
while (output_size >= 3)
|
while (output_size >= 3)
|
||||||
{
|
{
|
||||||
rev_iterator rit = output.rbegin();
|
auto rit = output.rbegin();
|
||||||
point_type const last = *rit++;
|
point_type const last = *rit++;
|
||||||
point_type const& last2 = *rit++;
|
point_type const& last2 = *rit++;
|
||||||
|
|
||||||
|
@ -30,8 +30,6 @@
|
|||||||
|
|
||||||
#include <boost/geometry/util/range.hpp>
|
#include <boost/geometry/util/range.hpp>
|
||||||
|
|
||||||
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
namespace boost { namespace geometry
|
namespace boost { namespace geometry
|
||||||
{
|
{
|
||||||
@ -67,10 +65,8 @@ struct polygon_count
|
|||||||
{
|
{
|
||||||
std::size_t n = RangeCount::apply(exterior_ring(poly));
|
std::size_t n = RangeCount::apply(exterior_ring(poly));
|
||||||
|
|
||||||
typename interior_return_type<Polygon const>::type
|
auto const& rings = interior_rings(poly);
|
||||||
rings = interior_rings(poly);
|
for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
|
||||||
for (typename detail::interior_iterator<Polygon const>::type
|
|
||||||
it = boost::begin(rings); it != boost::end(rings); ++it)
|
|
||||||
{
|
{
|
||||||
n += RangeCount::apply(*it);
|
n += RangeCount::apply(*it);
|
||||||
}
|
}
|
||||||
@ -84,13 +80,10 @@ template <typename SingleCount>
|
|||||||
struct multi_count
|
struct multi_count
|
||||||
{
|
{
|
||||||
template <typename MultiGeometry>
|
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;
|
std::size_t n = 0;
|
||||||
for (typename boost::range_iterator<MultiGeometry const>::type
|
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
|
||||||
it = boost::begin(geometry);
|
|
||||||
it != boost::end(geometry);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
n += SingleCount::apply(*it);
|
n += SingleCount::apply(*it);
|
||||||
}
|
}
|
||||||
|
@ -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)
|
static inline bool apply(Geometry1 const& g1, Geometry2 const& g2, Strategy const& strategy)
|
||||||
{
|
{
|
||||||
// TODO: use partition or rtree on g2
|
// TODO: use partition or rtree on g2
|
||||||
typedef typename boost::range_iterator<Geometry1 const>::type iterator;
|
for (auto it = boost::begin(g1); it != boost::end(g1); ++it)
|
||||||
for ( iterator it = boost::begin(g1) ; it != boost::end(g1) ; ++it )
|
|
||||||
{
|
{
|
||||||
typedef typename boost::range_value<Geometry1 const>::type value_type;
|
typedef typename boost::range_value<Geometry1 const>::type value_type;
|
||||||
if ( ! disjoint_no_intersections_policy<value_type const, Geometry2>
|
if (! disjoint_no_intersections_policy<value_type const, Geometry2>
|
||||||
::apply(*it, g2, strategy) )
|
::apply(*it, g2, strategy))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -291,8 +291,7 @@ public:
|
|||||||
geometry::envelope(single_geometry, box2, strategy);
|
geometry::envelope(single_geometry, box2, strategy);
|
||||||
geometry::detail::expand_by_epsilon(box2);
|
geometry::detail::expand_by_epsilon(box2);
|
||||||
|
|
||||||
typedef typename boost::range_const_iterator<MultiPoint>::type iterator;
|
for (auto it = boost::begin(multi_point) ; it != boost::end(multi_point) ; ++it)
|
||||||
for ( iterator it = boost::begin(multi_point) ; it != boost::end(multi_point) ; ++it )
|
|
||||||
{
|
{
|
||||||
// The default strategy is enough for Point/Box
|
// The default strategy is enough for Point/Box
|
||||||
if (! detail::disjoint::disjoint_point_box(*it, box2, strategy)
|
if (! detail::disjoint::disjoint_point_box(*it, box2, strategy)
|
||||||
|
@ -163,17 +163,11 @@ public:
|
|||||||
Strategies const& strategies,
|
Strategies const& strategies,
|
||||||
bool check_intersection = true)
|
bool check_intersection = true)
|
||||||
{
|
{
|
||||||
typedef geometry::point_iterator<Geometry const> point_iterator_type;
|
|
||||||
typedef geometry::segment_iterator
|
typedef geometry::segment_iterator
|
||||||
<
|
<
|
||||||
Geometry const
|
Geometry const
|
||||||
> segment_iterator_type;
|
> 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;
|
typedef assign_new_min_iterator<SegmentOrBox> assign_new_value;
|
||||||
|
|
||||||
|
|
||||||
@ -203,21 +197,16 @@ public:
|
|||||||
// consider all distances of the points in the geometry to the
|
// consider all distances of the points in the geometry to the
|
||||||
// segment or box
|
// segment or box
|
||||||
comparable_return_type cd_min1(0);
|
comparable_return_type cd_min1(0);
|
||||||
point_iterator_type pit_min;
|
auto pit_min = points_begin(geometry);
|
||||||
seg_or_box_const_iterator it_min1 = boost::const_begin(seg_or_box_points);
|
auto it_min1 = boost::const_begin(seg_or_box_points);
|
||||||
seg_or_box_const_iterator it_min2 = it_min1;
|
auto it_min2 = it_min1 + 1;
|
||||||
++it_min2;
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
for (point_iterator_type pit = points_begin(geometry);
|
for (auto pit = pit_min;
|
||||||
pit != points_end(geometry); ++pit, first = false)
|
pit != points_end(geometry); ++pit, first = false)
|
||||||
{
|
{
|
||||||
comparable_return_type cd;
|
comparable_return_type cd;
|
||||||
std::pair
|
auto it_pair = point_to_point_range::apply(*pit,
|
||||||
<
|
|
||||||
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_begin(seg_or_box_points),
|
||||||
boost::const_end(seg_or_box_points),
|
boost::const_end(seg_or_box_points),
|
||||||
cstrategy,
|
cstrategy,
|
||||||
@ -236,10 +225,10 @@ public:
|
|||||||
// segments of the geometry
|
// segments of the geometry
|
||||||
comparable_return_type cd_min2(0);
|
comparable_return_type cd_min2(0);
|
||||||
segment_iterator_type sit_min;
|
segment_iterator_type sit_min;
|
||||||
seg_or_box_const_iterator it_min;
|
auto it_min = boost::const_begin(seg_or_box_points);
|
||||||
|
|
||||||
first = true;
|
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)
|
it != boost::const_end(seg_or_box_points); ++it, first = false)
|
||||||
{
|
{
|
||||||
comparable_return_type cd;
|
comparable_return_type cd;
|
||||||
@ -299,14 +288,7 @@ class geometry_to_segment_or_box
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
typedef detail::closest_feature::geometry_to_range base_type;
|
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 detail::closest_feature::geometry_to_range geometry_to_range;
|
||||||
|
|
||||||
typedef distance::strategy_t<MultiPoint, SegmentOrBox, Strategies> strategy_type;
|
typedef distance::strategy_t<MultiPoint, SegmentOrBox, Strategies> strategy_type;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -318,7 +300,7 @@ public:
|
|||||||
{
|
{
|
||||||
distance::creturn_t<MultiPoint, SegmentOrBox, Strategies> cd_min;
|
distance::creturn_t<MultiPoint, SegmentOrBox, Strategies> cd_min;
|
||||||
|
|
||||||
iterator_type it_min
|
auto const it_min
|
||||||
= geometry_to_range::apply(segment_or_box,
|
= geometry_to_range::apply(segment_or_box,
|
||||||
boost::begin(multipoint),
|
boost::begin(multipoint),
|
||||||
boost::end(multipoint),
|
boost::end(multipoint),
|
||||||
|
@ -162,11 +162,6 @@ struct envelope_range_of_boxes_by_expansion
|
|||||||
{
|
{
|
||||||
typedef typename boost::range_value<RangeOfBoxes>::type box_type;
|
typedef typename boost::range_value<RangeOfBoxes>::type box_type;
|
||||||
|
|
||||||
typedef typename boost::range_iterator
|
|
||||||
<
|
|
||||||
RangeOfBoxes const
|
|
||||||
>::type iterator_type;
|
|
||||||
|
|
||||||
// first initialize MBR
|
// first initialize MBR
|
||||||
detail::indexed_point_view<Box, min_corner> mbr_min(mbr);
|
detail::indexed_point_view<Box, min_corner> mbr_min(mbr);
|
||||||
detail::indexed_point_view<Box, max_corner> mbr_max(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);
|
>::apply(first_box_max, mbr_max);
|
||||||
|
|
||||||
// now expand using the remaining boxes
|
// 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)
|
for (++it; it != boost::end(range_of_boxes); ++it)
|
||||||
{
|
{
|
||||||
detail::expand::indexed_loop
|
detail::expand::indexed_loop
|
||||||
@ -237,10 +232,6 @@ struct envelope_range_of_boxes
|
|||||||
typedef typename boost::range_value<RangeOfBoxes>::type box_type;
|
typedef typename boost::range_value<RangeOfBoxes>::type box_type;
|
||||||
typedef typename coordinate_type<box_type>::type coordinate_type;
|
typedef typename coordinate_type<box_type>::type coordinate_type;
|
||||||
typedef typename detail::cs_angular_units<box_type>::type units_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
|
static const bool is_equatorial = ! std::is_same
|
||||||
<
|
<
|
||||||
@ -258,10 +249,10 @@ struct envelope_range_of_boxes
|
|||||||
|
|
||||||
BOOST_GEOMETRY_ASSERT(! boost::empty(range_of_boxes));
|
BOOST_GEOMETRY_ASSERT(! boost::empty(range_of_boxes));
|
||||||
|
|
||||||
iterator_type it_min = std::min_element(boost::begin(range_of_boxes),
|
auto const it_min = std::min_element(boost::begin(range_of_boxes),
|
||||||
boost::end(range_of_boxes),
|
boost::end(range_of_boxes),
|
||||||
latitude_less<min_corner>());
|
latitude_less<min_corner>());
|
||||||
iterator_type it_max = std::max_element(boost::begin(range_of_boxes),
|
auto const it_max = std::max_element(boost::begin(range_of_boxes),
|
||||||
boost::end(range_of_boxes),
|
boost::end(range_of_boxes),
|
||||||
latitude_less<max_corner>());
|
latitude_less<max_corner>());
|
||||||
|
|
||||||
@ -270,17 +261,18 @@ struct envelope_range_of_boxes
|
|||||||
coordinate_type const period = constants::period();
|
coordinate_type const period = constants::period();
|
||||||
|
|
||||||
interval_range_type intervals;
|
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 != boost::end(range_of_boxes);
|
||||||
++it)
|
++it)
|
||||||
{
|
{
|
||||||
if (is_inverse_spheroidal_coordinates(*it))
|
auto const& box = *it;
|
||||||
|
if (is_inverse_spheroidal_coordinates(box))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
coordinate_type lat_min = geometry::get<min_corner, 1>(*it);
|
coordinate_type lat_min = geometry::get<min_corner, 1>(box);
|
||||||
coordinate_type lat_max = geometry::get<max_corner, 1>(*it);
|
coordinate_type lat_max = geometry::get<max_corner, 1>(box);
|
||||||
if (math::equals(lat_min, constants::max_latitude())
|
if (math::equals(lat_min, constants::max_latitude())
|
||||||
|| math::equals(lat_max, constants::min_latitude()))
|
|| math::equals(lat_max, constants::min_latitude()))
|
||||||
{
|
{
|
||||||
@ -289,8 +281,8 @@ struct envelope_range_of_boxes
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
coordinate_type lon_left = geometry::get<min_corner, 0>(*it);
|
coordinate_type lon_left = geometry::get<min_corner, 0>(box);
|
||||||
coordinate_type lon_right = geometry::get<max_corner, 0>(*it);
|
coordinate_type lon_right = geometry::get<max_corner, 0>(box);
|
||||||
|
|
||||||
if (math::larger(lon_right, max_longitude))
|
if (math::larger(lon_right, max_longitude))
|
||||||
{
|
{
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
#include <boost/numeric/conversion/cast.hpp>
|
#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/detail/normalize.hpp>
|
||||||
#include <boost/geometry/algorithms/not_implemented.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;
|
typedef range_collect_vectors<ring_type, Collection> per_range;
|
||||||
per_range::apply(collection, exterior_ring(polygon));
|
per_range::apply(collection, exterior_ring(polygon));
|
||||||
|
|
||||||
typename interior_return_type<Polygon const>::type
|
auto const& rings = interior_rings(polygon);
|
||||||
rings = interior_rings(polygon);
|
for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
|
||||||
for (typename detail::interior_iterator<Polygon const>::type
|
|
||||||
it = boost::begin(rings); it != boost::end(rings); ++it)
|
|
||||||
{
|
{
|
||||||
per_range::apply(collection, *it);
|
per_range::apply(collection, *it);
|
||||||
}
|
}
|
||||||
@ -416,10 +413,7 @@ struct multi_collect_vectors
|
|||||||
{
|
{
|
||||||
static inline void apply(Collection& collection, MultiGeometry const& multi)
|
static inline void apply(Collection& collection, MultiGeometry const& multi)
|
||||||
{
|
{
|
||||||
for (typename boost::range_iterator<MultiGeometry const>::type
|
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
|
||||||
it = boost::begin(multi);
|
|
||||||
it != boost::end(multi);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
SinglePolicy::apply(collection, *it);
|
SinglePolicy::apply(collection, *it);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include <boost/range/value_type.hpp>
|
#include <boost/range/value_type.hpp>
|
||||||
|
|
||||||
#include <boost/geometry/algorithms/detail/assign_box_corners.hpp>
|
#include <boost/geometry/algorithms/detail/assign_box_corners.hpp>
|
||||||
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
|
|
||||||
|
|
||||||
#include <boost/geometry/arithmetic/arithmetic.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 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;
|
typedef typename geometry::point_type<Ring>::type point_type;
|
||||||
|
|
||||||
template <typename CirclingIterator, typename Points>
|
template <typename CirclingIterator, typename Points>
|
||||||
@ -288,8 +286,7 @@ struct extreme_points_on_ring
|
|||||||
template <typename Iterator, typename SideStrategy>
|
template <typename Iterator, typename SideStrategy>
|
||||||
static inline bool right_turn(Ring const& ring, Iterator it, SideStrategy const& strategy)
|
static inline bool right_turn(Ring const& ring, Iterator it, SideStrategy const& strategy)
|
||||||
{
|
{
|
||||||
typename std::iterator_traits<Iterator>::difference_type const index
|
auto const index = std::distance(boost::begin(ring), it);
|
||||||
= std::distance(boost::begin(ring), it);
|
|
||||||
geometry::ever_circling_range_iterator<Ring const> left(ring);
|
geometry::ever_circling_range_iterator<Ring const> left(ring);
|
||||||
geometry::ever_circling_range_iterator<Ring const> right(ring);
|
geometry::ever_circling_range_iterator<Ring const> right(ring);
|
||||||
left += index;
|
left += index;
|
||||||
@ -326,9 +323,9 @@ struct extreme_points_on_ring
|
|||||||
|
|
||||||
// Get all maxima, usually one. In case of self-tangencies, or self-crossings,
|
// 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
|
// 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;
|
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))
|
if (smaller(*max_it, *it) && right_turn(ring, it, strategy))
|
||||||
{
|
{
|
||||||
@ -341,8 +338,7 @@ struct extreme_points_on_ring
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
typename std::iterator_traits<range_iterator>::difference_type const
|
auto const index = std::distance(boost::begin(ring), max_it);
|
||||||
index = std::distance(boost::begin(ring), max_it);
|
|
||||||
//std::cout << "Extreme point lies at " << index << " having " << geometry::wkt(*max_it) << std::endl;
|
//std::cout << "Extreme point lies at " << index << " having " << geometry::wkt(*max_it) << std::endl;
|
||||||
|
|
||||||
geometry::ever_circling_range_iterator<Ring const> left(ring);
|
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
|
// For a polygon, its interior rings can contain intruders
|
||||||
typename interior_return_type<Polygon const>::type
|
auto const& rings = interior_rings(polygon);
|
||||||
rings = interior_rings(polygon);
|
for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
|
||||||
for (typename detail::interior_iterator<Polygon const>::type
|
|
||||||
it = boost::begin(rings); it != boost::end(rings); ++it)
|
|
||||||
{
|
{
|
||||||
ring_implementation::get_intruders(*it, extremes, intruders, strategy);
|
ring_implementation::get_intruders(*it, extremes, intruders, strategy);
|
||||||
}
|
}
|
||||||
|
@ -91,10 +91,8 @@ inline bool has_self_intersections(Geometry const& geometry,
|
|||||||
#ifdef BOOST_GEOMETRY_DEBUG_HAS_SELF_INTERSECTIONS
|
#ifdef BOOST_GEOMETRY_DEBUG_HAS_SELF_INTERSECTIONS
|
||||||
bool first = true;
|
bool first = true;
|
||||||
#endif
|
#endif
|
||||||
for(typename std::deque<turn_info>::const_iterator it = boost::begin(turns);
|
for (auto const& info : turns)
|
||||||
it != boost::end(turns); ++it)
|
|
||||||
{
|
{
|
||||||
turn_info const& info = *it;
|
|
||||||
bool const both_union_turn =
|
bool const both_union_turn =
|
||||||
info.operations[0].operation == detail::overlay::operation_union
|
info.operations[0].operation == detail::overlay::operation_union
|
||||||
&& info.operations[1].operation == detail::overlay::operation_union;
|
&& info.operations[1].operation == detail::overlay::operation_union;
|
||||||
|
@ -64,19 +64,9 @@ struct intersection_multi_linestring_multi_linestring_point
|
|||||||
{
|
{
|
||||||
// Note, this loop is quadratic w.r.t. number of linestrings per input.
|
// Note, this loop is quadratic w.r.t. number of linestrings per input.
|
||||||
// Future Enhancement: first do the sections of each, then intersect.
|
// Future Enhancement: first do the sections of each, then intersect.
|
||||||
for (typename boost::range_iterator
|
for (auto it1 = boost::begin(ml1); it1 != boost::end(ml1); ++it1)
|
||||||
<
|
|
||||||
MultiLinestring1 const
|
|
||||||
>::type it1 = boost::begin(ml1);
|
|
||||||
it1 != boost::end(ml1);
|
|
||||||
++it1)
|
|
||||||
{
|
{
|
||||||
for (typename boost::range_iterator
|
for (auto it2 = boost::begin(ml2); it2 != boost::end(ml2); ++it2)
|
||||||
<
|
|
||||||
MultiLinestring2 const
|
|
||||||
>::type it2 = boost::begin(ml2);
|
|
||||||
it2 != boost::end(ml2);
|
|
||||||
++it2)
|
|
||||||
{
|
{
|
||||||
out = intersection_linestring_linestring_point<PointOut>
|
out = intersection_linestring_linestring_point<PointOut>
|
||||||
::apply(*it1, *it2, robust_policy, out, strategy);
|
::apply(*it1, *it2, robust_policy, out, strategy);
|
||||||
@ -103,12 +93,7 @@ struct intersection_linestring_multi_linestring_point
|
|||||||
OutputIterator out,
|
OutputIterator out,
|
||||||
Strategy const& strategy)
|
Strategy const& strategy)
|
||||||
{
|
{
|
||||||
for (typename boost::range_iterator
|
for (auto it = boost::begin(ml); it != boost::end(ml); ++it)
|
||||||
<
|
|
||||||
MultiLinestring const
|
|
||||||
>::type it = boost::begin(ml);
|
|
||||||
it != boost::end(ml);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
out = intersection_linestring_linestring_point<PointOut>
|
out = intersection_linestring_linestring_point<PointOut>
|
||||||
::apply(linestring, *it, robust_policy, out, strategy);
|
::apply(linestring, *it, robust_policy, out, strategy);
|
||||||
@ -141,12 +126,7 @@ struct intersection_of_multi_linestring_with_areal
|
|||||||
OutputIterator out,
|
OutputIterator out,
|
||||||
Strategy const& strategy)
|
Strategy const& strategy)
|
||||||
{
|
{
|
||||||
for (typename boost::range_iterator
|
for (auto it = boost::begin(ml); it != boost::end(ml); ++it)
|
||||||
<
|
|
||||||
MultiLinestring const
|
|
||||||
>::type it = boost::begin(ml);
|
|
||||||
it != boost::end(ml);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
out = intersection_of_linestring_with_areal
|
out = intersection_of_linestring_with_areal
|
||||||
<
|
<
|
||||||
@ -205,9 +185,7 @@ struct clip_multi_linestring
|
|||||||
{
|
{
|
||||||
typedef typename point_type<LinestringOut>::type point_type;
|
typedef typename point_type<LinestringOut>::type point_type;
|
||||||
strategy::intersection::liang_barsky<Box, point_type> lb_strategy;
|
strategy::intersection::liang_barsky<Box, point_type> lb_strategy;
|
||||||
for (typename boost::range_iterator<MultiLinestring const>::type it
|
for (auto it = boost::begin(multi_linestring); it != boost::end(multi_linestring); ++it)
|
||||||
= boost::begin(multi_linestring);
|
|
||||||
it != boost::end(multi_linestring); ++it)
|
|
||||||
{
|
{
|
||||||
out = detail::intersection::clip_range_with_box
|
out = detail::intersection::clip_range_with_box
|
||||||
<LinestringOut>(box, *it, robust_policy, out, lb_strategy);
|
<LinestringOut>(box, *it, robust_policy, out, lb_strategy);
|
||||||
|
@ -69,9 +69,7 @@ struct debug_boundary_points_printer<MultiLinestring, multi_linestring_tag>
|
|||||||
typedef std::vector<point_type> point_vector;
|
typedef std::vector<point_type> point_vector;
|
||||||
|
|
||||||
point_vector boundary_points;
|
point_vector boundary_points;
|
||||||
for (typename boost::range_iterator<MultiLinestring const>::type it
|
for (auto it = boost::begin(multilinestring); it != boost::end(multilinestring); ++it)
|
||||||
= boost::begin(multilinestring);
|
|
||||||
it != boost::end(multilinestring); ++it)
|
|
||||||
{
|
{
|
||||||
if ( boost::size(*it) > 1
|
if ( boost::size(*it) > 1
|
||||||
&& !geometry::equals(range::front(*it), range::back(*it)) )
|
&& !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>());
|
geometry::less<point_type>());
|
||||||
|
|
||||||
std::cout << "boundary points: ";
|
std::cout << "boundary points: ";
|
||||||
for (typename point_vector::const_iterator
|
for (auto const& p : boundary_points)
|
||||||
pit = boundary_points.begin();
|
|
||||||
pit != boundary_points.end(); ++pit)
|
|
||||||
{
|
{
|
||||||
std::cout << " " << geometry::dsv(*pit);
|
std::cout << " " << geometry::dsv(p);
|
||||||
}
|
}
|
||||||
std::cout << std::endl << std::endl;
|
std::cout << std::endl << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,9 @@ struct has_spikes
|
|||||||
Strategy const& strategy)
|
Strategy const& strategy)
|
||||||
{
|
{
|
||||||
if (first == last)
|
if (first == last)
|
||||||
|
{
|
||||||
return last;
|
return last;
|
||||||
|
}
|
||||||
auto const& front = *first;
|
auto const& front = *first;
|
||||||
++first;
|
++first;
|
||||||
return std::find_if(first, last, [&](auto const& pt) {
|
return std::find_if(first, last, [&](auto const& pt) {
|
||||||
@ -71,18 +73,12 @@ struct has_spikes
|
|||||||
{
|
{
|
||||||
boost::ignore_unused(visitor);
|
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),
|
||||||
iterator cur = boost::begin(view);
|
|
||||||
typename boost::range_reverse_iterator
|
|
||||||
<
|
|
||||||
View const
|
|
||||||
>::type prev = find_different_from_first(boost::rbegin(view),
|
|
||||||
boost::rend(view),
|
boost::rend(view),
|
||||||
strategy);
|
strategy);
|
||||||
|
|
||||||
iterator next = find_different_from_first(cur, boost::end(view),
|
auto next = find_different_from_first(cur, boost::end(view), strategy);
|
||||||
strategy);
|
|
||||||
if (detail::is_spike_or_equal(*next, *cur, *prev, strategy.side()))
|
if (detail::is_spike_or_equal(*next, *cur, *prev, strategy.side()))
|
||||||
{
|
{
|
||||||
return ! visitor.template apply<failure_spikes>(is_linear, *cur);
|
return ! visitor.template apply<failure_spikes>(is_linear, *cur);
|
||||||
@ -131,8 +127,7 @@ struct has_spikes
|
|||||||
// also in geographic cases going over the pole
|
// also in geographic cases going over the pole
|
||||||
if (detail::is_spike_or_equal(*next, *cur, *prev, strategy.side()))
|
if (detail::is_spike_or_equal(*next, *cur, *prev, strategy.side()))
|
||||||
{
|
{
|
||||||
return
|
return ! visitor.template apply<failure_spikes>(is_linestring, *cur);
|
||||||
! visitor.template apply<failure_spikes>(is_linestring, *cur);
|
|
||||||
}
|
}
|
||||||
prev = cur;
|
prev = cur;
|
||||||
cur = next;
|
cur = next;
|
||||||
|
@ -36,10 +36,7 @@ struct multi_modify_with_predicate
|
|||||||
{
|
{
|
||||||
static inline void apply(MultiGeometry& multi, Predicate const& predicate)
|
static inline void apply(MultiGeometry& multi, Predicate const& predicate)
|
||||||
{
|
{
|
||||||
typedef typename boost::range_iterator<MultiGeometry>::type iterator_type;
|
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
|
||||||
for (iterator_type it = boost::begin(multi);
|
|
||||||
it != boost::end(multi);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
Policy::apply(*it, predicate);
|
Policy::apply(*it, predicate);
|
||||||
}
|
}
|
||||||
|
@ -31,15 +31,10 @@ namespace detail
|
|||||||
struct multi_sum
|
struct multi_sum
|
||||||
{
|
{
|
||||||
template <typename ReturnType, typename Policy, typename MultiGeometry, typename Strategy>
|
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();
|
ReturnType sum = ReturnType();
|
||||||
for (typename boost::range_iterator
|
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
|
||||||
<
|
|
||||||
MultiGeometry const
|
|
||||||
>::type it = boost::begin(geometry);
|
|
||||||
it != boost::end(geometry);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
sum += Policy::apply(*it, strategy);
|
sum += Policy::apply(*it, strategy);
|
||||||
}
|
}
|
||||||
|
@ -48,8 +48,6 @@ struct num_distinct_consecutive_points
|
|||||||
template <typename Strategy>
|
template <typename Strategy>
|
||||||
static inline std::size_t apply(Range const& range, Strategy const& 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);
|
std::size_t const size = boost::size(range);
|
||||||
|
|
||||||
if ( size < 2u )
|
if ( size < 2u )
|
||||||
@ -57,13 +55,13 @@ struct num_distinct_consecutive_points
|
|||||||
return (size < MaximumNumber) ? size : MaximumNumber;
|
return (size < MaximumNumber) ? size : MaximumNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator current = boost::begin(range);
|
auto current = boost::begin(range);
|
||||||
iterator const end = boost::end(range);
|
auto const end = boost::end(range);
|
||||||
std::size_t counter(0);
|
std::size_t counter(0);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
++counter;
|
++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);
|
return ! equals::equals_point_point(pt, *current, strategy);
|
||||||
});
|
});
|
||||||
current = next;
|
current = next;
|
||||||
|
@ -96,8 +96,6 @@ inline OutputIterator add_rings(SelectionMap const& map,
|
|||||||
Strategy const& strategy,
|
Strategy const& strategy,
|
||||||
add_rings_error_handling error_handling = add_rings_ignore_unordered)
|
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
|
std::size_t const min_num_points = core_detail::closure::minimum_ring_size
|
||||||
<
|
<
|
||||||
geometry::closure
|
geometry::closure
|
||||||
@ -110,29 +108,23 @@ inline OutputIterator add_rings(SelectionMap const& map,
|
|||||||
>::value;
|
>::value;
|
||||||
|
|
||||||
|
|
||||||
for (iterator it = boost::begin(map);
|
for (auto const& pair : map)
|
||||||
it != boost::end(map);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
if (! it->second.discarded
|
if (! pair.second.discarded
|
||||||
&& it->second.parent.source_index == -1)
|
&& pair.second.parent.source_index == -1)
|
||||||
{
|
{
|
||||||
GeometryOut result;
|
GeometryOut result;
|
||||||
convert_and_add(result, geometry1, geometry2, collection,
|
convert_and_add(result, geometry1, geometry2, collection,
|
||||||
it->first, it->second.reversed, false);
|
pair.first, pair.second.reversed, false);
|
||||||
|
|
||||||
// Add children
|
// Add children
|
||||||
for (typename std::vector<ring_identifier>::const_iterator child_it
|
for (auto const& child : pair.second.children)
|
||||||
= it->second.children.begin();
|
|
||||||
child_it != it->second.children.end();
|
|
||||||
++child_it)
|
|
||||||
{
|
{
|
||||||
iterator mit = map.find(*child_it);
|
auto mit = map.find(child);
|
||||||
if (mit != map.end()
|
if (mit != map.end() && ! mit->second.discarded)
|
||||||
&& ! mit->second.discarded)
|
|
||||||
{
|
{
|
||||||
convert_and_add(result, geometry1, geometry2, collection,
|
convert_and_add(result, geometry1, geometry2, collection,
|
||||||
*child_it, mit->second.reversed, true);
|
child, mit->second.reversed, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +174,6 @@ inline void clean_closing_dups_and_spikes(Range& range,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef typename boost::range_iterator<Range>::type iterator_type;
|
|
||||||
static bool const closed = geometry::closure<Range>::value == geometry::closed;
|
static bool const closed = geometry::closure<Range>::value == geometry::closed;
|
||||||
|
|
||||||
// TODO: the following algorithm could be rewritten to first look for spikes
|
// 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
|
do
|
||||||
{
|
{
|
||||||
found = false;
|
found = false;
|
||||||
iterator_type first = boost::begin(range);
|
auto first = boost::begin(range);
|
||||||
iterator_type second = first + 1;
|
auto second = first + 1;
|
||||||
iterator_type ultimate = boost::end(range) - 1;
|
auto ultimate = boost::end(range) - 1;
|
||||||
if (BOOST_GEOMETRY_CONDITION(closed))
|
if (BOOST_GEOMETRY_CONDITION(closed))
|
||||||
{
|
{
|
||||||
ultimate--;
|
ultimate--;
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <boost/geometry/algorithms/detail/overlay/range_in_geometry.hpp>
|
#include <boost/geometry/algorithms/detail/overlay/range_in_geometry.hpp>
|
||||||
|
|
||||||
#include <boost/geometry/geometries/box.hpp>
|
#include <boost/geometry/geometries/box.hpp>
|
||||||
|
#include <boost/geometry/util/for_each_with_index.hpp>
|
||||||
|
|
||||||
namespace boost { namespace geometry
|
namespace boost { namespace geometry
|
||||||
{
|
{
|
||||||
@ -260,38 +261,31 @@ inline void assign_parents(Geometry1 const& geometry1,
|
|||||||
point_type, Strategy // TODO: point_type is technically incorrect
|
point_type, Strategy // TODO: point_type is technically incorrect
|
||||||
>::type area_result_type;
|
>::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_total = ring_map.size();
|
||||||
std::size_t count_positive = 0;
|
std::size_t count_positive = 0;
|
||||||
std::size_t index_positive = 0; // only used if 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)
|
// Copy to vector (this might be obsolete, using the map directly)
|
||||||
vector_type vector(count_total);
|
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);
|
for_each_with_index(ring_map, [&](std::size_t index, auto const& pair)
|
||||||
it != boost::end(ring_map); ++it, ++index)
|
|
||||||
{
|
{
|
||||||
vector[index] = helper(it->first, it->second.get_area());
|
vector[index] = helper(pair.first, pair.second.get_area());
|
||||||
helper& item = vector[index];
|
helper& item = vector[index];
|
||||||
switch(it->first.source_index)
|
switch(pair.first.source_index)
|
||||||
{
|
{
|
||||||
case 0 :
|
case 0 :
|
||||||
geometry::envelope(get_ring<tag1>::apply(it->first, geometry1),
|
geometry::envelope(get_ring<tag1>::apply(pair.first, geometry1),
|
||||||
item.envelope, strategy);
|
item.envelope, strategy);
|
||||||
break;
|
break;
|
||||||
case 1 :
|
case 1 :
|
||||||
geometry::envelope(get_ring<tag2>::apply(it->first, geometry2),
|
geometry::envelope(get_ring<tag2>::apply(pair.first, geometry2),
|
||||||
item.envelope, strategy);
|
item.envelope, strategy);
|
||||||
break;
|
break;
|
||||||
case 2 :
|
case 2 :
|
||||||
geometry::envelope(get_ring<void>::apply(it->first, collection),
|
geometry::envelope(get_ring<void>::apply(pair.first, collection),
|
||||||
item.envelope, strategy);
|
item.envelope, strategy);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -304,7 +298,7 @@ inline void assign_parents(Geometry1 const& geometry1,
|
|||||||
count_positive++;
|
count_positive++;
|
||||||
index_positive = index;
|
index_positive = index;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
if (! check_for_orientation)
|
if (! check_for_orientation)
|
||||||
{
|
{
|
||||||
@ -325,17 +319,15 @@ inline void assign_parents(Geometry1 const& geometry1,
|
|||||||
// located outside the outer ring, this cannot be done
|
// located outside the outer ring, this cannot be done
|
||||||
ring_identifier id_of_positive = vector[index_positive].id;
|
ring_identifier id_of_positive = vector[index_positive].id;
|
||||||
ring_info_type& outer = ring_map[id_of_positive];
|
ring_info_type& outer = ring_map[id_of_positive];
|
||||||
index = 0;
|
for_each_with_index(vector, [&](std::size_t index, auto const& item)
|
||||||
for (vector_iterator_type it = boost::begin(vector);
|
|
||||||
it != boost::end(vector); ++it, ++index)
|
|
||||||
{
|
{
|
||||||
if (index != index_positive)
|
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;
|
inner.parent = id_of_positive;
|
||||||
outer.children.push_back(it->id);
|
outer.children.push_back(item.id);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -357,10 +349,9 @@ inline void assign_parents(Geometry1 const& geometry1,
|
|||||||
|
|
||||||
if (check_for_orientation)
|
if (check_for_orientation)
|
||||||
{
|
{
|
||||||
for (map_iterator_type it = boost::begin(ring_map);
|
for (auto& pair : ring_map)
|
||||||
it != boost::end(ring_map); ++it)
|
|
||||||
{
|
{
|
||||||
ring_info_type& info = it->second;
|
ring_info_type& info = pair.second;
|
||||||
if (geometry::math::equals(info.get_area(), 0))
|
if (geometry::math::equals(info.get_area(), 0))
|
||||||
{
|
{
|
||||||
info.discarded = true;
|
info.discarded = true;
|
||||||
@ -397,12 +388,11 @@ inline void assign_parents(Geometry1 const& geometry1,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Assign childlist
|
// Assign childlist
|
||||||
for (map_iterator_type it = boost::begin(ring_map);
|
for (auto& pair : ring_map)
|
||||||
it != boost::end(ring_map); ++it)
|
|
||||||
{
|
{
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,21 +38,11 @@ namespace detail { namespace overlay
|
|||||||
template <typename Turns>
|
template <typename Turns>
|
||||||
inline void clear_visit_info(Turns& turns)
|
inline void clear_visit_info(Turns& turns)
|
||||||
{
|
{
|
||||||
typedef typename boost::range_value<Turns>::type tp_type;
|
for (auto& turn : turns)
|
||||||
|
|
||||||
for (typename boost::range_iterator<Turns>::type
|
|
||||||
it = boost::begin(turns);
|
|
||||||
it != boost::end(turns);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
for (typename boost::range_iterator
|
for (auto& op : turn.operations)
|
||||||
<
|
|
||||||
typename tp_type::container_type
|
|
||||||
>::type op_it = boost::begin(it->operations);
|
|
||||||
op_it != boost::end(it->operations);
|
|
||||||
++op_it)
|
|
||||||
{
|
{
|
||||||
op_it->visited.clear();
|
op.visited.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
typedef typename boost::range_value<TurnPoints>::type turn_point_type;
|
||||||
|
|
||||||
bool error = false;
|
bool error = false;
|
||||||
int index = 0;
|
|
||||||
|
|
||||||
std::vector<meta_turn<turn_point_type> > meta_turns;
|
std::vector<meta_turn<turn_point_type> > meta_turns;
|
||||||
for (typename boost::range_iterator<TurnPoints const>::type
|
for_each_with_index(turn_points, [&](std::size_t index, auto const& point)
|
||||||
it = boost::begin(turn_points);
|
|
||||||
it != boost::end(turn_points);
|
|
||||||
++it, ++index)
|
|
||||||
{
|
{
|
||||||
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;
|
int cycle = 0;
|
||||||
for (typename boost::range_iterator<std::vector<meta_turn<turn_point_type> > > ::type
|
for (auto& meta_turn : meta_turns)
|
||||||
it = boost::begin(meta_turns);
|
|
||||||
it != boost::end(meta_turns);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
if (! (it->turn->blocked() || it->turn->discarded))
|
if (! (meta_turn.turn->blocked() || meta_turn.turn->discarded))
|
||||||
{
|
{
|
||||||
for (int i = 0 ; i < 2; i++)
|
for (int i = 0 ; i < 2; i++)
|
||||||
{
|
{
|
||||||
if (! it->handled[i]
|
if (! meta_turn.handled[i]
|
||||||
&& it->turn->operations[i].operation == for_operation)
|
&& meta_turn.turn->operations[i].operation == for_operation)
|
||||||
{
|
{
|
||||||
#ifdef BOOST_GEOMETRY_DEBUG_ENRICH
|
#ifdef BOOST_GEOMETRY_DEBUG_ENRICH
|
||||||
std::cout << "CYCLE " << cycle << std::endl;
|
std::cout << "CYCLE " << cycle << std::endl;
|
||||||
#endif
|
#endif
|
||||||
it->handled[i] = true;
|
meta_turn.handled[i] = true;
|
||||||
check_detailed(meta_turns, *it, i, cycle++, it->index, for_operation, error);
|
check_detailed(meta_turns, meta_turn, i, cycle++, meta_turn.index, for_operation, error);
|
||||||
#ifdef BOOST_GEOMETRY_DEBUG_ENRICH
|
#ifdef BOOST_GEOMETRY_DEBUG_ENRICH
|
||||||
std::cout <<" END CYCLE " << it->index << std::endl;
|
std::cout <<" END CYCLE " << meta_turn.index << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,9 +197,8 @@ OutputIterator clip_range_with_box(Box const& b, Range const& range,
|
|||||||
|
|
||||||
OutputLinestring line_out;
|
OutputLinestring line_out;
|
||||||
|
|
||||||
typedef typename boost::range_iterator<Range const>::type iterator_type;
|
auto vertex = boost::begin(range);
|
||||||
iterator_type vertex = boost::begin(range);
|
for (auto previous = vertex++;
|
||||||
for(iterator_type previous = vertex++;
|
|
||||||
vertex != boost::end(range);
|
vertex != boost::end(range);
|
||||||
++previous, ++vertex)
|
++previous, ++vertex)
|
||||||
{
|
{
|
||||||
|
@ -67,16 +67,11 @@ private :
|
|||||||
signed_size_type rank_index;
|
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,
|
inline signed_size_type get_rank(Sbs const& sbs,
|
||||||
linked_turn_op_info const& info) const
|
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
|
if (rp.turn_index == info.turn_index
|
||||||
&& rp.operation_index == info.op_index
|
&& rp.operation_index == info.op_index
|
||||||
&& rp.direction == sort_by_side::dir_to)
|
&& rp.direction == sort_by_side::dir_to)
|
||||||
@ -95,9 +90,8 @@ private :
|
|||||||
|
|
||||||
bool collect(Turns const& turns)
|
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];
|
turn_type const& cluster_turn = turns[cluster_turn_index];
|
||||||
if (cluster_turn.discarded)
|
if (cluster_turn.discarded)
|
||||||
{
|
{
|
||||||
@ -148,23 +142,19 @@ private :
|
|||||||
return true;
|
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);
|
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);
|
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 (auto const& blti : blocked)
|
||||||
for (const_it_type bit = blocked.begin(); bit != blocked.end(); ++bit)
|
|
||||||
{
|
{
|
||||||
linked_turn_op_info const& blti = *bit;
|
|
||||||
if (blti.next_turn_index == lti.next_turn_index
|
if (blti.next_turn_index == lti.next_turn_index
|
||||||
&& blti.rank_index == lti.rank_index)
|
&& blti.rank_index == lti.rank_index)
|
||||||
{
|
{
|
||||||
@ -198,10 +188,8 @@ public :
|
|||||||
// If there is one (and only one) possibility pointing outside
|
// If there is one (and only one) possibility pointing outside
|
||||||
// the cluster, take that one.
|
// the cluster, take that one.
|
||||||
linked_turn_op_info target;
|
linked_turn_op_info target;
|
||||||
for (const_it_type it = possibilities.begin();
|
for (auto const& lti : possibilities)
|
||||||
it != possibilities.end(); ++it)
|
|
||||||
{
|
{
|
||||||
linked_turn_op_info const& lti = *it;
|
|
||||||
if (m_ids.count(lti.next_turn_index) == 0)
|
if (m_ids.count(lti.next_turn_index) == 0)
|
||||||
{
|
{
|
||||||
if (target.turn_index >= 0
|
if (target.turn_index >= 0
|
||||||
|
@ -86,6 +86,7 @@ struct convert_ring<polygon_tag>
|
|||||||
|
|
||||||
if (geometry::num_points(source) >= min_num_points)
|
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).resize(
|
||||||
interior_rings(destination).size() + 1);
|
interior_rings(destination).size() + 1);
|
||||||
geometry::convert(source, interior_rings(destination).back());
|
geometry::convert(source, interior_rings(destination).back());
|
||||||
|
@ -167,10 +167,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
signed_size_type const count = to_index - from_index + 1;
|
signed_size_type const count = to_index - from_index + 1;
|
||||||
|
auto it = boost::begin(ls) + from_index;
|
||||||
typename boost::range_iterator<LineString const>::type
|
|
||||||
it = boost::begin(ls) + from_index;
|
|
||||||
|
|
||||||
for (signed_size_type i = 0; i < count; ++i, ++it)
|
for (signed_size_type i = 0; i < count; ++i, ++it)
|
||||||
{
|
{
|
||||||
append_to_output(current_output, *it, strategy, robust_policy,
|
append_to_output(current_output, *it, strategy, robust_policy,
|
||||||
|
@ -422,13 +422,6 @@ public :
|
|||||||
OutputIterator out,
|
OutputIterator out,
|
||||||
Strategy const& strategy)
|
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;
|
typedef following::action_selector<OverlayType, RemoveSpikes> action;
|
||||||
|
|
||||||
// Sort intersection points on segments-along-linestring, and distance
|
// 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)
|
// Iterate through all intersection points (they are ordered along the line)
|
||||||
bool entered = false;
|
bool entered = false;
|
||||||
bool first = true;
|
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;
|
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;
|
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;
|
entered = true;
|
||||||
action::enter(current_piece, linestring, current_segment_id,
|
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,
|
strategy, robust_policy,
|
||||||
linear::get(out));
|
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;
|
entered = false;
|
||||||
action::leave(current_piece, linestring, current_segment_id,
|
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,
|
strategy, robust_policy,
|
||||||
linear::get(out));
|
linear::get(out));
|
||||||
}
|
}
|
||||||
else if (BOOST_GEOMETRY_CONDITION(FollowIsolatedPoints)
|
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
|
action::template isolated_point
|
||||||
<
|
<
|
||||||
typename pointlike::type
|
typename pointlike::type
|
||||||
>(it->point, pointlike::get(out));
|
>(turn.point, pointlike::get(out));
|
||||||
}
|
}
|
||||||
|
|
||||||
first = false;
|
first = false;
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
|
|
||||||
#include <boost/geometry/algorithms/detail/disjoint/box_box.hpp>
|
#include <boost/geometry/algorithms/detail/disjoint/box_box.hpp>
|
||||||
#include <boost/geometry/algorithms/detail/disjoint/point_point.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.hpp>
|
||||||
#include <boost/geometry/algorithms/detail/overlay/get_turn_info_ll.hpp>
|
#include <boost/geometry/algorithms/detail/overlay/get_turn_info_ll.hpp>
|
||||||
#include <boost/geometry/algorithms/detail/overlay/get_turn_info_la.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;
|
signed_size_type i = 0;
|
||||||
|
|
||||||
typename interior_return_type<Polygon const>::type
|
auto const& rings = interior_rings(polygon);
|
||||||
rings = interior_rings(polygon);
|
for (auto it = boost::begin(rings); it != boost::end(rings); ++it, ++i)
|
||||||
for (typename detail::interior_iterator<Polygon const>::type
|
|
||||||
it = boost::begin(rings); it != boost::end(rings); ++it, ++i)
|
|
||||||
{
|
{
|
||||||
intersector_type::apply(
|
intersector_type::apply(
|
||||||
source_id1, *it,
|
source_id1, *it,
|
||||||
@ -877,15 +874,8 @@ struct get_turns_multi_polygon_cs
|
|||||||
Turns& turns,
|
Turns& turns,
|
||||||
InterruptPolicy& interrupt_policy)
|
InterruptPolicy& interrupt_policy)
|
||||||
{
|
{
|
||||||
typedef typename boost::range_iterator
|
|
||||||
<
|
|
||||||
Multi const
|
|
||||||
>::type iterator_type;
|
|
||||||
|
|
||||||
signed_size_type i = 0;
|
signed_size_type i = 0;
|
||||||
for (iterator_type it = boost::begin(multi);
|
for (auto it = boost::begin(multi); it != boost::end(multi); ++it, ++i)
|
||||||
it != boost::end(multi);
|
|
||||||
++it, ++i)
|
|
||||||
{
|
{
|
||||||
// Call its single version
|
// Call its single version
|
||||||
get_turns_polygon_cs
|
get_turns_polygon_cs
|
||||||
|
@ -82,8 +82,8 @@ inline void cleanup_clusters(Turns& turns, Clusters& clusters)
|
|||||||
for (auto& pair : clusters)
|
for (auto& pair : clusters)
|
||||||
{
|
{
|
||||||
auto& cinfo = pair.second;
|
auto& cinfo = pair.second;
|
||||||
auto& ids = cinfo.turn_indices;
|
auto& indices = cinfo.turn_indices;
|
||||||
for (auto sit = ids.begin(); sit != ids.end(); /* no increment */)
|
for (auto sit = indices.begin(); sit != indices.end(); /* no increment */)
|
||||||
{
|
{
|
||||||
auto current_it = sit;
|
auto current_it = sit;
|
||||||
++sit;
|
++sit;
|
||||||
@ -91,7 +91,7 @@ inline void cleanup_clusters(Turns& turns, Clusters& clusters)
|
|||||||
auto const turn_index = *current_it;
|
auto const turn_index = *current_it;
|
||||||
if (turns[turn_index].discarded)
|
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);
|
colocate_clusters(clusters, turns);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Turn, typename IdSet>
|
template <typename Turn, typename IndexSet>
|
||||||
inline void discard_colocated_turn(Turn& turn, IdSet& ids, signed_size_type id)
|
inline void discard_colocated_turn(Turn& turn, IndexSet& indices, signed_size_type index)
|
||||||
{
|
{
|
||||||
turn.discarded = true;
|
turn.discarded = true;
|
||||||
// Set cluster id to -1, but don't clear colocated flags
|
// Set cluster id to -1, but don't clear colocated flags
|
||||||
turn.cluster_id = -1;
|
turn.cluster_id = -1;
|
||||||
// To remove it later from clusters
|
// To remove it later from clusters
|
||||||
ids.insert(id);
|
indices.insert(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <bool Reverse>
|
template <bool Reverse>
|
||||||
@ -167,22 +167,17 @@ template
|
|||||||
>
|
>
|
||||||
inline void discard_interior_exterior_turns(Turns& turns, Clusters& clusters)
|
inline void discard_interior_exterior_turns(Turns& turns, Clusters& clusters)
|
||||||
{
|
{
|
||||||
typedef std::set<signed_size_type>::const_iterator set_iterator;
|
std::set<signed_size_type> indices_to_remove;
|
||||||
typedef typename boost::range_value<Turns>::type turn_type;
|
|
||||||
|
|
||||||
std::set<signed_size_type> ids_to_remove;
|
for (auto& pair : clusters)
|
||||||
|
|
||||||
for (typename Clusters::iterator cit = clusters.begin();
|
|
||||||
cit != clusters.end(); ++cit)
|
|
||||||
{
|
{
|
||||||
cluster_info& cinfo = cit->second;
|
cluster_info& cinfo = pair.second;
|
||||||
std::set<signed_size_type>& ids = cinfo.turn_indices;
|
|
||||||
|
|
||||||
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_0 = turn.operations[0].seg_id;
|
||||||
segment_identifier const& seg_1 = turn.operations[1].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;
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Turn with, possibly, an interior ring involved
|
// Turn with, possibly, an interior ring involved
|
||||||
turn_type& int_turn = turns[*int_it];
|
auto& interior_turn = turns[interior_index];
|
||||||
segment_identifier const& int_seg_0 = int_turn.operations[0].seg_id;
|
segment_identifier const& int_seg_0 = interior_turn.operations[0].seg_id;
|
||||||
segment_identifier const& int_seg_1 = int_turn.operations[1].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))
|
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))
|
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)
|
// Erase from the indices (which cannot be done above)
|
||||||
for (set_iterator sit = ids_to_remove.begin();
|
for (auto index : indices_to_remove)
|
||||||
sit != ids_to_remove.end(); ++sit)
|
|
||||||
{
|
{
|
||||||
ids.erase(*sit);
|
cinfo.turn_indices.erase(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -233,19 +227,14 @@ template
|
|||||||
>
|
>
|
||||||
inline void set_colocation(Turns& turns, Clusters const& clusters)
|
inline void set_colocation(Turns& turns, Clusters const& clusters)
|
||||||
{
|
{
|
||||||
typedef std::set<signed_size_type>::const_iterator set_iterator;
|
for (auto const& pair : clusters)
|
||||||
typedef typename boost::range_value<Turns>::type turn_type;
|
|
||||||
|
|
||||||
for (typename Clusters::const_iterator cit = clusters.begin();
|
|
||||||
cit != clusters.end(); ++cit)
|
|
||||||
{
|
{
|
||||||
cluster_info const& cinfo = cit->second;
|
cluster_info const& cinfo = pair.second;
|
||||||
std::set<signed_size_type> const& ids = cinfo.turn_indices;
|
|
||||||
|
|
||||||
bool both_target = false;
|
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))
|
if (turn.both(operation_from_overlay<OverlayType>::value))
|
||||||
{
|
{
|
||||||
both_target = true;
|
both_target = true;
|
||||||
@ -255,9 +244,9 @@ inline void set_colocation(Turns& turns, Clusters const& clusters)
|
|||||||
|
|
||||||
if (both_target)
|
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;
|
turn.has_colocated_both = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -276,7 +265,7 @@ inline void check_colocation(bool& has_blocked,
|
|||||||
|
|
||||||
has_blocked = false;
|
has_blocked = false;
|
||||||
|
|
||||||
typename Clusters::const_iterator mit = clusters.find(cluster_id);
|
auto mit = clusters.find(cluster_id);
|
||||||
if (mit == clusters.end())
|
if (mit == clusters.end())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -284,11 +273,9 @@ inline void check_colocation(bool& has_blocked,
|
|||||||
|
|
||||||
cluster_info const& cinfo = mit->second;
|
cluster_info const& cinfo = mit->second;
|
||||||
|
|
||||||
for (std::set<signed_size_type>::const_iterator it
|
for (auto index : cinfo.turn_indices)
|
||||||
= cinfo.turn_indices.begin();
|
|
||||||
it != cinfo.turn_indices.end(); ++it)
|
|
||||||
{
|
{
|
||||||
turn_type const& turn = turns[*it];
|
turn_type const& turn = turns[index];
|
||||||
if (turn.any_blocked())
|
if (turn.any_blocked())
|
||||||
{
|
{
|
||||||
has_blocked = true;
|
has_blocked = true;
|
||||||
@ -410,21 +397,15 @@ inline bool fill_sbs(Sbs& sbs, Point& turn_point,
|
|||||||
Turns const& turns,
|
Turns const& turns,
|
||||||
Geometry1 const& geometry1, Geometry2 const& geometry2)
|
Geometry1 const& geometry1, Geometry2 const& geometry2)
|
||||||
{
|
{
|
||||||
typedef typename boost::range_value<Turns>::type turn_type;
|
if (cinfo.turn_indices.empty())
|
||||||
|
|
||||||
std::set<signed_size_type> const& ids = cinfo.turn_indices;
|
|
||||||
|
|
||||||
if (ids.empty())
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (std::set<signed_size_type>::const_iterator sit = ids.begin();
|
for (auto turn_index : cinfo.turn_indices)
|
||||||
sit != ids.end(); ++sit)
|
|
||||||
{
|
{
|
||||||
signed_size_type turn_index = *sit;
|
auto const& turn = turns[turn_index];
|
||||||
turn_type const& turn = turns[turn_index];
|
|
||||||
if (first)
|
if (first)
|
||||||
{
|
{
|
||||||
turn_point = turn.point;
|
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>
|
Reverse1, Reverse2, OverlayType, point_type, SideStrategy, std::less<int>
|
||||||
> sbs_type;
|
> sbs_type;
|
||||||
|
|
||||||
for (typename Clusters::iterator mit = clusters.begin();
|
for (auto& pair : clusters)
|
||||||
mit != clusters.end(); ++mit)
|
|
||||||
{
|
{
|
||||||
cluster_info& cinfo = mit->second;
|
cluster_info& cinfo = pair.second;
|
||||||
|
|
||||||
sbs_type sbs(strategy);
|
sbs_type sbs(strategy);
|
||||||
point_type turn_point; // should be all the same for all turns in cluster
|
point_type turn_point; // should be all the same for all turns in cluster
|
||||||
|
@ -106,15 +106,8 @@ struct discard_closed_turns<overlay_union, operation_union>
|
|||||||
Geometry0 const& geometry0, Geometry1 const& geometry1,
|
Geometry0 const& geometry0, Geometry1 const& geometry1,
|
||||||
Strategy const& strategy)
|
Strategy const& strategy)
|
||||||
{
|
{
|
||||||
typedef typename boost::range_value<Turns>::type turn_type;
|
for (auto& turn : turns)
|
||||||
|
|
||||||
for (typename boost::range_iterator<Turns>::type
|
|
||||||
it = boost::begin(turns);
|
|
||||||
it != boost::end(turns);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
turn_type& turn = *it;
|
|
||||||
|
|
||||||
if (! turn.discarded
|
if (! turn.discarded
|
||||||
&& is_self_turn<overlay_union>(turn)
|
&& is_self_turn<overlay_union>(turn)
|
||||||
&& check_within<overlay_union>::apply(turn, geometry0,
|
&& check_within<overlay_union>::apply(turn, geometry0,
|
||||||
@ -137,18 +130,16 @@ private :
|
|||||||
bool is_self_cluster(signed_size_type cluster_id,
|
bool is_self_cluster(signed_size_type cluster_id,
|
||||||
const Turns& turns, Clusters const& clusters)
|
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())
|
if (cit == clusters.end())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
cluster_info const& cinfo = cit->second;
|
cluster_info const& cinfo = cit->second;
|
||||||
for (std::set<signed_size_type>::const_iterator it
|
for (auto index : cinfo.turn_indices)
|
||||||
= cinfo.turn_indices.begin();
|
|
||||||
it != cinfo.turn_indices.end(); ++it)
|
|
||||||
{
|
{
|
||||||
if (! is_self_turn<OverlayType>(turns[*it]))
|
if (! is_self_turn<OverlayType>(turns[index]))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -164,28 +155,25 @@ private :
|
|||||||
Geometry0 const& geometry0, Geometry1 const& geometry1,
|
Geometry0 const& geometry0, Geometry1 const& geometry1,
|
||||||
Strategy const& strategy)
|
Strategy const& strategy)
|
||||||
{
|
{
|
||||||
for (typename Clusters::const_iterator cit = clusters.begin();
|
for (auto const& pair : clusters)
|
||||||
cit != clusters.end(); ++cit)
|
|
||||||
{
|
{
|
||||||
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
|
// If there are only self-turns in the cluster, the cluster should
|
||||||
// be located within the other geometry, for intersection
|
// 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))
|
&& is_self_cluster(cluster_id, turns, clusters))
|
||||||
{
|
{
|
||||||
cluster_info const& cinfo = cit->second;
|
|
||||||
signed_size_type const index = *cinfo.turn_indices.begin();
|
signed_size_type const index = *cinfo.turn_indices.begin();
|
||||||
if (! check_within<OverlayType>::apply(turns[index],
|
if (! check_within<OverlayType>::apply(turns[index],
|
||||||
geometry0, geometry1,
|
geometry0, geometry1,
|
||||||
strategy))
|
strategy))
|
||||||
{
|
{
|
||||||
// Discard all turns in cluster
|
// Discard all turns in cluster
|
||||||
for (std::set<signed_size_type>::const_iterator sit
|
for (auto index : cinfo.turn_indices)
|
||||||
= cinfo.turn_indices.begin();
|
|
||||||
sit != cinfo.turn_indices.end(); ++sit)
|
|
||||||
{
|
{
|
||||||
turns[*sit].discarded = true;
|
turns[index].discarded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -203,15 +191,8 @@ public :
|
|||||||
{
|
{
|
||||||
discard_clusters(turns, clusters, geometry0, geometry1, strategy);
|
discard_clusters(turns, clusters, geometry0, geometry1, strategy);
|
||||||
|
|
||||||
typedef typename boost::range_value<Turns>::type turn_type;
|
for (auto& turn : turns)
|
||||||
|
|
||||||
for (typename boost::range_iterator<Turns>::type
|
|
||||||
it = boost::begin(turns);
|
|
||||||
it != boost::end(turns);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
turn_type& turn = *it;
|
|
||||||
|
|
||||||
// It is a ii self-turn
|
// It is a ii self-turn
|
||||||
// Check if it is within the other geometry
|
// Check if it is within the other geometry
|
||||||
if (! turn.discarded
|
if (! turn.discarded
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
#if defined(BOOST_GEOMETRY_DEBUG_FOLLOW)
|
#if defined(BOOST_GEOMETRY_DEBUG_FOLLOW)
|
||||||
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
|
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
|
||||||
#include <boost/geometry/io/wkt/wkt.hpp>
|
#include <boost/geometry/io/wkt/wkt.hpp>
|
||||||
|
#include <boost/geometry/util/for_each_with_index.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace boost { namespace geometry
|
namespace boost { namespace geometry
|
||||||
@ -145,11 +146,10 @@ struct intersection_linestring_linestring_point
|
|||||||
geometry::get_intersection_points(linestring1, linestring2,
|
geometry::get_intersection_points(linestring1, linestring2,
|
||||||
robust_policy, turns, strategy);
|
robust_policy, turns, strategy);
|
||||||
|
|
||||||
for (typename boost::range_iterator<std::deque<turn_info> const>::type
|
for (auto const& turn : turns)
|
||||||
it = boost::begin(turns); it != boost::end(turns); ++it)
|
|
||||||
{
|
{
|
||||||
PointOut p;
|
PointOut p;
|
||||||
geometry::convert(it->point, p);
|
geometry::convert(turn.point, p);
|
||||||
*out++ = p;
|
*out++ = p;
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
@ -212,11 +212,10 @@ struct intersection_of_linestring_with_areal
|
|||||||
bool found_union = false;
|
bool found_union = false;
|
||||||
bool found_front = false;
|
bool found_front = false;
|
||||||
|
|
||||||
for (typename Turns::const_iterator it = turns.begin();
|
for (auto const& turn : turns)
|
||||||
it != turns.end(); ++it)
|
|
||||||
{
|
{
|
||||||
method_type const method = it->method;
|
method_type const method = turn.method;
|
||||||
operation_type const op = it->operations[0].operation;
|
operation_type const op = turn.operations[0].operation;
|
||||||
|
|
||||||
if (method == method_crosses)
|
if (method == method_crosses)
|
||||||
{
|
{
|
||||||
@ -240,7 +239,7 @@ struct intersection_of_linestring_with_areal
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (it->operations[0].position == position_front)
|
if (turn.operations[0].position == position_front)
|
||||||
{
|
{
|
||||||
found_front = true;
|
found_front = true;
|
||||||
}
|
}
|
||||||
@ -380,12 +379,10 @@ struct intersection_of_linestring_with_areal
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(BOOST_GEOMETRY_DEBUG_FOLLOW)
|
#if defined(BOOST_GEOMETRY_DEBUG_FOLLOW)
|
||||||
int index = 0;
|
for_each_with_index(turns, [](auto index, auto const& turn)
|
||||||
for(typename std::deque<turn_info>::const_iterator
|
|
||||||
it = turns.begin(); it != turns.end(); ++it)
|
|
||||||
{
|
{
|
||||||
debug_follow(*it, it->operations[0], index++);
|
debug_follow(turn, turn.operations[0], index);
|
||||||
}
|
});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return follower::apply
|
return follower::apply
|
||||||
@ -402,10 +399,9 @@ template <typename Turns, typename OutputIterator>
|
|||||||
inline OutputIterator intersection_output_turn_points(Turns const& turns,
|
inline OutputIterator intersection_output_turn_points(Turns const& turns,
|
||||||
OutputIterator out)
|
OutputIterator out)
|
||||||
{
|
{
|
||||||
for (typename Turns::const_iterator
|
for (auto const& turn : turns)
|
||||||
it = turns.begin(); it != turns.end(); ++it)
|
|
||||||
{
|
{
|
||||||
*out++ = it->point;
|
*out++ = turn.point;
|
||||||
}
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
|
@ -82,9 +82,7 @@ struct linear_linear_no_intersections
|
|||||||
static inline OutputIterator apply(MultiLineString const& multilinestring,
|
static inline OutputIterator apply(MultiLineString const& multilinestring,
|
||||||
OutputIterator oit)
|
OutputIterator oit)
|
||||||
{
|
{
|
||||||
for (typename boost::range_iterator<MultiLineString const>::type
|
for (auto it = boost::begin(multilinestring); it != boost::end(multilinestring); ++it)
|
||||||
it = boost::begin(multilinestring);
|
|
||||||
it != boost::end(multilinestring); ++it)
|
|
||||||
{
|
{
|
||||||
LineStringOut ls_out;
|
LineStringOut ls_out;
|
||||||
geometry::convert(*it, ls_out);
|
geometry::convert(*it, ls_out);
|
||||||
|
@ -103,10 +103,6 @@ template
|
|||||||
>
|
>
|
||||||
inline void get_ring_turn_info(TurnInfoMap& turn_info_map, Turns const& turns, Clusters const& clusters)
|
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
|
static const operation_type target_operation
|
||||||
= operation_from_overlay<OverlayType>::value;
|
= operation_from_overlay<OverlayType>::value;
|
||||||
static const operation_type opposite_operation
|
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_intersection
|
||||||
: operation_union;
|
: operation_union;
|
||||||
|
|
||||||
for (typename boost::range_iterator<Turns const>::type
|
for (auto const& turn : turns)
|
||||||
it = boost::begin(turns);
|
|
||||||
it != boost::end(turns);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
turn_type const& turn = *it;
|
|
||||||
|
|
||||||
bool cluster_checked = false;
|
bool cluster_checked = false;
|
||||||
bool has_blocked = false;
|
bool has_blocked = false;
|
||||||
|
|
||||||
@ -130,12 +121,8 @@ inline void get_ring_turn_info(TurnInfoMap& turn_info_map, Turns const& turns, C
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (typename boost::range_iterator<container_type const>::type
|
for (auto const& op : turn.operations)
|
||||||
op_it = boost::begin(turn.operations);
|
|
||||||
op_it != boost::end(turn.operations);
|
|
||||||
++op_it)
|
|
||||||
{
|
{
|
||||||
turn_operation_type const& op = *op_it;
|
|
||||||
ring_identifier const ring_id = ring_id_by_seg_id(op.seg_id);
|
ring_identifier const ring_id = ring_id_by_seg_id(op.seg_id);
|
||||||
|
|
||||||
if (! is_self_turn<OverlayType>(turn)
|
if (! is_self_turn<OverlayType>(turn)
|
||||||
|
@ -98,10 +98,7 @@ struct multipoint_single_point
|
|||||||
OutputIterator oit,
|
OutputIterator oit,
|
||||||
Strategy const& strategy)
|
Strategy const& strategy)
|
||||||
{
|
{
|
||||||
for (typename boost::range_iterator<MultiPoint const>::type
|
for (auto it = boost::begin(multipoint); it != boost::end(multipoint); ++it)
|
||||||
it = boost::begin(multipoint);
|
|
||||||
it != boost::end(multipoint);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
action_selector_pl
|
action_selector_pl
|
||||||
<
|
<
|
||||||
|
@ -75,9 +75,7 @@ struct copy_points<PointOut, MultiPointIn, multi_point_tag>
|
|||||||
static inline void apply(MultiPointIn const& multi_point_in,
|
static inline void apply(MultiPointIn const& multi_point_in,
|
||||||
OutputIterator& oit)
|
OutputIterator& oit)
|
||||||
{
|
{
|
||||||
for (typename boost::range_iterator<MultiPointIn const>::type
|
for (auto it = boost::begin(multi_point_in); it != boost::end(multi_point_in); ++it)
|
||||||
it = boost::begin(multi_point_in);
|
|
||||||
it != boost::end(multi_point_in); ++it)
|
|
||||||
{
|
{
|
||||||
PointOut point_out;
|
PointOut point_out;
|
||||||
geometry::convert(*it, point_out);
|
geometry::convert(*it, point_out);
|
||||||
@ -189,9 +187,7 @@ struct multipoint_point_point
|
|||||||
{
|
{
|
||||||
BOOST_GEOMETRY_ASSERT( OverlayType == overlay_difference );
|
BOOST_GEOMETRY_ASSERT( OverlayType == overlay_difference );
|
||||||
|
|
||||||
for (typename boost::range_iterator<MultiPoint const>::type
|
for (auto it = boost::begin(multipoint); it != boost::end(multipoint); ++it)
|
||||||
it = boost::begin(multipoint);
|
|
||||||
it != boost::end(multipoint); ++it)
|
|
||||||
{
|
{
|
||||||
action_selector_pl
|
action_selector_pl
|
||||||
<
|
<
|
||||||
@ -225,9 +221,7 @@ struct point_multipoint_point
|
|||||||
{
|
{
|
||||||
typedef action_selector_pl<PointOut, OverlayType> action;
|
typedef action_selector_pl<PointOut, OverlayType> action;
|
||||||
|
|
||||||
for (typename boost::range_iterator<MultiPoint const>::type
|
for (auto it = boost::begin(multipoint); it != boost::end(multipoint); ++it)
|
||||||
it = boost::begin(multipoint);
|
|
||||||
it != boost::end(multipoint); ++it)
|
|
||||||
{
|
{
|
||||||
if ( detail::equals::equals_point_point(*it, point, strategy) )
|
if ( detail::equals::equals_point_point(*it, point, strategy) )
|
||||||
{
|
{
|
||||||
@ -279,9 +273,7 @@ struct multipoint_multipoint_point
|
|||||||
less_type const less = less_type();
|
less_type const less = less_type();
|
||||||
std::sort(points2.begin(), points2.end(), less);
|
std::sort(points2.begin(), points2.end(), less);
|
||||||
|
|
||||||
for (typename boost::range_iterator<MultiPoint1 const>::type
|
for (auto it1 = boost::begin(multipoint1); it1 != boost::end(multipoint1); ++it1)
|
||||||
it1 = boost::begin(multipoint1);
|
|
||||||
it1 != boost::end(multipoint1); ++it1)
|
|
||||||
{
|
{
|
||||||
bool found = std::binary_search(points2.begin(), points2.end(),
|
bool found = std::binary_search(points2.begin(), points2.end(),
|
||||||
*it1, less);
|
*it1, less);
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include <boost/geometry/core/tags.hpp>
|
#include <boost/geometry/core/tags.hpp>
|
||||||
|
|
||||||
#include <boost/geometry/algorithms/detail/covered_by/implementation.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/range_in_geometry.hpp>
|
||||||
#include <boost/geometry/algorithms/detail/overlay/ring_properties.hpp>
|
#include <boost/geometry/algorithms/detail/overlay/ring_properties.hpp>
|
||||||
#include <boost/geometry/algorithms/detail/overlay/overlay_type.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);
|
per_ring::apply(exterior_ring(polygon), geometry, id, ring_properties, strategy);
|
||||||
|
|
||||||
typename interior_return_type<Polygon const>::type
|
auto const& rings = interior_rings(polygon);
|
||||||
rings = interior_rings(polygon);
|
for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
|
||||||
for (typename detail::interior_iterator<Polygon const>::type
|
|
||||||
it = boost::begin(rings); it != boost::end(rings); ++it)
|
|
||||||
{
|
{
|
||||||
id.ring_index++;
|
id.ring_index++;
|
||||||
per_ring::apply(*it, geometry, id, ring_properties, strategy);
|
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);
|
per_ring::apply(exterior_ring(polygon), id, ring_properties, strategy);
|
||||||
|
|
||||||
typename interior_return_type<Polygon const>::type
|
auto const& rings = interior_rings(polygon);
|
||||||
rings = interior_rings(polygon);
|
for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
|
||||||
for (typename detail::interior_iterator<Polygon const>::type
|
|
||||||
it = boost::begin(rings); it != boost::end(rings); ++it)
|
|
||||||
{
|
{
|
||||||
id.ring_index++;
|
id.ring_index++;
|
||||||
per_ring::apply(*it, id, ring_properties, strategy);
|
per_ring::apply(*it, id, ring_properties, strategy);
|
||||||
@ -158,15 +153,10 @@ namespace dispatch
|
|||||||
ring_identifier id, RingPropertyMap& ring_properties,
|
ring_identifier id, RingPropertyMap& ring_properties,
|
||||||
Strategy const& strategy)
|
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;
|
typedef select_rings<polygon_tag, typename boost::range_value<Multi>::type> per_polygon;
|
||||||
|
|
||||||
id.multi_index = 0;
|
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;
|
id.ring_index = -1;
|
||||||
per_polygon::apply(*it, geometry, id, ring_properties, strategy);
|
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();
|
selected_ring_properties.clear();
|
||||||
|
|
||||||
for (typename RingPropertyMap::const_iterator it = boost::begin(all_ring_properties);
|
for (auto const& pair : all_ring_properties)
|
||||||
it != boost::end(all_ring_properties);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
ring_identifier const& id = it->first;
|
ring_identifier const& id = pair.first;
|
||||||
|
|
||||||
ring_turn_info info;
|
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())
|
if (tcit != turn_info_map.end())
|
||||||
{
|
{
|
||||||
info = tcit->second; // Copy by value
|
info = tcit->second; // Copy by value
|
||||||
@ -281,12 +269,12 @@ inline void update_ring_selection(Geometry1 const& geometry1,
|
|||||||
{
|
{
|
||||||
// within
|
// within
|
||||||
case 0 :
|
case 0 :
|
||||||
info.within_other = range_in_geometry(it->second.point,
|
info.within_other = range_in_geometry(pair.second.point,
|
||||||
geometry1, geometry2,
|
geometry1, geometry2,
|
||||||
strategy) > 0;
|
strategy) > 0;
|
||||||
break;
|
break;
|
||||||
case 1 :
|
case 1 :
|
||||||
info.within_other = range_in_geometry(it->second.point,
|
info.within_other = range_in_geometry(pair.second.point,
|
||||||
geometry2, geometry1,
|
geometry2, geometry1,
|
||||||
strategy) > 0;
|
strategy) > 0;
|
||||||
break;
|
break;
|
||||||
@ -294,7 +282,7 @@ inline void update_ring_selection(Geometry1 const& geometry1,
|
|||||||
|
|
||||||
if (decide<OverlayType>::include(id, info))
|
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);
|
properties.reversed = decide<OverlayType>::reversed(id, info);
|
||||||
selected_ring_properties[id] = properties;
|
selected_ring_properties[id] = properties;
|
||||||
}
|
}
|
||||||
|
@ -475,7 +475,7 @@ public :
|
|||||||
|
|
||||||
// Move iterator after rank==0
|
// Move iterator after rank==0
|
||||||
bool has_first = false;
|
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)
|
for (; it != m_ranked_points.end() && it->rank == 0; ++it)
|
||||||
{
|
{
|
||||||
has_first = true;
|
has_first = true;
|
||||||
@ -486,8 +486,7 @@ public :
|
|||||||
// Reverse first part (having rank == 0), if any,
|
// Reverse first part (having rank == 0), if any,
|
||||||
// but skip the very first row
|
// but skip the very first row
|
||||||
std::reverse(m_ranked_points.begin() + 1, it);
|
std::reverse(m_ranked_points.begin() + 1, it);
|
||||||
for (typename container_type::iterator fit = m_ranked_points.begin();
|
for (auto fit = m_ranked_points.begin(); fit != it; ++fit)
|
||||||
fit != it; ++fit)
|
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(fit->rank == 0);
|
BOOST_ASSERT(fit->rank == 0);
|
||||||
}
|
}
|
||||||
|
@ -123,12 +123,8 @@ public :
|
|||||||
template <typename TurnInfoMap>
|
template <typename TurnInfoMap>
|
||||||
inline void finalize_visit_info(TurnInfoMap& turn_info_map)
|
inline void finalize_visit_info(TurnInfoMap& turn_info_map)
|
||||||
{
|
{
|
||||||
for (typename boost::range_iterator<Turns>::type
|
for (auto& turn : m_turns)
|
||||||
it = boost::begin(m_turns);
|
|
||||||
it != boost::end(m_turns);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
turn_type& turn = *it;
|
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
turn_operation_type& op = turn.operations[i];
|
turn_operation_type& op = turn.operations[i];
|
||||||
@ -158,23 +154,18 @@ public :
|
|||||||
inline void set_visited_in_cluster(signed_size_type cluster_id,
|
inline void set_visited_in_cluster(signed_size_type cluster_id,
|
||||||
signed_size_type rank)
|
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());
|
BOOST_ASSERT(mit != m_clusters.end());
|
||||||
|
|
||||||
cluster_info const& cinfo = mit->second;
|
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();
|
for (auto turn_index : cinfo.turn_indices)
|
||||||
it != ids.end(); ++it)
|
|
||||||
{
|
{
|
||||||
signed_size_type const turn_index = *it;
|
|
||||||
turn_type& turn = m_turns[turn_index];
|
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();
|
op.visited.set_visited();
|
||||||
}
|
}
|
||||||
@ -789,21 +780,19 @@ public :
|
|||||||
turn_type const& turn = m_turns[turn_index];
|
turn_type const& turn = m_turns[turn_index];
|
||||||
BOOST_ASSERT(turn.is_clustered());
|
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());
|
BOOST_ASSERT(mit != m_clusters.end());
|
||||||
|
|
||||||
cluster_info const& cinfo = mit->second;
|
cluster_info const& cinfo = mit->second;
|
||||||
std::set<signed_size_type> const& cluster_indices = cinfo.turn_indices;
|
|
||||||
|
|
||||||
sbs_type sbs(m_strategy);
|
sbs_type sbs(m_strategy);
|
||||||
|
|
||||||
|
if (! fill_sbs(sbs, turn_index, cinfo.turn_indices, previous_seg_id))
|
||||||
if (! fill_sbs(sbs, turn_index, cluster_indices, previous_seg_id))
|
|
||||||
{
|
{
|
||||||
return false;
|
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))
|
if (exits.apply(turn_index, op_index))
|
||||||
{
|
{
|
||||||
@ -814,7 +803,7 @@ public :
|
|||||||
|
|
||||||
if (is_union)
|
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,
|
op_index, sbs,
|
||||||
start_turn_index, start_op_index);
|
start_turn_index, start_op_index);
|
||||||
if (! result)
|
if (! result)
|
||||||
|
@ -42,14 +42,11 @@ class traverse
|
|||||||
template <typename Turns>
|
template <typename Turns>
|
||||||
static void reset_visits(Turns& turns)
|
static void reset_visits(Turns& turns)
|
||||||
{
|
{
|
||||||
for (typename boost::range_iterator<Turns>::type
|
for (auto& turn : turns)
|
||||||
it = boost::begin(turns);
|
|
||||||
it != boost::end(turns);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 2; i++)
|
for (auto& op : turn.operations)
|
||||||
{
|
{
|
||||||
it->operations[i].visited.reset();
|
op.visited.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,12 +85,7 @@ inline void divide_into_subsets(Box const& lower_box,
|
|||||||
IteratorVector& exceeding,
|
IteratorVector& exceeding,
|
||||||
OverlapsPolicy const& overlaps_policy)
|
OverlapsPolicy const& overlaps_policy)
|
||||||
{
|
{
|
||||||
typedef typename boost::range_iterator
|
for (auto it = boost::begin(input); it != boost::end(input); ++it)
|
||||||
<
|
|
||||||
IteratorVector const
|
|
||||||
>::type it_type;
|
|
||||||
|
|
||||||
for(it_type it = boost::begin(input); it != boost::end(input); ++it)
|
|
||||||
{
|
{
|
||||||
bool const lower_overlapping = overlaps_policy.apply(lower_box, **it);
|
bool const lower_overlapping = overlaps_policy.apply(lower_box, **it);
|
||||||
bool const upper_overlapping = overlaps_policy.apply(upper_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,
|
inline void expand_with_elements(Box& total, IteratorVector const& input,
|
||||||
ExpandPolicy const& expand_policy)
|
ExpandPolicy const& expand_policy)
|
||||||
{
|
{
|
||||||
typedef typename boost::range_iterator<IteratorVector const>::type it_type;
|
for (auto const& it : input)
|
||||||
for(it_type it = boost::begin(input); it != boost::end(input); ++it)
|
|
||||||
{
|
{
|
||||||
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef typename boost::range_iterator<IteratorVector const>::type it_type;
|
|
||||||
|
|
||||||
// Quadratic behaviour at lowest level (lowest quad, or all exceeding)
|
// 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)
|
for (++it2; it2 != boost::end(input); ++it2)
|
||||||
{
|
{
|
||||||
if (! visitor.apply(**it1, **it2))
|
if (! visitor.apply(**it1, **it2))
|
||||||
@ -170,30 +162,17 @@ inline bool handle_two(IteratorVector1 const& input1,
|
|||||||
IteratorVector2 const& input2,
|
IteratorVector2 const& input2,
|
||||||
VisitPolicy& visitor)
|
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))
|
if (boost::empty(input1) || boost::empty(input2))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(iterator_type1 it1 = boost::begin(input1);
|
for (auto const& it1 : input1)
|
||||||
it1 != boost::end(input1);
|
|
||||||
++it1)
|
|
||||||
{
|
{
|
||||||
for(iterator_type2 it2 = boost::begin(input2);
|
for (auto const& it2 : input2)
|
||||||
it2 != boost::end(input2);
|
|
||||||
++it2)
|
|
||||||
{
|
{
|
||||||
if (! visitor.apply(**it1, **it2))
|
if (! visitor.apply(*it1, *it2))
|
||||||
{
|
{
|
||||||
return false; // interrupt
|
return false; // interrupt
|
||||||
}
|
}
|
||||||
@ -629,10 +608,7 @@ class partition
|
|||||||
IteratorVector& iterator_vector,
|
IteratorVector& iterator_vector,
|
||||||
ExpandPolicy const& expand_policy)
|
ExpandPolicy const& expand_policy)
|
||||||
{
|
{
|
||||||
for(typename boost::range_iterator<ForwardRange const>::type
|
for (auto it = boost::begin(forward_range); it != boost::end(forward_range); ++it)
|
||||||
it = boost::begin(forward_range);
|
|
||||||
it != boost::end(forward_range);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
if (IncludePolicy::apply(*it))
|
if (IncludePolicy::apply(*it))
|
||||||
{
|
{
|
||||||
@ -712,11 +688,11 @@ public:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(iterator_type it1 = boost::begin(forward_range);
|
for(auto it1 = boost::begin(forward_range);
|
||||||
it1 != boost::end(forward_range);
|
it1 != boost::end(forward_range);
|
||||||
++it1)
|
++it1)
|
||||||
{
|
{
|
||||||
iterator_type it2 = it1;
|
auto it2 = it1;
|
||||||
for(++it2; it2 != boost::end(forward_range); ++it2)
|
for(++it2; it2 != boost::end(forward_range); ++it2)
|
||||||
{
|
{
|
||||||
if (! visitor.apply(*it1, *it2))
|
if (! visitor.apply(*it1, *it2))
|
||||||
@ -849,11 +825,11 @@ public:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(iterator_type1 it1 = boost::begin(forward_range1);
|
for (auto it1 = boost::begin(forward_range1);
|
||||||
it1 != boost::end(forward_range1);
|
it1 != boost::end(forward_range1);
|
||||||
++it1)
|
++it1)
|
||||||
{
|
{
|
||||||
for(iterator_type2 it2 = boost::begin(forward_range2);
|
for (auto it2 = boost::begin(forward_range2);
|
||||||
it2 != boost::end(forward_range2);
|
it2 != boost::end(forward_range2);
|
||||||
++it2)
|
++it2)
|
||||||
{
|
{
|
||||||
|
@ -110,12 +110,7 @@ struct point_on_multi
|
|||||||
{
|
{
|
||||||
// Take a point on the first multi-geometry
|
// Take a point on the first multi-geometry
|
||||||
// (i.e. the first that is not empty)
|
// (i.e. the first that is not empty)
|
||||||
for (typename boost::range_iterator
|
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
|
||||||
<
|
|
||||||
MultiGeometry const
|
|
||||||
>::type it = boost::begin(multi);
|
|
||||||
it != boost::end(multi);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
if (Policy::apply(point, *it))
|
if (Policy::apply(point, *it))
|
||||||
{
|
{
|
||||||
|
@ -106,13 +106,10 @@ struct range_to_range
|
|||||||
typedef recalculate_point<geometry::dimension<point_type>::value> per_point;
|
typedef recalculate_point<geometry::dimension<point_type>::value> per_point;
|
||||||
geometry::clear(destination);
|
geometry::clear(destination);
|
||||||
|
|
||||||
for (typename boost::range_iterator<Range2 const>::type it
|
for (auto const& source_point : source)
|
||||||
= boost::begin(source);
|
|
||||||
it != boost::end(source);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
point_type p;
|
point_type p;
|
||||||
per_point::apply(p, *it, strategy);
|
per_point::apply(p, source_point, strategy);
|
||||||
geometry::append(destination, p);
|
geometry::append(destination, p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -256,9 +256,8 @@ public:
|
|||||||
segment_identifier const& other_id = turn.operations[other_op_id].seg_id;
|
segment_identifier const& other_id = turn.operations[other_op_id].seg_id;
|
||||||
overlay::operation_type exit_op = turn.operations[op_id].operation;
|
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
|
// search for the entry point in the same range of other geometry
|
||||||
point_iterator entry_it = std::find_if(m_other_entry_points.begin(),
|
auto entry_it = std::find_if(m_other_entry_points.begin(),
|
||||||
m_other_entry_points.end(),
|
m_other_entry_points.end(),
|
||||||
same_single(other_id));
|
same_single(other_id));
|
||||||
|
|
||||||
|
@ -277,7 +277,6 @@ inline bool calculate_from_inside(Geometry1 const& geometry1,
|
|||||||
auto const& range1 = sub_range(geometry1, turn.operations[op_id].seg_id);
|
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_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));
|
range2_view const range2(sub_range(geometry2, turn.operations[other_op_id].seg_id));
|
||||||
|
|
||||||
BOOST_GEOMETRY_ASSERT(boost::size(range1));
|
BOOST_GEOMETRY_ASSERT(boost::size(range1));
|
||||||
@ -305,7 +304,7 @@ inline bool calculate_from_inside(Geometry1 const& geometry1,
|
|||||||
std::size_t const q_seg_jk = (q_seg_ij + 1) % seg_count2;
|
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)
|
// 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
|
// It would be good to replace it with some O(1) mechanism
|
||||||
range2_iterator qk_it = find_next_non_duplicated(boost::begin(range2),
|
auto qk_it = find_next_non_duplicated(boost::begin(range2),
|
||||||
range::pos(range2, q_seg_jk),
|
range::pos(range2, q_seg_jk),
|
||||||
boost::end(range2),
|
boost::end(range2),
|
||||||
strategy);
|
strategy);
|
||||||
|
@ -188,8 +188,7 @@ struct multi_point_single_geometry
|
|||||||
geometry::envelope(single_geometry, box2, strategy);
|
geometry::envelope(single_geometry, box2, strategy);
|
||||||
geometry::detail::expand_by_epsilon(box2);
|
geometry::detail::expand_by_epsilon(box2);
|
||||||
|
|
||||||
typedef typename boost::range_const_iterator<MultiPoint>::type iterator;
|
for (auto it = boost::begin(multi_point); it != boost::end(multi_point); ++it)
|
||||||
for ( iterator it = boost::begin(multi_point) ; it != boost::end(multi_point) ; ++it )
|
|
||||||
{
|
{
|
||||||
if (! (relate::may_update<interior, interior, '0', Transpose>(result)
|
if (! (relate::may_update<interior, interior, '0', Transpose>(result)
|
||||||
|| relate::may_update<interior, boundary, '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 model::box<point2_type> box2_type;
|
||||||
typedef std::pair<box2_type, std::size_t> box_pair_type;
|
typedef std::pair<box2_type, std::size_t> box_pair_type;
|
||||||
typedef std::vector<box_pair_type> boxes_type;
|
typedef std::vector<box_pair_type> boxes_type;
|
||||||
typedef typename boxes_type::const_iterator boxes_iterator;
|
|
||||||
|
|
||||||
template <typename Result, typename Strategy>
|
template <typename Result, typename Strategy>
|
||||||
static inline void apply(MultiPoint const& multi_point,
|
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(),
|
rtree(boxes.begin(), boxes.end(),
|
||||||
index_parameters_type(index::rstar<4>(), strategy));
|
index_parameters_type(index::rstar<4>(), strategy));
|
||||||
|
|
||||||
typedef typename boost::range_const_iterator<MultiPoint>::type iterator;
|
for (auto it = boost::begin(multi_point); it != boost::end(multi_point); ++it)
|
||||||
for ( iterator it = boost::begin(multi_point) ; it != boost::end(multi_point) ; ++it )
|
|
||||||
{
|
{
|
||||||
if (! (relate::may_update<interior, interior, '0', Transpose>(result)
|
if (! (relate::may_update<interior, interior, '0', Transpose>(result)
|
||||||
|| relate::may_update<interior, boundary, '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));
|
rtree.query(index::intersects(point), std::back_inserter(boxes_found));
|
||||||
|
|
||||||
bool found_ii_or_ib = false;
|
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&
|
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);
|
int in_val = detail::within::point_in_geometry(point, single, strategy);
|
||||||
|
|
||||||
|
@ -67,21 +67,26 @@ std::pair<bool, bool> point_multipoint_check(Point const& point,
|
|||||||
// point_in_geometry could be used here but why iterate over MultiPoint twice?
|
// 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
|
// 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);
|
auto const end = boost::end(multi_point);
|
||||||
iterator last = boost::end(multi_point);
|
for (auto it = boost::begin(multi_point); it != end; ++it)
|
||||||
for ( ; it != last ; ++it )
|
|
||||||
{
|
{
|
||||||
bool ii = detail::equals::equals_point_point(point, *it, strategy);
|
bool ii = detail::equals::equals_point_point(point, *it, strategy);
|
||||||
|
|
||||||
if ( ii )
|
if (ii)
|
||||||
|
{
|
||||||
found_inside = true;
|
found_inside = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
found_outside = true;
|
found_outside = true;
|
||||||
|
}
|
||||||
|
|
||||||
if ( found_inside && found_outside )
|
if (found_inside && found_outside)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return std::make_pair(found_inside, found_outside);
|
return std::make_pair(found_inside, found_outside);
|
||||||
}
|
}
|
||||||
@ -229,20 +234,23 @@ struct multipoint_multipoint
|
|||||||
bool found_outside = false;
|
bool found_outside = false;
|
||||||
|
|
||||||
// for each point in the second MPt
|
// for each point in the second MPt
|
||||||
typedef typename boost::range_iterator<IteratedMultiPoint const>::type iterator;
|
for (auto it = boost::begin(iterated_mpt); it != boost::end(iterated_mpt); ++it)
|
||||||
for ( iterator 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;
|
found_inside = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
found_outside = true;
|
found_outside = true;
|
||||||
|
}
|
||||||
|
|
||||||
if ( found_inside && found_outside )
|
if (found_inside && found_outside)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( found_inside ) // some point of MP2 is equal to some of MP1
|
if ( found_inside ) // some point of MP2 is equal to some of MP1
|
||||||
{
|
{
|
||||||
|
@ -175,17 +175,17 @@ private:
|
|||||||
void init() const
|
void init() const
|
||||||
{
|
{
|
||||||
if (m_is_initialized)
|
if (m_is_initialized)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_endpoints.reserve(boost::size(m_mls) * 2);
|
m_endpoints.reserve(boost::size(m_mls) * 2);
|
||||||
|
|
||||||
m_has_interior = false;
|
m_has_interior = false;
|
||||||
|
|
||||||
typedef typename boost::range_iterator<MultiLinestring const>::type ls_iterator;
|
for (auto it = boost::begin(m_mls); it != boost::end(m_mls); ++it)
|
||||||
for ( ls_iterator it = boost::begin(m_mls) ; it != boost::end(m_mls) ; ++it )
|
|
||||||
{
|
{
|
||||||
typename boost::range_reference<MultiLinestring const>::type
|
auto const& ls = *it;
|
||||||
ls = *it;
|
|
||||||
|
|
||||||
std::size_t count = boost::size(ls);
|
std::size_t count = boost::size(ls);
|
||||||
|
|
||||||
@ -196,13 +196,8 @@ private:
|
|||||||
|
|
||||||
if (count > 1)
|
if (count > 1)
|
||||||
{
|
{
|
||||||
typedef typename boost::range_reference
|
auto const& front_pt = range::front(ls);
|
||||||
<
|
auto const& back_pt = range::back(ls);
|
||||||
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);
|
|
||||||
|
|
||||||
// don't store boundaries of linear rings, this doesn't change anything
|
// don't store boundaries of linear rings, this doesn't change anything
|
||||||
if (! equals::equals_point_point(front_pt, back_pt, m_strategy))
|
if (! equals::equals_point_point(front_pt, back_pt, m_strategy))
|
||||||
@ -226,7 +221,7 @@ private:
|
|||||||
|
|
||||||
m_has_boundary = false;
|
m_has_boundary = false;
|
||||||
|
|
||||||
if (! m_endpoints.empty() )
|
if (! m_endpoints.empty())
|
||||||
{
|
{
|
||||||
std::sort(m_endpoints.begin(), m_endpoints.end(), less_type());
|
std::sort(m_endpoints.begin(), m_endpoints.end(), less_type());
|
||||||
m_has_boundary = find_odd_count(m_endpoints.begin(), m_endpoints.end());
|
m_has_boundary = find_odd_count(m_endpoints.begin(), m_endpoints.end());
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
#include <boost/geometry/algorithms/envelope.hpp>
|
#include <boost/geometry/algorithms/envelope.hpp>
|
||||||
#include <boost/geometry/algorithms/expand.hpp>
|
#include <boost/geometry/algorithms/expand.hpp>
|
||||||
#include <boost/geometry/algorithms/detail/expand_by_epsilon.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/recalculate.hpp>
|
||||||
#include <boost/geometry/algorithms/detail/ring_identifier.hpp>
|
#include <boost/geometry/algorithms/detail/ring_identifier.hpp>
|
||||||
#include <boost/geometry/algorithms/detail/signed_size_type.hpp>
|
#include <boost/geometry/algorithms/detail/signed_size_type.hpp>
|
||||||
@ -710,10 +709,7 @@ struct sectionalize_multi
|
|||||||
std::size_t max_count)
|
std::size_t max_count)
|
||||||
{
|
{
|
||||||
ring_id.multi_index = 0;
|
ring_id.multi_index = 0;
|
||||||
for (typename boost::range_iterator<MultiGeometry const>::type
|
for (auto it = boost::begin(multi); it != boost::end(multi); ++it, ++ring_id.multi_index)
|
||||||
it = boost::begin(multi);
|
|
||||||
it != boost::end(multi);
|
|
||||||
++it, ++ring_id.multi_index)
|
|
||||||
{
|
{
|
||||||
Policy::apply(*it, robust_policy, sections,
|
Policy::apply(*it, robust_policy, sections,
|
||||||
strategy,
|
strategy,
|
||||||
|
@ -157,19 +157,20 @@ struct areal_interrupt_policy
|
|||||||
inline bool apply(Range const& range)
|
inline bool apply(Range const& range)
|
||||||
{
|
{
|
||||||
// if already rejected (temp workaround?)
|
// if already rejected (temp workaround?)
|
||||||
if ( found_not_touch )
|
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 ( 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;
|
found_not_touch = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(it->method)
|
switch (it->method)
|
||||||
{
|
{
|
||||||
case overlay::method_crosses:
|
case overlay::method_crosses:
|
||||||
found_not_touch = true;
|
found_not_touch = true;
|
||||||
|
@ -593,8 +593,7 @@ struct convert_to_output<Geometry, SingleOut, true>
|
|||||||
static OutputIterator apply(Geometry const& geometry,
|
static OutputIterator apply(Geometry const& geometry,
|
||||||
OutputIterator oit)
|
OutputIterator oit)
|
||||||
{
|
{
|
||||||
typedef typename boost::range_iterator<Geometry const>::type iterator;
|
for (auto it = boost::begin(geometry); it != boost::end(geometry); ++it)
|
||||||
for (iterator it = boost::begin(geometry); it != boost::end(geometry); ++it)
|
|
||||||
{
|
{
|
||||||
SingleOut single_out;
|
SingleOut single_out;
|
||||||
geometry::convert(*it, single_out);
|
geometry::convert(*it, single_out);
|
||||||
|
@ -55,8 +55,7 @@ struct multi_point_point
|
|||||||
{
|
{
|
||||||
auto const s = strategy.relate(multi_point, point);
|
auto const s = strategy.relate(multi_point, point);
|
||||||
|
|
||||||
typedef typename boost::range_const_iterator<MultiPoint>::type iterator;
|
for (auto it = boost::begin(multi_point); it != boost::end(multi_point); ++it)
|
||||||
for ( iterator it = boost::begin(multi_point) ; it != boost::end(multi_point) ; ++it )
|
|
||||||
{
|
{
|
||||||
if (! s.apply(*it, point))
|
if (! s.apply(*it, point))
|
||||||
{
|
{
|
||||||
@ -88,8 +87,7 @@ struct multi_point_multi_point
|
|||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
typedef typename boost::range_const_iterator<MultiPoint1>::type iterator;
|
for (auto it = boost::begin(multi_point1); it != boost::end(multi_point1); ++it)
|
||||||
for ( iterator it = boost::begin(multi_point1) ; it != boost::end(multi_point1) ; ++it )
|
|
||||||
{
|
{
|
||||||
if (! std::binary_search(points2.begin(), points2.end(), *it, less))
|
if (! std::binary_search(points2.begin(), points2.end(), *it, less))
|
||||||
{
|
{
|
||||||
@ -134,8 +132,7 @@ struct multi_point_single_geometry
|
|||||||
// If in the exterior, break
|
// If in the exterior, break
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
typedef typename boost::range_const_iterator<MultiPoint>::type iterator;
|
for (auto it = boost::begin(multi_point); it != boost::end(multi_point); ++it )
|
||||||
for ( iterator it = boost::begin(multi_point) ; it != boost::end(multi_point) ; ++it )
|
|
||||||
{
|
{
|
||||||
typedef decltype(strategy.covered_by(*it, box)) point_in_box_type;
|
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
|
// If a point is in the exterior break
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
typedef typename boost::range_const_iterator<MultiPoint>::type iterator;
|
for (auto it = boost::begin(multi_point); it != boost::end(multi_point); ++it)
|
||||||
for ( iterator it = boost::begin(multi_point) ; it != boost::end(multi_point) ; ++it )
|
|
||||||
{
|
{
|
||||||
// TODO: investigate the possibility of using satisfies
|
// TODO: investigate the possibility of using satisfies
|
||||||
// TODO: investigate the possibility of using iterative queries (optimization below)
|
// TODO: investigate the possibility of using iterative queries (optimization below)
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
#include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
|
#include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
|
||||||
#include <boost/geometry/algorithms/detail/equals/point_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/geometries/concepts/check.hpp>
|
||||||
#include <boost/geometry/strategies/concepts/within_concept.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;
|
typename Strategy::state_type state;
|
||||||
|
|
||||||
typedef typename boost::range_iterator<Range const>::type iterator_type;
|
auto it = boost::begin(range);
|
||||||
iterator_type it = boost::begin(range);
|
auto const end = boost::end(range);
|
||||||
iterator_type 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;
|
break;
|
||||||
}
|
}
|
||||||
@ -202,13 +200,8 @@ struct point_in_geometry<Polygon, polygon_tag>
|
|||||||
|
|
||||||
if (code == 1)
|
if (code == 1)
|
||||||
{
|
{
|
||||||
typename interior_return_type<Polygon const>::type
|
auto const& rings = interior_rings(polygon);
|
||||||
rings = interior_rings(polygon);
|
for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
|
||||||
|
|
||||||
for (typename detail::interior_iterator<Polygon const>::type
|
|
||||||
it = boost::begin(rings);
|
|
||||||
it != boost::end(rings);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
int const interior_code = point_in_geometry
|
int const interior_code = point_in_geometry
|
||||||
<
|
<
|
||||||
@ -235,15 +228,17 @@ struct point_in_geometry<Geometry, multi_point_tag>
|
|||||||
int apply(Point const& point, Geometry const& geometry, Strategy const& strategy)
|
int apply(Point const& point, Geometry const& geometry, Strategy const& strategy)
|
||||||
{
|
{
|
||||||
typedef typename boost::range_value<Geometry>::type point_type;
|
typedef typename boost::range_value<Geometry>::type point_type;
|
||||||
typedef typename boost::range_const_iterator<Geometry>::type iterator;
|
for (auto it = boost::begin(geometry); it != boost::end(geometry); ++it)
|
||||||
for ( iterator it = boost::begin(geometry) ; it != boost::end(geometry) ; ++it )
|
|
||||||
{
|
{
|
||||||
int pip = point_in_geometry<point_type>::apply(point, *it, strategy);
|
int pip = point_in_geometry<point_type>::apply(point, *it, strategy);
|
||||||
|
|
||||||
//BOOST_GEOMETRY_ASSERT(pip != 0);
|
//BOOST_GEOMETRY_ASSERT(pip != 0);
|
||||||
if ( pip > 0 ) // inside
|
if (pip > 0)
|
||||||
|
{
|
||||||
|
// inside
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return -1; // outside
|
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<Geometry>::type linestring_type;
|
||||||
typedef typename boost::range_value<linestring_type>::type point_type;
|
typedef typename boost::range_value<linestring_type>::type point_type;
|
||||||
typedef typename boost::range_iterator<Geometry const>::type iterator;
|
auto it = boost::begin(geometry);
|
||||||
iterator it = boost::begin(geometry);
|
for ( ; it != boost::end(geometry); ++it)
|
||||||
for ( ; it != boost::end(geometry) ; ++it )
|
|
||||||
{
|
{
|
||||||
pip = point_in_geometry<linestring_type>::apply(point, *it, strategy);
|
pip = point_in_geometry<linestring_type>::apply(point, *it, strategy);
|
||||||
|
|
||||||
// inside or on the boundary
|
// inside or on the boundary
|
||||||
if ( pip >= 0 )
|
if (pip >= 0)
|
||||||
{
|
{
|
||||||
++it;
|
++it;
|
||||||
break;
|
break;
|
||||||
@ -274,24 +268,30 @@ struct point_in_geometry<Geometry, multi_linestring_tag>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// outside
|
// outside
|
||||||
if ( pip < 0 )
|
if (pip < 0)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: the following isn't needed for covered_by()
|
// TODO: the following isn't needed for covered_by()
|
||||||
|
|
||||||
unsigned boundaries = pip == 0 ? 1 : 0;
|
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;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
point_type const& front = range::front(*it);
|
point_type const& front = range::front(*it);
|
||||||
point_type const& back = range::back(*it);
|
point_type const& back = range::back(*it);
|
||||||
|
|
||||||
// is closed_ring - no boundary
|
// is closed_ring - no boundary
|
||||||
if ( detail::equals::equals_point_point(front, back, strategy) )
|
if (detail::equals::equals_point_point(front, back, strategy))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// is point on boundary
|
// is point on boundary
|
||||||
if ( detail::equals::equals_point_point(point, front, strategy)
|
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
|
//int res = -1; // outside
|
||||||
|
|
||||||
typedef typename boost::range_value<Geometry>::type polygon_type;
|
typedef typename boost::range_value<Geometry>::type polygon_type;
|
||||||
typedef typename boost::range_const_iterator<Geometry>::type iterator;
|
for (auto it = boost::begin(geometry); it != boost::end(geometry); ++it)
|
||||||
for ( iterator it = boost::begin(geometry) ; it != boost::end(geometry) ; ++it )
|
|
||||||
{
|
{
|
||||||
int pip = point_in_geometry<polygon_type>::apply(point, *it, strategy);
|
int pip = point_in_geometry<polygon_type>::apply(point, *it, strategy);
|
||||||
|
|
||||||
// inside or on the boundary
|
// inside or on the boundary
|
||||||
if ( pip >= 0 )
|
if (pip >= 0)
|
||||||
|
{
|
||||||
return pip;
|
return pip;
|
||||||
|
}
|
||||||
|
|
||||||
// For invalid multi-polygons
|
// For invalid multi-polygons
|
||||||
//if ( 1 == pip ) // inside polygon
|
//if ( 1 == pip ) // inside polygon
|
||||||
|
@ -41,8 +41,10 @@ struct within_no_turns
|
|||||||
{
|
{
|
||||||
typedef typename geometry::point_type<Geometry1>::type point1_type;
|
typedef typename geometry::point_type<Geometry1>::type point1_type;
|
||||||
point1_type p;
|
point1_type p;
|
||||||
if ( !geometry::point_on_border(p, geometry1) )
|
if (! geometry::point_on_border(p, geometry1))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return detail::within::point_in_geometry(p, geometry2, strategy) >= 0;
|
return detail::within::point_in_geometry(p, geometry2, strategy) >= 0;
|
||||||
}
|
}
|
||||||
@ -57,26 +59,29 @@ struct within_no_turns<Geometry1, Geometry2, ring_tag, polygon_tag>
|
|||||||
typedef typename geometry::point_type<Geometry1>::type point1_type;
|
typedef typename geometry::point_type<Geometry1>::type point1_type;
|
||||||
typedef typename geometry::point_type<Geometry2>::type point2_type;
|
typedef typename geometry::point_type<Geometry2>::type point2_type;
|
||||||
point1_type p;
|
point1_type p;
|
||||||
if ( !geometry::point_on_border(p, geometry1) )
|
if (! geometry::point_on_border(p, geometry1))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
// check if one of ring points is outside the polygon
|
// 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;
|
return false;
|
||||||
|
}
|
||||||
// Now check if holes of G2 aren't inside G1
|
// Now check if holes of G2 aren't inside G1
|
||||||
typedef typename boost::range_const_iterator
|
auto const& rings2 = geometry::interior_rings(geometry2);
|
||||||
<
|
for (auto it = boost::begin(rings2); it != boost::end(rings2); ++it)
|
||||||
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 )
|
|
||||||
{
|
{
|
||||||
point2_type p;
|
point2_type p;
|
||||||
if ( !geometry::point_on_border(p, *it) )
|
if (! geometry::point_on_border(p, *it))
|
||||||
|
{
|
||||||
return false;
|
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 false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -90,46 +95,44 @@ struct within_no_turns<Geometry1, Geometry2, polygon_tag, polygon_tag>
|
|||||||
typedef typename geometry::point_type<Geometry1>::type point1_type;
|
typedef typename geometry::point_type<Geometry1>::type point1_type;
|
||||||
typedef typename geometry::point_type<Geometry2>::type point2_type;
|
typedef typename geometry::point_type<Geometry2>::type point2_type;
|
||||||
point1_type p;
|
point1_type p;
|
||||||
if ( !geometry::point_on_border(p, geometry1) )
|
if (! geometry::point_on_border(p, geometry1))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
// check if one of ring points is outside the polygon
|
// 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;
|
return false;
|
||||||
|
}
|
||||||
// Now check if holes of G2 aren't inside G1
|
// Now check if holes of G2 aren't inside G1
|
||||||
typedef typename boost::range_const_iterator
|
auto const& rings2 = geometry::interior_rings(geometry2);
|
||||||
<
|
for (auto it2 = boost::begin(rings2); it != boost::end(rings2); ++it)
|
||||||
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 )
|
|
||||||
{
|
{
|
||||||
point2_type p2;
|
point2_type p2;
|
||||||
if ( !geometry::point_on_border(p2, *it) )
|
if (! geometry::point_on_border(p2, *it2))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
// if the hole of G2 is inside G1
|
// 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
|
// if it's also inside one of the G1 holes, it's ok
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
typedef typename boost::range_const_iterator
|
auto const& rings1 = geometry::interior_rings(geometry1);
|
||||||
<
|
for (auto it1 = boost::begin(rings1); it1 != boost::end(rings1); ++it1)
|
||||||
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 )
|
|
||||||
{
|
{
|
||||||
if ( detail::within::point_in_geometry(p2, *it1, strategy) < 0 )
|
if (detail::within::point_in_geometry(p2, *it1, strategy) < 0)
|
||||||
{
|
{
|
||||||
ok = true;
|
ok = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !ok )
|
if (! ok)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -157,12 +160,13 @@ struct within_no_turns_multi<Geometry1, Geometry2, Tag1, Tag2, true, false>
|
|||||||
{
|
{
|
||||||
// All values of G1 must be inside G2
|
// All values of G1 must be inside G2
|
||||||
typedef typename boost::range_value<Geometry1>::type subgeometry1;
|
typedef typename boost::range_value<Geometry1>::type subgeometry1;
|
||||||
typedef typename boost::range_const_iterator<Geometry1>::type iterator;
|
for (auto it = boost::begin(geometry1) ; it != boost::end(geometry1) ; ++it )
|
||||||
for ( iterator 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 false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -175,12 +179,13 @@ struct within_no_turns_multi<Geometry1, Geometry2, Tag1, Tag2, false, true>
|
|||||||
{
|
{
|
||||||
// G1 must be within at least one value of G2
|
// G1 must be within at least one value of G2
|
||||||
typedef typename boost::range_value<Geometry2>::type subgeometry2;
|
typedef typename boost::range_value<Geometry2>::type subgeometry2;
|
||||||
typedef typename boost::range_const_iterator<Geometry2>::type iterator;
|
for (auto it = boost::begin(geometry2); it != boost::end(geometry2); ++it)
|
||||||
for ( iterator 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 true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -193,12 +198,13 @@ struct within_no_turns_multi<Geometry1, Geometry2, Tag1, Tag2, true, true>
|
|||||||
{
|
{
|
||||||
// each value of G1 must be inside at least one value of G2
|
// 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_value<Geometry1>::type subgeometry1;
|
||||||
typedef typename boost::range_const_iterator<Geometry1>::type iterator;
|
for (auto it = boost::begin(geometry1) ; it != boost::end(geometry1) ; ++it)
|
||||||
for ( iterator 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 false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
#include <boost/range/reference.hpp>
|
#include <boost/range/reference.hpp>
|
||||||
#include <boost/range/value_type.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/algorithms/not_implemented.hpp>
|
||||||
#include <boost/geometry/core/closure.hpp>
|
#include <boost/geometry/core/closure.hpp>
|
||||||
#include <boost/geometry/core/exterior_ring.hpp>
|
#include <boost/geometry/core/exterior_ring.hpp>
|
||||||
@ -326,9 +325,7 @@ struct for_each_polygon
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
typename interior_return_type<Polygon>::type
|
auto&& rings = interior_rings(poly);
|
||||||
rings = interior_rings(poly);
|
|
||||||
|
|
||||||
auto const end = boost::end(rings);
|
auto const end = boost::end(rings);
|
||||||
for (auto it = boost::begin(rings); it != end; ++it)
|
for (auto it = boost::begin(rings); it != end; ++it)
|
||||||
{
|
{
|
||||||
|
@ -139,6 +139,7 @@ struct multi_polygon_is_convex
|
|||||||
static inline bool apply(MultiPolygon const& multi_polygon, Strategies const& strategies)
|
static inline bool apply(MultiPolygon const& multi_polygon, Strategies const& strategies)
|
||||||
{
|
{
|
||||||
auto const size = boost::size(multi_polygon);
|
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
|
return size == 0 // For consistency with ring_is_convex
|
||||||
|| (size == 1 && polygon_is_convex::apply(range::front(multi_polygon), strategies));
|
|| (size == 1 && polygon_is_convex::apply(range::front(multi_polygon), strategies));
|
||||||
}
|
}
|
||||||
@ -272,7 +273,7 @@ struct is_convex
|
|||||||
template <typename Strategy>
|
template <typename Strategy>
|
||||||
static bool apply(Geometry const& geometry, Strategy const& 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);
|
return resolve_strategy::is_convex<Strategy>::apply(geometry, strategy);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -89,11 +89,10 @@ struct interpolate_range
|
|||||||
PointLike & pointlike,
|
PointLike & pointlike,
|
||||||
Strategies const& strategies)
|
Strategies const& strategies)
|
||||||
{
|
{
|
||||||
typedef typename boost::range_iterator<Range const>::type iterator_t;
|
|
||||||
typedef typename boost::range_value<Range const>::type point_t;
|
typedef typename boost::range_value<Range const>::type point_t;
|
||||||
|
|
||||||
iterator_t it = boost::begin(range);
|
auto it = boost::begin(range);
|
||||||
iterator_t end = boost::end(range);
|
auto const end = boost::end(range);
|
||||||
|
|
||||||
if (it == end) // empty(range)
|
if (it == end) // empty(range)
|
||||||
{
|
{
|
||||||
@ -112,7 +111,7 @@ struct interpolate_range
|
|||||||
typedef decltype(pp_strategy.apply(
|
typedef decltype(pp_strategy.apply(
|
||||||
std::declval<point_t>(), std::declval<point_t>())) distance_type;
|
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 repeated_distance = max_distance;
|
||||||
distance_type prev_distance = 0;
|
distance_type prev_distance = 0;
|
||||||
distance_type current_distance = 0;
|
distance_type current_distance = 0;
|
||||||
|
@ -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)
|
inline bool max_value(Collection const& collection, Value& the_max, Predicate const& predicate)
|
||||||
{
|
{
|
||||||
bool first = true;
|
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)
|
if (first || the_value > the_max)
|
||||||
{
|
{
|
||||||
the_max = the_value;
|
the_max = the_value;
|
||||||
@ -153,16 +153,14 @@ template <typename Point, typename P>
|
|||||||
inline void calculate_average(Point& point, std::vector<P> const& points)
|
inline void calculate_average(Point& point, std::vector<P> const& points)
|
||||||
{
|
{
|
||||||
typedef typename geometry::coordinate_type<Point>::type coordinate_type;
|
typedef typename geometry::coordinate_type<Point>::type coordinate_type;
|
||||||
typedef typename std::vector<P>::const_iterator iterator_type;
|
|
||||||
|
|
||||||
coordinate_type x = 0;
|
coordinate_type x = 0;
|
||||||
coordinate_type y = 0;
|
coordinate_type y = 0;
|
||||||
|
|
||||||
iterator_type end = points.end();
|
for (auto const& p : points)
|
||||||
for ( iterator_type it = points.begin() ; it != end ; ++it)
|
|
||||||
{
|
{
|
||||||
x += geometry::get<0>(*it);
|
x += geometry::get<0>(p);
|
||||||
y += geometry::get<1>(*it);
|
y += geometry::get<1>(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
signed_size_type const count = points.size();
|
signed_size_type const count = points.size();
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
#include <boost/geometry/geometries/concepts/check.hpp>
|
#include <boost/geometry/geometries/concepts/check.hpp>
|
||||||
|
|
||||||
#include <boost/geometry/algorithms/detail/point_is_spike_or_equal.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/algorithms/clear.hpp>
|
||||||
|
|
||||||
#include <boost/geometry/strategies/default_strategy.hpp>
|
#include <boost/geometry/strategies/default_strategy.hpp>
|
||||||
@ -88,11 +87,10 @@ struct range_remove_spikes
|
|||||||
std::vector<point_type> cleaned;
|
std::vector<point_type> cleaned;
|
||||||
cleaned.reserve(n);
|
cleaned.reserve(n);
|
||||||
|
|
||||||
for (typename boost::range_iterator<Range const>::type it = boost::begin(range);
|
for (auto const& p : range)
|
||||||
it != boost::end(range); ++it)
|
|
||||||
{
|
{
|
||||||
// Add point
|
// Add point
|
||||||
cleaned.push_back(*it);
|
cleaned.push_back(p);
|
||||||
|
|
||||||
while(cleaned.size() >= 3
|
while(cleaned.size() >= 3
|
||||||
&& detail::is_spike_or_equal(range::at(cleaned, 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;
|
auto cleaned_b = cleaned.begin();
|
||||||
cleaned_iterator cleaned_b = cleaned.begin();
|
auto cleaned_e = cleaned.end();
|
||||||
cleaned_iterator cleaned_e = cleaned.end();
|
|
||||||
std::size_t cleaned_count = cleaned.size();
|
std::size_t cleaned_count = cleaned.size();
|
||||||
|
|
||||||
// For a closed-polygon, remove closing point, this makes checking first point(s) easier and consistent
|
// 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;
|
typedef range_remove_spikes per_range;
|
||||||
per_range::apply(exterior_ring(polygon), strategy);
|
per_range::apply(exterior_ring(polygon), strategy);
|
||||||
|
|
||||||
typename interior_return_type<Polygon>::type
|
auto&& rings = interior_rings(polygon);
|
||||||
rings = interior_rings(polygon);
|
|
||||||
|
|
||||||
for (typename detail::interior_iterator<Polygon>::type
|
for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
|
||||||
it = boost::begin(rings); it != boost::end(rings); ++it)
|
|
||||||
{
|
{
|
||||||
per_range::apply(*it, strategy);
|
per_range::apply(*it, strategy);
|
||||||
}
|
}
|
||||||
@ -196,10 +191,7 @@ struct multi_remove_spikes
|
|||||||
template <typename MultiGeometry, typename SideStrategy>
|
template <typename MultiGeometry, typename SideStrategy>
|
||||||
static inline void apply(MultiGeometry& multi, SideStrategy const& strategy)
|
static inline void apply(MultiGeometry& multi, SideStrategy const& strategy)
|
||||||
{
|
{
|
||||||
for (typename boost::range_iterator<MultiGeometry>::type
|
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
|
||||||
it = boost::begin(multi);
|
|
||||||
it != boost::end(multi);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
SingleVersion::apply(*it, strategy);
|
SingleVersion::apply(*it, strategy);
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include <boost/range/begin.hpp>
|
#include <boost/range/begin.hpp>
|
||||||
#include <boost/range/end.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/multi_modify.hpp>
|
||||||
#include <boost/geometry/algorithms/detail/visit.hpp>
|
#include <boost/geometry/algorithms/detail/visit.hpp>
|
||||||
#include <boost/geometry/core/interior_rings.hpp>
|
#include <boost/geometry/core/interior_rings.hpp>
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
|
|
||||||
#include <boost/geometry/algorithms/assign.hpp>
|
#include <boost/geometry/algorithms/assign.hpp>
|
||||||
#include <boost/geometry/algorithms/clear.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/algorithms/num_interior_rings.hpp>
|
||||||
|
|
||||||
#include <boost/geometry/core/cs.hpp>
|
#include <boost/geometry/core/cs.hpp>
|
||||||
@ -143,10 +142,7 @@ inline bool transform_range_out(Range const& range,
|
|||||||
OutputIterator out, Strategy const& strategy)
|
OutputIterator out, Strategy const& strategy)
|
||||||
{
|
{
|
||||||
PointOut point_out;
|
PointOut point_out;
|
||||||
for(typename boost::range_iterator<Range const>::type
|
for (auto it = boost::begin(range); it != boost::end(range); ++it)
|
||||||
it = boost::begin(range);
|
|
||||||
it != boost::end(range);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
if (! transform_point::apply(*it, point_out, strategy))
|
if (! transform_point::apply(*it, point_out, strategy))
|
||||||
{
|
{
|
||||||
@ -184,15 +180,11 @@ struct transform_polygon
|
|||||||
>::apply(geometry::interior_rings(poly2),
|
>::apply(geometry::interior_rings(poly2),
|
||||||
geometry::num_interior_rings(poly1));
|
geometry::num_interior_rings(poly1));
|
||||||
|
|
||||||
typename geometry::interior_return_type<Polygon1 const>::type
|
auto const& rings1 = geometry::interior_rings(poly1);
|
||||||
rings1 = geometry::interior_rings(poly1);
|
auto&& rings2 = geometry::interior_rings(poly2);
|
||||||
typename geometry::interior_return_type<Polygon2>::type
|
|
||||||
rings2 = geometry::interior_rings(poly2);
|
|
||||||
|
|
||||||
typename detail::interior_iterator<Polygon1 const>::type
|
auto it1 = boost::begin(rings1);
|
||||||
it1 = boost::begin(rings1);
|
auto it2 = boost::begin(rings2);
|
||||||
typename detail::interior_iterator<Polygon2>::type
|
|
||||||
it2 = boost::begin(rings2);
|
|
||||||
for ( ; it1 != boost::end(rings1); ++it1, ++it2)
|
for ( ; it1 != boost::end(rings1); ++it1, ++it2)
|
||||||
{
|
{
|
||||||
if ( ! transform_range_out<point2_type>(*it1,
|
if ( ! transform_range_out<point2_type>(*it1,
|
||||||
@ -251,10 +243,8 @@ struct transform_multi
|
|||||||
{
|
{
|
||||||
traits::resize<Multi2>::apply(multi2, boost::size(multi1));
|
traits::resize<Multi2>::apply(multi2, boost::size(multi1));
|
||||||
|
|
||||||
typename boost::range_iterator<Multi1 const>::type it1
|
auto it1 = boost::begin(multi1);
|
||||||
= boost::begin(multi1);
|
auto it2 = boost::begin(multi2);
|
||||||
typename boost::range_iterator<Multi2>::type it2
|
|
||||||
= boost::begin(multi2);
|
|
||||||
|
|
||||||
for (; it1 != boost::end(multi1); ++it1, ++it2)
|
for (; it1 != boost::end(multi1); ++it1, ++it2)
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include <boost/range/begin.hpp>
|
#include <boost/range/begin.hpp>
|
||||||
#include <boost/range/end.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/interior_rings.hpp>
|
||||||
#include <boost/geometry/core/mutable_range.hpp>
|
#include <boost/geometry/core/mutable_range.hpp>
|
||||||
#include <boost/geometry/core/tags.hpp>
|
#include <boost/geometry/core/tags.hpp>
|
||||||
@ -46,7 +45,7 @@ struct range_unique
|
|||||||
template <typename Range, typename ComparePolicy>
|
template <typename Range, typename ComparePolicy>
|
||||||
static inline void apply(Range& range, ComparePolicy const& policy)
|
static inline void apply(Range& range, ComparePolicy const& policy)
|
||||||
{
|
{
|
||||||
typename boost::range_iterator<Range>::type it
|
auto it
|
||||||
= std::unique
|
= std::unique
|
||||||
(
|
(
|
||||||
boost::begin(range),
|
boost::begin(range),
|
||||||
@ -66,11 +65,9 @@ struct polygon_unique
|
|||||||
{
|
{
|
||||||
range_unique::apply(exterior_ring(polygon), policy);
|
range_unique::apply(exterior_ring(polygon), policy);
|
||||||
|
|
||||||
typename interior_return_type<Polygon>::type
|
auto&& rings = interior_rings(polygon);
|
||||||
rings = interior_rings(polygon);
|
|
||||||
|
|
||||||
for (typename detail::interior_iterator<Polygon>::type
|
for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
|
||||||
it = boost::begin(rings); it != boost::end(rings); ++it)
|
|
||||||
{
|
{
|
||||||
range_unique::apply(*it, policy);
|
range_unique::apply(*it, policy);
|
||||||
}
|
}
|
||||||
@ -84,10 +81,7 @@ struct multi_unique
|
|||||||
template <typename MultiGeometry, typename ComparePolicy>
|
template <typename MultiGeometry, typename ComparePolicy>
|
||||||
static inline void apply(MultiGeometry& multi, ComparePolicy const& compare)
|
static inline void apply(MultiGeometry& multi, ComparePolicy const& compare)
|
||||||
{
|
{
|
||||||
for (typename boost::range_iterator<MultiGeometry>::type
|
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
|
||||||
it = boost::begin(multi);
|
|
||||||
it != boost::end(multi);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
Policy::apply(*it, compare);
|
Policy::apply(*it, compare);
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,7 @@
|
|||||||
#include <boost/geometry/algorithms/for_each.hpp>
|
#include <boost/geometry/algorithms/for_each.hpp>
|
||||||
#include <boost/geometry/algorithms/intersection.hpp>
|
#include <boost/geometry/algorithms/intersection.hpp>
|
||||||
#include <boost/geometry/algorithms/intersects.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_empty.hpp>
|
||||||
#include <boost/geometry/algorithms/is_simple.hpp>
|
#include <boost/geometry/algorithms/is_simple.hpp>
|
||||||
#include <boost/geometry/algorithms/is_valid.hpp>
|
#include <boost/geometry/algorithms/is_valid.hpp>
|
||||||
@ -94,6 +95,7 @@
|
|||||||
#include <boost/geometry/algorithms/num_segments.hpp>
|
#include <boost/geometry/algorithms/num_segments.hpp>
|
||||||
#include <boost/geometry/algorithms/overlaps.hpp>
|
#include <boost/geometry/algorithms/overlaps.hpp>
|
||||||
#include <boost/geometry/algorithms/perimeter.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/relate.hpp>
|
||||||
#include <boost/geometry/algorithms/relation.hpp>
|
#include <boost/geometry/algorithms/relation.hpp>
|
||||||
#include <boost/geometry/algorithms/remove_spikes.hpp>
|
#include <boost/geometry/algorithms/remove_spikes.hpp>
|
||||||
|
@ -28,8 +28,6 @@
|
|||||||
#include <boost/range/end.hpp>
|
#include <boost/range/end.hpp>
|
||||||
#include <boost/range/value_type.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/exterior_ring.hpp>
|
||||||
#include <boost/geometry/core/interior_rings.hpp>
|
#include <boost/geometry/core/interior_rings.hpp>
|
||||||
#include <boost/geometry/core/ring_type.hpp>
|
#include <boost/geometry/core/ring_type.hpp>
|
||||||
@ -170,15 +168,11 @@ struct dsv_range
|
|||||||
Range const& range,
|
Range const& range,
|
||||||
dsv_settings const& settings)
|
dsv_settings const& settings)
|
||||||
{
|
{
|
||||||
typedef typename boost::range_iterator<Range const>::type iterator_type;
|
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
os << settings.list_open;
|
os << settings.list_open;
|
||||||
|
|
||||||
for (iterator_type it = boost::begin(range);
|
for (auto it = boost::begin(range); it != boost::end(range); ++it)
|
||||||
it != boost::end(range);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
os << (first ? "" : settings.point_separator)
|
os << (first ? "" : settings.point_separator)
|
||||||
<< settings.point_open;
|
<< settings.point_open;
|
||||||
@ -218,10 +212,8 @@ struct dsv_poly
|
|||||||
|
|
||||||
dsv_range<ring>::apply(os, exterior_ring(poly), settings);
|
dsv_range<ring>::apply(os, exterior_ring(poly), settings);
|
||||||
|
|
||||||
typename interior_return_type<Polygon const>::type
|
auto const& rings = interior_rings(poly);
|
||||||
rings = interior_rings(poly);
|
for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
|
||||||
for (typename detail::interior_iterator<Polygon const>::type
|
|
||||||
it = boost::begin(rings); it != boost::end(rings); ++it)
|
|
||||||
{
|
{
|
||||||
os << settings.list_separator;
|
os << settings.list_separator;
|
||||||
dsv_range<ring>::apply(os, *it, settings);
|
dsv_range<ring>::apply(os, *it, settings);
|
||||||
@ -362,12 +354,6 @@ struct dsv_multi
|
|||||||
typename boost::range_value<MultiGeometry>::type
|
typename boost::range_value<MultiGeometry>::type
|
||||||
> dispatch_one;
|
> dispatch_one;
|
||||||
|
|
||||||
typedef typename boost::range_iterator
|
|
||||||
<
|
|
||||||
MultiGeometry const
|
|
||||||
>::type iterator;
|
|
||||||
|
|
||||||
|
|
||||||
template <typename Char, typename Traits>
|
template <typename Char, typename Traits>
|
||||||
static inline void apply(std::basic_ostream<Char, Traits>& os,
|
static inline void apply(std::basic_ostream<Char, Traits>& os,
|
||||||
MultiGeometry const& multi,
|
MultiGeometry const& multi,
|
||||||
@ -376,9 +362,7 @@ struct dsv_multi
|
|||||||
os << settings.list_open;
|
os << settings.list_open;
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for(iterator it = boost::begin(multi);
|
for(auto it = boost::begin(multi); it != boost::end(multi); ++it, first = false)
|
||||||
it != boost::end(multi);
|
|
||||||
++it, first = false)
|
|
||||||
{
|
{
|
||||||
os << (first ? "" : settings.list_separator);
|
os << (first ? "" : settings.list_separator);
|
||||||
dispatch_one::apply(os, *it, settings);
|
dispatch_one::apply(os, *it, settings);
|
||||||
|
@ -160,10 +160,7 @@ struct svg_map<multi_tag, Multi, SvgPoint>
|
|||||||
std::string const& style, double size,
|
std::string const& style, double size,
|
||||||
Multi const& multi, TransformStrategy const& strategy)
|
Multi const& multi, TransformStrategy const& strategy)
|
||||||
{
|
{
|
||||||
for (typename boost::range_iterator<Multi const>::type it
|
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
|
||||||
= boost::begin(multi);
|
|
||||||
it != boost::end(multi);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
svg_map
|
svg_map
|
||||||
<
|
<
|
||||||
@ -466,19 +463,17 @@ public :
|
|||||||
{
|
{
|
||||||
// Multi-line modus
|
// Multi-line modus
|
||||||
|
|
||||||
std::vector<std::string> splitted;
|
std::vector<std::string> split;
|
||||||
boost::split(splitted, s, boost::is_any_of("\n"));
|
boost::split(split, s, boost::is_any_of("\n"));
|
||||||
for (std::vector<std::string>::const_iterator it
|
for (auto const& item : split)
|
||||||
= splitted.begin();
|
|
||||||
it != splitted.end();
|
|
||||||
++it, offset_y += lineheight)
|
|
||||||
{
|
{
|
||||||
m_stream
|
m_stream
|
||||||
<< "<tspan x=\"" << get<0>(map_point) + offset_x
|
<< "<tspan x=\"" << get<0>(map_point) + offset_x
|
||||||
<< "\""
|
<< "\""
|
||||||
<< " y=\"" << get<1>(map_point) + offset_y
|
<< " y=\"" << get<1>(map_point) + offset_y
|
||||||
<< "\""
|
<< "\""
|
||||||
<< ">" << *it << "</tspan>";
|
<< ">" << item << "</tspan>";
|
||||||
|
offset_y += lineheight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_stream << "</text>" << std::endl;
|
m_stream << "</text>" << std::endl;
|
||||||
|
@ -29,8 +29,6 @@
|
|||||||
#include <boost/variant/static_visitor.hpp>
|
#include <boost/variant/static_visitor.hpp>
|
||||||
#include <boost/variant/variant_fwd.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/exterior_ring.hpp>
|
||||||
#include <boost/geometry/core/interior_rings.hpp>
|
#include <boost/geometry/core/interior_rings.hpp>
|
||||||
#include <boost/geometry/core/ring_type.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,
|
static inline void apply(std::basic_ostream<Char, Traits>& os,
|
||||||
Range const& range, std::string const& style, double)
|
Range const& range, std::string const& style, double)
|
||||||
{
|
{
|
||||||
typedef typename boost::range_iterator<Range const>::type iterator;
|
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
os << "<" << Policy::prefix() << " points=\"";
|
os << "<" << Policy::prefix() << " points=\"";
|
||||||
|
|
||||||
for (iterator it = boost::begin(range);
|
for (auto it = boost::begin(range); it != boost::end(range); ++it, first = false)
|
||||||
it != boost::end(range);
|
|
||||||
++it, first = false)
|
|
||||||
{
|
{
|
||||||
os << (first ? "" : " " )
|
os << (first ? "" : " " )
|
||||||
<< geometry::get<0>(*it)
|
<< geometry::get<0>(*it)
|
||||||
@ -146,15 +140,12 @@ struct svg_poly
|
|||||||
Polygon const& polygon, std::string const& style, double)
|
Polygon const& polygon, std::string const& style, double)
|
||||||
{
|
{
|
||||||
typedef typename geometry::ring_type<Polygon>::type ring_type;
|
typedef typename geometry::ring_type<Polygon>::type ring_type;
|
||||||
typedef typename boost::range_iterator<ring_type const>::type iterator_type;
|
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
os << "<g fill-rule=\"evenodd\"><path d=\"";
|
os << "<g fill-rule=\"evenodd\"><path d=\"";
|
||||||
|
|
||||||
ring_type const& ring = geometry::exterior_ring(polygon);
|
ring_type const& ring = geometry::exterior_ring(polygon);
|
||||||
for (iterator_type it = boost::begin(ring);
|
for (auto it = boost::begin(ring); it != boost::end(ring); ++it, first = false)
|
||||||
it != boost::end(ring);
|
|
||||||
++it, first = false)
|
|
||||||
{
|
{
|
||||||
os << (first ? "M" : " L") << " "
|
os << (first ? "M" : " L") << " "
|
||||||
<< geometry::get<0>(*it)
|
<< geometry::get<0>(*it)
|
||||||
@ -164,15 +155,11 @@ struct svg_poly
|
|||||||
|
|
||||||
// Inner rings:
|
// Inner rings:
|
||||||
{
|
{
|
||||||
typename interior_return_type<Polygon const>::type
|
auto const& rings = interior_rings(polygon);
|
||||||
rings = interior_rings(polygon);
|
for (auto rit = boost::begin(rings); rit != boost::end(rings); ++rit)
|
||||||
for (typename detail::interior_iterator<Polygon const>::type
|
|
||||||
rit = boost::begin(rings); rit != boost::end(rings); ++rit)
|
|
||||||
{
|
{
|
||||||
first = true;
|
first = true;
|
||||||
for (typename detail::interior_ring_iterator<Polygon const>::type
|
for (auto it = boost::begin(*rit); it != boost::end(*rit); ++it, first = false)
|
||||||
it = boost::begin(*rit); it != boost::end(*rit);
|
|
||||||
++it, first = false)
|
|
||||||
{
|
{
|
||||||
os << (first ? "M" : " L") << " "
|
os << (first ? "M" : " L") << " "
|
||||||
<< geometry::get<0>(*it)
|
<< geometry::get<0>(*it)
|
||||||
@ -209,14 +196,10 @@ struct svg_multi
|
|||||||
static inline void apply(std::basic_ostream<Char, Traits>& os,
|
static inline void apply(std::basic_ostream<Char, Traits>& os,
|
||||||
MultiGeometry const& multi, std::string const& style, double size)
|
MultiGeometry const& multi, std::string const& style, double size)
|
||||||
{
|
{
|
||||||
for (typename boost::range_iterator<MultiGeometry const>::type
|
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
|
||||||
it = boost::begin(multi);
|
|
||||||
it != boost::end(multi);
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
Policy::apply(os, *it, style, size);
|
Policy::apply(os, *it, style, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -754,7 +754,7 @@ struct box_parser
|
|||||||
{
|
{
|
||||||
auto const tokens{make_tokenizer(wkt)};
|
auto const tokens{make_tokenizer(wkt)};
|
||||||
auto it = tokens.begin();
|
auto it = tokens.begin();
|
||||||
auto end = tokens.end();
|
auto const end = tokens.end();
|
||||||
|
|
||||||
apply(it, end, wkt, box);
|
apply(it, end, wkt, box);
|
||||||
|
|
||||||
@ -835,7 +835,7 @@ struct segment_parser
|
|||||||
{
|
{
|
||||||
auto const tokens{make_tokenizer(wkt)};
|
auto const tokens{make_tokenizer(wkt)};
|
||||||
auto it = tokens.begin();
|
auto it = tokens.begin();
|
||||||
auto end = tokens.end();
|
auto const end = tokens.end();
|
||||||
|
|
||||||
apply(it, end, wkt, segment);
|
apply(it, end, wkt, segment);
|
||||||
|
|
||||||
@ -1122,7 +1122,7 @@ struct read_wkt<DynamicGeometry, dynamic_geometry_tag>
|
|||||||
{
|
{
|
||||||
auto tokens{detail::wkt::make_tokenizer(wkt)};
|
auto tokens{detail::wkt::make_tokenizer(wkt)};
|
||||||
auto it = tokens.begin();
|
auto it = tokens.begin();
|
||||||
auto end = tokens.end();
|
auto const end = tokens.end();
|
||||||
if (it == end)
|
if (it == end)
|
||||||
{
|
{
|
||||||
BOOST_THROW_EXCEPTION(read_wkt_exception(
|
BOOST_THROW_EXCEPTION(read_wkt_exception(
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#include <boost/range/size.hpp>
|
#include <boost/range/size.hpp>
|
||||||
#include <boost/range/value_type.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/assign.hpp>
|
||||||
#include <boost/geometry/algorithms/convert.hpp>
|
#include <boost/geometry/algorithms/convert.hpp>
|
||||||
#include <boost/geometry/algorithms/detail/disjoint/point_point.hpp>
|
#include <boost/geometry/algorithms/detail/disjoint/point_point.hpp>
|
||||||
@ -136,7 +135,7 @@ struct wkt_range
|
|||||||
os << "(";
|
os << "(";
|
||||||
}
|
}
|
||||||
auto begin = boost::begin(range);
|
auto begin = boost::begin(range);
|
||||||
auto end = boost::end(range);
|
auto const end = boost::end(range);
|
||||||
for (auto it = begin; it != end; ++it)
|
for (auto it = begin; it != end; ++it)
|
||||||
{
|
{
|
||||||
os << (first ? "" : ",");
|
os << (first ? "" : ",");
|
||||||
@ -201,8 +200,8 @@ struct wkt_poly
|
|||||||
{
|
{
|
||||||
using ring = typename ring_type<Polygon const>::type;
|
using ring = typename ring_type<Polygon const>::type;
|
||||||
|
|
||||||
auto const exterior = exterior_ring(poly);
|
auto const& exterior = exterior_ring(poly);
|
||||||
auto const rings = interior_rings(poly);
|
auto const& rings = interior_rings(poly);
|
||||||
|
|
||||||
std::size_t point_count = boost::size(exterior);
|
std::size_t point_count = boost::size(exterior);
|
||||||
for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
|
for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
|
||||||
|
@ -9,8 +9,9 @@
|
|||||||
#ifndef BOOST_GEOMETRY_UTIL_FOR_EACH_WITH_INDEX_HPP
|
#ifndef BOOST_GEOMETRY_UTIL_FOR_EACH_WITH_INDEX_HPP
|
||||||
#define BOOST_GEOMETRY_UTIL_FOR_EACH_WITH_INDEX_HPP
|
#define BOOST_GEOMETRY_UTIL_FOR_EACH_WITH_INDEX_HPP
|
||||||
|
|
||||||
#include <boost/concept/requires.hpp>
|
#include <boost/range/begin.hpp>
|
||||||
#include <boost/geometry/geometries/concepts/point_concept.hpp>
|
#include <boost/range/end.hpp>
|
||||||
|
#include <boost/range/size_type.hpp>
|
||||||
|
|
||||||
namespace boost { namespace geometry
|
namespace boost { namespace geometry
|
||||||
{
|
{
|
||||||
@ -23,8 +24,18 @@ namespace detail
|
|||||||
template <typename Container, typename Function>
|
template <typename Container, typename Function>
|
||||||
inline void for_each_with_index(Container const& container, Function func)
|
inline void for_each_with_index(Container const& container, Function func)
|
||||||
{
|
{
|
||||||
std::size_t index = 0;
|
typename boost::range_size<Container>::type index = 0;
|
||||||
for (auto it = std::begin(container); it != std::end(container); ++it, ++index)
|
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);
|
func(index, *it);
|
||||||
}
|
}
|
||||||
|
@ -146,10 +146,9 @@ public :
|
|||||||
template <typename PieceCollection>
|
template <typename PieceCollection>
|
||||||
inline void apply(PieceCollection const& collection, int phase)
|
inline void apply(PieceCollection const& collection, int phase)
|
||||||
{
|
{
|
||||||
for(typename container_type::iterator it = mappers.begin();
|
for (auto& item : mappers)
|
||||||
it != mappers.end(); ++it)
|
|
||||||
{
|
{
|
||||||
it->apply(collection, phase);
|
item.apply(collection, phase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,10 +156,9 @@ public :
|
|||||||
void map_input_output(Geometry const& geometry,
|
void map_input_output(Geometry const& geometry,
|
||||||
GeometryBuffer const& buffered, bool negative)
|
GeometryBuffer const& buffered, bool negative)
|
||||||
{
|
{
|
||||||
for(typename container_type::iterator it = mappers.begin();
|
for (auto& item : mappers)
|
||||||
it != mappers.end(); ++it)
|
|
||||||
{
|
{
|
||||||
it->map_input_output(geometry, buffered, negative);
|
item.map_input_output(geometry, buffered, negative);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -23,8 +23,7 @@
|
|||||||
template <typename P, typename Functor, typename T>
|
template <typename P, typename Functor, typename T>
|
||||||
void test_all(std::vector<T> const& expected, double precision = 0.01)
|
void test_all(std::vector<T> const& expected, double precision = 0.01)
|
||||||
{
|
{
|
||||||
typename boost::range_const_iterator<std::vector<T> >::type iterator
|
auto iterator = boost::begin(expected);
|
||||||
= boost::begin(expected);
|
|
||||||
|
|
||||||
typedef bg::model::multi_polygon<bg::model::polygon<P> > mp;
|
typedef bg::model::multi_polygon<bg::model::polygon<P> > mp;
|
||||||
typedef bg::model::box<P> box;
|
typedef bg::model::box<P> box;
|
||||||
|
@ -95,8 +95,7 @@ void test_all(std::vector<T> const& expected)
|
|||||||
|
|
||||||
// compilation test only, will not output
|
// compilation test only, will not output
|
||||||
//test_overlay<box, polygon, Functor>("", "", "", "");
|
//test_overlay<box, polygon, Functor>("", "", "", "");
|
||||||
typename boost::range_const_iterator<std::vector<T> >::type iterator
|
auto iterator = boost::begin(expected);
|
||||||
= boost::begin(expected);
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef ONLY_CASE_BRANDON
|
#ifndef ONLY_CASE_BRANDON
|
||||||
|
@ -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");
|
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" :
|
//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");
|
"fill-opacity:0.2;stroke-opacity:0.4;fill:rgb(255,0,0);stroke:rgb(255,0,255);stroke-width:8");
|
||||||
}
|
}
|
||||||
|
@ -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);"
|
mapper.map(g2, "fill-opacity:0.3;fill:rgb(51,51,153);"
|
||||||
"stroke:rgb(51,51,153);stroke-width:3");
|
"stroke:rgb(51,51,153);stroke-width:3");
|
||||||
|
|
||||||
for (typename result_type::const_iterator it = intersection_output.begin();
|
for (auto const& item : intersection_output)
|
||||||
it != intersection_output.end(); ++it)
|
|
||||||
{
|
{
|
||||||
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");
|
"stroke:rgb(255,0,255);stroke-width:8");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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(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");
|
//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();
|
for (auto const& item : clip)
|
||||||
it != clip.end(); ++it)
|
|
||||||
{
|
{
|
||||||
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");
|
"stroke:rgb(255,0,255);stroke-width:8");
|
||||||
//mapper.map(*it, "opacity:0.6;fill:none;stroke:rgb(255,0,0);stroke-width:5");
|
//mapper.map(*it, "opacity:0.6;fill:none;stroke:rgb(255,0,0);stroke-width:5");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user