Merge branch 'develop' into test/add-more-cmake-lists

This commit is contained in:
Vissarion Fisikopoulos 2024-07-24 16:44:04 +03:00 committed by GitHub
commit aa42b99a56
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
124 changed files with 805 additions and 3188 deletions

View File

@ -64,13 +64,12 @@ int main(void)
#endif #endif
// Calculate intersection points (turn points) // Calculate intersection points (turn points)
using segment_ratio = bg::detail::segment_ratio_type<point_2d, bg::detail::no_rescale_policy>::type; using segment_ratio = bg::segment_ratio_type<point_2d>::type;
using turn_info = bg::detail::overlay::turn_info<point_2d, segment_ratio>; using turn_info = bg::detail::overlay::turn_info<point_2d, segment_ratio>;
std::vector<turn_info> turns; std::vector<turn_info> turns;
bg::detail::get_turns::no_interrupt_policy policy; bg::detail::get_turns::no_interrupt_policy policy;
bg::detail::no_rescale_policy rescale_policy;
bg::strategies::relate::services::default_strategy<bg::model::linestring<point_2d>, bg::model::polygon<point_2d>>::type strategy; bg::strategies::relate::services::default_strategy<bg::model::linestring<point_2d>, bg::model::polygon<point_2d>>::type strategy;
bg::get_turns<false, false, bg::detail::overlay::assign_null_policy>(ls, p, strategy, rescale_policy, turns, policy); bg::get_turns<false, false, bg::detail::overlay::assign_null_policy>(ls, p, strategy, turns, policy);
std::cout << "Intersection of linestring/polygon" << std::endl; std::cout << "Intersection of linestring/polygon" << std::endl;
for (turn_info const& turn : turns) for (turn_info const& turn : turns)

View File

@ -102,11 +102,10 @@ int main()
// This works because outputs to a normal struct point, no point* // This works because outputs to a normal struct point, no point*
typedef boost::geometry::model::linestring<point_2d> linestring_2d; typedef boost::geometry::model::linestring<point_2d> linestring_2d;
boost::geometry::detail::no_rescale_policy rescale_policy;
std::vector<linestring_2d> clipped; std::vector<linestring_2d> clipped;
boost::geometry::strategy::intersection::liang_barsky<box_2d, point_2d> strategy; boost::geometry::strategy::intersection::liang_barsky<box_2d, point_2d> strategy;
boost::geometry::detail::intersection::clip_range_with_box<linestring_2d>(cb, boost::geometry::detail::intersection::clip_range_with_box<linestring_2d>(cb,
myline, rescale_policy, std::back_inserter(clipped), strategy); myline, std::back_inserter(clipped), strategy);
std::cout << boost::geometry::length(clipped.front()) << std::endl; std::cout << boost::geometry::length(clipped.front()) << std::endl;

View File

@ -3,8 +3,9 @@
// Copyright (c) 2012-2020 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2012-2020 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2022-2023 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2022-2023 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2017-2022. // This file was modified by Oracle on 2017-2024.
// Modifications copyright (c) 2017-2022 Oracle and/or its affiliates. // Modifications copyright (c) 2017-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -95,7 +96,6 @@ struct buffer_range
typename SegmentStrategy, typename SegmentStrategy,
typename JoinStrategy, typename JoinStrategy,
typename EndStrategy, typename EndStrategy,
typename RobustPolicy,
typename Strategies typename Strategies
> >
static inline static inline
@ -112,7 +112,6 @@ struct buffer_range
SegmentStrategy const& segment_strategy, SegmentStrategy const& segment_strategy,
JoinStrategy const& join_strategy, JoinStrategy const& join_strategy,
EndStrategy const& end_strategy, EndStrategy const& end_strategy,
RobustPolicy const& ,
Strategies const& strategies) Strategies const& strategies)
{ {
geometry::strategy::buffer::join_selector const join geometry::strategy::buffer::join_selector const join
@ -204,7 +203,6 @@ struct buffer_range
typename SegmentStrategy, typename SegmentStrategy,
typename JoinStrategy, typename JoinStrategy,
typename EndStrategy, typename EndStrategy,
typename RobustPolicy,
typename Strategies typename Strategies
> >
static inline geometry::strategy::buffer::result_code iterate(Collection& collection, static inline geometry::strategy::buffer::result_code iterate(Collection& collection,
@ -214,7 +212,6 @@ struct buffer_range
SegmentStrategy const& segment_strategy, SegmentStrategy const& segment_strategy,
JoinStrategy const& join_strategy, JoinStrategy const& join_strategy,
EndStrategy const& end_strategy, EndStrategy const& end_strategy,
RobustPolicy const& robust_policy,
Strategies const& strategies, Strategies const& strategies,
bool linear, bool linear,
output_point_type& first_p1, output_point_type& first_p1,
@ -291,7 +288,7 @@ struct buffer_range
*it, generated_side.front(), generated_side.back(), *it, generated_side.front(), generated_side.back(),
side, side,
distance_strategy, segment_strategy, join_strategy, end_strategy, distance_strategy, segment_strategy, join_strategy, end_strategy,
robust_policy, strategies); strategies);
} }
collection.add_side_piece(*prev, *it, generated_side, first, distance_strategy.empty(side)); collection.add_side_piece(*prev, *it, generated_side, first, distance_strategy.empty(side));
@ -340,7 +337,6 @@ struct buffer_multi
typename JoinStrategy, typename JoinStrategy,
typename EndStrategy, typename EndStrategy,
typename PointStrategy, typename PointStrategy,
typename RobustPolicy,
typename Strategies typename Strategies
> >
static inline void apply(Multi const& multi, static inline void apply(Multi const& multi,
@ -350,7 +346,6 @@ struct buffer_multi
JoinStrategy const& join_strategy, JoinStrategy const& join_strategy,
EndStrategy const& end_strategy, EndStrategy const& end_strategy,
PointStrategy const& point_strategy, PointStrategy const& point_strategy,
RobustPolicy const& robust_policy,
Strategies const& strategies) Strategies const& strategies)
{ {
for (auto it = boost::begin(multi); it != boost::end(multi); ++it) for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
@ -358,7 +353,7 @@ struct buffer_multi
Policy::apply(*it, collection, Policy::apply(*it, collection,
distance_strategy, segment_strategy, distance_strategy, segment_strategy,
join_strategy, end_strategy, point_strategy, join_strategy, end_strategy, point_strategy,
robust_policy, strategies); strategies);
} }
} }
}; };
@ -425,7 +420,6 @@ struct buffer_inserter<point_tag, Point, RingOutput>
typename JoinStrategy, typename JoinStrategy,
typename EndStrategy, typename EndStrategy,
typename PointStrategy, typename PointStrategy,
typename RobustPolicy,
typename Strategies typename Strategies
> >
static inline void apply(Point const& point, Collection& collection, static inline void apply(Point const& point, Collection& collection,
@ -434,7 +428,6 @@ struct buffer_inserter<point_tag, Point, RingOutput>
JoinStrategy const& , JoinStrategy const& ,
EndStrategy const& , EndStrategy const& ,
PointStrategy const& point_strategy, PointStrategy const& point_strategy,
RobustPolicy const& ,
Strategies const& ) Strategies const& )
{ {
detail::buffer::buffer_point detail::buffer::buffer_point
@ -463,7 +456,6 @@ struct buffer_inserter_ring
typename SegmentStrategy, typename SegmentStrategy,
typename JoinStrategy, typename JoinStrategy,
typename EndStrategy, typename EndStrategy,
typename RobustPolicy,
typename Strategies typename Strategies
> >
static inline geometry::strategy::buffer::result_code iterate(Collection& collection, static inline geometry::strategy::buffer::result_code iterate(Collection& collection,
@ -473,7 +465,6 @@ struct buffer_inserter_ring
SegmentStrategy const& segment_strategy, SegmentStrategy const& segment_strategy,
JoinStrategy const& join_strategy, JoinStrategy const& join_strategy,
EndStrategy const& end_strategy, EndStrategy const& end_strategy,
RobustPolicy const& robust_policy,
Strategies const& strategies) Strategies const& strategies)
{ {
output_point_type first_p1, first_p2, last_p1, last_p2; output_point_type first_p1, first_p2, last_p1, last_p2;
@ -484,7 +475,7 @@ struct buffer_inserter_ring
= buffer_range::iterate(collection, begin, end, = buffer_range::iterate(collection, begin, end,
side, side,
distance_strategy, segment_strategy, join_strategy, end_strategy, distance_strategy, segment_strategy, join_strategy, end_strategy,
robust_policy, strategies, strategies,
false, first_p1, first_p2, last_p1, last_p2); false, first_p1, first_p2, last_p1, last_p2);
// Generate closing join // Generate closing join
@ -496,7 +487,7 @@ struct buffer_inserter_ring
*(begin + 1), first_p1, first_p2, *(begin + 1), first_p1, first_p2,
side, side,
distance_strategy, segment_strategy, join_strategy, end_strategy, distance_strategy, segment_strategy, join_strategy, end_strategy,
robust_policy, strategies); strategies);
} }
// Buffer is closed automatically by last closing corner // Buffer is closed automatically by last closing corner
@ -511,7 +502,6 @@ struct buffer_inserter_ring
typename JoinStrategy, typename JoinStrategy,
typename EndStrategy, typename EndStrategy,
typename PointStrategy, typename PointStrategy,
typename RobustPolicy,
typename Strategies typename Strategies
> >
static inline geometry::strategy::buffer::result_code apply(RingInput const& ring, static inline geometry::strategy::buffer::result_code apply(RingInput const& ring,
@ -521,7 +511,6 @@ struct buffer_inserter_ring
JoinStrategy const& join_strategy, JoinStrategy const& join_strategy,
EndStrategy const& end_strategy, EndStrategy const& end_strategy,
PointStrategy const& point_strategy, PointStrategy const& point_strategy,
RobustPolicy const& robust_policy,
Strategies const& strategies) Strategies const& strategies)
{ {
// Use helper geometry to support non-mutable input Rings // Use helper geometry to support non-mutable input Rings
@ -551,14 +540,14 @@ struct buffer_inserter_ring
code = iterate(collection, boost::rbegin(view), boost::rend(view), code = iterate(collection, boost::rbegin(view), boost::rend(view),
geometry::strategy::buffer::buffer_side_right, geometry::strategy::buffer::buffer_side_right,
distance, segment_strategy, join_strategy, end_strategy, distance, segment_strategy, join_strategy, end_strategy,
robust_policy, strategies); strategies);
} }
else else
{ {
code = iterate(collection, boost::begin(view), boost::end(view), code = iterate(collection, boost::begin(view), boost::end(view),
geometry::strategy::buffer::buffer_side_left, geometry::strategy::buffer::buffer_side_left,
distance, segment_strategy, join_strategy, end_strategy, distance, segment_strategy, join_strategy, end_strategy,
robust_policy, strategies); strategies);
} }
} }
@ -591,7 +580,6 @@ struct buffer_inserter<ring_tag, RingInput, RingOutput>
typename JoinStrategy, typename JoinStrategy,
typename EndStrategy, typename EndStrategy,
typename PointStrategy, typename PointStrategy,
typename RobustPolicy,
typename Strategies typename Strategies
> >
static inline geometry::strategy::buffer::result_code apply(RingInput const& ring, static inline geometry::strategy::buffer::result_code apply(RingInput const& ring,
@ -601,7 +589,6 @@ struct buffer_inserter<ring_tag, RingInput, RingOutput>
JoinStrategy const& join_strategy, JoinStrategy const& join_strategy,
EndStrategy const& end_strategy, EndStrategy const& end_strategy,
PointStrategy const& point_strategy, PointStrategy const& point_strategy,
RobustPolicy const& robust_policy,
Strategies const& strategies) Strategies const& strategies)
{ {
collection.start_new_ring(distance.negative()); collection.start_new_ring(distance.negative());
@ -609,7 +596,7 @@ struct buffer_inserter<ring_tag, RingInput, RingOutput>
= buffer_inserter_ring<RingInput, RingOutput>::apply(ring, = buffer_inserter_ring<RingInput, RingOutput>::apply(ring,
collection, distance, collection, distance,
segment_strategy, join_strategy, end_strategy, point_strategy, segment_strategy, join_strategy, end_strategy, point_strategy,
robust_policy, strategies); strategies);
collection.finish_ring(code, ring, false, false); collection.finish_ring(code, ring, false, false);
return code; return code;
} }
@ -633,7 +620,6 @@ struct buffer_inserter<linestring_tag, Linestring, Polygon>
typename SegmentStrategy, typename SegmentStrategy,
typename JoinStrategy, typename JoinStrategy,
typename EndStrategy, typename EndStrategy,
typename RobustPolicy,
typename Strategies typename Strategies
> >
static inline geometry::strategy::buffer::result_code iterate(Collection& collection, static inline geometry::strategy::buffer::result_code iterate(Collection& collection,
@ -643,7 +629,6 @@ struct buffer_inserter<linestring_tag, Linestring, Polygon>
SegmentStrategy const& segment_strategy, SegmentStrategy const& segment_strategy,
JoinStrategy const& join_strategy, JoinStrategy const& join_strategy,
EndStrategy const& end_strategy, EndStrategy const& end_strategy,
RobustPolicy const& robust_policy,
Strategies const& strategies, Strategies const& strategies,
output_point_type& first_p1) output_point_type& first_p1)
{ {
@ -680,7 +665,7 @@ struct buffer_inserter<linestring_tag, Linestring, Polygon>
= detail::buffer::buffer_range<output_ring_type>::iterate(collection, = detail::buffer::buffer_range<output_ring_type>::iterate(collection,
begin, end, side, begin, end, side,
distance_strategy, segment_strategy, join_strategy, end_strategy, distance_strategy, segment_strategy, join_strategy, end_strategy,
robust_policy, strategies, strategies,
true, first_p1, first_p2, last_p1, last_p2); true, first_p1, first_p2, last_p1, last_p2);
if (result == geometry::strategy::buffer::result_normal) if (result == geometry::strategy::buffer::result_normal)
@ -701,7 +686,6 @@ struct buffer_inserter<linestring_tag, Linestring, Polygon>
typename JoinStrategy, typename JoinStrategy,
typename EndStrategy, typename EndStrategy,
typename PointStrategy, typename PointStrategy,
typename RobustPolicy,
typename Strategies typename Strategies
> >
static inline geometry::strategy::buffer::result_code apply(Linestring const& linestring, static inline geometry::strategy::buffer::result_code apply(Linestring const& linestring,
@ -711,7 +695,6 @@ struct buffer_inserter<linestring_tag, Linestring, Polygon>
JoinStrategy const& join_strategy, JoinStrategy const& join_strategy,
EndStrategy const& end_strategy, EndStrategy const& end_strategy,
PointStrategy const& point_strategy, PointStrategy const& point_strategy,
RobustPolicy const& robust_policy,
Strategies const& strategies) Strategies const& strategies)
{ {
// Use helper geometry to support non-mutable input Linestrings // Use helper geometry to support non-mutable input Linestrings
@ -728,7 +711,7 @@ struct buffer_inserter<linestring_tag, Linestring, Polygon>
boost::begin(simplified), boost::end(simplified), boost::begin(simplified), boost::end(simplified),
geometry::strategy::buffer::buffer_side_left, geometry::strategy::buffer::buffer_side_left,
distance, segment_strategy, join_strategy, end_strategy, distance, segment_strategy, join_strategy, end_strategy,
robust_policy, strategies, strategies,
first_p1); first_p1);
if (code == geometry::strategy::buffer::result_normal) if (code == geometry::strategy::buffer::result_normal)
@ -737,7 +720,7 @@ struct buffer_inserter<linestring_tag, Linestring, Polygon>
boost::rbegin(simplified), boost::rend(simplified), boost::rbegin(simplified), boost::rend(simplified),
geometry::strategy::buffer::buffer_side_right, geometry::strategy::buffer::buffer_side_right,
distance, segment_strategy, join_strategy, end_strategy, distance, segment_strategy, join_strategy, end_strategy,
robust_policy, strategies, strategies,
first_p1); first_p1);
} }
collection.finish_ring(code); collection.finish_ring(code);
@ -779,7 +762,6 @@ private:
typename JoinStrategy, typename JoinStrategy,
typename EndStrategy, typename EndStrategy,
typename PointStrategy, typename PointStrategy,
typename RobustPolicy,
typename Strategies typename Strategies
> >
static inline static inline
@ -790,7 +772,6 @@ private:
JoinStrategy const& join_strategy, JoinStrategy const& join_strategy,
EndStrategy const& end_strategy, EndStrategy const& end_strategy,
PointStrategy const& point_strategy, PointStrategy const& point_strategy,
RobustPolicy const& robust_policy,
Strategies const& strategies, Strategies const& strategies,
bool is_interior) bool is_interior)
{ {
@ -806,7 +787,7 @@ private:
geometry::strategy::buffer::result_code const code geometry::strategy::buffer::result_code const code
= policy::apply(*it, collection, distance, segment_strategy, = policy::apply(*it, collection, distance, segment_strategy,
join_strategy, end_strategy, point_strategy, join_strategy, end_strategy, point_strategy,
robust_policy, strategies); strategies);
collection.finish_ring(code, *it, is_interior, false); collection.finish_ring(code, *it, is_interior, false);
} }
@ -821,7 +802,6 @@ private:
typename JoinStrategy, typename JoinStrategy,
typename EndStrategy, typename EndStrategy,
typename PointStrategy, typename PointStrategy,
typename RobustPolicy,
typename Strategies typename Strategies
> >
static inline static inline
@ -832,13 +812,12 @@ private:
JoinStrategy const& join_strategy, JoinStrategy const& join_strategy,
EndStrategy const& end_strategy, EndStrategy const& end_strategy,
PointStrategy const& point_strategy, PointStrategy const& point_strategy,
RobustPolicy const& robust_policy,
Strategies const& strategies) Strategies const& strategies)
{ {
iterate(boost::begin(interior_rings), boost::end(interior_rings), iterate(boost::begin(interior_rings), boost::end(interior_rings),
collection, distance, segment_strategy, collection, distance, segment_strategy,
join_strategy, end_strategy, point_strategy, join_strategy, end_strategy, point_strategy,
robust_policy, strategies, true); strategies, true);
} }
public: public:
@ -850,7 +829,6 @@ public:
typename JoinStrategy, typename JoinStrategy,
typename EndStrategy, typename EndStrategy,
typename PointStrategy, typename PointStrategy,
typename RobustPolicy,
typename Strategies typename Strategies
> >
static inline void apply(PolygonInput const& polygon, static inline void apply(PolygonInput const& polygon,
@ -860,7 +838,6 @@ public:
JoinStrategy const& join_strategy, JoinStrategy const& join_strategy,
EndStrategy const& end_strategy, EndStrategy const& end_strategy,
PointStrategy const& point_strategy, PointStrategy const& point_strategy,
RobustPolicy const& robust_policy,
Strategies const& strategies) Strategies const& strategies)
{ {
{ {
@ -870,7 +847,7 @@ public:
= policy::apply(exterior_ring(polygon), collection, = policy::apply(exterior_ring(polygon), collection,
distance, segment_strategy, distance, segment_strategy,
join_strategy, end_strategy, point_strategy, join_strategy, end_strategy, point_strategy,
robust_policy, strategies); strategies);
collection.finish_ring(code, exterior_ring(polygon), false, collection.finish_ring(code, exterior_ring(polygon), false,
geometry::num_interior_rings(polygon) > 0u); geometry::num_interior_rings(polygon) > 0u);
@ -879,7 +856,7 @@ public:
apply_interior_rings(interior_rings(polygon), apply_interior_rings(interior_rings(polygon),
collection, distance, segment_strategy, collection, distance, segment_strategy,
join_strategy, end_strategy, point_strategy, join_strategy, end_strategy, point_strategy,
robust_policy, strategies); strategies);
} }
}; };
@ -925,7 +902,6 @@ template
typename EndStrategy, typename EndStrategy,
typename PointStrategy, typename PointStrategy,
typename Strategies, typename Strategies,
typename RobustPolicy,
typename VisitPiecesPolicy typename VisitPiecesPolicy
> >
inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator out, inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator out,
@ -935,7 +911,6 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator
EndStrategy const& end_strategy, EndStrategy const& end_strategy,
PointStrategy const& point_strategy, PointStrategy const& point_strategy,
Strategies const& strategies, Strategies const& strategies,
RobustPolicy const& robust_policy,
VisitPiecesPolicy& visit_pieces_policy VisitPiecesPolicy& visit_pieces_policy
) )
{ {
@ -945,10 +920,9 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator
< <
typename geometry::ring_type<GeometryOutput>::type, typename geometry::ring_type<GeometryOutput>::type,
Strategies, Strategies,
DistanceStrategy, DistanceStrategy
RobustPolicy
>; >;
collection_type collection(strategies, distance_strategy, robust_policy); collection_type collection(strategies, distance_strategy);
collection_type const& const_collection = collection; collection_type const& const_collection = collection;
static constexpr bool areal = util::is_areal<GeometryInput>::value; static constexpr bool areal = util::is_areal<GeometryInput>::value;
@ -965,7 +939,7 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator
>::apply(geometry_input, collection, >::apply(geometry_input, collection,
distance_strategy, segment_strategy, join_strategy, distance_strategy, segment_strategy, join_strategy,
end_strategy, point_strategy, end_strategy, point_strategy,
robust_policy, strategies); strategies);
collection.get_turns(); collection.get_turns();
if BOOST_GEOMETRY_CONSTEXPR (areal) if BOOST_GEOMETRY_CONSTEXPR (areal)
@ -1035,8 +1009,7 @@ template
typename JoinStrategy, typename JoinStrategy,
typename EndStrategy, typename EndStrategy,
typename PointStrategy, typename PointStrategy,
typename Strategies, typename Strategies
typename RobustPolicy
> >
inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator out, inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator out,
DistanceStrategy const& distance_strategy, DistanceStrategy const& distance_strategy,
@ -1044,14 +1017,13 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator
JoinStrategy const& join_strategy, JoinStrategy const& join_strategy,
EndStrategy const& end_strategy, EndStrategy const& end_strategy,
PointStrategy const& point_strategy, PointStrategy const& point_strategy,
Strategies const& strategies, Strategies const& strategies)
RobustPolicy const& robust_policy)
{ {
detail::buffer::visit_pieces_default_policy visitor; detail::buffer::visit_pieces_default_policy visitor;
buffer_inserter<GeometryOutput>(geometry_input, out, buffer_inserter<GeometryOutput>(geometry_input, out,
distance_strategy, segment_strategy, join_strategy, distance_strategy, segment_strategy, join_strategy,
end_strategy, point_strategy, end_strategy, point_strategy,
strategies, robust_policy, visitor); strategies, visitor);
} }
#endif // DOXYGEN_NO_DETAIL #endif // DOXYGEN_NO_DETAIL

View File

@ -2,8 +2,9 @@
// Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017-2020. // This file was modified by Oracle on 2017-2024.
// Modifications copyright (c) 2017-2020, Oracle and/or its affiliates. // Modifications copyright (c) 2017-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -47,7 +48,6 @@ public :
typename Turns, typename Turns,
typename Geometry, typename Geometry,
typename Strategy, typename Strategy,
typename RobustPolicy,
typename Visitor typename Visitor
> >
static inline void apply(std::size_t size_at_start, static inline void apply(std::size_t size_at_start,
@ -59,7 +59,6 @@ public :
Geometry const& , Geometry const& ,
Geometry const& , Geometry const& ,
Strategy const& , Strategy const& ,
RobustPolicy const& ,
state_type& state, state_type& state,
Visitor& /*visitor*/ Visitor& /*visitor*/
) )
@ -131,11 +130,11 @@ struct buffer_turn_operation
: public detail::overlay::traversal_turn_operation<Point, SegmentRatio> : public detail::overlay::traversal_turn_operation<Point, SegmentRatio>
{ {
signed_size_type piece_index; signed_size_type piece_index;
signed_size_type index_in_robust_ring; signed_size_type index_in_ring;
inline buffer_turn_operation() inline buffer_turn_operation()
: piece_index(-1) : piece_index(-1)
, index_in_robust_ring(-1) , index_in_ring(-1)
{} {}
}; };

View File

@ -3,8 +3,9 @@
// Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2017-2023 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2017-2023 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2016-2022. // This file was modified by Oracle on 2016-2024.
// Modifications copyright (c) 2016-2022 Oracle and/or its affiliates. // Modifications copyright (c) 2016-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -100,7 +101,7 @@ namespace detail { namespace buffer
* form together the offsetted ring (marked with o below) * form together the offsetted ring (marked with o below)
* The 8 pieces are part of the piece collection and use for inside-checks * The 8 pieces are part of the piece collection and use for inside-checks
* The inner parts form (using 1 or 2 points per piece, often co-located) * The inner parts form (using 1 or 2 points per piece, often co-located)
* form together the robust_polygons (marked with r below) * form together the polygons (marked with r below)
* The remaining piece-segments are helper-segments (marked with h) * The remaining piece-segments are helper-segments (marked with h)
* *
* ooooooooooooooooo * ooooooooooooooooo
@ -119,8 +120,7 @@ template
< <
typename Ring, typename Ring,
typename Strategy, typename Strategy,
typename DistanceStrategy, typename DistanceStrategy
typename RobustPolicy
> >
struct buffered_piece_collection struct buffered_piece_collection
{ {
@ -135,13 +135,13 @@ struct buffered_piece_collection
typedef buffer_turn_info typedef buffer_turn_info
< <
point_type, point_type,
typename segment_ratio_type<point_type, RobustPolicy>::type typename segment_ratio_type<point_type>::type
> buffer_turn_info_type; > buffer_turn_info_type;
typedef buffer_turn_operation typedef buffer_turn_operation
< <
point_type, point_type,
typename segment_ratio_type<point_type, RobustPolicy>::type typename segment_ratio_type<point_type>::type
> buffer_turn_operation_type; > buffer_turn_operation_type;
typedef std::vector<buffer_turn_info_type> turn_vector_type; typedef std::vector<buffer_turn_info_type> turn_vector_type;
@ -158,7 +158,7 @@ struct buffered_piece_collection
// The next two members (1, 2) form together a complete clockwise ring // The next two members (1, 2) form together a complete clockwise ring
// for each piece (with one dupped point) // for each piece (with one dupped point)
// The complete clockwise ring is also included as a robust ring (3) // The complete clockwise ring is also included as a ring (3)
// 1: half, part of offsetted_rings // 1: half, part of offsetted_rings
@ -228,7 +228,7 @@ struct buffered_piece_collection
geometry::sectionalize geometry::sectionalize
< <
false, dimensions false, dimensions
>(m_ring, detail::no_rescale_policy(), m_sections, strategy); >(m_ring, m_sections, strategy);
} }
clockwise_ring_type m_ring; clockwise_ring_type m_ring;
@ -258,14 +258,8 @@ struct buffered_piece_collection
segment_identifier current_segment_id; segment_identifier current_segment_id;
// Monotonic sections (used for offsetted rings around points) // Monotonic sections (used for offsetted rings around points)
// are still using a robust type, to be comparable with turn calculations, typedef geometry::sections<box_type, 2> sections_type;
// which is using rescaling. sections_type monotonic_sections;
typedef geometry::model::box
<
typename geometry::robust_point_type<point_type, RobustPolicy>::type
> robust_box_type;
typedef geometry::sections <robust_box_type, 2> robust_sections_type;
robust_sections_type monotonic_sections;
// Define the clusters, mapping cluster_id -> turns // Define the clusters, mapping cluster_id -> turns
typedef std::map typedef std::map
@ -278,17 +272,14 @@ struct buffered_piece_collection
Strategy m_strategy; Strategy m_strategy;
DistanceStrategy m_distance_strategy; DistanceStrategy m_distance_strategy;
RobustPolicy const& m_robust_policy;
buffered_piece_collection(Strategy const& strategy, buffered_piece_collection(Strategy const& strategy,
DistanceStrategy const& distance_strategy, DistanceStrategy const& distance_strategy)
RobustPolicy const& robust_policy)
: m_first_piece_index(-1) : m_first_piece_index(-1)
, m_deflate(false) , m_deflate(false)
, m_has_deflated(false) , m_has_deflated(false)
, m_strategy(strategy) , m_strategy(strategy)
, m_distance_strategy(distance_strategy) , m_distance_strategy(distance_strategy)
, m_robust_policy(robust_policy)
{} {}
inline void check_linear_endpoints(buffer_turn_info_type& turn) const inline void check_linear_endpoints(buffer_turn_info_type& turn) const
@ -434,16 +425,15 @@ struct buffered_piece_collection
piece_vector_type, piece_vector_type,
buffered_ring_collection<buffered_ring<Ring> >, buffered_ring_collection<buffered_ring<Ring> >,
turn_vector_type, turn_vector_type,
Strategy, Strategy
RobustPolicy
> visitor(m_pieces, offsetted_rings, m_turns, > visitor(m_pieces, offsetted_rings, m_turns,
m_strategy, m_robust_policy); m_strategy);
detail::sectionalize::enlarge_sections(monotonic_sections, m_strategy); detail::sectionalize::enlarge_sections(monotonic_sections, m_strategy);
geometry::partition geometry::partition
< <
robust_box_type box_type
>::apply(monotonic_sections, visitor, >::apply(monotonic_sections, visitor,
detail::section::get_section_box<Strategy>(m_strategy), detail::section::get_section_box<Strategy>(m_strategy),
detail::section::overlaps_section_box<Strategy>(m_strategy)); detail::section::overlaps_section_box<Strategy>(m_strategy));
@ -593,8 +583,7 @@ struct buffered_piece_collection
if (! boost::empty(input_ring)) if (! boost::empty(input_ring))
{ {
// Assign the ring to the original_ring collection // Assign the ring to the original_ring collection
// For rescaling, it is recalculated. Without rescaling, it // (note that this Ring type is the
// is just assigning (note that this Ring type is the
// GeometryOut type, which might differ from the input ring type) // GeometryOut type, which might differ from the input ring type)
clockwise_ring_type clockwise_ring; clockwise_ring_type clockwise_ring;
@ -706,7 +695,6 @@ struct buffered_piece_collection
sectionalizer::apply(monotonic_sections, sectionalizer::apply(monotonic_sections,
boost::begin(ring) + pc.first_seg_id.segment_index, boost::begin(ring) + pc.first_seg_id.segment_index,
boost::begin(ring) + pc.beyond_last_segment_index, boost::begin(ring) + pc.beyond_last_segment_index,
m_robust_policy,
m_strategy, m_strategy,
ring_id, 10); ring_id, 10);
} }
@ -885,7 +873,7 @@ struct buffered_piece_collection
< <
false, false, overlay_buffer, false, false, overlay_buffer,
ring_collection_t, ring_collection_t ring_collection_t, ring_collection_t
>(m_turns, m_clusters, m_robust_policy)) >(m_turns, m_clusters))
{ {
return; return;
} }
@ -938,7 +926,6 @@ struct buffered_piece_collection
{ {
enrich_intersection_points<false, false, overlay_buffer>(m_turns, enrich_intersection_points<false, false, overlay_buffer>(m_turns,
m_clusters, offsetted_rings, offsetted_rings, m_clusters, offsetted_rings, offsetted_rings,
m_robust_policy,
m_strategy); m_strategy);
} }
@ -965,8 +952,8 @@ struct buffered_piece_collection
{ {
signed_size_type count_in_original = 0; signed_size_type count_in_original = 0;
// Check of the robust point of this outputted ring is in // Check of the point of this outputted ring is in
// any of the robust original rings // any of the 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 (auto const& original : original_rings) for (auto const& original : original_rings)
@ -1054,7 +1041,7 @@ struct buffered_piece_collection
traversed_rings.clear(); traversed_rings.clear();
buffer_overlay_visitor visitor; buffer_overlay_visitor visitor;
traverser::apply(offsetted_rings, offsetted_rings, traverser::apply(offsetted_rings, offsetted_rings,
m_strategy, m_robust_policy, m_strategy,
m_turns, traversed_rings, m_turns, traversed_rings,
turn_info_per_ring, turn_info_per_ring,
m_clusters, visitor); m_clusters, visitor);

View File

@ -3,8 +3,9 @@
// Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2017-2020. // This file was modified by Oracle on 2017-2024.
// Modifications copyright (c) 2017-2020 Oracle and/or its affiliates. // Modifications copyright (c) 2017-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -117,8 +118,7 @@ template
typename Pieces, typename Pieces,
typename Rings, typename Rings,
typename Turns, typename Turns,
typename Strategy, typename Strategy
typename RobustPolicy
> >
class piece_turn_visitor class piece_turn_visitor
{ {
@ -126,7 +126,6 @@ class piece_turn_visitor
Rings const& m_rings; Rings const& m_rings;
Turns& m_turns; Turns& m_turns;
Strategy const& m_strategy; Strategy const& m_strategy;
RobustPolicy const& m_robust_policy;
template <typename Piece> template <typename Piece>
inline bool is_adjacent(Piece const& piece1, Piece const& piece2) const inline bool is_adjacent(Piece const& piece1, Piece const& piece2) const
@ -161,8 +160,7 @@ class piece_turn_visitor
&& it_begin + 1 != it_beyond && it_begin + 1 != it_beyond
&& detail::section::preceding<Dimension>(dir, *(it_begin + 1), && detail::section::preceding<Dimension>(dir, *(it_begin + 1),
this_bounding_box, this_bounding_box,
other_bounding_box, other_bounding_box);
m_robust_policy);
++it_begin, index++) ++it_begin, index++)
{} {}
} }
@ -177,7 +175,7 @@ class piece_turn_visitor
&& it_beyond - 2 != it_begin) && it_beyond - 2 != it_begin)
{ {
if (detail::section::exceeding<Dimension>(dir, *(it_beyond - 2), if (detail::section::exceeding<Dimension>(dir, *(it_beyond - 2),
this_bounding_box, other_bounding_box, m_robust_policy)) this_bounding_box, other_bounding_box))
{ {
--it_beyond; --it_beyond;
} }
@ -271,7 +269,6 @@ class piece_turn_visitor
turn_policy::apply(unique_sub_range1, unique_sub_range2, turn_policy::apply(unique_sub_range1, unique_sub_range2,
the_model, the_model,
m_strategy, m_strategy,
m_robust_policy,
std::back_inserter(m_turns)); std::back_inserter(m_turns));
} }
} }
@ -282,13 +279,11 @@ public:
piece_turn_visitor(Pieces const& pieces, piece_turn_visitor(Pieces const& pieces,
Rings const& ring_collection, Rings const& ring_collection,
Turns& turns, Turns& turns,
Strategy const& strategy, Strategy const& strategy)
RobustPolicy const& robust_policy)
: m_pieces(pieces) : m_pieces(pieces)
, m_rings(ring_collection) , m_rings(ring_collection)
, m_turns(turns) , m_turns(turns)
, m_strategy(strategy) , m_strategy(strategy)
, m_robust_policy(robust_policy)
{} {}
template <typename Section> template <typename Section>

View File

@ -4,8 +4,9 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2017-2022. // This file was modified by Oracle on 2017-2024.
// Modifications copyright (c) 2017-2022 Oracle and/or its affiliates. // Modifications copyright (c) 2017-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
@ -78,11 +79,6 @@ struct buffer_all<Input, Output, TagIn, multi_polygon_tag>
typedef typename boost::range_value<Output>::type polygon_type; typedef typename boost::range_value<Output>::type polygon_type;
typedef typename point_type<Input>::type point_type; typedef typename point_type<Input>::type point_type;
typedef typename rescale_policy_type
<
point_type,
typename geometry::cs_tag<point_type>::type
>::type rescale_policy_type;
if (geometry::is_empty(geometry_in)) if (geometry::is_empty(geometry_in))
{ {
@ -94,10 +90,6 @@ struct buffer_all<Input, Output, TagIn, multi_polygon_tag>
geometry::envelope(geometry_in, box); geometry::envelope(geometry_in, box);
geometry::buffer(box, box, distance_strategy.max_distance(join_strategy, end_strategy)); geometry::buffer(box, box, distance_strategy.max_distance(join_strategy, end_strategy));
rescale_policy_type rescale_policy
= boost::geometry::get_rescale_policy<rescale_policy_type>(
box, strategies);
detail::buffer::buffer_inserter<polygon_type>(geometry_in, detail::buffer::buffer_inserter<polygon_type>(geometry_in,
range::back_inserter(geometry_out), range::back_inserter(geometry_out),
distance_strategy, distance_strategy,
@ -105,8 +97,7 @@ struct buffer_all<Input, Output, TagIn, multi_polygon_tag>
join_strategy, join_strategy,
end_strategy, end_strategy,
point_strategy, point_strategy,
strategies, strategies);
rescale_policy);
} }
}; };

View File

@ -5,11 +5,11 @@
// Copyright (c) 2009-2014 Mateusz Loskot, London, UK. // Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
// Copyright (c) 2013-2014 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2013-2014 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2013-2020. // This file was modified by Oracle on 2013-2024.
// Modifications copyright (c) 2013-2020, Oracle and/or its affiliates. // Modifications copyright (c) 2013-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@ -36,7 +36,6 @@
#include <boost/geometry/geometries/helper_geometry.hpp> #include <boost/geometry/geometries/helper_geometry.hpp>
#include <boost/geometry/policies/disjoint_interrupt_policy.hpp> #include <boost/geometry/policies/disjoint_interrupt_policy.hpp>
#include <boost/geometry/policies/robustness/no_rescale_policy.hpp>
#include <boost/geometry/algorithms/dispatch/disjoint.hpp> #include <boost/geometry/algorithms/dispatch/disjoint.hpp>
@ -128,7 +127,7 @@ struct disjoint_linear
Geometry1, Geometry2, assign_disjoint_policy Geometry1, Geometry2, assign_disjoint_policy
> >
>::apply(0, geometry1, 1, geometry2, >::apply(0, geometry1, 1, geometry2,
strategy, detail::no_rescale_policy(), turns, interrupt_policy); strategy, turns, interrupt_policy);
return !interrupt_policy.has_intersections; return !interrupt_policy.has_intersections;
} }

View File

@ -3,8 +3,9 @@
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2017-2020. // This file was modified by Oracle on 2017-2024.
// Modifications copyright (c) 2017-2020 Oracle and/or its affiliates. // Modifications copyright (c) 2017-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -26,9 +27,6 @@
#include <boost/geometry/algorithms/detail/overlay/self_turn_points.hpp> #include <boost/geometry/algorithms/detail/overlay/self_turn_points.hpp>
#include <boost/geometry/policies/disjoint_interrupt_policy.hpp> #include <boost/geometry/policies/disjoint_interrupt_policy.hpp>
#include <boost/geometry/policies/robustness/robust_point_type.hpp>
#include <boost/geometry/policies/robustness/segment_ratio_type.hpp>
#include <boost/geometry/policies/robustness/get_rescale_policy.hpp>
#ifdef BOOST_GEOMETRY_DEBUG_HAS_SELF_INTERSECTIONS #ifdef BOOST_GEOMETRY_DEBUG_HAS_SELF_INTERSECTIONS
# include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp> # include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
@ -67,17 +65,16 @@ namespace detail { namespace overlay
{ {
template <typename Geometry, typename Strategy, typename RobustPolicy> template <typename Geometry, typename Strategy>
inline bool has_self_intersections(Geometry const& geometry, inline bool has_self_intersections(Geometry const& geometry,
Strategy const& strategy, Strategy const& strategy,
RobustPolicy const& robust_policy,
bool throw_on_self_intersection = true) bool throw_on_self_intersection = true)
{ {
typedef typename point_type<Geometry>::type point_type; typedef typename point_type<Geometry>::type point_type;
typedef turn_info typedef turn_info
< <
point_type, point_type,
typename segment_ratio_type<point_type, RobustPolicy>::type typename segment_ratio_type<point_type>::type
> turn_info; > turn_info;
std::deque<turn_info> turns; std::deque<turn_info> turns;
detail::disjoint::disjoint_interrupt_policy policy; detail::disjoint::disjoint_interrupt_policy policy;
@ -86,7 +83,7 @@ inline bool has_self_intersections(Geometry const& geometry,
< <
false, false,
detail::overlay::assign_null_policy detail::overlay::assign_null_policy
>(geometry, strategy, robust_policy, turns, policy, 0, false); >(geometry, strategy, turns, policy, 0, false);
#ifdef BOOST_GEOMETRY_DEBUG_HAS_SELF_INTERSECTIONS #ifdef BOOST_GEOMETRY_DEBUG_HAS_SELF_INTERSECTIONS
bool first = true; bool first = true;

View File

@ -1,6 +1,7 @@
// Boost.Geometry // Boost.Geometry
// Copyright (c) 2020-2021, Oracle and/or its affiliates. // Copyright (c) 2020-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0. // Licensed under the Boost Software License version 1.0.
@ -40,12 +41,10 @@ struct intersection_areal_areal_
< <
typename Areal1, typename Areal1,
typename Areal2, typename Areal2,
typename RobustPolicy,
typename Strategy typename Strategy
> >
static inline void apply(Areal1 const& areal1, static inline void apply(Areal1 const& areal1,
Areal2 const& areal2, Areal2 const& areal2,
RobustPolicy const& robust_policy,
GeometryOut& geometry_out, GeometryOut& geometry_out,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -54,7 +53,7 @@ struct intersection_areal_areal_
Areal1, Areal2, Areal1, Areal2,
typename boost::range_value<GeometryOut>::type, typename boost::range_value<GeometryOut>::type,
overlay_intersection overlay_intersection
>::apply(areal1, areal2, robust_policy, >::apply(areal1, areal2,
geometry::range::back_inserter(geometry_out), geometry::range::back_inserter(geometry_out),
strategy); strategy);
} }
@ -69,12 +68,10 @@ struct intersection_areal_areal_<TupledOut, tupled_output_tag>
< <
typename Areal1, typename Areal1,
typename Areal2, typename Areal2,
typename RobustPolicy,
typename Strategy typename Strategy
> >
static inline void apply(Areal1 const& areal1, static inline void apply(Areal1 const& areal1,
Areal2 const& areal2, Areal2 const& areal2,
RobustPolicy const& robust_policy,
TupledOut& geometry_out, TupledOut& geometry_out,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -105,16 +102,8 @@ struct intersection_areal_areal_<TupledOut, tupled_output_tag>
single_out, point_tag, point_tag single_out, point_tag, point_tag
> pointlike; > pointlike;
typedef typename geometry::tuples::element
<
areal::index, TupledOut
>::type areal_out_type;
// NOTE: The same robust_policy is used in each call of
// intersection_insert. Is that correct?
// A * A -> A // A * A -> A
call_intersection(areal1, areal2, robust_policy, call_intersection(areal1, areal2,
areal::get(geometry_out), areal::get(geometry_out),
strategy); strategy);
@ -124,7 +113,6 @@ struct intersection_areal_areal_<TupledOut, tupled_output_tag>
// L * L -> (L, P) // L * L -> (L, P)
call_intersection(geometry::detail::boundary_view<Areal1 const>(areal1), call_intersection(geometry::detail::boundary_view<Areal1 const>(areal1),
geometry::detail::boundary_view<Areal2 const>(areal2), geometry::detail::boundary_view<Areal2 const>(areal2),
robust_policy,
! is_areal_empty ! is_areal_empty
? temp_out ? temp_out
: geometry_out, : geometry_out,
@ -134,6 +122,13 @@ struct intersection_areal_areal_<TupledOut, tupled_output_tag>
{ {
// NOTE: the original areal geometry could be used instead of boundary here // NOTE: the original areal geometry could be used instead of boundary here
// however this results in static assert failure related to rescale policy // however this results in static assert failure related to rescale policy
// After the removing of rescaling replacing boundary with areal geometry results in
// some tests failing.
typedef typename geometry::tuples::element
<
areal::index, TupledOut
>::type areal_out_type;
typedef geometry::detail::boundary_view typedef geometry::detail::boundary_view
< <
areal_out_type const areal_out_type const
@ -144,14 +139,12 @@ struct intersection_areal_areal_<TupledOut, tupled_output_tag>
// L - L -> L // L - L -> L
call_difference(linear::get(temp_out), call_difference(linear::get(temp_out),
areal_out_boundary, areal_out_boundary,
robust_policy,
linear::get(geometry_out), linear::get(geometry_out),
strategy); strategy);
// P - L -> P // P - L -> P
call_difference(pointlike::get(temp_out), call_difference(pointlike::get(temp_out),
areal_out_boundary, areal_out_boundary,
robust_policy,
pointlike::get(geometry_out), pointlike::get(geometry_out),
strategy); strategy);
} }
@ -164,13 +157,11 @@ private:
< <
typename Geometry1, typename Geometry1,
typename Geometry2, typename Geometry2,
typename RobustPolicy,
typename GeometryOut, typename GeometryOut,
typename Strategy typename Strategy
> >
static inline void call_intersection(Geometry1 const& geometry1, static inline void call_intersection(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
GeometryOut& geometry_out, GeometryOut& geometry_out,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -185,7 +176,6 @@ private:
overlay_intersection overlay_intersection
>::apply(geometry1, >::apply(geometry1,
geometry2, geometry2,
robust_policy,
geometry::detail::output_geometry_back_inserter(geometry_out), geometry::detail::output_geometry_back_inserter(geometry_out),
strategy); strategy);
} }
@ -194,13 +184,11 @@ private:
< <
typename Geometry1, typename Geometry1,
typename Geometry2, typename Geometry2,
typename RobustPolicy,
typename GeometryOut, typename GeometryOut,
typename Strategy typename Strategy
> >
static inline void call_difference(Geometry1 const& geometry1, static inline void call_difference(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
GeometryOut& geometry_out, GeometryOut& geometry_out,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -212,7 +200,6 @@ private:
overlay_difference overlay_difference
>::apply(geometry1, >::apply(geometry1,
geometry2, geometry2,
robust_policy,
geometry::range::back_inserter(geometry_out), geometry::range::back_inserter(geometry_out),
strategy); strategy);
} }
@ -225,20 +212,18 @@ struct intersection_areal_areal
< <
typename Areal1, typename Areal1,
typename Areal2, typename Areal2,
typename RobustPolicy,
typename GeometryOut, typename GeometryOut,
typename Strategy typename Strategy
> >
static inline bool apply(Areal1 const& areal1, static inline bool apply(Areal1 const& areal1,
Areal2 const& areal2, Areal2 const& areal2,
RobustPolicy const& robust_policy,
GeometryOut& geometry_out, GeometryOut& geometry_out,
Strategy const& strategy) Strategy const& strategy)
{ {
intersection_areal_areal_ intersection_areal_areal_
< <
GeometryOut GeometryOut
>::apply(areal1, areal2, robust_policy, geometry_out, strategy); >::apply(areal1, areal2, geometry_out, strategy);
return true; return true;
} }

View File

@ -2,9 +2,9 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2015. // This file was modified by Oracle on 2015-2024.
// Modifications copyright (c) 2015, Oracle and/or its affiliates. // Modifications copyright (c) 2015-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -31,13 +31,11 @@ struct intersection_box_box
template template
< <
typename Box1, typename Box2, typename Box1, typename Box2,
typename RobustPolicy,
typename BoxOut, typename BoxOut,
typename Strategy typename Strategy
> >
static inline bool apply(Box1 const& box1, static inline bool apply(Box1 const& box1,
Box2 const& box2, Box2 const& box2,
RobustPolicy const& robust_policy,
BoxOut& box_out, BoxOut& box_out,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -62,7 +60,7 @@ struct intersection_box_box
set<max_corner, Dimension>(box_out, max1 > max2 ? max2 : max1); set<max_corner, Dimension>(box_out, max1 > max2 ? max2 : max1);
return intersection_box_box<Dimension + 1, DimensionCount> return intersection_box_box<Dimension + 1, DimensionCount>
::apply(box1, box2, robust_policy, box_out, strategy); ::apply(box1, box2, box_out, strategy);
} }
}; };
@ -72,12 +70,10 @@ struct intersection_box_box<DimensionCount, DimensionCount>
template template
< <
typename Box1, typename Box2, typename Box1, typename Box2,
typename RobustPolicy,
typename BoxOut, typename BoxOut,
typename Strategy typename Strategy
> >
static inline bool apply(Box1 const&, Box2 const&, static inline bool apply(Box1 const&, Box2 const&, BoxOut&, Strategy const&)
RobustPolicy const&, BoxOut&, Strategy const&)
{ {
return true; return true;
} }

View File

@ -1,6 +1,7 @@
// Boost.Geometry // Boost.Geometry
// Copyright (c) 2022, Oracle and/or its affiliates. // Copyright (c) 2022-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0. // Licensed under the Boost Software License version 1.0.
@ -216,22 +217,12 @@ private:
template <typename Out, typename Strategy, std::enable_if_t<! util::is_pointlike<Out>::value, int> = 0> template <typename Out, typename Strategy, std::enable_if_t<! util::is_pointlike<Out>::value, int> = 0>
static void merge_two(Out const& g1, Out const& g2, Out& out, Strategy const& strategy) static void merge_two(Out const& g1, Out const& g2, Out& out, Strategy const& strategy)
{ {
using rescale_policy_type = typename geometry::rescale_overlay_policy_type
<
Out, Out, typename Strategy::cs_tag
>::type;
rescale_policy_type robust_policy
= geometry::get_rescale_policy<rescale_policy_type>(
g1, g2, strategy);
geometry::dispatch::intersection_insert geometry::dispatch::intersection_insert
< <
Out, Out, typename boost::range_value<Out>::type, Out, Out, typename boost::range_value<Out>::type,
overlay_union overlay_union
>::apply(g1, >::apply(g1,
g2, g2,
robust_policy,
geometry::range::back_inserter(out), geometry::range::back_inserter(out),
strategy); strategy);
} }
@ -244,7 +235,6 @@ private:
Out, Out, typename boost::range_value<Out>::type Out, Out, typename boost::range_value<Out>::type
>::apply(g1, >::apply(g1,
g2, g2,
0, // dummy robust policy
geometry::range::back_inserter(out), geometry::range::back_inserter(out),
strategy); strategy);
} }

View File

@ -2,8 +2,9 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2014-2022. // This file was modified by Oracle on 2014-2024.
// Modifications copyright (c) 2014-2022, Oracle and/or its affiliates. // Modifications copyright (c) 2014-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -17,7 +18,6 @@
#include <boost/geometry/algorithms/detail/overlay/intersection_insert.hpp> #include <boost/geometry/algorithms/detail/overlay/intersection_insert.hpp>
#include <boost/geometry/algorithms/detail/tupled_output.hpp> #include <boost/geometry/algorithms/detail/tupled_output.hpp>
#include <boost/geometry/geometries/adapted/boost_variant.hpp> #include <boost/geometry/geometries/adapted/boost_variant.hpp>
#include <boost/geometry/policies/robustness/get_rescale_policy.hpp>
#include <boost/geometry/strategies/default_strategy.hpp> #include <boost/geometry/strategies/default_strategy.hpp>
#include <boost/geometry/strategies/detail.hpp> #include <boost/geometry/strategies/detail.hpp>
#include <boost/geometry/strategies/relate/services.hpp> #include <boost/geometry/strategies/relate/services.hpp>
@ -43,10 +43,9 @@ template
> >
struct intersection struct intersection
{ {
template <typename RobustPolicy, typename GeometryOut, typename Strategy> template <typename GeometryOut, typename Strategy>
static inline bool apply(Geometry1 const& geometry1, static inline bool apply(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
GeometryOut& geometry_out, GeometryOut& geometry_out,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -59,7 +58,7 @@ struct intersection
< <
Geometry1, Geometry2, SingleOut, Geometry1, Geometry2, SingleOut,
overlay_intersection overlay_intersection
>::apply(geometry1, geometry2, robust_policy, >::apply(geometry1, geometry2,
geometry::detail::output_geometry_back_inserter(geometry_out), geometry::detail::output_geometry_back_inserter(geometry_out),
strategy); strategy);
@ -83,11 +82,10 @@ struct intersection
> >
: intersection<Geometry2, Geometry1, Tag2, Tag1, false> : intersection<Geometry2, Geometry1, Tag2, Tag1, false>
{ {
template <typename RobustPolicy, typename GeometryOut, typename Strategy> template <typename GeometryOut, typename Strategy>
static inline bool apply( static inline bool apply(
Geometry1 const& g1, Geometry1 const& g1,
Geometry2 const& g2, Geometry2 const& g2,
RobustPolicy const& robust_policy,
GeometryOut& out, GeometryOut& out,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -96,7 +94,7 @@ struct intersection
Geometry2, Geometry1, Geometry2, Geometry1,
Tag2, Tag1, Tag2, Tag1,
false false
>::apply(g2, g1, robust_policy, out, strategy); >::apply(g2, g1, out, strategy);
} }
}; };
@ -121,22 +119,11 @@ struct intersection
static bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2, static bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2,
GeometryOut & geometry_out, Strategy const& strategy) GeometryOut & geometry_out, Strategy const& strategy)
{ {
typedef typename geometry::rescale_overlay_policy_type
<
Geometry1,
Geometry2,
typename Strategy::cs_tag
>::type rescale_policy_type;
rescale_policy_type robust_policy
= geometry::get_rescale_policy<rescale_policy_type>(
geometry1, geometry2, strategy);
return dispatch::intersection return dispatch::intersection
< <
Geometry1, Geometry1,
Geometry2 Geometry2
>::apply(geometry1, geometry2, robust_policy, geometry_out, >::apply(geometry1, geometry2, geometry_out,
strategy); strategy);
} }
}; };

View File

@ -2,9 +2,9 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2014-2022. // This file was modified by Oracle on 2014-2024.
// Modifications copyright (c) 2014-2022, Oracle and/or its affiliates. // Modifications copyright (c) 2014-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -53,12 +53,10 @@ struct intersection_multi_linestring_multi_linestring_point
template template
< <
typename MultiLinestring1, typename MultiLinestring2, typename MultiLinestring1, typename MultiLinestring2,
typename RobustPolicy,
typename OutputIterator, typename Strategy typename OutputIterator, typename Strategy
> >
static inline OutputIterator apply(MultiLinestring1 const& ml1, static inline OutputIterator apply(MultiLinestring1 const& ml1,
MultiLinestring2 const& ml2, MultiLinestring2 const& ml2,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -69,7 +67,7 @@ struct intersection_multi_linestring_multi_linestring_point
for (auto it2 = boost::begin(ml2); it2 != boost::end(ml2); ++it2) for (auto it2 = boost::begin(ml2); it2 != boost::end(ml2); ++it2)
{ {
out = intersection_linestring_linestring_point<PointOut> out = intersection_linestring_linestring_point<PointOut>
::apply(*it1, *it2, robust_policy, out, strategy); ::apply(*it1, *it2, out, strategy);
} }
} }
@ -84,19 +82,17 @@ struct intersection_linestring_multi_linestring_point
template template
< <
typename Linestring, typename MultiLinestring, typename Linestring, typename MultiLinestring,
typename RobustPolicy,
typename OutputIterator, typename Strategy typename OutputIterator, typename Strategy
> >
static inline OutputIterator apply(Linestring const& linestring, static inline OutputIterator apply(Linestring const& linestring,
MultiLinestring const& ml, MultiLinestring const& ml,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
for (auto it = boost::begin(ml); it != boost::end(ml); ++it) for (auto it = boost::begin(ml); it != boost::end(ml); ++it)
{ {
out = intersection_linestring_linestring_point<PointOut> out = intersection_linestring_linestring_point<PointOut>
::apply(linestring, *it, robust_policy, out, strategy); ::apply(linestring, *it, out, strategy);
} }
return out; return out;
@ -118,11 +114,9 @@ struct intersection_of_multi_linestring_with_areal
template template
< <
typename MultiLinestring, typename Areal, typename MultiLinestring, typename Areal,
typename RobustPolicy,
typename OutputIterator, typename Strategy typename OutputIterator, typename Strategy
> >
static inline OutputIterator apply(MultiLinestring const& ml, Areal const& areal, static inline OutputIterator apply(MultiLinestring const& ml, Areal const& areal,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -131,7 +125,7 @@ struct intersection_of_multi_linestring_with_areal
out = intersection_of_linestring_with_areal out = intersection_of_linestring_with_areal
< <
ReverseAreal, LineStringOut, OverlayType, FollowIsolatedPoints ReverseAreal, LineStringOut, OverlayType, FollowIsolatedPoints
>::apply(*it, areal, robust_policy, out, strategy); >::apply(*it, areal, out, strategy);
} }
return out; return out;
@ -152,18 +146,16 @@ struct intersection_of_areal_with_multi_linestring
template template
< <
typename Areal, typename MultiLinestring, typename Areal, typename MultiLinestring,
typename RobustPolicy,
typename OutputIterator, typename Strategy typename OutputIterator, typename Strategy
> >
static inline OutputIterator apply(Areal const& areal, MultiLinestring const& ml, static inline OutputIterator apply(Areal const& areal, MultiLinestring const& ml,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
return intersection_of_multi_linestring_with_areal return intersection_of_multi_linestring_with_areal
< <
ReverseAreal, LineStringOut, OverlayType, FollowIsolatedPoints ReverseAreal, LineStringOut, OverlayType, FollowIsolatedPoints
>::apply(ml, areal, robust_policy, out, strategy); >::apply(ml, areal, out, strategy);
} }
}; };
@ -175,12 +167,10 @@ struct clip_multi_linestring
template template
< <
typename MultiLinestring, typename Box, typename MultiLinestring, typename Box,
typename RobustPolicy,
typename OutputIterator, typename Strategy typename OutputIterator, typename Strategy
> >
static inline OutputIterator apply(MultiLinestring const& multi_linestring, static inline OutputIterator apply(MultiLinestring const& multi_linestring,
Box const& box, Box const& box,
RobustPolicy const& robust_policy,
OutputIterator out, Strategy const& ) OutputIterator out, Strategy const& )
{ {
typedef typename point_type<LinestringOut>::type point_type; typedef typename point_type<LinestringOut>::type point_type;
@ -188,7 +178,7 @@ struct clip_multi_linestring
for (auto it = boost::begin(multi_linestring); it != boost::end(multi_linestring); ++it) for (auto it = boost::begin(multi_linestring); it != boost::end(multi_linestring); ++it)
{ {
out = detail::intersection::clip_range_with_box out = detail::intersection::clip_range_with_box
<LinestringOut>(box, *it, robust_policy, out, lb_strategy); <LinestringOut>(box, *it, out, lb_strategy);
} }
return out; return out;
} }

View File

@ -4,9 +4,9 @@
// Copyright (c) 2008-2014 Bruno Lalande, Paris, France. // Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2014 Mateusz Loskot, London, UK. // Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2013-2020. // This file was modified by Oracle on 2013-2024.
// Modifications copyright (c) 2013-2020, Oracle and/or its affiliates. // Modifications copyright (c) 2013-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -28,7 +28,6 @@
#include <boost/geometry/algorithms/detail/overlay/self_turn_points.hpp> #include <boost/geometry/algorithms/detail/overlay/self_turn_points.hpp>
#include <boost/geometry/policies/disjoint_interrupt_policy.hpp> #include <boost/geometry/policies/disjoint_interrupt_policy.hpp>
#include <boost/geometry/policies/robustness/no_rescale_policy.hpp>
#include <boost/geometry/strategies/relate/services.hpp> #include <boost/geometry/strategies/relate/services.hpp>
@ -69,7 +68,7 @@ struct self_intersects
detail::self_get_turn_points::get_turns detail::self_get_turn_points::get_turns
< <
false, turn_policy false, turn_policy
>::apply(geometry, strategy, detail::no_rescale_policy(), turns, policy, 0, true); >::apply(geometry, strategy, turns, policy, 0, true);
return policy.has_intersections; return policy.has_intersections;
} }
}; };

View File

@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2014-2021, Oracle and/or its affiliates. // Copyright (c) 2014-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
@ -31,7 +31,6 @@
#include <boost/geometry/util/range.hpp> #include <boost/geometry/util/range.hpp>
#include <boost/geometry/policies/predicate_based_interrupt_policy.hpp> #include <boost/geometry/policies/predicate_based_interrupt_policy.hpp>
#include <boost/geometry/policies/robustness/no_rescale_policy.hpp>
#include <boost/geometry/policies/robustness/segment_ratio.hpp> #include <boost/geometry/policies/robustness/segment_ratio.hpp>
#include <boost/geometry/algorithms/intersects.hpp> #include <boost/geometry/algorithms/intersects.hpp>
@ -218,7 +217,6 @@ inline bool has_self_intersections(Linear const& linear, Strategy const& strateg
false, turn_policy false, turn_policy
>::apply(linear, >::apply(linear,
strategy, strategy,
detail::no_rescale_policy(),
turns, turns,
interrupt_policy, 0, true); interrupt_policy, 0, true);

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2014-2021, Oracle and/or its affiliates. // Copyright (c) 2014-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -26,8 +26,6 @@
#include <boost/geometry/core/point_type.hpp> #include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/policies/predicate_based_interrupt_policy.hpp> #include <boost/geometry/policies/predicate_based_interrupt_policy.hpp>
#include <boost/geometry/policies/robustness/segment_ratio_type.hpp>
#include <boost/geometry/policies/robustness/get_rescale_policy.hpp>
namespace boost { namespace geometry namespace boost { namespace geometry
{ {
@ -48,21 +46,11 @@ class has_valid_self_turns
private: private:
typedef typename point_type<Geometry>::type point_type; typedef typename point_type<Geometry>::type point_type;
typedef typename geometry::rescale_policy_type
<
point_type,
CSTag
>::type rescale_policy_type;
public: public:
typedef detail::overlay::turn_info typedef detail::overlay::turn_info
< <
point_type, point_type,
typename segment_ratio_type typename segment_ratio_type<point_type>::type
<
point_type,
rescale_policy_type
>::type
> turn_type; > turn_type;
// returns true if all turns are valid // returns true if all turns are valid
@ -74,9 +62,6 @@ public:
{ {
boost::ignore_unused(visitor); boost::ignore_unused(visitor);
rescale_policy_type robust_policy
= geometry::get_rescale_policy<rescale_policy_type>(geometry, strategy);
detail::overlay::stateless_predicate_based_interrupt_policy detail::overlay::stateless_predicate_based_interrupt_policy
< <
is_acceptable_turn<Geometry> is_acceptable_turn<Geometry>
@ -86,7 +71,7 @@ public:
detail::self_get_turn_points::self_turns detail::self_get_turn_points::self_turns
< <
false, detail::overlay::assign_null_policy false, detail::overlay::assign_null_policy
>(geometry, strategy, robust_policy, turns, interrupt_policy, >(geometry, strategy, turns, interrupt_policy,
0, true); 0, true);
if (interrupt_policy.has_intersections) if (interrupt_policy.has_intersections)

View File

@ -3,8 +3,9 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2014-2020. // This file was modified by Oracle on 2014-2024.
// Modifications copyright (c) 2014-2020 Oracle and/or its affiliates. // Modifications copyright (c) 2014-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -42,50 +43,22 @@ namespace detail { namespace overlay
{ {
// TODO: move this / rename this // TODO: move this / rename this
template <typename Point1, typename Point2, typename Strategy, typename RobustPolicy> template <typename Point1, typename Point2, typename Strategy>
inline bool points_equal_or_close(Point1 const& point1, inline bool points_equal_or_close(Point1 const& point1,
Point2 const& point2, Point2 const& point2,
Strategy const& strategy, Strategy const& strategy)
RobustPolicy const& robust_policy)
{ {
if (detail::equals::equals_point_point(point1, point2, strategy)) if (detail::equals::equals_point_point(point1, point2, strategy))
{ {
return true; return true;
} }
if BOOST_GEOMETRY_CONSTEXPR (! RobustPolicy::enabled)
{
return false; return false;
} }
else // else prevents unreachable code warning
{
// Try using specified robust policy
using robust_point_type = typename geometry::robust_point_type
<
Point1,
RobustPolicy
>::type;
robust_point_type point1_rob, point2_rob;
geometry::recalculate(point1_rob, point1, robust_policy);
geometry::recalculate(point2_rob, point2, robust_policy);
// Only if this is the case the same strategy can be used.
BOOST_STATIC_ASSERT((std::is_same
<
typename geometry::cs_tag<Point1>::type,
typename geometry::cs_tag<robust_point_type>::type
>::value));
return detail::equals::equals_point_point(point1_rob, point2_rob, strategy);
}
}
template <typename Range, typename Point, typename Strategy, typename RobustPolicy> template <typename Range, typename Point, typename Strategy>
inline void append_no_dups_or_spikes(Range& range, Point const& point, inline void append_no_dups_or_spikes(Range& range, Point const& point,
Strategy const& strategy, Strategy const& strategy)
RobustPolicy const& robust_policy)
{ {
#ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION #ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
std::cout << " add: (" std::cout << " add: ("
@ -96,8 +69,7 @@ inline void append_no_dups_or_spikes(Range& range, Point const& point,
// for geometries >= 3 points. // for geometries >= 3 points.
// So we have to check the first potential duplicate differently // So we have to check the first potential duplicate differently
if ( boost::size(range) == 1 if ( boost::size(range) == 1
&& points_equal_or_close(*(boost::begin(range)), point, strategy, && points_equal_or_close(*(boost::begin(range)), point, strategy) )
robust_policy) )
{ {
return; return;
} }
@ -122,8 +94,8 @@ inline void append_no_dups_or_spikes(Range& range, Point const& point,
&& point_is_spike_or_equal(point, && point_is_spike_or_equal(point,
*(boost::end(range) - 3), *(boost::end(range) - 3),
*(boost::end(range) - 2), *(boost::end(range) - 2),
strategy.side(), // TODO: Pass strategy? strategy.side() // TODO: Pass strategy?
robust_policy)) ))
{ {
// Use the Concept/traits, so resize and append again // Use the Concept/traits, so resize and append again
traits::resize<Range>::apply(range, boost::size(range) - 2); traits::resize<Range>::apply(range, boost::size(range) - 2);
@ -131,10 +103,9 @@ inline void append_no_dups_or_spikes(Range& range, Point const& point,
} }
} }
template <typename Range, typename Point, typename Strategy, typename RobustPolicy> template <typename Range, typename Point, typename Strategy>
inline void append_no_collinear(Range& range, Point const& point, inline void append_no_collinear(Range& range, Point const& point,
Strategy const& strategy, Strategy const& strategy)
RobustPolicy const& robust_policy)
{ {
// Stricter version, not allowing any point in a linear row // Stricter version, not allowing any point in a linear row
// (spike, continuation or same point) // (spike, continuation or same point)
@ -144,8 +115,7 @@ inline void append_no_collinear(Range& range, Point const& point,
// So we have to check the first potential duplicate differently // So we have to check the first potential duplicate differently
if ( boost::size(range) == 1 if ( boost::size(range) == 1
&& points_equal_or_close(*(boost::begin(range)), point, && points_equal_or_close(*(boost::begin(range)), point,
strategy, strategy) )
robust_policy) )
{ {
return; return;
} }
@ -161,8 +131,8 @@ inline void append_no_collinear(Range& range, Point const& point,
&& point_is_collinear(point, && point_is_collinear(point,
*(boost::end(range) - 3), *(boost::end(range) - 3),
*(boost::end(range) - 2), *(boost::end(range) - 2),
strategy.side(), // TODO: Pass strategy? strategy.side() // TODO: Pass strategy?
robust_policy)) ))
{ {
// Use the Concept/traits, so resize and append again // Use the Concept/traits, so resize and append again
traits::resize<Range>::apply(range, boost::size(range) - 2); traits::resize<Range>::apply(range, boost::size(range) - 2);
@ -171,9 +141,8 @@ inline void append_no_collinear(Range& range, Point const& point,
} }
// Should only be called internally, from traverse. // Should only be called internally, from traverse.
template <typename Ring, typename Strategy, typename RobustPolicy> template <typename Ring, typename Strategy>
inline void remove_spikes_at_closure(Ring& ring, Strategy const& strategy, inline void remove_spikes_at_closure(Ring& ring, Strategy const& strategy)
RobustPolicy const& robust_policy)
{ {
// It assumes a closed ring (whatever the closure value) // It assumes a closed ring (whatever the closure value)
constexpr std::size_t min_size constexpr std::size_t min_size
@ -199,8 +168,8 @@ inline void remove_spikes_at_closure(Ring& ring, Strategy const& strategy,
// Check if closing point is a spike (this is so if the second point is // Check if closing point is a spike (this is so if the second point is
// considered as collinear w.r.t. the last segment) // considered as collinear w.r.t. the last segment)
if (point_is_collinear(*second, *penultimate, *first, if (point_is_collinear(*second, *penultimate, *first,
strategy.side(), // TODO: Pass strategy? strategy.side() // TODO: Pass strategy?
robust_policy)) ))
{ {
// Remove first point and last point // Remove first point and last point
range::erase(ring, first); range::erase(ring, first);

View File

@ -2,8 +2,9 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017-2020. // This file was modified by Oracle on 2017-2024.
// Modifications copyright (c) 2017-2020, Oracle and/or its affiliates. // Modifications copyright (c) 2017-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -106,7 +107,6 @@ public :
typename Operation, typename Operation,
typename Rings, typename Ring, typename Turns, typename Rings, typename Ring, typename Turns,
typename Strategy, typename Strategy,
typename RobustPolicy,
typename Visitor typename Visitor
> >
static inline void apply(std::size_t size_at_start, static inline void apply(std::size_t size_at_start,
@ -119,7 +119,6 @@ public :
Geometry1 const& geometry1, Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
Strategy const& strategy, Strategy const& strategy,
RobustPolicy const& robust_policy,
state_type& state, state_type& state,
Visitor& visitor) Visitor& visitor)
{ {
@ -131,8 +130,8 @@ public :
if (! state.m_checked) if (! state.m_checked)
{ {
state.m_checked = true; state.m_checked = true;
has_self_intersections(geometry1, strategy, robust_policy); has_self_intersections(geometry1, strategy);
has_self_intersections(geometry2, strategy, robust_policy); has_self_intersections(geometry2, strategy);
} }
// Make bad output clean // Make bad output clean

View File

@ -2,9 +2,9 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2015-2020. // This file was modified by Oracle on 2015-2024.
// Modifications copyright (c) 2015-2020 Oracle and/or its affiliates. // Modifications copyright (c) 2015-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -180,12 +180,10 @@ template
typename OutputLinestring, typename OutputLinestring,
typename OutputIterator, typename OutputIterator,
typename Range, typename Range,
typename RobustPolicy,
typename Box, typename Box,
typename Strategy typename Strategy
> >
OutputIterator clip_range_with_box(Box const& b, Range const& range, OutputIterator clip_range_with_box(Box const& b, Range const& range,
RobustPolicy const&,
OutputIterator out, Strategy const& strategy) OutputIterator out, Strategy const& strategy)
{ {
if (boost::begin(range) == boost::end(range)) if (boost::begin(range) == boost::end(range))

View File

@ -3,8 +3,9 @@
// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2014-2021. // This file was modified by Oracle on 2014-2024.
// Modifications copyright (c) 2014-2021 Oracle and/or its affiliates. // Modifications copyright (c) 2014-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -62,14 +63,12 @@ struct copy_segments_ring
typename Ring, typename Ring,
typename SegmentIdentifier, typename SegmentIdentifier,
typename Strategy, typename Strategy,
typename RobustPolicy,
typename RangeOut typename RangeOut
> >
static inline void apply(Ring const& ring, static inline void apply(Ring const& ring,
SegmentIdentifier const& seg_id, SegmentIdentifier const& seg_id,
signed_size_type to_index, signed_size_type to_index,
Strategy const& strategy, Strategy const& strategy,
RobustPolicy const& robust_policy,
RangeOut& current_output) RangeOut& current_output)
{ {
using view_type = detail::closed_clockwise_view using view_type = detail::closed_clockwise_view
@ -108,7 +107,7 @@ struct copy_segments_ring
for (signed_size_type i = 0; i < count; ++i, ++it) for (signed_size_type i = 0; i < count; ++i, ++it)
{ {
detail::overlay::append_no_dups_or_spikes(current_output, *it, strategy, robust_policy); detail::overlay::append_no_dups_or_spikes(current_output, *it, strategy);
} }
} }
}; };
@ -118,24 +117,21 @@ class copy_segments_linestring
{ {
private: private:
// remove spikes // remove spikes
template <typename RangeOut, typename Point, typename Strategy, typename RobustPolicy> template <typename RangeOut, typename Point, typename Strategy>
static inline void append_to_output(RangeOut& current_output, static inline void append_to_output(RangeOut& current_output,
Point const& point, Point const& point,
Strategy const& strategy, Strategy const& strategy,
RobustPolicy const& robust_policy,
std::true_type const&) std::true_type const&)
{ {
detail::overlay::append_no_dups_or_spikes(current_output, point, detail::overlay::append_no_dups_or_spikes(current_output, point,
strategy, strategy);
robust_policy);
} }
// keep spikes // keep spikes
template <typename RangeOut, typename Point, typename Strategy, typename RobustPolicy> template <typename RangeOut, typename Point, typename Strategy>
static inline void append_to_output(RangeOut& current_output, static inline void append_to_output(RangeOut& current_output,
Point const& point, Point const& point,
Strategy const& strategy, Strategy const& strategy,
RobustPolicy const&,
std::false_type const&) std::false_type const&)
{ {
detail::overlay::append_no_duplicates(current_output, point, strategy); detail::overlay::append_no_duplicates(current_output, point, strategy);
@ -147,14 +143,12 @@ public:
typename LineString, typename LineString,
typename SegmentIdentifier, typename SegmentIdentifier,
typename SideStrategy, typename SideStrategy,
typename RobustPolicy,
typename RangeOut typename RangeOut
> >
static inline void apply(LineString const& ls, static inline void apply(LineString const& ls,
SegmentIdentifier const& seg_id, SegmentIdentifier const& seg_id,
signed_size_type to_index, signed_size_type to_index,
SideStrategy const& strategy, SideStrategy const& strategy,
RobustPolicy const& robust_policy,
RangeOut& current_output) RangeOut& current_output)
{ {
signed_size_type const from_index = seg_id.segment_index + 1; signed_size_type const from_index = seg_id.segment_index + 1;
@ -171,7 +165,7 @@ public:
auto it = boost::begin(ls) + from_index; auto 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,
std::integral_constant<bool, RemoveSpikes>()); std::integral_constant<bool, RemoveSpikes>());
} }
} }
@ -185,14 +179,12 @@ struct copy_segments_polygon
typename Polygon, typename Polygon,
typename SegmentIdentifier, typename SegmentIdentifier,
typename SideStrategy, typename SideStrategy,
typename RobustPolicy,
typename RangeOut typename RangeOut
> >
static inline void apply(Polygon const& polygon, static inline void apply(Polygon const& polygon,
SegmentIdentifier const& seg_id, SegmentIdentifier const& seg_id,
signed_size_type to_index, signed_size_type to_index,
SideStrategy const& strategy, SideStrategy const& strategy,
RobustPolicy const& robust_policy,
RangeOut& current_output) RangeOut& current_output)
{ {
// Call ring-version with the right ring // Call ring-version with the right ring
@ -203,7 +195,6 @@ struct copy_segments_polygon
: range::at(geometry::interior_rings(polygon), seg_id.ring_index), : range::at(geometry::interior_rings(polygon), seg_id.ring_index),
seg_id, to_index, seg_id, to_index,
strategy, strategy,
robust_policy,
current_output current_output
); );
} }
@ -218,14 +209,12 @@ struct copy_segments_box
typename Box, typename Box,
typename SegmentIdentifier, typename SegmentIdentifier,
typename SideStrategy, typename SideStrategy,
typename RobustPolicy,
typename RangeOut typename RangeOut
> >
static inline void apply(Box const& box, static inline void apply(Box const& box,
SegmentIdentifier const& seg_id, SegmentIdentifier const& seg_id,
signed_size_type to_index, signed_size_type to_index,
SideStrategy const& strategy, SideStrategy const& strategy,
RobustPolicy const& robust_policy,
RangeOut& current_output) RangeOut& current_output)
{ {
signed_size_type index = seg_id.segment_index + 1; signed_size_type index = seg_id.segment_index + 1;
@ -245,7 +234,7 @@ struct copy_segments_box
for (signed_size_type i = 0; i < count; i++, index++) for (signed_size_type i = 0; i < count; i++, index++)
{ {
detail::overlay::append_no_dups_or_spikes(current_output, detail::overlay::append_no_dups_or_spikes(current_output,
bp[index % 5], strategy, robust_policy); bp[index % 5], strategy);
} }
} }
@ -260,14 +249,12 @@ struct copy_segments_multi
typename MultiGeometry, typename MultiGeometry,
typename SegmentIdentifier, typename SegmentIdentifier,
typename SideStrategy, typename SideStrategy,
typename RobustPolicy,
typename RangeOut typename RangeOut
> >
static inline void apply(MultiGeometry const& multi_geometry, static inline void apply(MultiGeometry const& multi_geometry,
SegmentIdentifier const& seg_id, SegmentIdentifier const& seg_id,
signed_size_type to_index, signed_size_type to_index,
SideStrategy const& strategy, SideStrategy const& strategy,
RobustPolicy const& robust_policy,
RangeOut& current_output) RangeOut& current_output)
{ {
@ -281,7 +268,6 @@ struct copy_segments_multi
Policy::apply(range::at(multi_geometry, seg_id.multi_index), Policy::apply(range::at(multi_geometry, seg_id.multi_index),
seg_id, to_index, seg_id, to_index,
strategy, strategy,
robust_policy,
current_output); current_output);
} }
}; };
@ -351,14 +337,12 @@ template
typename Geometry, typename Geometry,
typename SegmentIdentifier, typename SegmentIdentifier,
typename SideStrategy, typename SideStrategy,
typename RobustPolicy,
typename RangeOut typename RangeOut
> >
inline void copy_segments(Geometry const& geometry, inline void copy_segments(Geometry const& geometry,
SegmentIdentifier const& seg_id, SegmentIdentifier const& seg_id,
signed_size_type to_index, signed_size_type to_index,
SideStrategy const& strategy, SideStrategy const& strategy,
RobustPolicy const& robust_policy,
RangeOut& range_out) RangeOut& range_out)
{ {
concepts::check<Geometry const>(); concepts::check<Geometry const>();
@ -367,7 +351,7 @@ inline void copy_segments(Geometry const& geometry,
< <
typename tag<Geometry>::type, typename tag<Geometry>::type,
Reverse Reverse
>::apply(geometry, seg_id, to_index, strategy, robust_policy, range_out); >::apply(geometry, seg_id, to_index, strategy, range_out);
} }

View File

@ -3,8 +3,9 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2017-2021. // This file was modified by Oracle on 2017-2024.
// Modifications copyright (c) 2017-2020 Oracle and/or its affiliates. // Modifications copyright (c) 2017-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -41,7 +42,6 @@
#include <boost/geometry/algorithms/detail/overlay/is_self_turn.hpp> #include <boost/geometry/algorithms/detail/overlay/is_self_turn.hpp>
#include <boost/geometry/algorithms/detail/overlay/less_by_segment_ratio.hpp> #include <boost/geometry/algorithms/detail/overlay/less_by_segment_ratio.hpp>
#include <boost/geometry/algorithms/detail/overlay/overlay_type.hpp> #include <boost/geometry/algorithms/detail/overlay/overlay_type.hpp>
#include <boost/geometry/policies/robustness/robust_type.hpp>
#include <boost/geometry/util/constexpr.hpp> #include <boost/geometry/util/constexpr.hpp>
#include <boost/geometry/views/enumerate_view.hpp> #include <boost/geometry/views/enumerate_view.hpp>
@ -81,14 +81,12 @@ template
typename Operations, typename Operations,
typename Turns, typename Turns,
typename Geometry1, typename Geometry2, typename Geometry1, typename Geometry2,
typename RobustPolicy,
typename Strategy typename Strategy
> >
inline void enrich_sort(Operations& operations, inline void enrich_sort(Operations& operations,
Turns const& turns, Turns const& turns,
Geometry1 const& geometry1, Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
Strategy const& strategy) Strategy const& strategy)
{ {
std::sort(std::begin(operations), std::sort(std::begin(operations),
@ -98,10 +96,9 @@ inline void enrich_sort(Operations& operations,
Turns, Turns,
typename boost::range_value<Operations>::type, typename boost::range_value<Operations>::type,
Geometry1, Geometry2, Geometry1, Geometry2,
RobustPolicy,
Strategy, Strategy,
Reverse1, Reverse2 Reverse1, Reverse2
>(turns, geometry1, geometry2, robust_policy, strategy)); >(turns, geometry1, geometry2, strategy));
} }
@ -379,7 +376,6 @@ inline void calculate_remaining_distance(Turns& turns)
\param clusters container containing clusters \param clusters container containing clusters
\param geometry1 \param_geometry \param geometry1 \param_geometry
\param geometry2 \param_geometry \param geometry2 \param_geometry
\param robust_policy policy to handle robustness issues
\param strategy point in geometry strategy \param strategy point in geometry strategy
*/ */
template template
@ -389,13 +385,11 @@ template
typename Turns, typename Turns,
typename Clusters, typename Clusters,
typename Geometry1, typename Geometry2, typename Geometry1, typename Geometry2,
typename RobustPolicy,
typename IntersectionStrategy typename IntersectionStrategy
> >
inline void enrich_intersection_points(Turns& turns, inline void enrich_intersection_points(Turns& turns,
Clusters& clusters, Clusters& clusters,
Geometry1 const& geometry1, Geometry2 const& geometry2, Geometry1 const& geometry1, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
IntersectionStrategy const& strategy) IntersectionStrategy const& strategy)
{ {
constexpr detail::overlay::operation_type target_operation constexpr detail::overlay::operation_type target_operation
@ -431,7 +425,7 @@ inline void enrich_intersection_points(Turns& turns,
has_colocations = detail::overlay::handle_colocations has_colocations = detail::overlay::handle_colocations
< <
Reverse1, Reverse2, OverlayType, Geometry1, Geometry2 Reverse1, Reverse2, OverlayType, Geometry1, Geometry2
>(turns, clusters, robust_policy); >(turns, clusters);
// Gather cluster properties (using even clusters with // Gather cluster properties (using even clusters with
// discarded turns - for open turns) // discarded turns - for open turns)
detail::overlay::gather_cluster_properties detail::overlay::gather_cluster_properties
@ -510,7 +504,7 @@ inline void enrich_intersection_points(Turns& turns,
detail::overlay::enrich_sort<Reverse1, Reverse2>( detail::overlay::enrich_sort<Reverse1, Reverse2>(
pair.second, turns, pair.second, turns,
geometry1, geometry2, geometry1, geometry2,
robust_policy, strategy); strategy);
} }
if (has_colocations) if (has_colocations)

View File

@ -3,8 +3,9 @@
// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2014-2022. // This file was modified by Oracle on 2014-2024.
// Modifications copyright (c) 2014-2022 Oracle and/or its affiliates. // Modifications copyright (c) 2014-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -220,8 +221,7 @@ struct action_selector<overlay_intersection, RemoveSpikes>
typename LineString, typename LineString,
typename Point, typename Point,
typename Operation, typename Operation,
typename Strategy, typename Strategy
typename RobustPolicy
> >
static inline void enter(LineStringOut& current_piece, static inline void enter(LineStringOut& current_piece,
LineString const& , LineString const& ,
@ -229,7 +229,6 @@ struct action_selector<overlay_intersection, RemoveSpikes>
signed_size_type , Point const& point, signed_size_type , Point const& point,
Operation const& operation, Operation const& operation,
Strategy const& strategy, Strategy const& strategy,
RobustPolicy const& ,
OutputIterator& ) OutputIterator& )
{ {
// On enter, append the intersection point and remember starting point // On enter, append the intersection point and remember starting point
@ -245,8 +244,7 @@ struct action_selector<overlay_intersection, RemoveSpikes>
typename LineString, typename LineString,
typename Point, typename Point,
typename Operation, typename Operation,
typename Strategy, typename Strategy
typename RobustPolicy
> >
static inline void leave(LineStringOut& current_piece, static inline void leave(LineStringOut& current_piece,
LineString const& linestring, LineString const& linestring,
@ -254,7 +252,6 @@ struct action_selector<overlay_intersection, RemoveSpikes>
signed_size_type index, Point const& point, signed_size_type index, Point const& point,
Operation const& , Operation const& ,
Strategy const& strategy, Strategy const& strategy,
RobustPolicy const& robust_policy,
OutputIterator& out) OutputIterator& out)
{ {
// On leave, copy all segments from starting point, append the intersection point // On leave, copy all segments from starting point, append the intersection point
@ -262,7 +259,7 @@ struct action_selector<overlay_intersection, RemoveSpikes>
detail::copy_segments::copy_segments_linestring detail::copy_segments::copy_segments_linestring
< <
false, RemoveSpikes false, RemoveSpikes
>::apply(linestring, segment_id, index, strategy, robust_policy, current_piece); >::apply(linestring, segment_id, index, strategy, current_piece);
detail::overlay::append_no_duplicates(current_piece, point, strategy); detail::overlay::append_no_duplicates(current_piece, point, strategy);
if (::boost::size(current_piece) > 1) if (::boost::size(current_piece) > 1)
{ {
@ -309,8 +306,7 @@ struct action_selector<overlay_difference, RemoveSpikes>
typename LineString, typename LineString,
typename Point, typename Point,
typename Operation, typename Operation,
typename Strategy, typename Strategy
typename RobustPolicy
> >
static inline void enter(LineStringOut& current_piece, static inline void enter(LineStringOut& current_piece,
LineString const& linestring, LineString const& linestring,
@ -318,11 +314,10 @@ struct action_selector<overlay_difference, RemoveSpikes>
signed_size_type index, Point const& point, signed_size_type index, Point const& point,
Operation const& operation, Operation const& operation,
Strategy const& strategy, Strategy const& strategy,
RobustPolicy const& robust_policy,
OutputIterator& out) OutputIterator& out)
{ {
normal_action::leave(current_piece, linestring, segment_id, index, normal_action::leave(current_piece, linestring, segment_id, index,
point, operation, strategy, robust_policy, out); point, operation, strategy, out);
} }
template template
@ -332,8 +327,7 @@ struct action_selector<overlay_difference, RemoveSpikes>
typename LineString, typename LineString,
typename Point, typename Point,
typename Operation, typename Operation,
typename Strategy, typename Strategy
typename RobustPolicy
> >
static inline void leave(LineStringOut& current_piece, static inline void leave(LineStringOut& current_piece,
LineString const& linestring, LineString const& linestring,
@ -341,11 +335,10 @@ struct action_selector<overlay_difference, RemoveSpikes>
signed_size_type index, Point const& point, signed_size_type index, Point const& point,
Operation const& operation, Operation const& operation,
Strategy const& strategy, Strategy const& strategy,
RobustPolicy const& robust_policy,
OutputIterator& out) OutputIterator& out)
{ {
normal_action::enter(current_piece, linestring, segment_id, index, normal_action::enter(current_piece, linestring, segment_id, index,
point, operation, strategy, robust_policy, out); point, operation, strategy, out);
} }
template template
@ -412,13 +405,11 @@ public :
< <
typename Turns, typename Turns,
typename OutputIterator, typename OutputIterator,
typename RobustPolicy,
typename Strategy typename Strategy
> >
static inline OutputIterator apply(LineString const& linestring, Polygon const& polygon, static inline OutputIterator apply(LineString const& linestring, Polygon const& polygon,
detail::overlay::operation_type , // TODO: this parameter might be redundant detail::overlay::operation_type , // TODO: this parameter might be redundant
Turns& turns, Turns& turns,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -464,7 +455,7 @@ public :
entered = true; entered = true;
action::enter(current_piece, linestring, current_segment_id, action::enter(current_piece, linestring, current_segment_id,
op.seg_id.segment_index, turn.point, op, op.seg_id.segment_index, turn.point, op,
strategy, robust_policy, strategy,
linear::get(out)); linear::get(out));
} }
else if (following::is_leaving(turn, op, entered, first, linestring, polygon, strategy)) else if (following::is_leaving(turn, op, entered, first, linestring, polygon, strategy))
@ -474,7 +465,7 @@ public :
entered = false; entered = false;
action::leave(current_piece, linestring, current_segment_id, action::leave(current_piece, linestring, current_segment_id,
op.seg_id.segment_index, turn.point, op, op.seg_id.segment_index, turn.point, op,
strategy, robust_policy, strategy,
linear::get(out)); linear::get(out));
} }
else if (BOOST_GEOMETRY_CONDITION(FollowIsolatedPoints) else if (BOOST_GEOMETRY_CONDITION(FollowIsolatedPoints)
@ -499,7 +490,7 @@ public :
>::apply(linestring, >::apply(linestring,
current_segment_id, current_segment_id,
static_cast<signed_size_type>(boost::size(linestring) - 1), static_cast<signed_size_type>(boost::size(linestring) - 1),
strategy, robust_policy, strategy,
current_piece); current_piece);
} }

View File

@ -2,8 +2,8 @@
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2014-2020, Oracle and/or its affiliates. // Copyright (c) 2014-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -212,9 +212,6 @@ protected:
OutputIterator oit, OutputIterator oit,
SideStrategy const& strategy) SideStrategy const& strategy)
{ {
// We don't rescale linear/linear
detail::no_rescale_policy robust_policy;
if ( is_entering(*it, *op_it) ) if ( is_entering(*it, *op_it) )
{ {
detail::turns::debug_turn(*it, *op_it, "-> Entering"); detail::turns::debug_turn(*it, *op_it, "-> Entering");
@ -226,7 +223,7 @@ protected:
linestring, linestring,
current_segment_id, current_segment_id,
op_it->seg_id.segment_index, op_it->seg_id.segment_index,
it->point, *op_it, strategy, robust_policy, it->point, *op_it, strategy,
linear::get(oit)); linear::get(oit));
} }
++enter_count; ++enter_count;
@ -243,7 +240,7 @@ protected:
linestring, linestring,
current_segment_id, current_segment_id,
op_it->seg_id.segment_index, op_it->seg_id.segment_index,
it->point, *op_it, strategy, robust_policy, it->point, *op_it, strategy,
linear::get(oit)); linear::get(oit));
} }
} }
@ -284,9 +281,6 @@ protected:
{ {
if ( action::is_entered(entered) ) if ( action::is_entered(entered) )
{ {
// We don't rescale linear/linear
detail::no_rescale_policy robust_policy;
detail::copy_segments::copy_segments_linestring detail::copy_segments::copy_segments_linestring
< <
false, false // do not reverse; do not remove spikes false, false // do not reverse; do not remove spikes
@ -294,7 +288,6 @@ protected:
current_segment_id, current_segment_id,
static_cast<signed_size_type>(boost::size(linestring) - 1), static_cast<signed_size_type>(boost::size(linestring) - 1),
strategy, strategy,
robust_policy,
current_piece); current_piece);
} }

View File

@ -2,6 +2,10 @@
// Copyright (c) 2021 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2021 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2024.
// Modifications copyright (c) 2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
@ -17,14 +21,9 @@
#include <boost/geometry/algorithms/detail/overlay/approximately_equals.hpp> #include <boost/geometry/algorithms/detail/overlay/approximately_equals.hpp>
#include <boost/geometry/algorithms/detail/overlay/cluster_info.hpp> #include <boost/geometry/algorithms/detail/overlay/cluster_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_ring.hpp> #include <boost/geometry/algorithms/detail/overlay/get_ring.hpp>
#include <boost/geometry/algorithms/detail/recalculate.hpp>
#include <boost/geometry/policies/robustness/rescale_policy_tags.hpp>
#include <boost/range/value_type.hpp> #include <boost/range/value_type.hpp>
#include <boost/geometry/util/math.hpp> #include <boost/geometry/util/math.hpp>
#define BOOST_GEOMETRY_USE_RESCALING_IN_GET_CLUSTERS
namespace boost { namespace geometry namespace boost { namespace geometry
{ {
@ -32,7 +31,7 @@ namespace boost { namespace geometry
namespace detail { namespace overlay namespace detail { namespace overlay
{ {
template <typename Tag = no_rescale_policy_tag, bool Integral = false> template <bool Integral = false>
struct sweep_equal_policy struct sweep_equal_policy
{ {
@ -58,7 +57,7 @@ public:
}; };
template <> template <>
struct sweep_equal_policy<no_rescale_policy_tag, true> struct sweep_equal_policy<true>
{ {
template <typename P> template <typename P>
static inline bool equals(P const& p1, P const& p2) static inline bool equals(P const& p1, P const& p2)
@ -74,26 +73,6 @@ struct sweep_equal_policy<no_rescale_policy_tag, true>
} }
}; };
#ifdef BOOST_GEOMETRY_USE_RESCALING_IN_GET_CLUSTERS
template <>
struct sweep_equal_policy<rescale_policy_tag, true>
{
template <typename P>
static inline bool equals(P const& p1, P const& p2)
{
// Neighbouring cells in the "integer grid" are considered as equal
return math::abs(geometry::get<0>(p1) - geometry::get<0>(p2)) <= 1
&& math::abs(geometry::get<1>(p1) - geometry::get<1>(p2)) <= 1;
}
template <typename T>
static inline bool exceeds(T value)
{
return value > 1;
}
};
#endif
template <typename Point> template <typename Point>
struct turn_with_point struct turn_with_point
{ {
@ -112,29 +91,16 @@ struct cluster_with_point
template template
< <
typename Turns, typename Turns,
typename Clusters, typename Clusters
typename RobustPolicy
> >
inline void get_clusters(Turns& turns, Clusters& clusters, inline void get_clusters(Turns& turns, Clusters& clusters)
RobustPolicy const& robust_policy)
{ {
using turn_type = typename boost::range_value<Turns>::type; using turn_type = typename boost::range_value<Turns>::type;
using cluster_type = typename Clusters::mapped_type; using cluster_type = typename Clusters::mapped_type;
#ifdef BOOST_GEOMETRY_USE_RESCALING_IN_GET_CLUSTERS
// For now still use robust points for rescaled, otherwise points do not match
using point_type = typename geometry::robust_point_type
<
typename turn_type::point_type,
RobustPolicy
>::type;
#else
using point_type = typename turn_type::point_type; using point_type = typename turn_type::point_type;
#endif
sweep_equal_policy sweep_equal_policy
< <
typename rescale_policy_type<RobustPolicy>::type,
std::is_integral<typename coordinate_type<point_type>::type>::value std::is_integral<typename coordinate_type<point_type>::type>::value
> equal_policy; > equal_policy;
@ -144,13 +110,7 @@ inline void get_clusters(Turns& turns, Clusters& clusters,
{ {
if (! turn.discarded) if (! turn.discarded)
{ {
#ifdef BOOST_GEOMETRY_USE_RESCALING_IN_GET_CLUSTERS
point_type pnt;
geometry::recalculate(pnt, turn.point, robust_policy);
points.push_back({turn_index, pnt});
#else
points.push_back({turn_index, turn.point}); points.push_back({turn_index, turn.point});
#endif
} }
turn_index++; turn_index++;
} }

View File

@ -2,9 +2,9 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017-2020. // This file was modified by Oracle on 2017-2024.
// Modifications copyright (c) 2017-2020 Oracle and/or its affiliates. // Modifications copyright (c) 2017-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -22,7 +22,6 @@
#include <boost/geometry/algorithms/convert.hpp> #include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp> #include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
#include <boost/geometry/policies/robustness/rescale_policy_tags.hpp>
#include <boost/geometry/geometries/segment.hpp> #include <boost/geometry/geometries/segment.hpp>
@ -48,23 +47,14 @@ struct get_turn_without_info
typename UniqueSubRange1, typename UniqueSubRange1,
typename UniqueSubRange2, typename UniqueSubRange2,
typename Strategy, typename Strategy,
typename RobustPolicy,
typename OutputIterator typename OutputIterator
> >
static inline OutputIterator apply(UniqueSubRange1 const& range_p, static inline OutputIterator apply(UniqueSubRange1 const& range_p,
UniqueSubRange2 const& range_q, UniqueSubRange2 const& range_q,
TurnInfo const& , TurnInfo const& ,
Strategy const& strategy, Strategy const& strategy,
RobustPolicy const& ,
OutputIterator out) OutputIterator out)
{ {
// Make sure this is only called with no rescaling
BOOST_STATIC_ASSERT((std::is_same
<
no_rescale_policy_tag,
typename rescale_policy_type<RobustPolicy>::type
>::value));
typedef typename TurnInfo::point_type turn_point_type; typedef typename TurnInfo::point_type turn_point_type;
typedef policies::relate::segments_intersection_points typedef policies::relate::segments_intersection_points
@ -96,13 +86,11 @@ template
< <
typename Geometry1, typename Geometry1,
typename Geometry2, typename Geometry2,
typename RobustPolicy,
typename Turns, typename Turns,
typename Strategy typename Strategy
> >
inline void get_intersection_points(Geometry1 const& geometry1, inline void get_intersection_points(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
Turns& turns, Turns& turns,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -139,7 +127,6 @@ inline void get_intersection_points(Geometry1 const& geometry1,
>::apply(0, geometry1, >::apply(0, geometry1,
1, geometry2, 1, geometry2,
strategy, strategy,
robust_policy,
turns, interrupt_policy); turns, interrupt_policy);
} }

View File

@ -3,8 +3,9 @@
// Copyright (c) 2007-2023 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2023 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2017-2023 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2017-2023 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2015-2022. // This file was modified by Oracle on 2015-2024.
// Modifications copyright (c) 2015-2022 Oracle and/or its affiliates. // Modifications copyright (c) 2015-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -76,17 +77,10 @@ struct policy_verify_all
static bool const use_handle_imperfect_touch = true; static bool const use_handle_imperfect_touch = true;
}; };
#if defined(BOOST_GEOMETRY_USE_RESCALING)
using verify_policy_aa = policy_verify_nothing;
#else
using verify_policy_aa = policy_verify_all; using verify_policy_aa = policy_verify_all;
#endif
using verify_policy_ll = policy_verify_nothing; using verify_policy_ll = policy_verify_nothing;
using verify_policy_la = policy_verify_nothing; using verify_policy_la = policy_verify_nothing;
struct base_turn_handler struct base_turn_handler
{ {
// Returns true if both sides are opposite // Returns true if both sides are opposite
@ -138,8 +132,8 @@ struct base_turn_handler
BOOST_GEOMETRY_ASSERT(index < info.count); BOOST_GEOMETRY_ASSERT(index < info.count);
geometry::convert(info.intersections[index], ti.point); geometry::convert(info.intersections[index], ti.point);
ti.operations[0].fraction = info.fractions[index].robust_ra; ti.operations[0].fraction = info.fractions[index].ra;
ti.operations[1].fraction = info.fractions[index].robust_rb; ti.operations[1].fraction = info.fractions[index].rb;
} }
template <typename TurnInfo, typename IntersectionInfo, typename DirInfo> template <typename TurnInfo, typename IntersectionInfo, typename DirInfo>
@ -170,8 +164,8 @@ struct base_turn_handler
} }
else else
{ {
ti.operations[i].fraction = i == 0 ? info.fractions[index].robust_ra ti.operations[i].fraction = i == 0 ? info.fractions[index].ra
: info.fractions[index].robust_rb; : info.fractions[index].rb;
} }
} }
} }
@ -179,7 +173,7 @@ struct base_turn_handler
template <typename IntersectionInfo> template <typename IntersectionInfo>
static inline unsigned int non_opposite_to_index(IntersectionInfo const& info) static inline unsigned int non_opposite_to_index(IntersectionInfo const& info)
{ {
return info.fractions[0].robust_rb < info.fractions[1].robust_rb return info.fractions[0].rb < info.fractions[1].rb
? 1 : 0; ? 1 : 0;
} }
@ -1394,7 +1388,6 @@ struct get_turn_info
typename UniqueSubRange2, typename UniqueSubRange2,
typename TurnInfo, typename TurnInfo,
typename UmbrellaStrategy, typename UmbrellaStrategy,
typename RobustPolicy,
typename OutputIterator typename OutputIterator
> >
static inline OutputIterator apply( static inline OutputIterator apply(
@ -1402,18 +1395,16 @@ struct get_turn_info
UniqueSubRange2 const& range_q, UniqueSubRange2 const& range_q,
TurnInfo const& tp_model, TurnInfo const& tp_model,
UmbrellaStrategy const& umbrella_strategy, UmbrellaStrategy const& umbrella_strategy,
RobustPolicy const& robust_policy,
OutputIterator out) OutputIterator out)
{ {
typedef intersection_info typedef intersection_info
< <
UniqueSubRange1, UniqueSubRange2, UniqueSubRange1, UniqueSubRange2,
typename TurnInfo::point_type, typename TurnInfo::point_type,
UmbrellaStrategy, UmbrellaStrategy
RobustPolicy
> inters_info; > inters_info;
inters_info inters(range_p, range_q, umbrella_strategy, robust_policy); inters_info inters(range_p, range_q, umbrella_strategy);
char const method = inters.d_info().how; char const method = inters.d_info().how;

View File

@ -2,9 +2,9 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2013-2020. // This file was modified by Oracle on 2013-2024.
// Modifications copyright (c) 2013-2020 Oracle and/or its affiliates. // Modifications copyright (c) 2013-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -19,7 +19,6 @@
#include <boost/geometry/algorithms/detail/equals/point_point.hpp> #include <boost/geometry/algorithms/detail/equals/point_point.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turn_info.hpp> #include <boost/geometry/algorithms/detail/overlay/get_turn_info.hpp>
#include <boost/geometry/core/assert.hpp> #include <boost/geometry/core/assert.hpp>
#include <boost/geometry/policies/robustness/no_rescale_policy.hpp>
namespace boost { namespace geometry { namespace boost { namespace geometry {

View File

@ -2,9 +2,9 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2013-2020. // This file was modified by Oracle on 2013-2024.
// Modifications copyright (c) 2013-2020 Oracle and/or its affiliates. // Modifications copyright (c) 2013-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -16,10 +16,8 @@
#include <boost/geometry/algorithms/detail/direction_code.hpp> #include <boost/geometry/algorithms/detail/direction_code.hpp>
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp> #include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
#include <boost/geometry/algorithms/detail/recalculate.hpp>
#include <boost/geometry/core/assert.hpp> #include <boost/geometry/core/assert.hpp>
#include <boost/geometry/policies/relate/intersection_policy.hpp> #include <boost/geometry/policies/relate/intersection_policy.hpp>
#include <boost/geometry/policies/robustness/rescale_policy_tags.hpp>
#include <boost/geometry/strategies/intersection_result.hpp> #include <boost/geometry/strategies/intersection_result.hpp>
namespace boost { namespace geometry { namespace boost { namespace geometry {
@ -85,246 +83,17 @@ struct side_calculator
// Used side-strategy, owned by the calculator // Used side-strategy, owned by the calculator
side_strategy_type m_side_strategy; side_strategy_type m_side_strategy;
// Used ranges - owned by get_turns or (for robust points) by intersection_info_base // Used ranges - owned by get_turns or (for points) by intersection_info_base
UniqueSubRange1 const& m_range_p; UniqueSubRange1 const& m_range_p;
UniqueSubRange2 const& m_range_q; UniqueSubRange2 const& m_range_q;
}; };
template<typename Point, typename UniqueSubRange, typename RobustPolicy>
struct robust_subrange_adapter
{
typedef Point point_type;
robust_subrange_adapter(UniqueSubRange const& unique_sub_range,
Point const& robust_point_i, Point const& robust_point_j,
RobustPolicy const& robust_policy)
: m_unique_sub_range(unique_sub_range)
, m_robust_policy(robust_policy)
, m_robust_point_i(robust_point_i)
, m_robust_point_j(robust_point_j)
, m_k_retrieved(false)
{}
std::size_t size() const { return m_unique_sub_range.size(); }
//! Get precalculated point
Point const& at(std::size_t index) const
{
BOOST_GEOMETRY_ASSERT(index < size());
switch (index)
{
case 0 : return m_robust_point_i;
case 1 : return m_robust_point_j;
case 2 : return get_point_k();
default : return m_robust_point_i;
}
}
private :
Point const& get_point_k() const
{
if (! m_k_retrieved)
{
geometry::recalculate(m_robust_point_k, m_unique_sub_range.at(2), m_robust_policy);
m_k_retrieved = true;
}
return m_robust_point_k;
}
UniqueSubRange const& m_unique_sub_range;
RobustPolicy const& m_robust_policy;
Point const& m_robust_point_i;
Point const& m_robust_point_j;
mutable Point m_robust_point_k;
mutable bool m_k_retrieved;
};
template template
< <
typename UniqueSubRange1, typename UniqueSubRange2, typename UniqueSubRange1, typename UniqueSubRange2,
typename RobustPolicy typename TurnPoint, typename UmbrellaStrategy
> >
struct robust_point_calculator class intersection_info_base
{
typedef typename geometry::robust_point_type
<
typename UniqueSubRange1::point_type, RobustPolicy
>::type robust_point1_type;
typedef typename geometry::robust_point_type
<
typename UniqueSubRange2::point_type, RobustPolicy
>::type robust_point2_type;
inline robust_point_calculator(UniqueSubRange1 const& range_p,
UniqueSubRange2 const& range_q,
RobustPolicy const& robust_policy)
: m_robust_policy(robust_policy)
, m_range_p(range_p)
, m_range_q(range_q)
, m_pk_retrieved(false)
, m_qk_retrieved(false)
{
// Calculate pi,pj and qi,qj which are almost always necessary
// But don't calculate pk/qk yet, which is retrieved (taking
// more time) and not always necessary.
geometry::recalculate(m_rpi, range_p.at(0), robust_policy);
geometry::recalculate(m_rpj, range_p.at(1), robust_policy);
geometry::recalculate(m_rqi, range_q.at(0), robust_policy);
geometry::recalculate(m_rqj, range_q.at(1), robust_policy);
}
inline robust_point1_type const& get_rpk() const
{
if (! m_pk_retrieved)
{
geometry::recalculate(m_rpk, m_range_p.at(2), m_robust_policy);
m_pk_retrieved = true;
}
return m_rpk;
}
inline robust_point2_type const& get_rqk() const
{
if (! m_qk_retrieved)
{
geometry::recalculate(m_rqk, m_range_q.at(2), m_robust_policy);
m_qk_retrieved = true;
}
return m_rqk;
}
robust_point1_type m_rpi, m_rpj;
robust_point2_type m_rqi, m_rqj;
private :
RobustPolicy const& m_robust_policy;
UniqueSubRange1 const& m_range_p;
UniqueSubRange2 const& m_range_q;
// On retrieval
mutable robust_point1_type m_rpk;
mutable robust_point2_type m_rqk;
mutable bool m_pk_retrieved;
mutable bool m_qk_retrieved;
};
// Default version (empty - specialized below)
template
<
typename UniqueSubRange1, typename UniqueSubRange2,
typename TurnPoint, typename UmbrellaStrategy,
typename RobustPolicy,
typename Tag = typename rescale_policy_type<RobustPolicy>::type
>
class intersection_info_base {};
// Version with rescaling, having robust points
template
<
typename UniqueSubRange1, typename UniqueSubRange2,
typename TurnPoint, typename UmbrellaStrategy,
typename RobustPolicy
>
class intersection_info_base<UniqueSubRange1, UniqueSubRange2,
TurnPoint, UmbrellaStrategy, RobustPolicy, rescale_policy_tag>
{
typedef robust_point_calculator
<
UniqueSubRange1, UniqueSubRange2,
RobustPolicy
>
robust_calc_type;
public:
typedef segment_intersection_points
<
TurnPoint,
geometry::segment_ratio<boost::long_long_type>
> intersection_point_type;
typedef policies::relate::segments_intersection_policy
<
intersection_point_type
> intersection_policy_type;
typedef typename intersection_policy_type::return_type result_type;
typedef typename robust_calc_type::robust_point1_type robust_point1_type;
typedef typename robust_calc_type::robust_point2_type robust_point2_type;
typedef robust_subrange_adapter<robust_point1_type, UniqueSubRange1, RobustPolicy> robust_subrange1;
typedef robust_subrange_adapter<robust_point2_type, UniqueSubRange2, RobustPolicy> robust_subrange2;
typedef side_calculator
<
robust_subrange1, robust_subrange2, UmbrellaStrategy
> side_calculator_type;
typedef side_calculator
<
robust_subrange2, robust_subrange1, UmbrellaStrategy
> robust_swapped_side_calculator_type;
intersection_info_base(UniqueSubRange1 const& range_p,
UniqueSubRange2 const& range_q,
UmbrellaStrategy const& umbrella_strategy,
RobustPolicy const& robust_policy)
: m_range_p(range_p)
, m_range_q(range_q)
, m_robust_calc(range_p, range_q, robust_policy)
, m_robust_range_p(range_p, m_robust_calc.m_rpi, m_robust_calc.m_rpj, robust_policy)
, m_robust_range_q(range_q, m_robust_calc.m_rqi, m_robust_calc.m_rqj, robust_policy)
, m_side_calc(m_robust_range_p, m_robust_range_q, umbrella_strategy)
, m_swapped_side_calc(m_robust_range_q, m_robust_range_p, umbrella_strategy)
, m_result(umbrella_strategy.relate().apply(range_p, range_q,
intersection_policy_type(),
m_robust_range_p, m_robust_range_q))
{}
inline bool p_is_last_segment() const { return m_range_p.is_last_segment(); }
inline bool q_is_last_segment() const { return m_range_q.is_last_segment(); }
inline robust_point1_type const& rpi() const { return m_robust_calc.m_rpi; }
inline robust_point1_type const& rpj() const { return m_robust_calc.m_rpj; }
inline robust_point1_type const& rpk() const { return m_robust_calc.get_rpk(); }
inline robust_point2_type const& rqi() const { return m_robust_calc.m_rqi; }
inline robust_point2_type const& rqj() const { return m_robust_calc.m_rqj; }
inline robust_point2_type const& rqk() const { return m_robust_calc.get_rqk(); }
inline side_calculator_type const& sides() const { return m_side_calc; }
inline robust_swapped_side_calculator_type const& swapped_sides() const
{
return m_swapped_side_calc;
}
private :
// Owned by get_turns
UniqueSubRange1 const& m_range_p;
UniqueSubRange2 const& m_range_q;
// Owned by this class
robust_calc_type m_robust_calc;
robust_subrange1 m_robust_range_p;
robust_subrange2 m_robust_range_q;
side_calculator_type m_side_calc;
robust_swapped_side_calculator_type m_swapped_side_calc;
protected :
result_type m_result;
};
// Version without rescaling
template
<
typename UniqueSubRange1, typename UniqueSubRange2,
typename TurnPoint, typename UmbrellaStrategy,
typename RobustPolicy
>
class intersection_info_base<UniqueSubRange1, UniqueSubRange2,
TurnPoint, UmbrellaStrategy, RobustPolicy, no_rescale_policy_tag>
{ {
public: public:
@ -348,8 +117,7 @@ public:
intersection_info_base(UniqueSubRange1 const& range_p, intersection_info_base(UniqueSubRange1 const& range_p,
UniqueSubRange2 const& range_q, UniqueSubRange2 const& range_q,
UmbrellaStrategy const& umbrella_strategy, UmbrellaStrategy const& umbrella_strategy)
no_rescale_policy const& )
: m_range_p(range_p) : m_range_p(range_p)
, m_range_q(range_q) , m_range_q(range_q)
, m_side_calc(range_p, range_q, umbrella_strategy) , m_side_calc(range_p, range_q, umbrella_strategy)
@ -393,15 +161,14 @@ template
< <
typename UniqueSubRange1, typename UniqueSubRange2, typename UniqueSubRange1, typename UniqueSubRange2,
typename TurnPoint, typename TurnPoint,
typename UmbrellaStrategy, typename UmbrellaStrategy
typename RobustPolicy
> >
class intersection_info class intersection_info
: public intersection_info_base<UniqueSubRange1, UniqueSubRange2, : public intersection_info_base<UniqueSubRange1, UniqueSubRange2,
TurnPoint, UmbrellaStrategy, RobustPolicy> TurnPoint, UmbrellaStrategy>
{ {
typedef intersection_info_base<UniqueSubRange1, UniqueSubRange2, typedef intersection_info_base<UniqueSubRange1, UniqueSubRange2,
TurnPoint, UmbrellaStrategy, RobustPolicy> base; TurnPoint, UmbrellaStrategy> base;
public: public:
@ -415,11 +182,9 @@ public:
intersection_info(UniqueSubRange1 const& range_p, intersection_info(UniqueSubRange1 const& range_p,
UniqueSubRange2 const& range_q, UniqueSubRange2 const& range_q,
UmbrellaStrategy const& umbrella_strategy, UmbrellaStrategy const& umbrella_strategy)
RobustPolicy const& robust_policy) : base(range_p, range_q, umbrella_strategy)
: base(range_p, range_q, umbrella_strategy, robust_policy)
, m_umbrella_strategy(umbrella_strategy) , m_umbrella_strategy(umbrella_strategy)
, m_robust_policy(robust_policy)
{} {}
inline result_type const& result() const { return base::m_result; } inline result_type const& result() const { return base::m_result; }
@ -530,7 +295,6 @@ private:
} }
UmbrellaStrategy const& m_umbrella_strategy; UmbrellaStrategy const& m_umbrella_strategy;
RobustPolicy const& m_robust_policy;
}; };
}} // namespace detail::overlay }} // namespace detail::overlay

View File

@ -3,9 +3,9 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2017-2023 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2017-2023 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2013-2020. // This file was modified by Oracle on 2013-2024.
// Modifications copyright (c) 2013-2020 Oracle and/or its affiliates. // Modifications copyright (c) 2013-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -45,7 +45,6 @@ struct get_turn_info_linear_areal
typename UniqueSubRange2, typename UniqueSubRange2,
typename TurnInfo, typename TurnInfo,
typename UmbrellaStrategy, typename UmbrellaStrategy,
typename RobustPolicy,
typename OutputIterator typename OutputIterator
> >
static inline OutputIterator apply( static inline OutputIterator apply(
@ -53,18 +52,16 @@ struct get_turn_info_linear_areal
UniqueSubRange2 const& range_q, UniqueSubRange2 const& range_q,
TurnInfo const& tp_model, TurnInfo const& tp_model,
UmbrellaStrategy const& umbrella_strategy, UmbrellaStrategy const& umbrella_strategy,
RobustPolicy const& robust_policy,
OutputIterator out) OutputIterator out)
{ {
typedef intersection_info typedef intersection_info
< <
UniqueSubRange1, UniqueSubRange2, UniqueSubRange1, UniqueSubRange2,
typename TurnInfo::point_type, typename TurnInfo::point_type,
UmbrellaStrategy, UmbrellaStrategy
RobustPolicy
> inters_info; > inters_info;
inters_info inters(range_p, range_q, umbrella_strategy, robust_policy); inters_info inters(range_p, range_q, umbrella_strategy);
char const method = inters.d_info().how; char const method = inters.d_info().how;
@ -388,9 +385,6 @@ struct get_turn_info_linear_areal
break; break;
default : default :
{ {
#if defined(BOOST_GEOMETRY_DEBUG_ROBUSTNESS)
std::cout << "TURN: Unknown method: " << method << std::endl;
#endif
#if ! defined(BOOST_GEOMETRY_OVERLAY_NO_THROW) #if ! defined(BOOST_GEOMETRY_OVERLAY_NO_THROW)
BOOST_THROW_EXCEPTION(turn_info_exception(method)); BOOST_THROW_EXCEPTION(turn_info_exception(method));
#endif #endif

View File

@ -3,8 +3,9 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2017-2023 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2017-2023 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2013, 2014, 2015, 2017, 2018. // This file was modified by Oracle on 2013-2024.
// Modifications copyright (c) 2013-2018 Oracle and/or its affiliates. // Modifications copyright (c) 2013-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -39,7 +40,6 @@ struct get_turn_info_linear_linear
typename UniqueSubRange2, typename UniqueSubRange2,
typename TurnInfo, typename TurnInfo,
typename UmbrellaStrategy, typename UmbrellaStrategy,
typename RobustPolicy,
typename OutputIterator typename OutputIterator
> >
static inline OutputIterator apply( static inline OutputIterator apply(
@ -47,18 +47,16 @@ struct get_turn_info_linear_linear
UniqueSubRange2 const& range_q, UniqueSubRange2 const& range_q,
TurnInfo const& tp_model, TurnInfo const& tp_model,
UmbrellaStrategy const& umbrella_strategy, UmbrellaStrategy const& umbrella_strategy,
RobustPolicy const& robust_policy,
OutputIterator out) OutputIterator out)
{ {
typedef intersection_info typedef intersection_info
< <
UniqueSubRange1, UniqueSubRange2, UniqueSubRange1, UniqueSubRange2,
typename TurnInfo::point_type, typename TurnInfo::point_type,
UmbrellaStrategy, UmbrellaStrategy
RobustPolicy
> inters_info; > inters_info;
inters_info inters(range_p, range_q, umbrella_strategy, robust_policy); inters_info inters(range_p, range_q, umbrella_strategy);
char const method = inters.d_info().how; char const method = inters.d_info().how;
@ -457,9 +455,6 @@ struct get_turn_info_linear_linear
break; break;
default : default :
{ {
#if defined(BOOST_GEOMETRY_DEBUG_ROBUSTNESS)
std::cout << "TURN: Unknown method: " << method << std::endl;
#endif
#if ! defined(BOOST_GEOMETRY_OVERLAY_NO_THROW) #if ! defined(BOOST_GEOMETRY_OVERLAY_NO_THROW)
BOOST_THROW_EXCEPTION(turn_info_exception(method)); BOOST_THROW_EXCEPTION(turn_info_exception(method));
#endif #endif

View File

@ -3,8 +3,9 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2014-2023 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2014-2023 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2014-2021. // This file was modified by Oracle on 2014-2024.
// Modifications copyright (c) 2014-2021 Oracle and/or its affiliates. // Modifications copyright (c) 2014-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -33,7 +34,6 @@
#include <boost/geometry/algorithms/detail/overlay/get_turn_info_la.hpp> #include <boost/geometry/algorithms/detail/overlay/get_turn_info_la.hpp>
#include <boost/geometry/algorithms/detail/overlay/segment_identifier.hpp> #include <boost/geometry/algorithms/detail/overlay/segment_identifier.hpp>
#include <boost/geometry/algorithms/detail/partition.hpp> #include <boost/geometry/algorithms/detail/partition.hpp>
#include <boost/geometry/algorithms/detail/recalculate.hpp>
#include <boost/geometry/algorithms/detail/sections/range_by_section.hpp> #include <boost/geometry/algorithms/detail/sections/range_by_section.hpp>
#include <boost/geometry/algorithms/detail/sections/section_box_policies.hpp> #include <boost/geometry/algorithms/detail/sections/section_box_policies.hpp>
#include <boost/geometry/algorithms/detail/sections/section_functions.hpp> #include <boost/geometry/algorithms/detail/sections/section_functions.hpp>
@ -103,8 +103,7 @@ template
typename Section, typename Section,
typename Point, typename Point,
typename CircularIterator, typename CircularIterator,
typename Strategy, typename Strategy
typename RobustPolicy
> >
struct unique_sub_range_from_section struct unique_sub_range_from_section
{ {
@ -113,8 +112,7 @@ struct unique_sub_range_from_section
unique_sub_range_from_section(Section const& section, signed_size_type index, unique_sub_range_from_section(Section const& section, signed_size_type index,
CircularIterator circular_iterator, CircularIterator circular_iterator,
Point const& previous, Point const& current, Point const& previous, Point const& current,
Strategy const& strategy, Strategy const& strategy)
RobustPolicy const& robust_policy)
: m_section(section) : m_section(section)
, m_index(index) , m_index(index)
, m_previous_point(previous) , m_previous_point(previous)
@ -122,7 +120,6 @@ struct unique_sub_range_from_section
, m_circular_iterator(circular_iterator) , m_circular_iterator(circular_iterator)
, m_next_point_retrieved(false) , m_next_point_retrieved(false)
, m_strategy(strategy) , m_strategy(strategy)
, m_robust_policy(robust_policy)
{} {}
inline bool is_first_segment() const inline bool is_first_segment() const
@ -165,13 +162,6 @@ private :
inline void advance_to_non_duplicate_next(Point const& current, CircularIterator& circular_iterator) const inline void advance_to_non_duplicate_next(Point const& current, CircularIterator& circular_iterator) const
{ {
using box_point_type = typename geometry::point_type<typename Section::box_type>::type;
using robust_point_type = typename robust_point_type<box_point_type, RobustPolicy>::type;
robust_point_type current_robust_point;
robust_point_type next_robust_point;
geometry::recalculate(current_robust_point, current, m_robust_policy);
geometry::recalculate(next_robust_point, *circular_iterator, m_robust_policy);
// To see where the next segments bend to, in case of touch/intersections // To see where the next segments bend to, in case of touch/intersections
// on end points, we need (in case of degenerate/duplicate points) an extra // on end points, we need (in case of degenerate/duplicate points) an extra
// iterator which moves to the REAL next point, so non duplicate. // iterator which moves to the REAL next point, so non duplicate.
@ -182,12 +172,10 @@ private :
// So advance to the "non duplicate next" // So advance to the "non duplicate next"
// (the check is defensive, to avoid endless loops) // (the check is defensive, to avoid endless loops)
std::size_t check = 0; std::size_t check = 0;
while (! detail::disjoint::disjoint_point_point( while (! detail::disjoint::disjoint_point_point(current, *circular_iterator, m_strategy)
current_robust_point, next_robust_point, m_strategy)
&& check++ < m_section.range_count) && check++ < m_section.range_count)
{ {
circular_iterator++; circular_iterator++;
geometry::recalculate(next_robust_point, *circular_iterator, m_robust_policy);
} }
} }
@ -198,7 +186,6 @@ private :
mutable CircularIterator m_circular_iterator; mutable CircularIterator m_circular_iterator;
mutable bool m_next_point_retrieved; mutable bool m_next_point_retrieved;
Strategy m_strategy; Strategy m_strategy;
RobustPolicy m_robust_policy;
}; };
template template
@ -252,13 +239,12 @@ class get_turns_in_sections
public : public :
// Returns true if terminated, false if interrupted // Returns true if terminated, false if interrupted
template <typename Strategy, typename RobustPolicy, typename Turns, typename InterruptPolicy> template <typename Strategy, typename Turns, typename InterruptPolicy>
static inline bool apply( static inline bool apply(
int source_id1, Geometry1 const& geometry1, Section1 const& sec1, int source_id1, Geometry1 const& geometry1, Section1 const& sec1,
int source_id2, Geometry2 const& geometry2, Section2 const& sec2, int source_id2, Geometry2 const& geometry2, Section2 const& sec2,
bool skip_larger, bool skip_adjacent, bool skip_larger, bool skip_adjacent,
Strategy const& strategy, Strategy const& strategy,
RobustPolicy const& robust_policy,
Turns& turns, Turns& turns,
InterruptPolicy& interrupt_policy) InterruptPolicy& interrupt_policy)
{ {
@ -294,7 +280,7 @@ public :
range1_iterator prev1, it1, end1; range1_iterator prev1, it1, end1;
get_start_point_iterator(sec1, view1, prev1, it1, end1, get_start_point_iterator(sec1, view1, prev1, it1, end1,
index1, ndi1, dir1, sec2.bounding_box, robust_policy); index1, ndi1, dir1, sec2.bounding_box);
// We need a circular iterator because it might run through the closing point. // We need a circular iterator because it might run through the closing point.
// One circle is actually enough but this one is just convenient. // One circle is actually enough but this one is just convenient.
@ -305,17 +291,17 @@ public :
// section 2: [--------------] // section 2: [--------------]
// section 1: |----|---|---|---|---| // section 1: |----|---|---|---|---|
for (prev1 = it1++, next1++; for (prev1 = it1++, next1++;
it1 != end1 && ! detail::section::exceeding<0>(dir1, *prev1, sec1.bounding_box, sec2.bounding_box, robust_policy); it1 != end1 && ! detail::section::exceeding<0>(dir1, *prev1, sec1.bounding_box, sec2.bounding_box);
++prev1, ++it1, ++index1, ++next1, ++ndi1) ++prev1, ++it1, ++index1, ++next1, ++ndi1)
{ {
unique_sub_range_from_section unique_sub_range_from_section
< <
areal1, Section1, point1_type, circular1_iterator, areal1, Section1, point1_type, circular1_iterator,
Strategy, RobustPolicy Strategy
> unique_sub_range1(sec1, index1, > unique_sub_range1(sec1, index1,
circular1_iterator(begin_range_1, end_range_1, next1, true), circular1_iterator(begin_range_1, end_range_1, next1, true),
*prev1, *it1, *prev1, *it1,
strategy, robust_policy); strategy);
signed_size_type index2 = sec2.begin_index; signed_size_type index2 = sec2.begin_index;
signed_size_type ndi2 = sec2.non_duplicate_index; signed_size_type ndi2 = sec2.non_duplicate_index;
@ -323,12 +309,12 @@ public :
range2_iterator prev2, it2, end2; range2_iterator prev2, it2, end2;
get_start_point_iterator(sec2, view2, prev2, it2, end2, get_start_point_iterator(sec2, view2, prev2, it2, end2,
index2, ndi2, dir2, sec1.bounding_box, robust_policy); index2, ndi2, dir2, sec1.bounding_box);
circular2_iterator next2(begin_range_2, end_range_2, it2, true); circular2_iterator next2(begin_range_2, end_range_2, it2, true);
next2++; next2++;
for (prev2 = it2++, next2++; for (prev2 = it2++, next2++;
it2 != end2 && ! detail::section::exceeding<0>(dir2, *prev2, sec2.bounding_box, sec1.bounding_box, robust_policy); it2 != end2 && ! detail::section::exceeding<0>(dir2, *prev2, sec2.bounding_box, sec1.bounding_box);
++prev2, ++it2, ++index2, ++next2, ++ndi2) ++prev2, ++it2, ++index2, ++next2, ++ndi2)
{ {
bool skip = false; bool skip = false;
@ -364,11 +350,11 @@ public :
unique_sub_range_from_section unique_sub_range_from_section
< <
areal2, Section2, point2_type, circular2_iterator, areal2, Section2, point2_type, circular2_iterator,
Strategy, RobustPolicy Strategy
> unique_sub_range2(sec2, index2, > unique_sub_range2(sec2, index2,
circular2_iterator(begin_range_2, end_range_2, next2), circular2_iterator(begin_range_2, end_range_2, next2),
*prev2, *it2, *prev2, *it2,
strategy, robust_policy); strategy);
typedef typename boost::range_value<Turns>::type turn_info; typedef typename boost::range_value<Turns>::type turn_info;
@ -383,7 +369,7 @@ public :
std::size_t const size_before = boost::size(turns); std::size_t const size_before = boost::size(turns);
TurnPolicy::apply(unique_sub_range1, unique_sub_range2, TurnPolicy::apply(unique_sub_range1, unique_sub_range2,
ti, strategy, robust_policy, ti, strategy,
std::back_inserter(turns)); std::back_inserter(turns));
if (InterruptPolicy::enabled) if (InterruptPolicy::enabled)
@ -410,14 +396,14 @@ private :
// because of the logistics of "index" (the section-iterator automatically // because of the logistics of "index" (the section-iterator automatically
// skips to the begin-point, we loose the index or have to recalculate it) // skips to the begin-point, we loose the index or have to recalculate it)
// So we mimic it here // So we mimic it here
template <typename Range, typename Section, typename Box, typename RobustPolicy> template <typename Range, typename Section, typename Box>
static inline void get_start_point_iterator(Section const& section, static inline void get_start_point_iterator(Section const& section,
Range const& range, Range const& range,
typename boost::range_iterator<Range const>::type& it, typename boost::range_iterator<Range const>::type& it,
typename boost::range_iterator<Range const>::type& prev, typename boost::range_iterator<Range const>::type& prev,
typename boost::range_iterator<Range const>::type& end, typename boost::range_iterator<Range const>::type& end,
signed_size_type& index, signed_size_type& ndi, signed_size_type& index, signed_size_type& ndi,
int dir, Box const& other_bounding_box, RobustPolicy const& robust_policy) int dir, Box const& other_bounding_box)
{ {
it = boost::begin(range) + section.begin_index; it = boost::begin(range) + section.begin_index;
end = boost::begin(range) + section.end_index + 1; end = boost::begin(range) + section.end_index + 1;
@ -425,7 +411,7 @@ private :
// Mimic section-iterator: // Mimic section-iterator:
// Skip to point such that section interects other box // Skip to point such that section interects other box
prev = it++; prev = it++;
for(; it != end && detail::section::preceding<0>(dir, *it, section.bounding_box, other_bounding_box, robust_policy); for(; it != end && detail::section::preceding<0>(dir, *it, section.bounding_box, other_bounding_box);
prev = it++, index++, ndi++) prev = it++, index++, ndi++)
{} {}
// Go back one step because we want to start completely preceding // Go back one step because we want to start completely preceding
@ -439,7 +425,6 @@ template
bool Reverse1, bool Reverse2, bool Reverse1, bool Reverse2,
typename TurnPolicy, typename TurnPolicy,
typename Strategy, typename Strategy,
typename RobustPolicy,
typename Turns, typename Turns,
typename InterruptPolicy typename InterruptPolicy
> >
@ -450,20 +435,17 @@ struct section_visitor
int m_source_id2; int m_source_id2;
Geometry2 const& m_geometry2; Geometry2 const& m_geometry2;
Strategy const& m_strategy; Strategy const& m_strategy;
RobustPolicy const& m_rescale_policy;
Turns& m_turns; Turns& m_turns;
InterruptPolicy& m_interrupt_policy; InterruptPolicy& m_interrupt_policy;
section_visitor(int id1, Geometry1 const& g1, section_visitor(int id1, Geometry1 const& g1,
int id2, Geometry2 const& g2, int id2, Geometry2 const& g2,
Strategy const& strategy, Strategy const& strategy,
RobustPolicy const& robust_policy,
Turns& turns, Turns& turns,
InterruptPolicy& ip) InterruptPolicy& ip)
: m_source_id1(id1), m_geometry1(g1) : m_source_id1(id1), m_geometry1(g1)
, m_source_id2(id2), m_geometry2(g2) , m_source_id2(id2), m_geometry2(g2)
, m_strategy(strategy) , m_strategy(strategy)
, m_rescale_policy(robust_policy)
, m_turns(turns) , m_turns(turns)
, m_interrupt_policy(ip) , m_interrupt_policy(ip)
{} {}
@ -487,7 +469,6 @@ struct section_visitor
m_source_id2, m_geometry2, sec2, m_source_id2, m_geometry2, sec2,
false, false, false, false,
m_strategy, m_strategy,
m_rescale_policy,
m_turns, m_interrupt_policy); m_turns, m_interrupt_policy);
} }
return true; return true;
@ -505,12 +486,11 @@ class get_turns_generic
{ {
public: public:
template <typename Strategy, typename RobustPolicy, typename Turns, typename InterruptPolicy> template <typename Strategy, typename Turns, typename InterruptPolicy>
static inline void apply( static inline void apply(
int source_id1, Geometry1 const& geometry1, int source_id1, Geometry1 const& geometry1,
int source_id2, Geometry2 const& geometry2, int source_id2, Geometry2 const& geometry2,
Strategy const& strategy, Strategy const& strategy,
RobustPolicy const& robust_policy,
Turns& turns, Turns& turns,
InterruptPolicy& interrupt_policy) InterruptPolicy& interrupt_policy)
{ {
@ -518,21 +498,15 @@ public:
typedef typename boost::range_value<Turns>::type ip_type; typedef typename boost::range_value<Turns>::type ip_type;
typedef typename ip_type::point_type point_type; typedef typename ip_type::point_type point_type;
typedef model::box typedef model::box<point_type> box_type;
<
typename geometry::robust_point_type
<
point_type, RobustPolicy
>::type
> box_type;
typedef geometry::sections<box_type, 2> sections_type; typedef geometry::sections<box_type, 2> sections_type;
sections_type sec1, sec2; sections_type sec1, sec2;
typedef std::integer_sequence<std::size_t, 0, 1> dimensions; typedef std::integer_sequence<std::size_t, 0, 1> dimensions;
geometry::sectionalize<Reverse1, dimensions>(geometry1, robust_policy, geometry::sectionalize<Reverse1, dimensions>(geometry1,
sec1, strategy, 0); sec1, strategy, 0);
geometry::sectionalize<Reverse2, dimensions>(geometry2, robust_policy, geometry::sectionalize<Reverse2, dimensions>(geometry2,
sec2, strategy, 1); sec2, strategy, 1);
// ... and then partition them, intersecting overlapping sections in visitor method // ... and then partition them, intersecting overlapping sections in visitor method
@ -541,10 +515,10 @@ public:
Geometry1, Geometry2, Geometry1, Geometry2,
Reverse1, Reverse2, Reverse1, Reverse2,
TurnPolicy, TurnPolicy,
Strategy, RobustPolicy, Strategy,
Turns, InterruptPolicy Turns, InterruptPolicy
> visitor(source_id1, geometry1, source_id2, geometry2, > visitor(source_id1, geometry1, source_id2, geometry2,
strategy, robust_policy, turns, interrupt_policy); strategy, turns, interrupt_policy);
geometry::partition geometry::partition
< <
@ -643,12 +617,11 @@ struct get_turns_cs
ever_circling_iterator<iterator_type> m_circular_iterator; ever_circling_iterator<iterator_type> m_circular_iterator;
}; };
template <typename IntersectionStrategy, typename RobustPolicy, typename Turns, typename InterruptPolicy> template <typename IntersectionStrategy, typename Turns, typename InterruptPolicy>
static inline void apply( static inline void apply(
int source_id1, Range const& range, int source_id1, Range const& range,
int source_id2, Box const& box, int source_id2, Box const& box,
IntersectionStrategy const& intersection_strategy, IntersectionStrategy const& intersection_strategy,
RobustPolicy const& robust_policy,
Turns& turns, Turns& turns,
InterruptPolicy& interrupt_policy, InterruptPolicy& interrupt_policy,
signed_size_type multi_index = -1, signed_size_type multi_index = -1,
@ -683,7 +656,6 @@ struct get_turns_cs
view_unique_sub_range, view_unique_sub_range,
box_points, box_points,
intersection_strategy, intersection_strategy,
robust_policy,
turns, turns,
interrupt_policy); interrupt_policy);
// Future performance enhancement: // Future performance enhancement:
@ -697,14 +669,12 @@ private:
< <
typename IntersectionStrategy, typename IntersectionStrategy,
typename Turns, typename Turns,
typename InterruptPolicy, typename InterruptPolicy
typename RobustPolicy
> >
static inline void get_turns_with_box(segment_identifier const& seg_id, int source_id2, static inline void get_turns_with_box(segment_identifier const& seg_id, int source_id2,
unique_sub_range_from_view_policy const& range_unique_sub_range, unique_sub_range_from_view_policy const& range_unique_sub_range,
box_array const& box, box_array const& box,
IntersectionStrategy const& intersection_strategy, IntersectionStrategy const& intersection_strategy,
RobustPolicy const& robust_policy,
// Output // Output
Turns& turns, Turns& turns,
InterruptPolicy& interrupt_policy) InterruptPolicy& interrupt_policy)
@ -721,25 +691,25 @@ private:
unique_sub_range_from_box_policy box_unique_sub_range(box); unique_sub_range_from_box_policy box_unique_sub_range(box);
ti.operations[1].seg_id = segment_identifier(source_id2, -1, -1, 0); ti.operations[1].seg_id = segment_identifier(source_id2, -1, -1, 0);
TurnPolicy::apply(range_unique_sub_range, box_unique_sub_range, TurnPolicy::apply(range_unique_sub_range, box_unique_sub_range,
ti, intersection_strategy, robust_policy, ti, intersection_strategy,
std::back_inserter(turns)); std::back_inserter(turns));
ti.operations[1].seg_id = segment_identifier(source_id2, -1, -1, 1); ti.operations[1].seg_id = segment_identifier(source_id2, -1, -1, 1);
box_unique_sub_range.next(); box_unique_sub_range.next();
TurnPolicy::apply(range_unique_sub_range, box_unique_sub_range, TurnPolicy::apply(range_unique_sub_range, box_unique_sub_range,
ti, intersection_strategy, robust_policy, ti, intersection_strategy,
std::back_inserter(turns)); std::back_inserter(turns));
ti.operations[1].seg_id = segment_identifier(source_id2, -1, -1, 2); ti.operations[1].seg_id = segment_identifier(source_id2, -1, -1, 2);
box_unique_sub_range.next(); box_unique_sub_range.next();
TurnPolicy::apply(range_unique_sub_range, box_unique_sub_range, TurnPolicy::apply(range_unique_sub_range, box_unique_sub_range,
ti, intersection_strategy, robust_policy, ti, intersection_strategy,
std::back_inserter(turns)); std::back_inserter(turns));
ti.operations[1].seg_id = segment_identifier(source_id2, -1, -1, 3); ti.operations[1].seg_id = segment_identifier(source_id2, -1, -1, 3);
box_unique_sub_range.next(); box_unique_sub_range.next();
TurnPolicy::apply(range_unique_sub_range, box_unique_sub_range, TurnPolicy::apply(range_unique_sub_range, box_unique_sub_range,
ti, intersection_strategy, robust_policy, ti, intersection_strategy,
std::back_inserter(turns)); std::back_inserter(turns));
if (InterruptPolicy::enabled) if (InterruptPolicy::enabled)
@ -760,12 +730,11 @@ template
> >
struct get_turns_polygon_cs struct get_turns_polygon_cs
{ {
template <typename IntersectionStrategy, typename RobustPolicy, typename Turns, typename InterruptPolicy> template <typename IntersectionStrategy, typename Turns, typename InterruptPolicy>
static inline void apply( static inline void apply(
int source_id1, Polygon const& polygon, int source_id1, Polygon const& polygon,
int source_id2, Box const& box, int source_id2, Box const& box,
IntersectionStrategy const& intersection_strategy, IntersectionStrategy const& intersection_strategy,
RobustPolicy const& robust_policy,
Turns& turns, Turns& turns,
InterruptPolicy& interrupt_policy, InterruptPolicy& interrupt_policy,
signed_size_type multi_index = -1) signed_size_type multi_index = -1)
@ -783,7 +752,6 @@ struct get_turns_polygon_cs
source_id1, geometry::exterior_ring(polygon), source_id1, geometry::exterior_ring(polygon),
source_id2, box, source_id2, box,
intersection_strategy, intersection_strategy,
robust_policy,
turns, turns,
interrupt_policy, interrupt_policy,
multi_index, -1); multi_index, -1);
@ -797,7 +765,6 @@ struct get_turns_polygon_cs
source_id1, *it, source_id1, *it,
source_id2, box, source_id2, box,
intersection_strategy, intersection_strategy,
robust_policy,
turns, interrupt_policy, turns, interrupt_policy,
multi_index, i); multi_index, i);
} }
@ -814,12 +781,11 @@ template
> >
struct get_turns_multi_polygon_cs struct get_turns_multi_polygon_cs
{ {
template <typename IntersectionStrategy, typename RobustPolicy, typename Turns, typename InterruptPolicy> template <typename IntersectionStrategy, typename Turns, typename InterruptPolicy>
static inline void apply( static inline void apply(
int source_id1, Multi const& multi, int source_id1, Multi const& multi,
int source_id2, Box const& box, int source_id2, Box const& box,
IntersectionStrategy const& intersection_strategy, IntersectionStrategy const& intersection_strategy,
RobustPolicy const& robust_policy,
Turns& turns, Turns& turns,
InterruptPolicy& interrupt_policy) InterruptPolicy& interrupt_policy)
{ {
@ -833,7 +799,7 @@ struct get_turns_multi_polygon_cs
Reverse, ReverseBox, Reverse, ReverseBox,
TurnPolicy TurnPolicy
>::apply(source_id1, *it, source_id2, box, >::apply(source_id1, *it, source_id2, box,
intersection_strategy, robust_policy, intersection_strategy,
turns, interrupt_policy, i); turns, interrupt_policy, i);
} }
} }
@ -986,11 +952,10 @@ template
> >
struct get_turns_reversed struct get_turns_reversed
{ {
template <typename Strategy, typename RobustPolicy, typename Turns, typename InterruptPolicy> template <typename Strategy, typename Turns, typename InterruptPolicy>
static inline void apply(int source_id1, Geometry1 const& g1, static inline void apply(int source_id1, Geometry1 const& g1,
int source_id2, Geometry2 const& g2, int source_id2, Geometry2 const& g2,
Strategy const& strategy, Strategy const& strategy,
RobustPolicy const& robust_policy,
Turns& turns, Turns& turns,
InterruptPolicy& interrupt_policy) InterruptPolicy& interrupt_policy)
{ {
@ -1001,7 +966,7 @@ struct get_turns_reversed
Reverse2, Reverse1, Reverse2, Reverse1,
TurnPolicy TurnPolicy
>::apply(source_id2, g2, source_id1, g1, >::apply(source_id2, g2, source_id1, g1,
strategy, robust_policy, strategy,
turns, interrupt_policy); turns, interrupt_policy);
} }
}; };
@ -1021,7 +986,6 @@ struct get_turns_reversed
\param geometry1 \param_geometry \param geometry1 \param_geometry
\param geometry2 \param_geometry \param geometry2 \param_geometry
\param intersection_strategy segments intersection strategy \param intersection_strategy segments intersection strategy
\param robust_policy policy to handle robustness issues
\param turns container which will contain turn points \param turns container which will contain turn points
\param interrupt_policy policy determining if process is stopped \param interrupt_policy policy determining if process is stopped
when intersection is found when intersection is found
@ -1033,14 +997,12 @@ template
typename Geometry1, typename Geometry1,
typename Geometry2, typename Geometry2,
typename Strategy, typename Strategy,
typename RobustPolicy,
typename Turns, typename Turns,
typename InterruptPolicy typename InterruptPolicy
> >
inline void get_turns(Geometry1 const& geometry1, inline void get_turns(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
Strategy const& strategy, Strategy const& strategy,
RobustPolicy const& robust_policy,
Turns& turns, Turns& turns,
InterruptPolicy& interrupt_policy) InterruptPolicy& interrupt_policy)
{ {
@ -1071,7 +1033,6 @@ inline void get_turns(Geometry1 const& geometry1,
>::apply(0, geometry1, >::apply(0, geometry1,
1, geometry2, 1, geometry2,
strategy, strategy,
robust_policy,
turns, interrupt_policy); turns, interrupt_policy);
} }

View File

@ -3,8 +3,9 @@
// Copyright (c) 2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2017-2023 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2017-2023 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2017-2020. // This file was modified by Oracle on 2017-2024.
// Modifications copyright (c) 2017-2020 Oracle and/or its affiliates. // Modifications copyright (c) 2017-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -315,16 +316,14 @@ template
typename Geometry0, typename Geometry0,
typename Geometry1, typename Geometry1,
typename Turns, typename Turns,
typename Clusters, typename Clusters
typename RobustPolicy
> >
inline bool handle_colocations(Turns& turns, Clusters& clusters, inline bool handle_colocations(Turns& turns, Clusters& clusters)
RobustPolicy const& robust_policy)
{ {
static const detail::overlay::operation_type target_operation static const detail::overlay::operation_type target_operation
= detail::overlay::operation_from_overlay<OverlayType>::value; = detail::overlay::operation_from_overlay<OverlayType>::value;
get_clusters(turns, clusters, robust_policy); get_clusters(turns, clusters);
if (clusters.empty()) if (clusters.empty())
{ {

View File

@ -2,8 +2,8 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2014-2021. // This file was modified by Oracle on 2014-2024.
// Modifications copyright (c) 2014-2021 Oracle and/or its affiliates. // Modifications copyright (c) 2014-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
@ -45,10 +45,6 @@
#include <boost/geometry/geometries/concepts/check.hpp> #include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/policies/robustness/rescale_policy_tags.hpp>
#include <boost/geometry/policies/robustness/segment_ratio_type.hpp>
#include <boost/geometry/policies/robustness/get_rescale_policy.hpp>
#include <boost/geometry/strategies/default_strategy.hpp> #include <boost/geometry/strategies/default_strategy.hpp>
#include <boost/geometry/strategies/detail.hpp> #include <boost/geometry/strategies/detail.hpp>
#include <boost/geometry/strategies/relate/services.hpp> #include <boost/geometry/strategies/relate/services.hpp>
@ -75,22 +71,13 @@ struct intersection_segment_segment_point
template template
< <
typename Segment1, typename Segment2, typename Segment1, typename Segment2,
typename RobustPolicy,
typename OutputIterator, typename Strategy typename OutputIterator, typename Strategy
> >
static inline OutputIterator apply(Segment1 const& segment1, static inline OutputIterator apply(Segment1 const& segment1,
Segment2 const& segment2, Segment2 const& segment2,
RobustPolicy const& ,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
// Make sure this is only called with no rescaling
BOOST_STATIC_ASSERT((std::is_same
<
no_rescale_policy_tag,
typename rescale_policy_type<RobustPolicy>::type
>::value));
typedef typename point_type<PointOut>::type point_type; typedef typename point_type<PointOut>::type point_type;
// Get the intersection point (or two points) // Get the intersection point (or two points)
@ -123,28 +110,19 @@ struct intersection_linestring_linestring_point
template template
< <
typename Linestring1, typename Linestring2, typename Linestring1, typename Linestring2,
typename RobustPolicy,
typename OutputIterator, typename OutputIterator,
typename Strategy typename Strategy
> >
static inline OutputIterator apply(Linestring1 const& linestring1, static inline OutputIterator apply(Linestring1 const& linestring1,
Linestring2 const& linestring2, Linestring2 const& linestring2,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
// Make sure this is only called with no rescaling
BOOST_STATIC_ASSERT((std::is_same
<
no_rescale_policy_tag,
typename rescale_policy_type<RobustPolicy>::type
>::value));
typedef detail::overlay::turn_info<PointOut> turn_info; typedef detail::overlay::turn_info<PointOut> turn_info;
std::deque<turn_info> turns; std::deque<turn_info> turns;
geometry::get_intersection_points(linestring1, linestring2, geometry::get_intersection_points(linestring1, linestring2,
robust_policy, turns, strategy); turns, strategy);
for (auto const& turn : turns) for (auto const& turn : turns)
{ {
@ -281,21 +259,12 @@ struct intersection_of_linestring_with_areal
template template
< <
typename LineString, typename Areal, typename LineString, typename Areal,
typename RobustPolicy,
typename OutputIterator, typename Strategy typename OutputIterator, typename Strategy
> >
static inline OutputIterator apply(LineString const& linestring, Areal const& areal, static inline OutputIterator apply(LineString const& linestring, Areal const& areal,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
// Make sure this is only called with no rescaling
BOOST_STATIC_ASSERT((std::is_same
<
no_rescale_policy_tag,
typename rescale_policy_type<RobustPolicy>::type
>::value));
if (boost::size(linestring) == 0) if (boost::size(linestring) == 0)
{ {
return out; return out;
@ -356,7 +325,7 @@ struct intersection_of_linestring_with_areal
(OverlayType == overlay_intersection ? ReverseAreal : !ReverseAreal), (OverlayType == overlay_intersection ? ReverseAreal : !ReverseAreal),
turn_policy turn_policy
>::apply(0, linestring, 1, areal, >::apply(0, linestring, 1, areal,
strategy, robust_policy, strategy,
turns, policy); turns, policy);
int inside_value = 0; int inside_value = 0;
@ -390,7 +359,7 @@ struct intersection_of_linestring_with_areal
( (
linestring, areal, linestring, areal,
geometry::detail::overlay::operation_intersection, geometry::detail::overlay::operation_intersection,
turns, robust_policy, out, strategy turns, out, strategy
); );
} }
}; };
@ -414,20 +383,18 @@ struct intersection_areal_areal_point
template template
< <
typename Geometry1, typename Geometry2, typename Geometry1, typename Geometry2,
typename RobustPolicy,
typename OutputIterator, typename OutputIterator,
typename Strategy typename Strategy
> >
static inline OutputIterator apply(Geometry1 const& geometry1, static inline OutputIterator apply(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
typedef detail::overlay::turn_info typedef detail::overlay::turn_info
< <
PointOut, PointOut,
typename segment_ratio_type<PointOut, RobustPolicy>::type typename segment_ratio_type<PointOut>::type
> turn_info; > turn_info;
std::vector<turn_info> turns; std::vector<turn_info> turns;
@ -436,7 +403,7 @@ struct intersection_areal_areal_point
geometry::get_turns geometry::get_turns
< <
false, false, detail::overlay::assign_null_policy false, false, detail::overlay::assign_null_policy
>(geometry1, geometry2, strategy, robust_policy, turns, policy); >(geometry1, geometry2, strategy, turns, policy);
return intersection_output_turn_points(turns, out); return intersection_output_turn_points(turns, out);
} }
@ -448,23 +415,14 @@ struct intersection_linear_areal_point
template template
< <
typename Geometry1, typename Geometry2, typename Geometry1, typename Geometry2,
typename RobustPolicy,
typename OutputIterator, typename OutputIterator,
typename Strategy typename Strategy
> >
static inline OutputIterator apply(Geometry1 const& geometry1, static inline OutputIterator apply(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
// Make sure this is only called with no rescaling
BOOST_STATIC_ASSERT((std::is_same
<
no_rescale_policy_tag,
typename rescale_policy_type<RobustPolicy>::type
>::value));
typedef geometry::segment_ratio<typename geometry::coordinate_type<PointOut>::type> ratio_type; typedef geometry::segment_ratio<typename geometry::coordinate_type<PointOut>::type> ratio_type;
typedef detail::overlay::turn_info typedef detail::overlay::turn_info
@ -497,7 +455,7 @@ struct intersection_linear_areal_point
false, false,
turn_policy turn_policy
>::apply(0, geometry1, 1, geometry2, >::apply(0, geometry1, 1, geometry2,
strategy, robust_policy, strategy,
turns, interrupt_policy); turns, interrupt_policy);
return intersection_output_turn_points(turns, out); return intersection_output_turn_points(turns, out);
@ -510,20 +468,18 @@ struct intersection_areal_linear_point
template template
< <
typename Geometry1, typename Geometry2, typename Geometry1, typename Geometry2,
typename RobustPolicy,
typename OutputIterator, typename OutputIterator,
typename Strategy typename Strategy
> >
static inline OutputIterator apply(Geometry1 const& geometry1, static inline OutputIterator apply(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
return intersection_linear_areal_point return intersection_linear_areal_point
< <
PointOut PointOut
>::apply(geometry2, geometry1, robust_policy, out, strategy); >::apply(geometry2, geometry1, out, strategy);
} }
}; };
@ -670,16 +626,15 @@ struct intersection_insert
linear_tag, areal_tag, linear_tag linear_tag, areal_tag, linear_tag
> >
{ {
template <typename RobustPolicy, typename OutputIterator, typename Strategy> template <typename OutputIterator, typename Strategy>
static inline OutputIterator apply(Linestring const& linestring, static inline OutputIterator apply(Linestring const& linestring,
Box const& box, Box const& box,
RobustPolicy const& robust_policy,
OutputIterator out, Strategy const& ) OutputIterator out, Strategy const& )
{ {
typedef typename point_type<GeometryOut>::type point_type; typedef typename point_type<GeometryOut>::type point_type;
strategy::intersection::liang_barsky<Box, point_type> lb_strategy; strategy::intersection::liang_barsky<Box, point_type> lb_strategy;
return detail::intersection::clip_range_with_box return detail::intersection::clip_range_with_box
<GeometryOut>(box, linestring, robust_policy, out, lb_strategy); <GeometryOut>(box, linestring, out, lb_strategy);
} }
}; };
@ -750,10 +705,9 @@ struct intersection_insert
linear_tag, areal_tag, linear_tag linear_tag, areal_tag, linear_tag
> >
{ {
template <typename RobustPolicy, typename OutputIterator, typename Strategy> template <typename OutputIterator, typename Strategy>
static inline OutputIterator apply(Segment const& segment, static inline OutputIterator apply(Segment const& segment,
Box const& box, Box const& box,
RobustPolicy const& robust_policy,
OutputIterator out, Strategy const& ) OutputIterator out, Strategy const& )
{ {
geometry::segment_view<Segment> range(segment); geometry::segment_view<Segment> range(segment);
@ -761,7 +715,7 @@ struct intersection_insert
typedef typename point_type<GeometryOut>::type point_type; typedef typename point_type<GeometryOut>::type point_type;
strategy::intersection::liang_barsky<Box, point_type> lb_strategy; strategy::intersection::liang_barsky<Box, point_type> lb_strategy;
return detail::intersection::clip_range_with_box return detail::intersection::clip_range_with_box
<GeometryOut>(box, range, robust_policy, out, lb_strategy); <GeometryOut>(box, range, out, lb_strategy);
} }
}; };
@ -842,10 +796,9 @@ template
> >
struct intersection_insert_reversed struct intersection_insert_reversed
{ {
template <typename RobustPolicy, typename OutputIterator, typename Strategy> template <typename OutputIterator, typename Strategy>
static inline OutputIterator apply(Geometry1 const& g1, static inline OutputIterator apply(Geometry1 const& g1,
Geometry2 const& g2, Geometry2 const& g2,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -854,7 +807,7 @@ struct intersection_insert_reversed
Geometry2, Geometry1, GeometryOut, Geometry2, Geometry1, GeometryOut,
OverlayType, OverlayType,
Reverse2, Reverse1 Reverse2, Reverse1
>::apply(g2, g1, robust_policy, out, strategy); >::apply(g2, g1, out, strategy);
} }
}; };
@ -879,11 +832,10 @@ struct intersection_insert
{ {
template template
< <
typename RobustPolicy, typename OutputIterator, typename Strategy typename OutputIterator, typename Strategy
> >
static inline OutputIterator apply(Geometry1 const& geometry1, static inline OutputIterator apply(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
OutputIterator oit, OutputIterator oit,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -896,7 +848,7 @@ struct intersection_insert
detail::boundary_view<Geometry2 const>, detail::boundary_view<Geometry2 const>,
LinestringOut, LinestringOut,
overlay_intersection overlay_intersection
>::apply(view1, view2, robust_policy, oit, strategy); >::apply(view1, view2, oit, strategy);
} }
}; };
@ -951,18 +903,17 @@ struct intersection_insert
// iterators in OutputIterators tuple/pair. // iterators in OutputIterators tuple/pair.
template template
< <
typename RobustPolicy, typename OutputIterators, typename Strategy typename OutputIterators, typename Strategy
> >
static inline OutputIterators apply(Linear1 const& linear1, static inline OutputIterators apply(Linear1 const& linear1,
Linear2 const& linear2, Linear2 const& linear2,
RobustPolicy const& robust_policy,
OutputIterators oit, OutputIterators oit,
Strategy const& strategy) Strategy const& strategy)
{ {
return detail::overlay::linear_linear_linestring return detail::overlay::linear_linear_linestring
< <
Linear1, Linear2, TupledOut, OverlayType Linear1, Linear2, TupledOut, OverlayType
>::apply(linear1, linear2, robust_policy, oit, strategy); >::apply(linear1, linear2, oit, strategy);
} }
}; };
@ -1065,11 +1016,10 @@ struct intersection_insert
// of iterators in OutputIterators tuple/pair. // of iterators in OutputIterators tuple/pair.
template template
< <
typename RobustPolicy, typename OutputIterators, typename Strategy typename OutputIterators, typename Strategy
> >
static inline OutputIterators apply(PointLike1 const& pointlike1, static inline OutputIterators apply(PointLike1 const& pointlike1,
PointLike2 const& pointlike2, PointLike2 const& pointlike2,
RobustPolicy const& robust_policy,
OutputIterators oits, OutputIterators oits,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -1088,7 +1038,7 @@ struct intersection_insert
out_point_index, TupledOut out_point_index, TupledOut
>::type, >::type,
OverlayType OverlayType
>::apply(pointlike1, pointlike2, robust_policy, >::apply(pointlike1, pointlike2,
bgt::get<out_point_index>(oits), bgt::get<out_point_index>(oits),
strategy); strategy);
@ -1156,10 +1106,9 @@ struct intersection_insert
linear_tag, pointlike_tag, pointlike_tag linear_tag, pointlike_tag, pointlike_tag
> >
{ {
template <typename RobustPolicy, typename OutputIterator, typename Strategy> template <typename OutputIterator, typename Strategy>
static inline OutputIterator apply(Linestring const& linestring, static inline OutputIterator apply(Linestring const& linestring,
MultiPoint const& multipoint, MultiPoint const& multipoint,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -1167,7 +1116,7 @@ struct intersection_insert
< <
MultiPoint, Linestring, PointOut, overlay_intersection, MultiPoint, Linestring, PointOut, overlay_intersection,
multi_point_tag, linear_tag multi_point_tag, linear_tag
>::apply(multipoint, linestring, robust_policy, out, strategy); >::apply(multipoint, linestring, out, strategy);
} }
}; };
@ -1212,17 +1161,16 @@ struct intersection_insert
linear_tag, pointlike_tag, detail::tupled_output_tag linear_tag, pointlike_tag, detail::tupled_output_tag
> >
{ {
template <typename RobustPolicy, typename OutputIterators, typename Strategy> template <typename OutputIterators, typename Strategy>
static inline OutputIterators apply(Linestring const& linestring, static inline OutputIterators apply(Linestring const& linestring,
MultiPoint const& multipoint, MultiPoint const& multipoint,
RobustPolicy const& robust_policy,
OutputIterators out, OutputIterators out,
Strategy const& strategy) Strategy const& strategy)
{ {
return intersection_insert return intersection_insert
< <
MultiPoint, Linestring, TupledOut, overlay_intersection MultiPoint, Linestring, TupledOut, overlay_intersection
>::apply(multipoint, linestring, robust_policy, out, strategy); >::apply(multipoint, linestring, out, strategy);
} }
}; };
@ -1284,10 +1232,9 @@ struct intersection_insert
areal_tag, pointlike_tag, pointlike_tag areal_tag, pointlike_tag, pointlike_tag
> >
{ {
template <typename RobustPolicy, typename OutputIterator, typename Strategy> template <typename OutputIterator, typename Strategy>
static inline OutputIterator apply(Areal const& areal, static inline OutputIterator apply(Areal const& areal,
MultiPoint const& multipoint, MultiPoint const& multipoint,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -1295,7 +1242,7 @@ struct intersection_insert
< <
MultiPoint, Areal, PointOut, overlay_intersection, MultiPoint, Areal, PointOut, overlay_intersection,
multi_point_tag, ArealTag multi_point_tag, ArealTag
>::apply(multipoint, areal, robust_policy, out, strategy); >::apply(multipoint, areal, out, strategy);
} }
}; };
@ -1341,17 +1288,16 @@ struct intersection_insert
areal_tag, pointlike_tag, detail::tupled_output_tag areal_tag, pointlike_tag, detail::tupled_output_tag
> >
{ {
template <typename RobustPolicy, typename OutputIterators, typename Strategy> template <typename OutputIterators, typename Strategy>
static inline OutputIterators apply(Areal const& areal, static inline OutputIterators apply(Areal const& areal,
MultiPoint const& multipoint, MultiPoint const& multipoint,
RobustPolicy const& robust_policy,
OutputIterators out, OutputIterators out,
Strategy const& strategy) Strategy const& strategy)
{ {
return intersection_insert return intersection_insert
< <
MultiPoint, Areal, TupledOut, overlay_intersection MultiPoint, Areal, TupledOut, overlay_intersection
>::apply(multipoint, areal, robust_policy, out, strategy); >::apply(multipoint, areal, out, strategy);
} }
}; };
@ -1420,13 +1366,11 @@ template
bool ReverseSecond, bool ReverseSecond,
overlay_type OverlayType, overlay_type OverlayType,
typename Geometry1, typename Geometry2, typename Geometry1, typename Geometry2,
typename RobustPolicy,
typename OutputIterator, typename OutputIterator,
typename Strategy typename Strategy
> >
inline OutputIterator insert(Geometry1 const& geometry1, inline OutputIterator insert(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -1449,7 +1393,7 @@ inline OutputIterator insert(Geometry1 const& geometry1,
geometry::detail::overlay::do_reverse<geometry::point_order<Geometry1>::value>::value, geometry::detail::overlay::do_reverse<geometry::point_order<Geometry1>::value>::value,
geometry::detail::overlay::do_reverse<geometry::point_order<Geometry2>::value, ReverseSecond>::value geometry::detail::overlay::do_reverse<geometry::point_order<Geometry2>::value, ReverseSecond>::value
> >
>::apply(geometry1, geometry2, robust_policy, out, strategy); >::apply(geometry1, geometry2, out, strategy);
} }
@ -1488,21 +1432,10 @@ inline OutputIterator intersection_insert(Geometry1 const& geometry1,
concepts::check<Geometry1 const>(); concepts::check<Geometry1 const>();
concepts::check<Geometry2 const>(); concepts::check<Geometry2 const>();
typedef typename geometry::rescale_overlay_policy_type
<
Geometry1,
Geometry2,
typename Strategy::cs_tag
>::type rescale_policy_type;
rescale_policy_type robust_policy
= geometry::get_rescale_policy<rescale_policy_type>(
geometry1, geometry2, strategy);
return detail::intersection::insert return detail::intersection::insert
< <
GeometryOut, false, overlay_intersection GeometryOut, false, overlay_intersection
>(geometry1, geometry2, robust_policy, out, strategy); >(geometry1, geometry2, out, strategy);
} }

View File

@ -2,9 +2,9 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017-2020. // This file was modified by Oracle on 2017-2024.
// Modifications copyright (c) 2017-2020 Oracle and/or its affiliates. // Modifications copyright (c) 2017-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -65,7 +65,6 @@ template
typename Turns, typename Turns,
typename Indexed, typename Indexed,
typename Geometry1, typename Geometry2, typename Geometry1, typename Geometry2,
typename RobustPolicy,
typename Strategy, typename Strategy,
bool Reverse1, bool Reverse2 bool Reverse1, bool Reverse2
> >
@ -74,12 +73,10 @@ struct less_by_segment_ratio
inline less_by_segment_ratio(Turns const& turns inline less_by_segment_ratio(Turns const& turns
, Geometry1 const& geometry1 , Geometry1 const& geometry1
, Geometry2 const& geometry2 , Geometry2 const& geometry2
, RobustPolicy const& robust_policy
, Strategy const& strategy) , Strategy const& strategy)
: m_turns(turns) : m_turns(turns)
, m_geometry1(geometry1) , m_geometry1(geometry1)
, m_geometry2(geometry2) , m_geometry2(geometry2)
, m_robust_policy(robust_policy)
, m_strategy(strategy) , m_strategy(strategy)
{ {
} }
@ -89,7 +86,6 @@ private :
Turns const& m_turns; Turns const& m_turns;
Geometry1 const& m_geometry1; Geometry1 const& m_geometry1;
Geometry2 const& m_geometry2; Geometry2 const& m_geometry2;
RobustPolicy const& m_robust_policy;
Strategy const& m_strategy; Strategy const& m_strategy;
typedef typename geometry::point_type<Geometry1>::type point_type; typedef typename geometry::point_type<Geometry1>::type point_type;

View File

@ -1,6 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2014-2022, Oracle and/or its affiliates. // Copyright (c) 2014-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -145,14 +146,12 @@ protected:
typename Turns, typename Turns,
typename LinearGeometry1, typename LinearGeometry1,
typename LinearGeometry2, typename LinearGeometry2,
typename Strategy, typename Strategy
typename RobustPolicy
> >
static inline void compute_turns(Turns& turns, static inline void compute_turns(Turns& turns,
LinearGeometry1 const& linear1, LinearGeometry1 const& linear1,
LinearGeometry2 const& linear2, LinearGeometry2 const& linear2,
Strategy const& strategy, Strategy const& strategy)
RobustPolicy const& robust_policy)
{ {
turns.clear(); turns.clear();
@ -168,7 +167,7 @@ protected:
LinearGeometry2, LinearGeometry2,
assign_policy assign_policy
> >
>::apply(turns, linear1, linear2, interrupt_policy, strategy, robust_policy); >::apply(turns, linear1, linear2, interrupt_policy, strategy);
} }
@ -221,11 +220,10 @@ protected:
public: public:
template template
< <
typename RobustPolicy, typename OutputIterator, typename Strategy typename OutputIterator, typename Strategy
> >
static inline OutputIterator apply(Linear1 const& linear1, static inline OutputIterator apply(Linear1 const& linear1,
Linear2 const& linear2, Linear2 const& linear2,
RobustPolicy const& robust_policy,
OutputIterator oit, OutputIterator oit,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -239,12 +237,12 @@ public:
Linear2, Linear2,
assign_policy assign_policy
> >
>::template turn_info_type<Strategy, RobustPolicy>::type turn_info; >::template turn_info_type<Strategy>::type turn_info;
typedef std::vector<turn_info> turns_container; typedef std::vector<turn_info> turns_container;
turns_container turns; turns_container turns;
compute_turns(turns, linear1, linear2, strategy, robust_policy); compute_turns(turns, linear1, linear2, strategy);
if ( turns.empty() ) if ( turns.empty() )
{ {
@ -289,11 +287,10 @@ struct linear_linear_linestring
{ {
template template
< <
typename RobustPolicy, typename OutputIterator, typename Strategy typename OutputIterator, typename Strategy
> >
static inline OutputIterator apply(Linear1 const& linear1, static inline OutputIterator apply(Linear1 const& linear1,
Linear2 const& linear2, Linear2 const& linear2,
RobustPolicy const& robust_policy,
OutputIterator oit, OutputIterator oit,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -310,7 +307,7 @@ struct linear_linear_linestring
Linear2, Linear1, LinestringOut, overlay_difference, Linear2, Linear1, LinestringOut, overlay_difference,
EnableFilterContinueTurns, EnableRemoveDuplicateTurns, EnableFilterContinueTurns, EnableRemoveDuplicateTurns,
EnableDegenerateTurns, EnableFollowIsolatedPoints EnableDegenerateTurns, EnableFollowIsolatedPoints
>::apply(linear2, linear1, robust_policy, oit, strategy); >::apply(linear2, linear1, oit, strategy);
} }
}; };

View File

@ -3,8 +3,9 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2013-2017 Adam Wulkiewicz, Lodz, Poland // Copyright (c) 2013-2017 Adam Wulkiewicz, Lodz, Poland
// This file was modified by Oracle on 2015-2020. // This file was modified by Oracle on 2015-2024.
// Modifications copyright (c) 2015-2020, Oracle and/or its affiliates. // Modifications copyright (c) 2015-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -35,8 +36,6 @@
#include <boost/geometry/algorithms/detail/overlay/self_turn_points.hpp> #include <boost/geometry/algorithms/detail/overlay/self_turn_points.hpp>
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp> #include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
#include <boost/geometry/algorithms/detail/recalculate.hpp>
#include <boost/geometry/algorithms/is_empty.hpp> #include <boost/geometry/algorithms/is_empty.hpp>
#include <boost/geometry/algorithms/reverse.hpp> #include <boost/geometry/algorithms/reverse.hpp>
@ -46,8 +45,6 @@
#include <boost/geometry/algorithms/detail/overlay/select_rings.hpp> #include <boost/geometry/algorithms/detail/overlay/select_rings.hpp>
#include <boost/geometry/algorithms/detail/overlay/do_reverse.hpp> #include <boost/geometry/algorithms/detail/overlay/do_reverse.hpp>
#include <boost/geometry/policies/robustness/segment_ratio_type.hpp>
#include <boost/geometry/util/condition.hpp> #include <boost/geometry/util/condition.hpp>
#ifdef BOOST_GEOMETRY_DEBUG_ASSEMBLE #ifdef BOOST_GEOMETRY_DEBUG_ASSEMBLE
@ -232,10 +229,9 @@ template
> >
struct overlay struct overlay
{ {
template <typename RobustPolicy, typename OutputIterator, typename Strategy, typename Visitor> template <typename OutputIterator, typename Strategy, typename Visitor>
static inline OutputIterator apply( static inline OutputIterator apply(
Geometry1 const& geometry1, Geometry2 const& geometry2, Geometry1 const& geometry1, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy, Strategy const& strategy,
Visitor& visitor) Visitor& visitor)
@ -260,7 +256,7 @@ struct overlay
typedef detail::overlay::traversal_turn_info typedef detail::overlay::traversal_turn_info
< <
point_type, point_type,
typename segment_ratio_type<point_type, RobustPolicy>::type typename segment_ratio_type<point_type>::type
> turn_info; > turn_info;
typedef std::deque<turn_info> turn_container_type; typedef std::deque<turn_info> turn_container_type;
@ -284,7 +280,7 @@ std::cout << "get turns" << std::endl;
< <
Reverse1, Reverse2, Reverse1, Reverse2,
assign_policy_only_start_turns assign_policy_only_start_turns
>(geometry1, geometry2, strategy, robust_policy, turns, policy); >(geometry1, geometry2, strategy, turns, policy);
visitor.visit_turns(1, turns); visitor.visit_turns(1, turns);
@ -296,12 +292,12 @@ std::cout << "get turns" << std::endl;
if (needs_self_turns<Geometry1>::apply(geometry1)) if (needs_self_turns<Geometry1>::apply(geometry1))
{ {
self_get_turn_points::self_turns<Reverse1, assign_policy_only_start_turns>(geometry1, self_get_turn_points::self_turns<Reverse1, assign_policy_only_start_turns>(geometry1,
strategy, robust_policy, turns, policy, 0); strategy, turns, policy, 0);
} }
if (needs_self_turns<Geometry2>::apply(geometry2)) if (needs_self_turns<Geometry2>::apply(geometry2))
{ {
self_get_turn_points::self_turns<Reverse2, assign_policy_only_start_turns>(geometry2, self_get_turn_points::self_turns<Reverse2, assign_policy_only_start_turns>(geometry2,
strategy, robust_policy, turns, policy, 1); strategy, turns, policy, 1);
} }
} }
#endif #endif
@ -315,7 +311,7 @@ std::cout << "enrich" << std::endl;
std::map<ring_identifier, ring_turn_info> turn_info_per_ring; std::map<ring_identifier, ring_turn_info> turn_info_per_ring;
geometry::enrich_intersection_points<Reverse1, Reverse2, OverlayType>( geometry::enrich_intersection_points<Reverse1, Reverse2, OverlayType>(
turns, clusters, geometry1, geometry2, robust_policy, strategy); turns, clusters, geometry1, geometry2, strategy);
visitor.visit_turns(2, turns); visitor.visit_turns(2, turns);
@ -332,7 +328,6 @@ std::cout << "traverse" << std::endl;
( (
geometry1, geometry2, geometry1, geometry2,
strategy, strategy,
robust_policy,
turns, rings, turns, rings,
turn_info_per_ring, turn_info_per_ring,
clusters, clusters,
@ -390,15 +385,14 @@ std::cout << "traverse" << std::endl;
); );
} }
template <typename RobustPolicy, typename OutputIterator, typename Strategy> template <typename OutputIterator, typename Strategy>
static inline OutputIterator apply( static inline OutputIterator apply(
Geometry1 const& geometry1, Geometry2 const& geometry2, Geometry1 const& geometry1, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
overlay_null_visitor visitor; overlay_null_visitor visitor;
return apply(geometry1, geometry2, robust_policy, out, strategy, visitor); return apply(geometry1, geometry2, out, strategy, visitor);
} }
}; };

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2020, Oracle and/or its affiliates. // Copyright (c) 2020-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0. // Licensed under the Boost Software License version 1.0.
@ -211,10 +211,9 @@ private:
} }
public: public:
template <typename RobustPolicy, typename OutputIterator, typename Strategy> template <typename OutputIterator, typename Strategy>
static inline OutputIterator apply(MultiPoint const& multipoint, static inline OutputIterator apply(MultiPoint const& multipoint,
MultiPolygon const& multipolygon, MultiPolygon const& multipolygon,
RobustPolicy const& robust_policy,
OutputIterator oit, OutputIterator oit,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -233,7 +232,7 @@ public:
return multipoint_multipoint_point return multipoint_multipoint_point
< <
MultiPoint, point_vector_type, PointOut, OverlayType MultiPoint, point_vector_type, PointOut, OverlayType
>::apply(multipoint, common_points, robust_policy, oit, strategy); >::apply(multipoint, common_points, oit, strategy);
} }
}; };

View File

@ -2,8 +2,8 @@
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2015-2020, Oracle and/or its affiliates. // Copyright (c) 2015-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -65,10 +65,9 @@ template
> >
struct point_single_point struct point_single_point
{ {
template <typename RobustPolicy, typename OutputIterator, typename Strategy> template <typename OutputIterator, typename Strategy>
static inline OutputIterator apply(Point const& point, static inline OutputIterator apply(Point const& point,
Geometry const& geometry, Geometry const& geometry,
RobustPolicy const&,
OutputIterator oit, OutputIterator oit,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -91,10 +90,9 @@ template
> >
struct multipoint_single_point struct multipoint_single_point
{ {
template <typename RobustPolicy, typename OutputIterator, typename Strategy> template <typename OutputIterator, typename Strategy>
static inline OutputIterator apply(MultiPoint const& multipoint, static inline OutputIterator apply(MultiPoint const& multipoint,
Geometry const& geometry, Geometry const& geometry,
RobustPolicy const&,
OutputIterator oit, OutputIterator oit,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -269,10 +267,9 @@ private:
} }
public: public:
template <typename RobustPolicy, typename OutputIterator, typename Strategy> template <typename OutputIterator, typename Strategy>
static inline OutputIterator apply(MultiPoint const& multipoint, static inline OutputIterator apply(MultiPoint const& multipoint,
Linear const& linear, Linear const& linear,
RobustPolicy const& robust_policy,
OutputIterator oit, OutputIterator oit,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -291,7 +288,7 @@ public:
return multipoint_multipoint_point return multipoint_multipoint_point
< <
MultiPoint, point_vector_type, PointOut, OverlayType MultiPoint, point_vector_type, PointOut, OverlayType
>::apply(multipoint, common_points, robust_policy, oit, strategy); >::apply(multipoint, common_points, oit, strategy);
} }
}; };

View File

@ -2,7 +2,7 @@
// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2014-2023, Oracle and/or its affiliates. // Copyright (c) 2014-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
@ -149,10 +149,9 @@ template
> >
struct point_point_point struct point_point_point
{ {
template <typename RobustPolicy, typename OutputIterator, typename Strategy> template <typename OutputIterator, typename Strategy>
static inline OutputIterator apply(Point1 const& point1, static inline OutputIterator apply(Point1 const& point1,
Point2 const& point2, Point2 const& point2,
RobustPolicy const& ,
OutputIterator oit, OutputIterator oit,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -183,10 +182,9 @@ template
> >
struct multipoint_point_point struct multipoint_point_point
{ {
template <typename RobustPolicy, typename OutputIterator, typename Strategy> template <typename OutputIterator, typename Strategy>
static inline OutputIterator apply(MultiPoint const& multipoint, static inline OutputIterator apply(MultiPoint const& multipoint,
Point const& point, Point const& point,
RobustPolicy const& ,
OutputIterator oit, OutputIterator oit,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -217,10 +215,9 @@ template
> >
struct point_multipoint_point struct point_multipoint_point
{ {
template <typename RobustPolicy, typename OutputIterator, typename Strategy> template <typename OutputIterator, typename Strategy>
static inline OutputIterator apply(Point const& point, static inline OutputIterator apply(Point const& point,
MultiPoint const& multipoint, MultiPoint const& multipoint,
RobustPolicy const& ,
OutputIterator oit, OutputIterator oit,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -252,10 +249,9 @@ template
> >
struct multipoint_multipoint_point struct multipoint_multipoint_point
{ {
template <typename RobustPolicy, typename OutputIterator, typename Strategy> template <typename OutputIterator, typename Strategy>
static inline OutputIterator apply(MultiPoint1 const& multipoint1, static inline OutputIterator apply(MultiPoint1 const& multipoint1,
MultiPoint2 const& multipoint2, MultiPoint2 const& multipoint2,
RobustPolicy const& robust_policy,
OutputIterator oit, OutputIterator oit,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -268,7 +264,7 @@ struct multipoint_multipoint_point
return multipoint_multipoint_point return multipoint_multipoint_point
< <
MultiPoint2, MultiPoint1, PointOut, OverlayType MultiPoint2, MultiPoint1, PointOut, OverlayType
>::apply(multipoint2, multipoint1, robust_policy, oit, strategy); >::apply(multipoint2, multipoint1, oit, strategy);
} }
} }
@ -414,10 +410,9 @@ template
> >
struct union_pointlike_pointlike_point struct union_pointlike_pointlike_point
{ {
template <typename RobustPolicy, typename OutputIterator, typename Strategy> template <typename OutputIterator, typename Strategy>
static inline OutputIterator apply(PointLike1 const& pointlike1, static inline OutputIterator apply(PointLike1 const& pointlike1,
PointLike2 const& pointlike2, PointLike2 const& pointlike2,
RobustPolicy const& robust_policy,
OutputIterator oit, OutputIterator oit,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -428,7 +423,7 @@ struct union_pointlike_pointlike_point
PointLike2, PointLike1, PointOut, overlay_difference, PointLike2, PointLike1, PointOut, overlay_difference,
typename tag<PointLike2>::type, typename tag<PointLike2>::type,
typename tag<PointLike1>::type typename tag<PointLike1>::type
>::apply(pointlike2, pointlike1, robust_policy, oit, strategy); >::apply(pointlike2, pointlike1, oit, strategy);
} }
}; };

View File

@ -3,8 +3,9 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2017-2021. // This file was modified by Oracle on 2017-2024.
// Modifications copyright (c) 2017-2021 Oracle and/or its affiliates. // Modifications copyright (c) 2017-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -36,7 +37,6 @@
#include <boost/geometry/util/condition.hpp> #include <boost/geometry/util/condition.hpp>
namespace boost { namespace geometry namespace boost { namespace geometry
{ {
@ -65,14 +65,12 @@ template
typename Turns, typename Turns,
typename TurnPolicy, typename TurnPolicy,
typename Strategy, typename Strategy,
typename RobustPolicy,
typename InterruptPolicy typename InterruptPolicy
> >
struct self_section_visitor struct self_section_visitor
{ {
Geometry const& m_geometry; Geometry const& m_geometry;
Strategy const& m_strategy; Strategy const& m_strategy;
RobustPolicy const& m_rescale_policy;
Turns& m_turns; Turns& m_turns;
InterruptPolicy& m_interrupt_policy; InterruptPolicy& m_interrupt_policy;
int m_source_index; int m_source_index;
@ -80,14 +78,12 @@ struct self_section_visitor
inline self_section_visitor(Geometry const& g, inline self_section_visitor(Geometry const& g,
Strategy const& s, Strategy const& s,
RobustPolicy const& rp,
Turns& turns, Turns& turns,
InterruptPolicy& ip, InterruptPolicy& ip,
int source_index, int source_index,
bool skip_adjacent) bool skip_adjacent)
: m_geometry(g) : m_geometry(g)
, m_strategy(s) , m_strategy(s)
, m_rescale_policy(rp)
, m_turns(turns) , m_turns(turns)
, m_interrupt_policy(ip) , m_interrupt_policy(ip)
, m_source_index(source_index) , m_source_index(source_index)
@ -114,7 +110,6 @@ struct self_section_visitor
m_source_index, m_geometry, sec2, m_source_index, m_geometry, sec2,
false, m_skip_adjacent, false, m_skip_adjacent,
m_strategy, m_strategy,
m_rescale_policy,
m_turns, m_interrupt_policy); m_turns, m_interrupt_policy);
} }
@ -128,23 +123,15 @@ struct self_section_visitor
template <bool Reverse, typename TurnPolicy> template <bool Reverse, typename TurnPolicy>
struct get_turns struct get_turns
{ {
template <typename Geometry, typename Strategy, typename RobustPolicy, typename Turns, typename InterruptPolicy> template <typename Geometry, typename Strategy, typename Turns, typename InterruptPolicy>
static inline bool apply( static inline bool apply(
Geometry const& geometry, Geometry const& geometry,
Strategy const& strategy, Strategy const& strategy,
RobustPolicy const& robust_policy,
Turns& turns, Turns& turns,
InterruptPolicy& interrupt_policy, InterruptPolicy& interrupt_policy,
int source_index, bool skip_adjacent) int source_index, bool skip_adjacent)
{ {
typedef model::box typedef model::box<typename geometry::point_type<Geometry>::type> box_type;
<
typename geometry::robust_point_type
<
typename geometry::point_type<Geometry>::type,
RobustPolicy
>::type
> box_type;
// sectionalize in two dimensions to detect // sectionalize in two dimensions to detect
// all potential spikes correctly // all potential spikes correctly
@ -153,14 +140,14 @@ struct get_turns
typedef std::integer_sequence<std::size_t, 0, 1> dimensions; typedef std::integer_sequence<std::size_t, 0, 1> dimensions;
sections_type sec; sections_type sec;
geometry::sectionalize<Reverse, dimensions>(geometry, robust_policy, geometry::sectionalize<Reverse, dimensions>(geometry,
sec, strategy); sec, strategy);
self_section_visitor self_section_visitor
< <
Reverse, Geometry, Reverse, Geometry,
Turns, TurnPolicy, Strategy, RobustPolicy, InterruptPolicy Turns, TurnPolicy, Strategy, InterruptPolicy
> visitor(geometry, strategy, robust_policy, turns, interrupt_policy, > visitor(geometry, strategy, turns, interrupt_policy,
source_index, skip_adjacent); source_index, skip_adjacent);
// false if interrupted // false if interrupted
@ -223,11 +210,10 @@ struct self_get_turn_points
TurnPolicy TurnPolicy
> >
{ {
template <typename Strategy, typename RobustPolicy, typename Turns, typename InterruptPolicy> template <typename Strategy, typename Turns, typename InterruptPolicy>
static inline bool apply( static inline bool apply(
Box const& , Box const& ,
Strategy const& , Strategy const& ,
RobustPolicy const& ,
Turns& , Turns& ,
InterruptPolicy& , InterruptPolicy& ,
int /*source_index*/, int /*source_index*/,
@ -287,13 +273,11 @@ struct self_get_turn_points
template template
< <
typename Geometry, typename Geometry,
typename RobustPolicy,
typename Turns, typename Turns,
typename InterruptPolicy typename InterruptPolicy
> >
static inline void apply(Geometry const& geometry, static inline void apply(Geometry const& geometry,
Strategies const& strategies, Strategies const& strategies,
RobustPolicy const& robust_policy,
Turns& turns, Turns& turns,
InterruptPolicy& interrupt_policy, InterruptPolicy& interrupt_policy,
int source_index, int source_index,
@ -307,7 +291,7 @@ struct self_get_turn_points
typename tag<Geometry>::type, typename tag<Geometry>::type,
Geometry, Geometry,
turn_policy turn_policy
>::apply(geometry, strategies, robust_policy, turns, interrupt_policy, >::apply(geometry, strategies, turns, interrupt_policy,
source_index, skip_adjacent); source_index, skip_adjacent);
} }
}; };
@ -318,13 +302,11 @@ struct self_get_turn_points<Reverse, AssignPolicy, Strategy, false>
template template
< <
typename Geometry, typename Geometry,
typename RobustPolicy,
typename Turns, typename Turns,
typename InterruptPolicy typename InterruptPolicy
> >
static inline void apply(Geometry const& geometry, static inline void apply(Geometry const& geometry,
Strategy const& strategy, Strategy const& strategy,
RobustPolicy const& robust_policy,
Turns& turns, Turns& turns,
InterruptPolicy& interrupt_policy, InterruptPolicy& interrupt_policy,
int source_index, int source_index,
@ -339,7 +321,6 @@ struct self_get_turn_points<Reverse, AssignPolicy, Strategy, false>
decltype(strategy_converter<Strategy>::get(strategy)) decltype(strategy_converter<Strategy>::get(strategy))
>::apply(geometry, >::apply(geometry,
strategy_converter<Strategy>::get(strategy), strategy_converter<Strategy>::get(strategy),
robust_policy,
turns, turns,
interrupt_policy, interrupt_policy,
source_index, source_index,
@ -363,13 +344,11 @@ template
typename AssignPolicy, typename AssignPolicy,
typename Geometry, typename Geometry,
typename Strategy, typename Strategy,
typename RobustPolicy,
typename Turns, typename Turns,
typename InterruptPolicy typename InterruptPolicy
> >
inline void self_turns(Geometry const& geometry, inline void self_turns(Geometry const& geometry,
Strategy const& strategy, Strategy const& strategy,
RobustPolicy const& robust_policy,
Turns& turns, Turns& turns,
InterruptPolicy& interrupt_policy, InterruptPolicy& interrupt_policy,
int source_index = 0, int source_index = 0,
@ -380,7 +359,7 @@ inline void self_turns(Geometry const& geometry,
resolve_strategy::self_get_turn_points resolve_strategy::self_get_turn_points
< <
Reverse, AssignPolicy, Strategy Reverse, AssignPolicy, Strategy
>::apply(geometry, strategy, robust_policy, turns, interrupt_policy, >::apply(geometry, strategy, turns, interrupt_policy,
source_index, skip_adjacent); source_index, skip_adjacent);
} }
@ -395,7 +374,6 @@ inline void self_turns(Geometry const& geometry,
(e.g. vector of "intersection/turn point"'s) (e.g. vector of "intersection/turn point"'s)
\param geometry geometry \param geometry geometry
\param strategy strategy to be used \param strategy strategy to be used
\param robust_policy policy to handle robustness issues
\param turns container which will contain intersection points \param turns container which will contain intersection points
\param interrupt_policy policy determining if process is stopped \param interrupt_policy policy determining if process is stopped
when intersection is found when intersection is found
@ -407,13 +385,11 @@ template
typename AssignPolicy, typename AssignPolicy,
typename Geometry, typename Geometry,
typename Strategy, typename Strategy,
typename RobustPolicy,
typename Turns, typename Turns,
typename InterruptPolicy typename InterruptPolicy
> >
inline void self_turns(Geometry const& geometry, inline void self_turns(Geometry const& geometry,
Strategy const& strategy, Strategy const& strategy,
RobustPolicy const& robust_policy,
Turns& turns, Turns& turns,
InterruptPolicy& interrupt_policy, InterruptPolicy& interrupt_policy,
int source_index = 0, int source_index = 0,
@ -429,7 +405,7 @@ inline void self_turns(Geometry const& geometry,
resolve_strategy::self_get_turn_points resolve_strategy::self_get_turn_points
< <
reverse, AssignPolicy, Strategy reverse, AssignPolicy, Strategy
>::apply(geometry, strategy, robust_policy, turns, interrupt_policy, >::apply(geometry, strategy, turns, interrupt_policy,
source_index, skip_adjacent); source_index, skip_adjacent);
} }

View File

@ -3,8 +3,9 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2023-2024 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2023-2024 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2017-2020. // This file was modified by Oracle on 2017-2024.
// Modifications copyright (c) 2017-2020 Oracle and/or its affiliates. // Modifications copyright (c) 2017-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -83,7 +84,6 @@ template
typename Geometry2, typename Geometry2,
typename Turns, typename Turns,
typename Clusters, typename Clusters,
typename RobustPolicy,
typename Strategy, typename Strategy,
typename Visitor typename Visitor
> >
@ -107,13 +107,12 @@ private :
public : public :
inline traversal(Geometry1 const& geometry1, Geometry2 const& geometry2, inline traversal(Geometry1 const& geometry1, Geometry2 const& geometry2,
Turns& turns, Clusters const& clusters, Turns& turns, Clusters const& clusters,
RobustPolicy const& robust_policy, Strategy const& strategy, Strategy const& strategy,
Visitor& visitor) Visitor& visitor)
: m_geometry1(geometry1) : m_geometry1(geometry1)
, m_geometry2(geometry2) , m_geometry2(geometry2)
, m_turns(turns) , m_turns(turns)
, m_clusters(clusters) , m_clusters(clusters)
, m_robust_policy(robust_policy)
, m_strategy(strategy) , m_strategy(strategy)
, m_visitor(visitor) , m_visitor(visitor)
{ {
@ -1071,7 +1070,6 @@ private :
Geometry2 const& m_geometry2; Geometry2 const& m_geometry2;
Turns& m_turns; Turns& m_turns;
Clusters const& m_clusters; Clusters const& m_clusters;
RobustPolicy const& m_robust_policy;
Strategy m_strategy; Strategy m_strategy;
Visitor& m_visitor; Visitor& m_visitor;
}; };

View File

@ -2,8 +2,9 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017-2020. // This file was modified by Oracle on 2017-2024.
// Modifications copyright (c) 2017-2020, Oracle and/or its affiliates. // Modifications copyright (c) 2017-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -45,7 +46,6 @@ template
typename TurnInfoMap, typename TurnInfoMap,
typename Clusters, typename Clusters,
typename Strategy, typename Strategy,
typename RobustPolicy,
typename Visitor, typename Visitor,
typename Backtrack typename Backtrack
> >
@ -55,7 +55,6 @@ struct traversal_ring_creator
< <
Reverse1, Reverse2, OverlayType, Reverse1, Reverse2, OverlayType,
Geometry1, Geometry2, Turns, Clusters, Geometry1, Geometry2, Turns, Clusters,
RobustPolicy,
Strategy, Strategy,
Visitor Visitor
> traversal_type; > traversal_type;
@ -70,16 +69,15 @@ struct traversal_ring_creator
Turns& turns, TurnInfoMap& turn_info_map, Turns& turns, TurnInfoMap& turn_info_map,
Clusters const& clusters, Clusters const& clusters,
Strategy const& strategy, Strategy const& strategy,
RobustPolicy const& robust_policy, Visitor& visitor) Visitor& visitor)
: m_trav(geometry1, geometry2, turns, clusters, : m_trav(geometry1, geometry2, turns, clusters,
robust_policy, strategy, visitor) strategy, visitor)
, m_geometry1(geometry1) , m_geometry1(geometry1)
, m_geometry2(geometry2) , m_geometry2(geometry2)
, m_turns(turns) , m_turns(turns)
, m_turn_info_map(turn_info_map) , m_turn_info_map(turn_info_map)
, m_clusters(clusters) , m_clusters(clusters)
, m_strategy(strategy) , m_strategy(strategy)
, m_robust_policy(robust_policy)
, m_visitor(visitor) , m_visitor(visitor)
{ {
} }
@ -113,13 +111,13 @@ struct traversal_ring_creator
{ {
geometry::copy_segments<Reverse1>(m_geometry1, geometry::copy_segments<Reverse1>(m_geometry1,
previous_op.seg_id, to_vertex_index, previous_op.seg_id, to_vertex_index,
m_strategy, m_robust_policy, current_ring); m_strategy, current_ring);
} }
else else
{ {
geometry::copy_segments<Reverse2>(m_geometry2, geometry::copy_segments<Reverse2>(m_geometry2,
previous_op.seg_id, to_vertex_index, previous_op.seg_id, to_vertex_index,
m_strategy, m_robust_policy, current_ring); m_strategy, current_ring);
} }
} }
@ -162,7 +160,7 @@ struct traversal_ring_creator
turn_type& current_turn = m_turns[turn_index]; turn_type& current_turn = m_turns[turn_index];
turn_operation_type& op = current_turn.operations[op_index]; turn_operation_type& op = current_turn.operations[op_index];
detail::overlay::append_no_collinear(current_ring, current_turn.point, detail::overlay::append_no_collinear(current_ring, current_turn.point,
m_strategy, m_robust_policy); m_strategy);
// Register the visit // Register the visit
m_trav.set_visited(current_turn, op); m_trav.set_visited(current_turn, op);
@ -179,7 +177,7 @@ struct traversal_ring_creator
turn_operation_type& start_op = m_turns[start_turn_index].operations[start_op_index]; turn_operation_type& start_op = m_turns[start_turn_index].operations[start_op_index];
detail::overlay::append_no_collinear(ring, start_turn.point, detail::overlay::append_no_collinear(ring, start_turn.point,
m_strategy, m_robust_policy); m_strategy);
signed_size_type current_turn_index = start_turn_index; signed_size_type current_turn_index = start_turn_index;
int current_op_index = start_op_index; int current_op_index = start_op_index;
@ -274,7 +272,7 @@ struct traversal_ring_creator
if (traverse_error == traverse_error_none) if (traverse_error == traverse_error_none)
{ {
remove_spikes_at_closure(ring, m_strategy, m_robust_policy); remove_spikes_at_closure(ring, m_strategy);
fix_closure(ring, m_strategy); fix_closure(ring, m_strategy);
std::size_t const min_num_points std::size_t const min_num_points
@ -298,7 +296,7 @@ struct traversal_ring_creator
m_turns[turn_index].operations[op_index], m_turns[turn_index].operations[op_index],
traverse_error, traverse_error,
m_geometry1, m_geometry2, m_geometry1, m_geometry2,
m_strategy, m_robust_policy, m_strategy,
state, m_visitor); state, m_visitor);
} }
} }
@ -409,7 +407,6 @@ private:
TurnInfoMap& m_turn_info_map; // contains turn-info information per ring TurnInfoMap& m_turn_info_map; // contains turn-info information per ring
Clusters const& m_clusters; Clusters const& m_clusters;
Strategy const& m_strategy; Strategy const& m_strategy;
RobustPolicy const& m_robust_policy;
Visitor& m_visitor; Visitor& m_visitor;
}; };

View File

@ -3,8 +3,9 @@
// Copyright (c) 2015-2016 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2015-2016 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2018-2020. // This file was modified by Oracle on 2018-2024.
// Modifications copyright (c) 2018-2020 Oracle and/or its affiliates. // Modifications copyright (c) 2018-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -83,7 +84,6 @@ template
typename Geometry2, typename Geometry2,
typename Turns, typename Turns,
typename Clusters, typename Clusters,
typename RobustPolicy,
typename Visitor typename Visitor
> >
struct traversal_switch_detector struct traversal_switch_detector
@ -138,12 +138,11 @@ struct traversal_switch_detector
inline traversal_switch_detector(Geometry1 const& geometry1, inline traversal_switch_detector(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
Turns& turns, Clusters const& clusters, Turns& turns, Clusters const& clusters,
RobustPolicy const& robust_policy, Visitor& visitor) Visitor& visitor)
: m_geometry1(geometry1) : m_geometry1(geometry1)
, m_geometry2(geometry2) , m_geometry2(geometry2)
, m_turns(turns) , m_turns(turns)
, m_clusters(clusters) , m_clusters(clusters)
, m_robust_policy(robust_policy)
, m_visitor(visitor) , m_visitor(visitor)
{ {
} }
@ -736,7 +735,6 @@ private:
Clusters const& m_clusters; Clusters const& m_clusters;
merge_map m_turns_per_ring; merge_map m_turns_per_ring;
region_connection_map m_connected_regions; region_connection_map m_connected_regions;
RobustPolicy const& m_robust_policy;
Visitor& m_visitor; Visitor& m_visitor;
}; };

View File

@ -2,6 +2,10 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2024.
// Modifications copyright (c) 2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
@ -58,7 +62,6 @@ public :
template template
< <
typename IntersectionStrategy, typename IntersectionStrategy,
typename RobustPolicy,
typename Turns, typename Turns,
typename Rings, typename Rings,
typename TurnInfoMap, typename TurnInfoMap,
@ -68,7 +71,6 @@ public :
static inline void apply(Geometry1 const& geometry1, static inline void apply(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
IntersectionStrategy const& intersection_strategy, IntersectionStrategy const& intersection_strategy,
RobustPolicy const& robust_policy,
Turns& turns, Rings& rings, Turns& turns, Rings& rings,
TurnInfoMap& turn_info_map, TurnInfoMap& turn_info_map,
Clusters& clusters, Clusters& clusters,
@ -79,9 +81,9 @@ public :
Reverse1, Reverse2, OverlayType, Reverse1, Reverse2, OverlayType,
Geometry1, Geometry2, Geometry1, Geometry2,
Turns, Clusters, Turns, Clusters,
RobustPolicy, Visitor Visitor
> switch_detector(geometry1, geometry2, turns, clusters, > switch_detector(geometry1, geometry2, turns, clusters,
robust_policy, visitor); visitor);
switch_detector.iterate(); switch_detector.iterate();
reset_visits(turns); reset_visits(turns);
@ -92,10 +94,10 @@ public :
Geometry1, Geometry2, Geometry1, Geometry2,
Turns, TurnInfoMap, Clusters, Turns, TurnInfoMap, Clusters,
IntersectionStrategy, IntersectionStrategy,
RobustPolicy, Visitor, Visitor,
Backtrack Backtrack
> trav(geometry1, geometry2, turns, turn_info_map, clusters, > trav(geometry1, geometry2, turns, turn_info_map, clusters,
intersection_strategy, robust_policy, visitor); intersection_strategy, visitor);
std::size_t finalized_ring_size = boost::size(rings); std::size_t finalized_ring_size = boost::size(rings);

View File

@ -5,8 +5,9 @@
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// Copyright (c) 2013-2023 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2013-2023 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2015, 2017, 2019. // This file was modified by Oracle on 2015-2024.
// Modifications copyright (c) 2015-2019 Oracle and/or its affiliates. // Modifications copyright (c) 2015-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -18,9 +19,7 @@
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_POINT_IS_EQUAL_OR_SPIKE_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_POINT_IS_EQUAL_OR_SPIKE_HPP
#include <boost/geometry/algorithms/detail/direction_code.hpp> #include <boost/geometry/algorithms/detail/direction_code.hpp>
#include <boost/geometry/algorithms/detail/recalculate.hpp>
#include <boost/geometry/core/cs.hpp> #include <boost/geometry/core/cs.hpp>
#include <boost/geometry/policies/robustness/robust_point_type.hpp>
#include <boost/geometry/strategies/side.hpp> #include <boost/geometry/strategies/side.hpp>
#include <boost/geometry/util/constexpr.hpp> #include <boost/geometry/util/constexpr.hpp>
#include <boost/geometry/util/math.hpp> #include <boost/geometry/util/math.hpp>
@ -70,87 +69,20 @@ template
typename Point1, typename Point1,
typename Point2, typename Point2,
typename Point3, typename Point3,
typename SideStrategy, typename SideStrategy
typename RobustPolicy
>
inline bool point_is_spike_or_equal(Point1 const& last_point,
Point2 const& segment_a,
Point3 const& segment_b,
SideStrategy const& strategy,
RobustPolicy const& robust_policy)
{
if (point_is_spike_or_equal(last_point, segment_a, segment_b, strategy))
{
return true;
}
if BOOST_GEOMETRY_CONSTEXPR (! RobustPolicy::enabled)
{
return false;
}
else // else prevents unreachable code warning
{
// Try using specified robust policy
using robust_point_type = typename geometry::robust_point_type
<
Point1,
RobustPolicy
>::type;
robust_point_type last_point_rob, segment_a_rob, segment_b_rob;
geometry::recalculate(last_point_rob, last_point, robust_policy);
geometry::recalculate(segment_a_rob, segment_a, robust_policy);
geometry::recalculate(segment_b_rob, segment_b, robust_policy);
return point_is_spike_or_equal(last_point_rob, segment_a_rob, segment_b_rob,
strategy);
}
}
template
<
typename Point1,
typename Point2,
typename Point3,
typename SideStrategy,
typename RobustPolicy
> >
inline bool point_is_collinear(Point1 const& last_point, inline bool point_is_collinear(Point1 const& last_point,
Point2 const& segment_a, Point2 const& segment_a,
Point3 const& segment_b, Point3 const& segment_b,
SideStrategy const& strategy, SideStrategy const& strategy)
RobustPolicy const& robust_policy)
{ {
int const side = strategy.apply(segment_a, segment_b, last_point); int const side = strategy.apply(segment_a, segment_b, last_point);
if (side == 0) if (side == 0)
{ {
return true; return true;
} }
// This part (or whole method, because it is then trivial)
// will be removed after rescaling
if BOOST_GEOMETRY_CONSTEXPR (! RobustPolicy::enabled)
{
return false; return false;
} }
else // else prevents unreachable code warning
{
// Redo, using specified robust policy
using robust_point_type = typename geometry::robust_point_type
<
Point1,
RobustPolicy
>::type;
robust_point_type last_point_rob, segment_a_rob, segment_b_rob;
geometry::recalculate(last_point_rob, last_point, robust_policy);
geometry::recalculate(segment_a_rob, segment_a, robust_policy);
geometry::recalculate(segment_b_rob, segment_b, robust_policy);
int const side_rob = strategy.apply(segment_a_rob, segment_b_rob, last_point_rob);
return side_rob == 0;
}
}
//! Version with intuitive order (A, B, C). The original order was //! Version with intuitive order (A, B, C). The original order was

View File

@ -1,230 +0,0 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2013 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2013 Bruno Lalande, Paris, France.
// Copyright (c) 2013 Mateusz Loskot, London, UK.
// Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_RECALCULATE_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RECALCULATE_HPP
#include <cstddef>
#include <boost/concept/requires.hpp>
#include <boost/concept_check.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/size.hpp>
#include <boost/geometry/arithmetic/arithmetic.hpp>
#include <boost/geometry/algorithms/append.hpp>
#include <boost/geometry/algorithms/clear.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/interior_rings.hpp>
#include <boost/geometry/core/exterior_ring.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace recalculate
{
template <std::size_t Dimension>
struct recalculate_point
{
template <typename Point1, typename Point2, typename Strategy>
static inline void apply(Point1& point1, Point2 const& point2, Strategy const& strategy)
{
std::size_t const dim = Dimension - 1;
geometry::set<dim>(point1, strategy.template apply<dim>(geometry::get<dim>(point2)));
recalculate_point<dim>::apply(point1, point2, strategy);
}
};
template <>
struct recalculate_point<0>
{
template <typename Point1, typename Point2, typename Strategy>
static inline void apply(Point1&, Point2 const&, Strategy const&)
{
}
};
template <std::size_t Dimension>
struct recalculate_indexed
{
template <typename Geometry1, typename Geometry2, typename Strategy>
static inline void apply(Geometry1& geometry1, Geometry2 const& geometry2, Strategy const& strategy)
{
// Do it for both indices in one dimension
static std::size_t const dim = Dimension - 1;
geometry::set<0, dim>(geometry1, strategy.template apply<dim>(geometry::get<0, dim>(geometry2)));
geometry::set<1, dim>(geometry1, strategy.template apply<dim>(geometry::get<1, dim>(geometry2)));
recalculate_indexed<dim>::apply(geometry1, geometry2, strategy);
}
};
template <>
struct recalculate_indexed<0>
{
template <typename Geometry1, typename Geometry2, typename Strategy>
static inline void apply(Geometry1& , Geometry2 const& , Strategy const& )
{
}
};
struct range_to_range
{
template
<
typename Range1,
typename Range2,
typename Strategy
>
static inline void apply(Range1& destination, Range2 const& source,
Strategy const& strategy)
{
typedef typename geometry::point_type<Range2>::type point_type;
typedef recalculate_point<geometry::dimension<point_type>::value> per_point;
geometry::clear(destination);
for (auto const& source_point : source)
{
point_type p;
per_point::apply(p, source_point, strategy);
geometry::append(destination, p);
}
}
};
struct polygon_to_polygon
{
private:
template
<
typename IteratorIn,
typename IteratorOut,
typename Strategy
>
static inline void iterate(IteratorIn begin, IteratorIn end,
IteratorOut it_out,
Strategy const& strategy)
{
for (IteratorIn it_in = begin; it_in != end; ++it_in, ++it_out)
{
range_to_range::apply(*it_out, *it_in, strategy);
}
}
template
<
typename InteriorRingsOut,
typename InteriorRingsIn,
typename Strategy
>
static inline void apply_interior_rings(
InteriorRingsOut& interior_rings_out,
InteriorRingsIn const& interior_rings_in,
Strategy const& strategy)
{
traits::resize<InteriorRingsOut>::apply(interior_rings_out,
boost::size(interior_rings_in));
iterate(
boost::begin(interior_rings_in), boost::end(interior_rings_in),
boost::begin(interior_rings_out),
strategy);
}
public:
template
<
typename Polygon1,
typename Polygon2,
typename Strategy
>
static inline void apply(Polygon1& destination, Polygon2 const& source,
Strategy const& strategy)
{
range_to_range::apply(geometry::exterior_ring(destination),
geometry::exterior_ring(source), strategy);
apply_interior_rings(geometry::interior_rings(destination),
geometry::interior_rings(source), strategy);
}
};
}} // namespace detail::recalculate
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template
<
typename Geometry1,
typename Geometry2,
typename Tag1 = typename geometry::tag<Geometry1>::type,
typename Tag2 = typename geometry::tag<Geometry2>::type
>
struct recalculate : not_implemented<Tag1, Tag2>
{};
template <typename Point1, typename Point2>
struct recalculate<Point1, Point2, point_tag, point_tag>
: detail::recalculate::recalculate_point<geometry::dimension<Point1>::value>
{};
template <typename Box1, typename Box2>
struct recalculate<Box1, Box2, box_tag, box_tag>
: detail::recalculate::recalculate_indexed<geometry::dimension<Box1>::value>
{};
template <typename Segment1, typename Segment2>
struct recalculate<Segment1, Segment2, segment_tag, segment_tag>
: detail::recalculate::recalculate_indexed<geometry::dimension<Segment1>::value>
{};
template <typename Polygon1, typename Polygon2>
struct recalculate<Polygon1, Polygon2, polygon_tag, polygon_tag>
: detail::recalculate::polygon_to_polygon
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
template <typename Geometry1, typename Geometry2, typename Strategy>
inline void recalculate(Geometry1& geometry1, Geometry2 const& geometry2, Strategy const& strategy)
{
concepts::check<Geometry1>();
concepts::check<Geometry2 const>();
// static assert dimensions (/types) are the same
dispatch::recalculate<Geometry1, Geometry2>::apply(geometry1, geometry2, strategy);
}
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_RECALCULATE_HPP

View File

@ -2,11 +2,11 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2013-2022. // This file was modified by Oracle on 2013-2024.
// Modifications copyright (c) 2013-2022 Oracle and/or its affiliates. // Modifications copyright (c) 2013-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -22,9 +22,6 @@
#include <boost/geometry/geometries/helper_geometry.hpp> #include <boost/geometry/geometries/helper_geometry.hpp>
#include <boost/geometry/policies/robustness/get_rescale_policy.hpp>
#include <boost/geometry/policies/robustness/segment_ratio_type.hpp>
#include <boost/geometry/strategies/cartesian/point_in_point.hpp> #include <boost/geometry/strategies/cartesian/point_in_point.hpp>
#include <boost/geometry/strategies/spherical/point_in_point.hpp> #include <boost/geometry/strategies/spherical/point_in_point.hpp>
#include <boost/geometry/strategies/distance.hpp> #include <boost/geometry/strategies/distance.hpp>
@ -60,24 +57,13 @@ struct get_turns
typename geometry::point_type<Geometry1>::type typename geometry::point_type<Geometry1>::type
>::type; >::type;
template <typename Strategy>
struct robust_policy_type
: geometry::rescale_overlay_policy_type
<
Geometry1,
Geometry2,
typename Strategy::cs_tag
>
{};
template template
< <
typename Strategy, typename Strategy
typename RobustPolicy = typename robust_policy_type<Strategy>::type
> >
struct turn_info_type struct turn_info_type
{ {
using ratio_type = typename segment_ratio_type<turn_point_type, RobustPolicy>::type; using ratio_type = typename segment_ratio_type<turn_point_type>::type;
using type = overlay::turn_info using type = overlay::turn_info
< <
turn_point_type, turn_point_type,
@ -95,23 +81,6 @@ struct get_turns
Geometry2 const& geometry2, Geometry2 const& geometry2,
InterruptPolicy & interrupt_policy, InterruptPolicy & interrupt_policy,
Strategy const& strategy) Strategy const& strategy)
{
typedef typename robust_policy_type<Strategy>::type robust_policy_t;
robust_policy_t robust_policy
= geometry::get_rescale_policy<robust_policy_t>(
geometry1, geometry2, strategy);
apply(turns, geometry1, geometry2, interrupt_policy, strategy, robust_policy);
}
template <typename Turns, typename InterruptPolicy, typename Strategy, typename RobustPolicy>
static inline void apply(Turns & turns,
Geometry1 const& geometry1,
Geometry2 const& geometry2,
InterruptPolicy & interrupt_policy,
Strategy const& strategy,
RobustPolicy const& robust_policy)
{ {
static const bool reverse1 = detail::overlay::do_reverse static const bool reverse1 = detail::overlay::do_reverse
< <
@ -133,7 +102,7 @@ struct get_turns
reverse2, reverse2,
GetTurnPolicy GetTurnPolicy
>::apply(0, geometry1, 1, geometry2, >::apply(0, geometry1, 1, geometry2,
strategy, robust_policy, strategy,
turns, interrupt_policy); turns, interrupt_policy);
} }
}; };

View File

@ -2,8 +2,9 @@
// Copyright (c) 2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2015-2021. // This file was modified by Oracle on 2015-2024.
// Modifications copyright (c) 2015-2021, Oracle and/or its affiliates. // Modifications copyright (c) 2015-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -15,8 +16,6 @@
#include <boost/geometry/core/access.hpp> #include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_type.hpp> #include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/algorithms/detail/recalculate.hpp>
#include <boost/geometry/policies/robustness/robust_point_type.hpp>
// For spherical/geographic longitudes covered_by point/box // For spherical/geographic longitudes covered_by point/box
#include <boost/geometry/strategies/cartesian/point_in_box.hpp> #include <boost/geometry/strategies/cartesian/point_in_box.hpp>
@ -121,41 +120,28 @@ template
< <
std::size_t Dimension, std::size_t Dimension,
typename Point, typename Point,
typename Box, typename Box
typename RobustPolicy
> >
inline bool preceding(int dir, inline bool preceding(int dir,
Point const& point, Point const& point,
Box const& point_box, Box const& point_box,
Box const& other_box, Box const& other_box)
RobustPolicy const& robust_policy)
{ {
using box_point_type = typename geometry::point_type<Box>::type; return preceding_check<Dimension, Box>::apply(dir, point, point_box, other_box);
typename geometry::robust_point_type<box_point_type, RobustPolicy>::type robust_point;
geometry::recalculate(robust_point, point, robust_policy);
// After recalculate() to prevent warning: 'robust_point' may be used uninitialized
assert_coordinate_type_equal(robust_point, point_box);
return preceding_check<Dimension, Box>::apply(dir, robust_point,
point_box,
other_box);
} }
template template
< <
std::size_t Dimension, std::size_t Dimension,
typename Point, typename Point,
typename Box, typename Box
typename RobustPolicy
> >
inline bool exceeding(int dir, inline bool exceeding(int dir,
Point const& point, Point const& point,
Box const& point_box, Box const& point_box,
Box const& other_box, Box const& other_box)
RobustPolicy const& robust_policy)
{ {
return preceding<Dimension>(-dir, point, point_box, other_box, robust_policy); return preceding<Dimension>(-dir, point, point_box, other_box);
} }

View File

@ -5,11 +5,11 @@
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// Copyright (c) 2014-2015 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2014-2015 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2013-2021. // This file was modified by Oracle on 2013-2024.
// Modifications copyright (c) 2013-2021 Oracle and/or its affiliates. // Modifications copyright (c) 2013-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@ -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/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>
@ -52,8 +51,6 @@
#include <boost/geometry/geometries/concepts/check.hpp> #include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/geometries/box.hpp> #include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/segment.hpp> #include <boost/geometry/geometries/segment.hpp>
#include <boost/geometry/policies/robustness/no_rescale_policy.hpp>
#include <boost/geometry/policies/robustness/robust_point_type.hpp>
#include <boost/geometry/util/math.hpp> #include <boost/geometry/util/math.hpp>
#include <boost/geometry/util/normalize_spheroidal_coordinates.hpp> #include <boost/geometry/util/normalize_spheroidal_coordinates.hpp>
#include <boost/geometry/util/sequence.hpp> #include <boost/geometry/util/sequence.hpp>
@ -386,19 +383,15 @@ struct sectionalize_part
template template
< <
typename Iterator, typename Iterator,
typename RobustPolicy,
typename Sections, typename Sections,
typename Strategy typename Strategy
> >
static inline void apply(Sections& sections, static inline void apply(Sections& sections,
Iterator begin, Iterator end, Iterator begin, Iterator end,
RobustPolicy const& robust_policy,
Strategy const& strategy, Strategy const& strategy,
ring_identifier ring_id, ring_identifier ring_id,
std::size_t max_count) std::size_t max_count)
{ {
boost::ignore_unused(robust_policy);
using section_type = typename boost::range_value<Sections>::type; using section_type = typename boost::range_value<Sections>::type;
using box_type = typename section_type::box_type; using box_type = typename section_type::box_type;
using point_type = typename geometry::point_type<box_type>::type; using point_type = typename geometry::point_type<box_type>::type;
@ -409,12 +402,6 @@ struct sectionalize_part
== util::sequence_size<DimensionVector>::value == util::sequence_size<DimensionVector>::value
); );
using robust_point_type = typename geometry::robust_point_type
<
point_type,
RobustPolicy
>::type;
std::size_t const count = std::distance(begin, end); std::size_t const count = std::distance(begin, end);
if (count == 0) if (count == 0)
{ {
@ -429,23 +416,20 @@ struct sectionalize_part
std::size_t last_non_duplicate_index = sections.size(); std::size_t last_non_duplicate_index = sections.size();
Iterator it = begin; Iterator it = begin;
robust_point_type previous_robust_point; point_type previous_point;
geometry::recalculate(previous_robust_point, *it, robust_policy); geometry::detail::conversion::convert_point_to_point(*it, previous_point);
for(Iterator previous = it++; for (Iterator previous = it++; it != end; ++previous, ++it, index++)
it != end;
++previous, ++it, index++)
{ {
robust_point_type current_robust_point; point_type current_point;
geometry::recalculate(current_robust_point, *it, robust_policy); geometry::detail::conversion::convert_point_to_point(*it, current_point);
model::referring_segment<robust_point_type> robust_segment( model::referring_segment<point_type> segment(previous_point, current_point);
previous_robust_point, current_robust_point);
int direction_classes[dimension_count] = {0}; int direction_classes[dimension_count] = {0};
get_direction_loop get_direction_loop
< <
point_type, DimensionVector, 0, dimension_count point_type, DimensionVector, 0, dimension_count
>::apply(robust_segment, direction_classes); >::apply(segment, direction_classes);
// if "dir" == 0 for all point-dimensions, it is duplicate. // if "dir" == 0 for all point-dimensions, it is duplicate.
// Those sections might be omitted, if wished, lateron // Those sections might be omitted, if wished, lateron
@ -459,7 +443,7 @@ struct sectionalize_part
if (check_duplicate_loop if (check_duplicate_loop
< <
0, geometry::dimension<point_type>::type::value 0, geometry::dimension<point_type>::type::value
>::apply(robust_segment) >::apply(segment)
) )
{ {
duplicate = true; duplicate = true;
@ -513,15 +497,15 @@ struct sectionalize_part
// In cartesian this is envelope of previous point expanded with current point // In cartesian this is envelope of previous point expanded with current point
// in non-cartesian this is envelope of a segment // in non-cartesian this is envelope of a segment
box_first_in_section<typename cs_tag<robust_point_type>::type> box_first_in_section<typename cs_tag<point_type>::type>
::apply(section.bounding_box, previous_robust_point, current_robust_point, strategy); ::apply(section.bounding_box, previous_point, current_point, strategy);
} }
else else
{ {
// In cartesian this is expand with current point // In cartesian this is expand with current point
// in non-cartesian this is expand with a segment // in non-cartesian this is expand with a segment
box_next_in_section<typename cs_tag<robust_point_type>::type> box_next_in_section<typename cs_tag<point_type>::type>
::apply(section.bounding_box, previous_robust_point, current_robust_point, strategy); ::apply(section.bounding_box, previous_point, current_point, strategy);
} }
section.end_index = index + 1; section.end_index = index + 1;
@ -530,7 +514,7 @@ struct sectionalize_part
{ {
ndi++; ndi++;
} }
previous_robust_point = current_robust_point; previous_point = current_point;
} }
// Add last section if applicable // Add last section if applicable
@ -564,12 +548,10 @@ struct sectionalize_range
template template
< <
typename Range, typename Range,
typename RobustPolicy,
typename Sections, typename Sections,
typename Strategy typename Strategy
> >
static inline void apply(Range const& range, static inline void apply(Range const& range,
RobustPolicy const& robust_policy,
Sections& sections, Sections& sections,
Strategy const& strategy, Strategy const& strategy,
ring_identifier ring_id, ring_identifier ring_id,
@ -597,7 +579,7 @@ struct sectionalize_range
sectionalize_part<DimensionVector>::apply(sections, sectionalize_part<DimensionVector>::apply(sections,
boost::begin(view), boost::end(view), boost::begin(view), boost::end(view),
robust_policy, strategy, strategy,
ring_id, max_count); ring_id, max_count);
} }
}; };
@ -612,12 +594,10 @@ struct sectionalize_polygon
template template
< <
typename Polygon, typename Polygon,
typename RobustPolicy,
typename Sections, typename Sections,
typename Strategy typename Strategy
> >
static inline void apply(Polygon const& poly, static inline void apply(Polygon const& poly,
RobustPolicy const& robust_policy,
Sections& sections, Sections& sections,
Strategy const& strategy, Strategy const& strategy,
ring_identifier ring_id, ring_identifier ring_id,
@ -629,7 +609,7 @@ struct sectionalize_polygon
>; >;
ring_id.ring_index = -1; ring_id.ring_index = -1;
sectionalizer::apply(exterior_ring(poly), robust_policy, sections, sectionalizer::apply(exterior_ring(poly), sections,
strategy, ring_id, max_count); strategy, ring_id, max_count);
ring_id.ring_index++; ring_id.ring_index++;
@ -637,7 +617,7 @@ struct sectionalize_polygon
for (auto it = boost::begin(rings); it != boost::end(rings); for (auto it = boost::begin(rings); it != boost::end(rings);
++it, ++ring_id.ring_index) ++it, ++ring_id.ring_index)
{ {
sectionalizer::apply(*it, robust_policy, sections, sectionalizer::apply(*it, sections,
strategy, ring_id, max_count); strategy, ring_id, max_count);
} }
} }
@ -649,12 +629,10 @@ struct sectionalize_box
template template
< <
typename Box, typename Box,
typename RobustPolicy,
typename Sections, typename Sections,
typename Strategy typename Strategy
> >
static inline void apply(Box const& box, static inline void apply(Box const& box,
RobustPolicy const& robust_policy,
Sections& sections, Sections& sections,
Strategy const& strategy, Strategy const& strategy,
ring_identifier const& ring_id, std::size_t max_count) ring_identifier const& ring_id, std::size_t max_count)
@ -686,7 +664,7 @@ struct sectionalize_box
sectionalize_range sectionalize_range
< <
closed, false, DimensionVector closed, false, DimensionVector
>::apply(points, robust_policy, sections, >::apply(points, sections,
strategy, ring_id, max_count); strategy, ring_id, max_count);
} }
}; };
@ -697,12 +675,10 @@ struct sectionalize_multi
template template
< <
typename MultiGeometry, typename MultiGeometry,
typename RobustPolicy,
typename Sections, typename Sections,
typename Strategy typename Strategy
> >
static inline void apply(MultiGeometry const& multi, static inline void apply(MultiGeometry const& multi,
RobustPolicy const& robust_policy,
Sections& sections, Sections& sections,
Strategy const& strategy, Strategy const& strategy,
ring_identifier ring_id, ring_identifier ring_id,
@ -711,7 +687,7 @@ struct sectionalize_multi
ring_id.multi_index = 0; ring_id.multi_index = 0;
for (auto it = boost::begin(multi); it != boost::end(multi); ++it, ++ring_id.multi_index) for (auto it = boost::begin(multi); it != boost::end(multi); ++it, ++ring_id.multi_index)
{ {
Policy::apply(*it, robust_policy, sections, Policy::apply(*it, sections,
strategy, strategy,
ring_id, max_count); ring_id, max_count);
} }
@ -869,7 +845,6 @@ struct sectionalize<multi_linestring_tag, MultiLinestring, Reverse, DimensionVec
\tparam Geometry type of geometry to check \tparam Geometry type of geometry to check
\tparam Sections type of sections to create \tparam Sections type of sections to create
\param geometry geometry to create sections from \param geometry geometry to create sections from
\param robust_policy policy to handle robustness issues
\param sections structure with sections \param sections structure with sections
\param strategy strategy for envelope calculation \param strategy strategy for envelope calculation
\param expand_strategy strategy for partitions \param expand_strategy strategy for partitions
@ -884,11 +859,9 @@ template
typename DimensionVector, typename DimensionVector,
typename Geometry, typename Geometry,
typename Sections, typename Sections,
typename RobustPolicy,
typename Strategy typename Strategy
> >
inline void sectionalize(Geometry const& geometry, inline void sectionalize(Geometry const& geometry,
RobustPolicy const& robust_policy,
Sections& sections, Sections& sections,
Strategy const& strategy, Strategy const& strategy,
int source_index = 0, int source_index = 0,
@ -907,7 +880,7 @@ inline void sectionalize(Geometry const& geometry,
Geometry, Geometry,
Reverse, Reverse,
DimensionVector DimensionVector
>::apply(geometry, robust_policy, sections, >::apply(geometry, sections,
strategy, strategy,
ring_id, max_count); ring_id, max_count);
@ -920,11 +893,9 @@ template
bool Reverse, bool Reverse,
typename DimensionVector, typename DimensionVector,
typename Geometry, typename Geometry,
typename Sections, typename Sections
typename RobustPolicy
> >
inline void sectionalize(Geometry const& geometry, inline void sectionalize(Geometry const& geometry,
RobustPolicy const& robust_policy,
Sections& sections, Sections& sections,
int source_index = 0, int source_index = 0,
std::size_t max_count = 10) std::size_t max_count = 10)
@ -939,7 +910,7 @@ inline void sectionalize(Geometry const& geometry,
boost::geometry::sectionalize boost::geometry::sectionalize
< <
Reverse, DimensionVector Reverse, DimensionVector
>(geometry, robust_policy, sections, >(geometry, sections,
strategy_type(), strategy_type(),
source_index, max_count); source_index, max_count);
} }

View File

@ -5,9 +5,9 @@
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// Copyright (c) 2013-2022 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2013-2022 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2013-2022. // This file was modified by Oracle on 2013-2024.
// Modifications copyright (c) 2013-2022, Oracle and/or its affiliates. // Modifications copyright (c) 2013-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
@ -39,8 +39,6 @@
#include <boost/geometry/geometries/helper_geometry.hpp> #include <boost/geometry/geometries/helper_geometry.hpp>
#include <boost/geometry/policies/robustness/no_rescale_policy.hpp>
#include <boost/geometry/strategies/relate/cartesian.hpp> #include <boost/geometry/strategies/relate/cartesian.hpp>
#include <boost/geometry/strategies/relate/geographic.hpp> #include <boost/geometry/strategies/relate/geographic.hpp>
#include <boost/geometry/strategies/relate/spherical.hpp> #include <boost/geometry/strategies/relate/spherical.hpp>
@ -255,7 +253,7 @@ struct areal_areal
detail::overlay::do_reverse<geometry::point_order<Geometry1>::value>::value, detail::overlay::do_reverse<geometry::point_order<Geometry1>::value>::value,
detail::overlay::do_reverse<geometry::point_order<Geometry2>::value>::value, detail::overlay::do_reverse<geometry::point_order<Geometry2>::value>::value,
detail::overlay::assign_null_policy detail::overlay::assign_null_policy
>(geometry1, geometry2, strategy, detail::no_rescale_policy(), turns, policy); >(geometry1, geometry2, strategy, turns, policy);
return policy.result() return policy.result()
&& ! geometry::detail::touches::rings_containing(geometry1, geometry2, strategy) && ! geometry::detail::touches::rings_containing(geometry1, geometry2, strategy)
@ -526,7 +524,7 @@ struct self_touches
detail::self_get_turn_points::get_turns detail::self_get_turn_points::get_turns
< <
false, policy_type false, policy_type
>::apply(geometry, strategy, detail::no_rescale_policy(), >::apply(geometry, strategy,
turns, policy, 0, true); turns, policy, 0, true);
return policy.result(); return policy.result();

View File

@ -2,8 +2,8 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017-2023. // This file was modified by Oracle on 2017-2024.
// Modifications copyright (c) 2017-2023, Oracle and/or its affiliates. // Modifications copyright (c) 2017-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -22,7 +22,6 @@
#include <boost/geometry/algorithms/detail/visit.hpp> #include <boost/geometry/algorithms/detail/visit.hpp>
#include <boost/geometry/core/geometry_types.hpp> #include <boost/geometry/core/geometry_types.hpp>
#include <boost/geometry/geometries/adapted/boost_variant.hpp> // For backward compatibility #include <boost/geometry/geometries/adapted/boost_variant.hpp> // For backward compatibility
#include <boost/geometry/policies/robustness/get_rescale_policy.hpp>
#include <boost/geometry/strategies/default_strategy.hpp> #include <boost/geometry/strategies/default_strategy.hpp>
#include <boost/geometry/strategies/detail.hpp> #include <boost/geometry/strategies/detail.hpp>
#include <boost/geometry/strategies/relate/cartesian.hpp> #include <boost/geometry/strategies/relate/cartesian.hpp>
@ -62,12 +61,10 @@ struct call_intersection_insert
template template
< <
typename OutputIterator, typename OutputIterator,
typename RobustPolicy,
typename Strategy typename Strategy
> >
static inline OutputIterator apply(Geometry1 const& geometry1, static inline OutputIterator apply(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -78,7 +75,7 @@ struct call_intersection_insert
overlay_difference, overlay_difference,
geometry::detail::overlay::do_reverse<geometry::point_order<Geometry1>::value>::value, geometry::detail::overlay::do_reverse<geometry::point_order<Geometry1>::value>::value,
geometry::detail::overlay::do_reverse<geometry::point_order<Geometry2>::value, true>::value geometry::detail::overlay::do_reverse<geometry::point_order<Geometry2>::value, true>::value
>::apply(geometry1, geometry2, robust_policy, out, strategy); >::apply(geometry1, geometry2, out, strategy);
} }
}; };
@ -86,10 +83,9 @@ struct call_intersection_insert
template <typename Geometry1, typename Geometry2, typename SingleOut, typename OutTag> template <typename Geometry1, typename Geometry2, typename SingleOut, typename OutTag>
struct call_intersection_insert<Geometry1, Geometry2, SingleOut, OutTag, true> struct call_intersection_insert<Geometry1, Geometry2, SingleOut, OutTag, true>
{ {
template <typename OutputIterator, typename RobustPolicy, typename Strategy> template <typename OutputIterator, typename Strategy>
static inline OutputIterator apply(Geometry1 const& geometry1, static inline OutputIterator apply(Geometry1 const& geometry1,
Geometry2 const& , Geometry2 const& ,
RobustPolicy const& ,
OutputIterator out, OutputIterator out,
Strategy const& ) Strategy const& )
{ {
@ -149,12 +145,10 @@ struct call_intersection_insert
template template
< <
typename OutputIterator, typename OutputIterator,
typename RobustPolicy,
typename Strategy typename Strategy
> >
static inline OutputIterator apply(Geometry1 const& geometry1, static inline OutputIterator apply(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -162,7 +156,7 @@ struct call_intersection_insert
< <
Geometry1, Geometry2, Geometry1, Geometry2,
typename base_t::access::type typename base_t::access::type
>::apply(geometry1, geometry2, robust_policy, >::apply(geometry1, geometry2,
base_t::access::get(out), strategy); base_t::access::get(out), strategy);
return out; return out;
@ -188,12 +182,10 @@ struct call_intersection_insert
template template
< <
typename OutputIterator, typename OutputIterator,
typename RobustPolicy,
typename Strategy typename Strategy
> >
static inline OutputIterator apply(Geometry1 const& geometry1, static inline OutputIterator apply(Geometry1 const& geometry1,
Geometry2 const& , Geometry2 const& ,
RobustPolicy const& ,
OutputIterator out, OutputIterator out,
Strategy const& ) Strategy const& )
{ {
@ -244,21 +236,10 @@ inline OutputIterator difference_insert(Geometry1 const& geometry1,
//concepts::check<GeometryOut>(); //concepts::check<GeometryOut>();
geometry::detail::output_geometry_concept_check<GeometryOut>::apply(); geometry::detail::output_geometry_concept_check<GeometryOut>::apply();
typedef typename geometry::rescale_overlay_policy_type
<
Geometry1,
Geometry2,
typename Strategy::cs_tag
>::type rescale_policy_type;
rescale_policy_type robust_policy
= geometry::get_rescale_policy<rescale_policy_type>(
geometry1, geometry2, strategy);
return geometry::detail::difference::call_intersection_insert return geometry::detail::difference::call_intersection_insert
< <
Geometry1, Geometry2, GeometryOut Geometry1, Geometry2, GeometryOut
>::apply(geometry1, geometry2, robust_policy, out, strategy); >::apply(geometry1, geometry2, out, strategy);
} }
/*! /*!

View File

@ -2,8 +2,8 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2015-2023. // This file was modified by Oracle on 2015-2024.
// Modifications copyright (c) 2015-2023 Oracle and/or its affiliates. // Modifications copyright (c) 2015-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -22,7 +22,6 @@
#include <boost/geometry/algorithms/union.hpp> #include <boost/geometry/algorithms/union.hpp>
#include <boost/geometry/geometries/adapted/boost_variant.hpp> #include <boost/geometry/geometries/adapted/boost_variant.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp> #include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/policies/robustness/get_rescale_policy.hpp>
#include <boost/geometry/strategies/default_strategy.hpp> #include <boost/geometry/strategies/default_strategy.hpp>
#include <boost/geometry/strategies/detail.hpp> #include <boost/geometry/strategies/detail.hpp>
#include <boost/geometry/strategies/relate/cartesian.hpp> #include <boost/geometry/strategies/relate/cartesian.hpp>
@ -45,13 +44,11 @@ struct compute_difference
< <
typename Geometry1, typename Geometry1,
typename Geometry2, typename Geometry2,
typename RobustPolicy,
typename OutputIterator, typename OutputIterator,
typename Strategy typename Strategy
> >
static inline OutputIterator apply(Geometry1 const& geometry1, static inline OutputIterator apply(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -69,7 +66,7 @@ struct compute_difference
< <
geometry::point_order<Geometry2>::value, true geometry::point_order<Geometry2>::value, true
>::value >::value
>::apply(geometry1, geometry2, robust_policy, out, strategy); >::apply(geometry1, geometry2, out, strategy);
} }
}; };
@ -80,25 +77,23 @@ struct sym_difference_generic
{ {
template template
< <
typename RobustPolicy,
typename OutputIterator, typename OutputIterator,
typename Strategy typename Strategy
> >
static inline OutputIterator apply(Geometry1 const& geometry1, static inline OutputIterator apply(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
out = compute_difference out = compute_difference
< <
GeometryOut GeometryOut
>::apply(geometry1, geometry2, robust_policy, out, strategy); >::apply(geometry1, geometry2, out, strategy);
return compute_difference return compute_difference
< <
GeometryOut GeometryOut
>::apply(geometry2, geometry1, robust_policy, out, strategy); >::apply(geometry2, geometry1, out, strategy);
} }
}; };
@ -108,13 +103,11 @@ struct sym_difference_areal_areal
{ {
template template
< <
typename RobustPolicy,
typename OutputIterator, typename OutputIterator,
typename Strategy typename Strategy
> >
static inline OutputIterator apply(Areal1 const& areal1, static inline OutputIterator apply(Areal1 const& areal1,
Areal2 const& areal2, Areal2 const& areal2,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -131,19 +124,19 @@ struct sym_difference_areal_areal
compute_difference compute_difference
< <
GeometryOut GeometryOut
>::apply(areal1, areal2, robust_policy, oit12, strategy); >::apply(areal1, areal2, oit12, strategy);
compute_difference compute_difference
< <
GeometryOut GeometryOut
>::apply(areal2, areal1, robust_policy, oit21, strategy); >::apply(areal2, areal1, oit21, strategy);
return geometry::dispatch::union_insert return geometry::dispatch::union_insert
< <
helper_geometry_type, helper_geometry_type,
helper_geometry_type, helper_geometry_type,
GeometryOut GeometryOut
>::apply(diff12, diff21, robust_policy, out, strategy); >::apply(diff12, diff21, out, strategy);
} }
}; };
@ -160,13 +153,11 @@ struct sym_difference_same_inputs_tupled_output
< <
typename Geometry1, typename Geometry1,
typename Geometry2, typename Geometry2,
typename RobustPolicy,
typename OutputIterator, typename OutputIterator,
typename Strategy typename Strategy
> >
static inline OutputIterator apply(Geometry1 const& geometry1, static inline OutputIterator apply(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -178,7 +169,7 @@ struct sym_difference_same_inputs_tupled_output
access::get(out) = Algorithm access::get(out) = Algorithm
< <
typename access::type, Geometry1, Geometry2 typename access::type, Geometry1, Geometry2
>::apply(geometry1, geometry2, robust_policy, access::get(out), strategy); >::apply(geometry1, geometry2, access::get(out), strategy);
return out; return out;
} }
@ -199,20 +190,18 @@ struct sym_difference_different_inputs_tupled_output
< <
typename Geometry1, typename Geometry1,
typename Geometry2, typename Geometry2,
typename RobustPolicy,
typename OutputIterator, typename OutputIterator,
typename Strategy typename Strategy
> >
static inline OutputIterator apply(Geometry1 const& geometry1, static inline OutputIterator apply(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
return sym_difference_different_inputs_tupled_output return sym_difference_different_inputs_tupled_output
< <
GeometryOut, SingleTag2, SingleTag1 GeometryOut, SingleTag2, SingleTag1
>::apply(geometry2, geometry1, robust_policy, out, strategy); >::apply(geometry2, geometry1, out, strategy);
} }
}; };
@ -231,13 +220,11 @@ struct sym_difference_different_inputs_tupled_output
< <
typename Geometry1, typename Geometry1,
typename Geometry2, typename Geometry2,
typename RobustPolicy,
typename OutputIterator, typename OutputIterator,
typename Strategy typename Strategy
> >
static inline OutputIterator apply(Geometry1 const& geometry1, static inline OutputIterator apply(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -253,7 +240,7 @@ struct sym_difference_different_inputs_tupled_output
access1::get(out) = compute_difference access1::get(out) = compute_difference
< <
typename access1::type typename access1::type
>::apply(geometry1, geometry2, robust_policy, access1::get(out), strategy); >::apply(geometry1, geometry2, access1::get(out), strategy);
access2::get(out) = geometry::detail::convert_to_output access2::get(out) = geometry::detail::convert_to_output
< <
@ -452,21 +439,10 @@ inline OutputIterator sym_difference_insert(Geometry1 const& geometry1,
//concepts::check<GeometryOut>(); //concepts::check<GeometryOut>();
geometry::detail::output_geometry_concept_check<GeometryOut>::apply(); geometry::detail::output_geometry_concept_check<GeometryOut>::apply();
typedef typename geometry::rescale_overlay_policy_type
<
Geometry1,
Geometry2,
typename Strategy::cs_tag
>::type rescale_policy_type;
rescale_policy_type robust_policy
= geometry::get_rescale_policy<rescale_policy_type>(
geometry1, geometry2, strategy);
return dispatch::sym_difference_insert return dispatch::sym_difference_insert
< <
Geometry1, Geometry2, GeometryOut Geometry1, Geometry2, GeometryOut
>::apply(geometry1, geometry2, robust_policy, out, strategy); >::apply(geometry1, geometry2, out, strategy);
} }

View File

@ -2,8 +2,8 @@
// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2014-2023. // This file was modified by Oracle on 2014-2024.
// Modifications copyright (c) 2014-2023 Oracle and/or its affiliates. // Modifications copyright (c) 2014-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -27,7 +27,6 @@
#include <boost/geometry/core/reverse_dispatch.hpp> #include <boost/geometry/core/reverse_dispatch.hpp>
#include <boost/geometry/geometries/adapted/boost_variant.hpp> #include <boost/geometry/geometries/adapted/boost_variant.hpp>
#include <boost/geometry/geometries/concepts/check.hpp> #include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/policies/robustness/get_rescale_policy.hpp>
#include <boost/geometry/strategies/default_strategy.hpp> #include <boost/geometry/strategies/default_strategy.hpp>
#include <boost/geometry/strategies/detail.hpp> #include <boost/geometry/strategies/detail.hpp>
#include <boost/geometry/strategies/relate/cartesian.hpp> #include <boost/geometry/strategies/relate/cartesian.hpp>
@ -76,17 +75,16 @@ struct union_insert
true true
> >
{ {
template <typename RobustPolicy, typename OutputIterator, typename Strategy> template <typename OutputIterator, typename Strategy>
static inline OutputIterator apply(Geometry1 const& g1, static inline OutputIterator apply(Geometry1 const& g1,
Geometry2 const& g2, Geometry2 const& g2,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
return union_insert return union_insert
< <
Geometry2, Geometry1, GeometryOut Geometry2, Geometry1, GeometryOut
>::apply(g2, g1, robust_policy, out, strategy); >::apply(g2, g1, out, strategy);
} }
}; };
@ -181,17 +179,16 @@ struct union_insert
SingleTupledOut, single_tag, single_tag SingleTupledOut, single_tag, single_tag
>; >;
template <typename RobustPolicy, typename OutputIterator, typename Strategy> template <typename OutputIterator, typename Strategy>
static inline OutputIterator apply(Geometry1 const& g1, static inline OutputIterator apply(Geometry1 const& g1,
Geometry2 const& g2, Geometry2 const& g2,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
access::get(out) = union_insert access::get(out) = union_insert
< <
Geometry2, Geometry1, typename access::type Geometry2, Geometry1, typename access::type
>::apply(g2, g1, robust_policy, access::get(out), strategy); >::apply(g2, g1, access::get(out), strategy);
return out; return out;
} }
@ -217,10 +214,9 @@ struct union_insert_tupled_different
SingleTupledOut, SingleTag2, SingleTag2 SingleTupledOut, SingleTag2, SingleTag2
>; >;
template <typename RobustPolicy, typename OutputIterator, typename Strategy> template <typename OutputIterator, typename Strategy>
static inline OutputIterator apply(Geometry1 const& g1, static inline OutputIterator apply(Geometry1 const& g1,
Geometry2 const& g2, Geometry2 const& g2,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
@ -231,7 +227,7 @@ struct union_insert_tupled_different
overlay_difference, overlay_difference,
geometry::detail::overlay::do_reverse<geometry::point_order<Geometry1>::value>::value, geometry::detail::overlay::do_reverse<geometry::point_order<Geometry1>::value>::value,
geometry::detail::overlay::do_reverse<geometry::point_order<Geometry2>::value, true>::value geometry::detail::overlay::do_reverse<geometry::point_order<Geometry2>::value, true>::value
>::apply(g1, g2, robust_policy, access1::get(out), strategy); >::apply(g1, g2, access1::get(out), strategy);
access2::get(out) = geometry::detail::convert_to_output access2::get(out) = geometry::detail::convert_to_output
< <
@ -254,17 +250,16 @@ struct union_insert_tupled_different
Geometry1, Geometry2, SingleTupledOut, SingleTag1, SingleTag2, false Geometry1, Geometry2, SingleTupledOut, SingleTag1, SingleTag2, false
> >
{ {
template <typename RobustPolicy, typename OutputIterator, typename Strategy> template <typename OutputIterator, typename Strategy>
static inline OutputIterator apply(Geometry1 const& g1, static inline OutputIterator apply(Geometry1 const& g1,
Geometry2 const& g2, Geometry2 const& g2,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
return union_insert_tupled_different return union_insert_tupled_different
< <
Geometry2, Geometry1, SingleTupledOut, SingleTag2, SingleTag1, true Geometry2, Geometry1, SingleTupledOut, SingleTag2, SingleTag1, true
>::apply(g2, g1, robust_policy, out, strategy); >::apply(g2, g1, out, strategy);
} }
}; };
@ -303,17 +298,16 @@ struct union_insert
Geometry1, Geometry2, SingleTupledOut, single_tag2 Geometry1, Geometry2, SingleTupledOut, single_tag2
>; >;
template <typename RobustPolicy, typename OutputIterator, typename Strategy> template <typename OutputIterator, typename Strategy>
static inline OutputIterator apply(Geometry1 const& g1, static inline OutputIterator apply(Geometry1 const& g1,
Geometry2 const& g2, Geometry2 const& g2,
RobustPolicy const& robust_policy,
OutputIterator out, OutputIterator out,
Strategy const& strategy) Strategy const& strategy)
{ {
return union_insert_tupled_different return union_insert_tupled_different
< <
Geometry1, Geometry2, SingleTupledOut, single_tag1, single_tag2 Geometry1, Geometry2, SingleTupledOut, single_tag1, single_tag2
>::apply(g1, g2, robust_policy, out, strategy); >::apply(g1, g2, out, strategy);
} }
}; };
@ -359,20 +353,10 @@ inline OutputIterator union_insert(Geometry1 const& geometry1,
Geometry1, Geometry2 Geometry1, Geometry2
>::type strategy; >::type strategy;
using rescale_policy_type = typename geometry::rescale_overlay_policy_type
<
Geometry1,
Geometry2
>::type;
rescale_policy_type robust_policy
= geometry::get_rescale_policy<rescale_policy_type>(
geometry1, geometry2, strategy);
return dispatch::union_insert return dispatch::union_insert
< <
Geometry1, Geometry2, GeometryOut Geometry1, Geometry2, GeometryOut
>::apply(geometry1, geometry2, robust_policy, out, strategy); >::apply(geometry1, geometry2, out, strategy);
} }
@ -401,21 +385,10 @@ struct union_
GeometryOut GeometryOut
>::type; >::type;
using rescale_policy_type = typename geometry::rescale_overlay_policy_type
<
Geometry1,
Geometry2,
typename Strategy::cs_tag
>::type;
rescale_policy_type robust_policy
= geometry::get_rescale_policy<rescale_policy_type>(
geometry1, geometry2, strategy);
dispatch::union_insert dispatch::union_insert
< <
Geometry1, Geometry2, single_out Geometry1, Geometry2, single_out
>::apply(geometry1, geometry2, robust_policy, >::apply(geometry1, geometry2,
geometry::detail::output_geometry_back_inserter(geometry_out), geometry::detail::output_geometry_back_inserter(geometry_out),
strategy); strategy);
} }
@ -594,15 +567,6 @@ private:
template <typename Multi1, typename Multi2, typename Strategy> template <typename Multi1, typename Multi2, typename Strategy>
static inline void subtract_greater_topodim(Multi1 const& multi1, Multi2 const& multi2, Multi1& multi_out, Strategy const& strategy) static inline void subtract_greater_topodim(Multi1 const& multi1, Multi2 const& multi2, Multi1& multi_out, Strategy const& strategy)
{ {
using rescale_policy_type = typename geometry::rescale_overlay_policy_type
<
Multi1, Multi2
>::type;
rescale_policy_type robust_policy
= geometry::get_rescale_policy<rescale_policy_type>(
multi1, multi2, strategy);
geometry::dispatch::intersection_insert geometry::dispatch::intersection_insert
< <
Multi1, Multi2, Multi1, Multi2,
@ -610,7 +574,7 @@ private:
overlay_difference, overlay_difference,
geometry::detail::overlay::do_reverse<geometry::point_order<Multi1>::value>::value, geometry::detail::overlay::do_reverse<geometry::point_order<Multi1>::value>::value,
geometry::detail::overlay::do_reverse<geometry::point_order<Multi2>::value, true>::value geometry::detail::overlay::do_reverse<geometry::point_order<Multi2>::value, true>::value
>::apply(multi1, multi2, robust_policy, range::back_inserter(multi_out), strategy); >::apply(multi1, multi2, range::back_inserter(multi_out), strategy);
} }
*/ */
}; };

View File

@ -2,7 +2,7 @@
// Copyright (c) 2019-2021 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2019-2021 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2018-2023 Oracle and/or its affiliates. // Copyright (c) 2018-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -14,25 +14,5 @@
#define BOOST_GEOMETRY_CORE_CONFIG_HPP #define BOOST_GEOMETRY_CORE_CONFIG_HPP
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/config/pragma_message.hpp>
// If no define is specified, it uses BOOST_GEOMETRY_NO_ROBUSTNESS, which means: no rescaling.
// (Rescaling was an earlier approach to fix robustness issues.)
// However, if BOOST_GEOMETRY_ROBUSTNESS_ALTERNATIVE is specified, it flips the default.
#if !defined(BOOST_GEOMETRY_NO_ROBUSTNESS) && !defined(BOOST_GEOMETRY_USE_RESCALING)
#if defined(BOOST_GEOMETRY_ROBUSTNESS_ALTERNATIVE)
#define BOOST_GEOMETRY_USE_RESCALING
#else
#define BOOST_GEOMETRY_NO_ROBUSTNESS
#endif
#endif
#if defined(BOOST_GEOMETRY_USE_RESCALING) && ! defined(BOOST_GEOMETRY_ROBUSTNESS_ALTERNATIVE)
BOOST_PRAGMA_MESSAGE("Rescaling is deprecated and its functionality will be removed in Boost 1.84")
#endif
#if defined(BOOST_GEOMETRY_USE_RESCALING) && defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
#error "Define either BOOST_GEOMETRY_NO_ROBUSTNESS (default) or BOOST_GEOMETRY_USE_RESCALING"
#endif
#endif // BOOST_GEOMETRY_CORE_CONFIG_HPP #endif // BOOST_GEOMETRY_CORE_CONFIG_HPP

View File

@ -4,8 +4,9 @@
// //
// Copyright (c) 2011-2018 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2011-2018 Adam Wulkiewicz, Lodz, Poland.
// //
// This file was modified by Oracle on 2019-2021. // This file was modified by Oracle on 2019-2024.
// Modifications copyright (c) 2019-2021 Oracle and/or its affiliates. // Modifications copyright (c) 2019-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// //
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -57,7 +58,7 @@ inline typename default_content_result<Box>::type intersection_content(Box const
bool const ok = geometry::detail::intersection::intersection_box_box bool const ok = geometry::detail::intersection::intersection_box_box
< <
0, geometry::dimension<Box>::value 0, geometry::dimension<Box>::value
>::apply(box1, box2, 0, box_intersection, 0); >::apply(box1, box2, box_intersection, 0);
if ( ok ) if ( ok )
{ {
return index::detail::content(box_intersection); return index::detail::content(box_intersection);

View File

@ -1,416 +0,0 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2014-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2014-2015 Bruno Lalande, Paris, France.
// Copyright (c) 2014-2015 Mateusz Loskot, London, UK.
// Copyright (c) 2014-2015 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2015-2020.
// Modifications copyright (c) 2015-2020, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GEOMETRY_POLICIES_ROBUSTNESS_GET_RESCALE_POLICY_HPP
#define BOOST_GEOMETRY_POLICIES_ROBUSTNESS_GET_RESCALE_POLICY_HPP
#include <cstddef>
#include <type_traits>
#include <boost/geometry/core/assert.hpp>
#include <boost/geometry/core/config.hpp>
#include <boost/geometry/core/coordinate_promotion.hpp>
#include <boost/geometry/core/tag_cast.hpp>
#include <boost/geometry/algorithms/envelope.hpp>
#include <boost/geometry/algorithms/expand.hpp>
#include <boost/geometry/algorithms/is_empty.hpp>
#include <boost/geometry/algorithms/detail/recalculate.hpp>
#include <boost/geometry/algorithms/detail/get_max_size.hpp>
#include <boost/geometry/core/static_assert.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/policies/robustness/no_rescale_policy.hpp>
#include <boost/geometry/policies/robustness/rescale_policy.hpp>
#include <boost/geometry/policies/robustness/robust_type.hpp>
#include <boost/geometry/util/numeric_cast.hpp>
#include <boost/geometry/util/type_traits.hpp>
// TEMP
#include <boost/geometry/strategies/envelope/cartesian.hpp>
#include <boost/geometry/strategies/envelope/geographic.hpp>
#include <boost/geometry/strategies/envelope/spherical.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace get_rescale_policy
{
template
<
typename Box,
typename Point,
typename RobustPoint,
typename Factor
>
inline void scale_box_to_integer_range(Box const& box,
Point& min_point,
RobustPoint& min_robust_point,
Factor& factor)
{
// Scale box to integer-range
typedef typename promote_floating_point
<
typename geometry::coordinate_type<Point>::type
>::type num_type;
num_type const diff = util::numeric_cast<num_type>(detail::get_max_size(box));
num_type const range = 10000000.0; // Define a large range to get precise integer coordinates
num_type const half = 0.5;
if (math::equals(diff, num_type())
|| diff >= range
|| ! boost::math::isfinite(diff))
{
factor = 1;
}
else
{
factor = util::numeric_cast<num_type>(
util::numeric_cast<boost::long_long_type>(half + range / diff));
BOOST_GEOMETRY_ASSERT(factor >= 1);
}
// Assign input/output minimal points
detail::assign_point_from_index<0>(box, min_point);
num_type const two = 2;
boost::long_long_type const min_coordinate
= util::numeric_cast<boost::long_long_type>(-range / two);
assign_values(min_robust_point, min_coordinate, min_coordinate);
}
template
<
typename Point, typename RobustPoint, typename Geometry,
typename Factor, typename Strategy
>
static inline void init_rescale_policy(Geometry const& geometry,
Point& min_point,
RobustPoint& min_robust_point,
Factor& factor,
Strategy const& strategy)
{
if (geometry::is_empty(geometry))
{
return;
}
// Get bounding box
model::box<Point> env = geometry::return_envelope
<
model::box<Point>
>(geometry, strategy);
scale_box_to_integer_range(env, min_point, min_robust_point, factor);
}
// NOTE: Actually it should take 2 separate strategies, one for each geometry
// in case one of them was e.g. a Box
template
<
typename Point, typename RobustPoint, typename Geometry1, typename Geometry2,
typename Factor, typename Strategy1, typename Strategy2
>
static inline void init_rescale_policy(Geometry1 const& geometry1,
Geometry2 const& geometry2,
Point& min_point,
RobustPoint& min_robust_point,
Factor& factor,
Strategy1 const& strategy1,
Strategy2 const& strategy2)
{
// Get bounding boxes (when at least one of the geometries is not empty)
bool const is_empty1 = geometry::is_empty(geometry1);
bool const is_empty2 = geometry::is_empty(geometry2);
if (is_empty1 && is_empty2)
{
return;
}
model::box<Point> env;
if (is_empty1)
{
geometry::envelope(geometry2, env, strategy2);
}
else if (is_empty2)
{
geometry::envelope(geometry1, env, strategy1);
}
else
{
// The following approach (envelope + expand) may not give the
// optimal MBR when then two geometries are in the spherical
// equatorial or geographic coordinate systems.
// TODO: implement envelope for two (or possibly more geometries)
geometry::envelope(geometry1, env, strategy1);
model::box<Point> env2 = geometry::return_envelope
<
model::box<Point>
>(geometry2, strategy2);
geometry::expand(env, env2, strategy1);
}
scale_box_to_integer_range(env, min_point, min_robust_point, factor);
}
template
<
typename Point,
bool IsFloatingPoint
>
struct rescale_policy_type
{
typedef no_rescale_policy type;
};
// We rescale only all FP types
template
<
typename Point
>
struct rescale_policy_type<Point, true>
{
typedef typename geometry::coordinate_type<Point>::type coordinate_type;
typedef model::point
<
typename detail::robust_type<coordinate_type>::type,
geometry::dimension<Point>::value,
typename geometry::coordinate_system<Point>::type
> robust_point_type;
typedef typename promote_floating_point<coordinate_type>::type factor_type;
typedef detail::robust_policy<Point, robust_point_type, factor_type> type;
};
template <typename Policy>
struct get_rescale_policy
{
template <typename Geometry, typename Strategy>
static inline Policy apply(Geometry const& geometry,
Strategy const& strategy)
{
typedef typename point_type<Geometry>::type point_type;
typedef typename geometry::coordinate_type<Geometry>::type coordinate_type;
typedef typename promote_floating_point<coordinate_type>::type factor_type;
typedef model::point
<
typename detail::robust_type<coordinate_type>::type,
geometry::dimension<point_type>::value,
typename geometry::coordinate_system<point_type>::type
> robust_point_type;
point_type min_point;
robust_point_type min_robust_point;
factor_type factor;
init_rescale_policy(geometry, min_point, min_robust_point,
factor, strategy);
return Policy(min_point, min_robust_point, factor);
}
template <typename Geometry1, typename Geometry2, typename Strategy1, typename Strategy2>
static inline Policy apply(Geometry1 const& geometry1, Geometry2 const& geometry2,
Strategy1 const& strategy1,
Strategy2 const& strategy2)
{
typedef typename point_type<Geometry1>::type point_type;
typedef typename geometry::coordinate_type<Geometry1>::type coordinate_type;
typedef typename promote_floating_point<coordinate_type>::type factor_type;
typedef model::point
<
typename detail::robust_type<coordinate_type>::type,
geometry::dimension<point_type>::value,
typename geometry::coordinate_system<point_type>::type
> robust_point_type;
point_type min_point;
robust_point_type min_robust_point;
factor_type factor;
init_rescale_policy(geometry1, geometry2, min_point, min_robust_point,
factor, strategy1, strategy2);
return Policy(min_point, min_robust_point, factor);
}
};
// Specialization for no-rescaling
template <>
struct get_rescale_policy<no_rescale_policy>
{
template <typename Geometry, typename EnvelopeStrategy>
static inline no_rescale_policy apply(Geometry const& , EnvelopeStrategy const&)
{
return no_rescale_policy();
}
template <typename Geometry1, typename Geometry2, typename EnvelopeStrategy1, typename EnvelopeStrategy2>
static inline no_rescale_policy apply(Geometry1 const& , Geometry2 const& ,
EnvelopeStrategy1 const& , EnvelopeStrategy2 const& )
{
return no_rescale_policy();
}
};
}} // namespace detail::get_rescale_policy
#endif // DOXYGEN_NO_DETAIL
template
<
typename Point,
typename CSTag = typename geometry::cs_tag<Point>::type
>
struct rescale_policy_type
: public detail::get_rescale_policy::rescale_policy_type
<
Point,
#if defined(BOOST_GEOMETRY_USE_RESCALING)
std::is_floating_point
<
typename geometry::coordinate_type<Point>::type
>::type::value
&&
std::is_same
<
CSTag,
geometry::cartesian_tag
>::value
#else
false
#endif
>
{
BOOST_GEOMETRY_STATIC_ASSERT(
(util::is_point<Point>::value),
"Point type expected.",
Point);
};
template
<
typename Geometry1,
typename Geometry2,
typename CSTag = typename geometry::cs_tag<Geometry1>::type,
typename Tag1 = typename tag_cast
<
typename tag<Geometry1>::type,
box_tag,
pointlike_tag,
linear_tag,
areal_tag
>::type,
typename Tag2 = typename tag_cast
<
typename tag<Geometry2>::type,
box_tag,
pointlike_tag,
linear_tag,
areal_tag
>::type
>
struct rescale_overlay_policy_type
// Default: no rescaling
: public detail::get_rescale_policy::rescale_policy_type
<
typename geometry::point_type<Geometry1>::type,
false
>
{};
// Areal/areal: get rescale policy based on coordinate type
template
<
typename Geometry1,
typename Geometry2,
typename CSTag
>
struct rescale_overlay_policy_type<Geometry1, Geometry2, CSTag, areal_tag, areal_tag>
: public rescale_policy_type
<
typename geometry::point_type<Geometry1>::type,
CSTag
>
{};
template <typename Policy, typename Geometry>
inline Policy get_rescale_policy(Geometry const& geometry)
{
typename geometry::strategies::envelope::services::default_strategy
<
Geometry,
model::box<typename point_type<Geometry>::type>
>::type strategy;
return detail::get_rescale_policy::get_rescale_policy<Policy>::apply(geometry, strategy);
}
template
<
typename Policy, typename Geometry, typename Strategy,
std::enable_if_t<std::is_void<typename geometry::tag<Strategy>::type>::value, int> = 0
>
inline Policy get_rescale_policy(Geometry const& geometry, Strategy const& strategy)
{
return detail::get_rescale_policy::get_rescale_policy
<
Policy
>::apply(geometry, strategy);
}
template
<
typename Policy, typename Geometry1, typename Geometry2,
std::enable_if_t<! std::is_void<typename geometry::tag<Geometry2>::type>::value, int> = 0
>
inline Policy get_rescale_policy(Geometry1 const& geometry1, Geometry2 const& geometry2)
{
typename geometry::strategies::envelope::services::default_strategy
<
Geometry1,
model::box<typename point_type<Geometry1>::type>
>::type strategy1;
typename geometry::strategies::envelope::services::default_strategy
<
Geometry2,
model::box<typename point_type<Geometry2>::type>
>::type strategy2;
return detail::get_rescale_policy::get_rescale_policy
<
Policy
>::apply(geometry1, geometry2, strategy1, strategy2);
}
template <typename Policy, typename Geometry1, typename Geometry2, typename Strategy>
inline Policy get_rescale_policy(Geometry1 const& geometry1, Geometry2 const& geometry2,
Strategy const& strategy)
{
return detail::get_rescale_policy::get_rescale_policy
<
Policy
>::apply(geometry1, geometry2, strategy, strategy);
}
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_POLICIES_ROBUSTNESS_GET_RESCALE_POLICY_HPP

View File

@ -1,55 +0,0 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2013 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2013 Bruno Lalande, Paris, France.
// Copyright (c) 2013 Mateusz Loskot, London, UK.
// Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GEOMETRY_POLICIES_ROBUSTNESS_NO_RESCALE_POLICY_HPP
#define BOOST_GEOMETRY_POLICIES_ROBUSTNESS_NO_RESCALE_POLICY_HPP
#include <stddef.h>
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/policies/robustness/robust_point_type.hpp>
#include <boost/geometry/policies/robustness/segment_ratio.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail
{
// Redudant later.
struct no_rescale_policy
{
static bool const enabled = false;
// We don't rescale but return the reference of the input
template <std::size_t Dimension, typename Value>
inline Value const& apply(Value const& value) const
{
return value;
}
};
} // namespace detail
#endif
// Implement meta-functions for this policy
template <typename Point>
struct robust_point_type<Point, detail::no_rescale_policy>
{
// The point itself
typedef Point type;
};
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_POLICIES_ROBUSTNESS_NO_RESCALE_POLICY_HPP

View File

@ -1,85 +0,0 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2014-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2014-2015 Bruno Lalande, Paris, France.
// Copyright (c) 2014-2015 Mateusz Loskot, London, UK.
// Copyright (c) 2014-2015 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2015, 2023.
// Modifications copyright (c) 2015-2023, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GEOMETRY_POLICIES_ROBUSTNESS_RESCALE_POLICY_HPP
#define BOOST_GEOMETRY_POLICIES_ROBUSTNESS_RESCALE_POLICY_HPP
#include <cstddef>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/policies/robustness/segment_ratio.hpp>
#include <boost/geometry/policies/robustness/robust_point_type.hpp>
#include <boost/geometry/util/math.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail
{
template <typename FpPoint, typename IntPoint, typename CalculationType>
struct robust_policy
{
static bool const enabled = true;
typedef typename geometry::coordinate_type<IntPoint>::type output_ct;
robust_policy(FpPoint const& fp_min, IntPoint const& int_min, CalculationType const& the_factor)
: m_fp_min(fp_min)
, m_int_min(int_min)
, m_multiplier(the_factor)
{
}
template <std::size_t Dimension, typename Value>
inline output_ct apply(Value const& value) const
{
// a + (v-b)*f
CalculationType const a = static_cast<CalculationType>(get<Dimension>(m_int_min));
CalculationType const b = static_cast<CalculationType>(get<Dimension>(m_fp_min));
CalculationType const result = a + (value - b) * m_multiplier;
return geometry::math::rounding_cast<output_ct>(result);
}
FpPoint m_fp_min;
IntPoint m_int_min;
CalculationType m_multiplier;
};
} // namespace detail
#endif
// Implement meta-functions for this policy
// Define the IntPoint as a robust-point type
template <typename Point, typename FpPoint, typename IntPoint, typename CalculationType>
struct robust_point_type<Point, detail::robust_policy<FpPoint, IntPoint, CalculationType> >
{
typedef IntPoint type;
};
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_POLICIES_ROBUSTNESS_RESCALE_POLICY_HPP

View File

@ -1,43 +0,0 @@
// Boost.Geometry
// Copyright (c) 2019-2019 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GEOMETRY_POLICIES_ROBUSTNESS_RESCALE_POLICY_TYPE_HPP
#define BOOST_GEOMETRY_POLICIES_ROBUSTNESS_RESCALE_POLICY_TYPE_HPP
#include <boost/geometry/policies/robustness/no_rescale_policy.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail
{
struct no_rescale_policy_tag {};
struct rescale_policy_tag {};
template <typename RobustPolicy>
struct rescale_policy_type
{
typedef rescale_policy_tag type;
};
// Specialization
template <>
struct rescale_policy_type<no_rescale_policy>
{
typedef no_rescale_policy_tag type;
};
} // namespace detail
#endif
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_POLICIES_ROBUSTNESS_RESCALE_POLICY_TYPE_HPP

View File

@ -1,30 +0,0 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2013 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2013 Bruno Lalande, Paris, France.
// Copyright (c) 2013 Mateusz Loskot, London, UK.
// Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GEOMETRY_POLICIES_ROBUSTNESS_ROBUST_POINT_TYPE_HPP
#define BOOST_GEOMETRY_POLICIES_ROBUSTNESS_ROBUST_POINT_TYPE_HPP
namespace boost { namespace geometry
{
// Meta-function to typedef a robust point type for a policy
template <typename Point, typename Policy>
struct robust_point_type
{
// By default, the point itself is the robust type
typedef Point type;
};
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_POLICIES_ROBUSTNESS_ROBUST_POINT_TYPE_HPP

View File

@ -1,72 +0,0 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2014 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2014 Bruno Lalande, Paris, France.
// Copyright (c) 2014 Mateusz Loskot, London, UK.
// Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GEOMETRY_POLICIES_ROBUSTNESS_ROBUST_TYPE_HPP
#define BOOST_GEOMETRY_POLICIES_ROBUSTNESS_ROBUST_TYPE_HPP
#include <type_traits>
#include <boost/config.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail_dispatch
{
template <typename CoordinateType, typename IsFloatingPoint>
struct robust_type
{
};
template <typename CoordinateType>
struct robust_type<CoordinateType, std::false_type>
{
typedef CoordinateType type;
};
template <typename CoordinateType>
struct robust_type<CoordinateType, std::true_type>
{
typedef boost::long_long_type type;
};
} // namespace detail_dispatch
namespace detail
{
template <typename CoordinateType>
struct robust_type
{
typedef typename detail_dispatch::robust_type
<
CoordinateType,
typename std::is_floating_point<CoordinateType>::type
>::type type;
};
} // namespace detail
#endif // DOXYGEN_NO_DETAIL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_POLICIES_ROBUSTNESS_ROBUST_TYPE_HPP

View File

@ -2,8 +2,9 @@
// Copyright (c) 2013 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2013 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2016-2021. // This file was modified by Oracle on 2016-2024.
// Modifications copyright (c) 2016-2021 Oracle and/or its affiliates. // Modifications copyright (c) 2016-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -347,6 +348,11 @@ private :
} }
}; };
template <typename Point>
struct segment_ratio_type
{
using type = segment_ratio<typename geometry::coordinate_type<Point>::type>;
};
}} // namespace boost::geometry }} // namespace boost::geometry

View File

@ -1,54 +0,0 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2013 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2013 Bruno Lalande, Paris, France.
// Copyright (c) 2013 Mateusz Loskot, London, UK.
// Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GEOMETRY_POLICIES_ROBUSTNESS_SEGMENT_RATIO_TYPE_HPP
#define BOOST_GEOMETRY_POLICIES_ROBUSTNESS_SEGMENT_RATIO_TYPE_HPP
#include <type_traits>
#include <boost/config.hpp>
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/policies/robustness/rescale_policy_tags.hpp>
namespace boost { namespace geometry { namespace detail
{
// Temporary meta-function to access segment-ratio for a policy
template <typename Point, typename Policy>
struct segment_ratio_type
{
// Type in segment ratio is either the coordinate type, or for
// deprecated robust point types it is a long_long type
typedef std::conditional_t
<
std::is_same
<
typename rescale_policy_type<Policy>::type,
no_rescale_policy_tag
>::value,
typename geometry::coordinate_type<Point>::type,
boost::long_long_type
> coordinate_type;
// Define segment ratio based on the coordinate type
typedef geometry::segment_ratio<coordinate_type> type;
};
}}} // namespace boost::geometry::deatil
#endif // BOOST_GEOMETRY_POLICIES_ROBUSTNESS_SEGMENT_RATIO_TYPE_HPP

View File

@ -3,9 +3,9 @@
// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2013-2023 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2013-2023 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2014-2021. // This file was modified by Oracle on 2014-2024.
// Modifications copyright (c) 2014-2021, Oracle and/or its affiliates. // Modifications copyright (c) 2014-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -28,7 +28,6 @@
#include <boost/geometry/algorithms/detail/assign_values.hpp> #include <boost/geometry/algorithms/detail/assign_values.hpp>
#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/recalculate.hpp>
#include <boost/geometry/util/math.hpp> #include <boost/geometry/util/math.hpp>
#include <boost/geometry/util/numeric_cast.hpp> #include <boost/geometry/util/numeric_cast.hpp>
@ -52,15 +51,6 @@
#include <boost/geometry/strategies/side_info.hpp> #include <boost/geometry/strategies/side_info.hpp>
#include <boost/geometry/strategies/within.hpp> #include <boost/geometry/strategies/within.hpp>
#include <boost/geometry/policies/robustness/rescale_policy_tags.hpp>
#include <boost/geometry/policies/robustness/robust_point_type.hpp>
#if defined(BOOST_GEOMETRY_DEBUG_ROBUSTNESS)
# include <boost/geometry/io/wkt/write.hpp>
#endif
namespace boost { namespace geometry namespace boost { namespace geometry
{ {
@ -157,12 +147,12 @@ struct cartesian_segments
template <typename Point, typename Segment1, typename Segment2> template <typename Point, typename Segment1, typename Segment2>
void assign_a(Point& point, Segment1 const& a, Segment2 const& ) const void assign_a(Point& point, Segment1 const& a, Segment2 const& ) const
{ {
assign(point, a, dx_a, dy_a, robust_ra); assign(point, a, dx_a, dy_a, ra);
} }
template <typename Point, typename Segment1, typename Segment2> template <typename Point, typename Segment1, typename Segment2>
void assign_b(Point& point, Segment1 const& , Segment2 const& b) const void assign_b(Point& point, Segment1 const& , Segment2 const& b) const
{ {
assign(point, b, dx_b, dy_b, robust_rb); assign(point, b, dx_b, dy_b, rb);
} }
template <typename Point, typename Segment> template <typename Point, typename Segment>
@ -239,7 +229,7 @@ struct cartesian_segments
< <
std::is_arithmetic<CoordinateType>::value std::is_arithmetic<CoordinateType>::value
>::apply(comparable_length_a(), comparable_length_b(), >::apply(comparable_length_a(), comparable_length_b(),
robust_ra.edge_value(), robust_rb.edge_value()); ra.edge_value(), rb.edge_value());
if (use_a) if (use_a)
{ {
@ -249,13 +239,10 @@ struct cartesian_segments
{ {
assign_b(point, a, b); assign_b(point, a, b);
} }
#ifndef BOOST_GEOMETRY_USE_RESCALING
// Verify nearly collinear cases (the threshold is arbitrary // Verify nearly collinear cases (the threshold is arbitrary
// but influences performance). If the intersection is located // but influences performance). If the intersection is located
// outside the segments, then it should be moved. // outside the segments, then it should be moved.
if (robust_ra.possibly_collinear(1.0e-3) if (ra.possibly_collinear(1.0e-3) && rb.possibly_collinear(1.0e-3))
&& robust_rb.possibly_collinear(1.0e-3))
{ {
// The segments are nearly collinear and because of the calculation // The segments are nearly collinear and because of the calculation
// method with very small denominator, the IP appears outside the // method with very small denominator, the IP appears outside the
@ -265,13 +252,12 @@ struct cartesian_segments
assign_if_exceeds(point, a); assign_if_exceeds(point, a);
assign_if_exceeds(point, b); assign_if_exceeds(point, b);
} }
#endif
} }
CoordinateType dx_a, dy_a; CoordinateType dx_a, dy_a;
CoordinateType dx_b, dy_b; CoordinateType dx_b, dy_b;
SegmentRatio robust_ra; SegmentRatio ra;
SegmentRatio robust_rb; SegmentRatio rb;
}; };
template <typename D, typename W, typename ResultType> template <typename D, typename W, typename ResultType>
@ -288,38 +274,15 @@ struct cartesian_segments
// IntersectionPoint = (x1 + r * dx_a, y1 + r * dy_a) // IntersectionPoint = (x1 + r * dx_a, y1 + r * dy_a)
} }
// Version for non-rescaled policies
template template
< <
typename UniqueSubRange1, typename UniqueSubRange1,
typename UniqueSubRange2, typename UniqueSubRange2,
typename Policy typename Policy
> >
static inline typename Policy::return_type static inline typename Policy::return_type apply(UniqueSubRange1 const& range_p,
apply(UniqueSubRange1 const& range_p,
UniqueSubRange2 const& range_q, UniqueSubRange2 const& range_q,
Policy const& policy) Policy const& policy)
{
// Pass the same ranges both as normal ranges and as modelled ranges
return apply(range_p, range_q, policy, range_p, range_q);
}
// Version for non rescaled versions.
// The "modelled" parameter might be rescaled (will be removed later)
template
<
typename UniqueSubRange1,
typename UniqueSubRange2,
typename Policy,
typename ModelledUniqueSubRange1,
typename ModelledUniqueSubRange2
>
static inline typename Policy::return_type
apply(UniqueSubRange1 const& range_p,
UniqueSubRange2 const& range_q,
Policy const& policy,
ModelledUniqueSubRange1 const& modelled_range_p,
ModelledUniqueSubRange2 const& modelled_range_q)
{ {
typedef typename UniqueSubRange1::point_type point1_type; typedef typename UniqueSubRange1::point_type point1_type;
typedef typename UniqueSubRange2::point_type point2_type; typedef typename UniqueSubRange2::point_type point2_type;
@ -332,18 +295,13 @@ struct cartesian_segments
point2_type const& q1 = range_q.at(0); point2_type const& q1 = range_q.at(0);
point2_type const& q2 = range_q.at(1); point2_type const& q2 = range_q.at(1);
// Declare segments, currently necessary for the policies
// (segment_crosses, segment_colinear, degenerate, one_degenerate, etc)
model::referring_segment<point1_type const> const p(p1, p2);
model::referring_segment<point2_type const> const q(q1, q2);
typedef typename select_most_precise typedef typename select_most_precise
< <
typename geometry::coordinate_type<typename ModelledUniqueSubRange1::point_type>::type, typename geometry::coordinate_type<point1_type>::type,
typename geometry::coordinate_type<typename ModelledUniqueSubRange1::point_type>::type typename geometry::coordinate_type<point2_type>::type
>::type modelled_coordinate_type; >::type coordinate_type;
typedef segment_ratio<modelled_coordinate_type> ratio_type; typedef segment_ratio<coordinate_type> ratio_type;
segment_intersection_info segment_intersection_info
< <
typename select_calculation_type<point1_type, point2_type, CalculationType>::type, typename select_calculation_type<point1_type, point2_type, CalculationType>::type,
@ -355,7 +313,7 @@ struct cartesian_segments
sinfo.dy_a = get<1>(p2) - get<1>(p1); // distance in y-dir sinfo.dy_a = get<1>(p2) - get<1>(p1); // distance in y-dir
sinfo.dy_b = get<1>(q2) - get<1>(q1); sinfo.dy_b = get<1>(q2) - get<1>(q1);
return unified<ratio_type>(sinfo, p, q, policy, modelled_range_p, modelled_range_q); return unified<ratio_type>(sinfo, range_p, range_q, policy);
} }
//! Returns true if two segments do not overlap. //! Returns true if two segments do not overlap.
@ -389,30 +347,22 @@ struct cartesian_segments
return math::smaller(maxp, minq) || math::smaller(maxq, minp); return math::smaller(maxp, minq) || math::smaller(maxq, minp);
} }
// Implementation for either rescaled or non rescaled versions.
template template
< <
typename RatioType, typename RatioType,
typename SegmentInfo, typename SegmentInfo,
typename Segment1,
typename Segment2,
typename Policy,
typename UniqueSubRange1, typename UniqueSubRange1,
typename UniqueSubRange2 typename UniqueSubRange2,
typename Policy
> >
static inline typename Policy::return_type static inline typename Policy::return_type
unified(SegmentInfo& sinfo, unified(SegmentInfo& sinfo,
Segment1 const& p, Segment2 const& q, Policy const&,
UniqueSubRange1 const& range_p, UniqueSubRange1 const& range_p,
UniqueSubRange2 const& range_q) UniqueSubRange2 const& range_q,
Policy const&)
{ {
typedef typename UniqueSubRange1::point_type point1_type; typedef typename UniqueSubRange1::point_type point1_type;
typedef typename UniqueSubRange2::point_type point2_type; typedef typename UniqueSubRange2::point_type point2_type;
typedef typename select_most_precise
<
typename geometry::coordinate_type<point1_type>::type,
typename geometry::coordinate_type<point2_type>::type
>::type coordinate_type;
point1_type const& p1 = range_p.at(0); point1_type const& p1 = range_p.at(0);
point1_type const& p2 = range_p.at(1); point1_type const& p2 = range_p.at(1);
@ -422,6 +372,11 @@ struct cartesian_segments
bool const p_is_point = equals_point_point(p1, p2); bool const p_is_point = equals_point_point(p1, p2);
bool const q_is_point = equals_point_point(q1, q2); bool const q_is_point = equals_point_point(q1, q2);
// Declare segments, currently necessary for the policies
// (segment_crosses, segment_colinear, degenerate, one_degenerate, etc)
model::referring_segment<point1_type const> const p(p1, p2);
model::referring_segment<point2_type const> const q(q1, q2);
if (p_is_point && q_is_point) if (p_is_point && q_is_point)
{ {
return equals_point_point(p1, q2) return equals_point_point(p1, q2)
@ -460,39 +415,38 @@ struct cartesian_segments
bool collinear = sides.collinear(); bool collinear = sides.collinear();
//TODO: remove this when rescaling is removed
// Calculate the differences again
// (for rescaled version, this is different from dx_p etc)
coordinate_type const dx_p = get<0>(p2) - get<0>(p1);
coordinate_type const dx_q = get<0>(q2) - get<0>(q1);
coordinate_type const dy_p = get<1>(p2) - get<1>(p1);
coordinate_type const dy_q = get<1>(q2) - get<1>(q1);
// r: ratio 0-1 where intersection divides A/B // r: ratio 0-1 where intersection divides A/B
// (only calculated for non-collinear segments) // (only calculated for non-collinear segments)
if (! collinear) if (! collinear)
{ {
coordinate_type denominator_a, nominator_a; typedef typename select_most_precise
coordinate_type denominator_b, nominator_b; <
typename geometry::coordinate_type<point1_type>::type,
typename geometry::coordinate_type<point2_type>::type
>::type coordinate_type;
cramers_rule(dx_p, dy_p, dx_q, dy_q, coordinate_type denominator_a;
coordinate_type nominator_a;
coordinate_type denominator_b;
coordinate_type nominator_b;
cramers_rule(sinfo.dx_a, sinfo.dy_a, sinfo.dx_b, sinfo.dy_b,
get<0>(p1) - get<0>(q1), get<0>(p1) - get<0>(q1),
get<1>(p1) - get<1>(q1), get<1>(p1) - get<1>(q1),
nominator_a, denominator_a); nominator_a, denominator_a);
cramers_rule(dx_q, dy_q, dx_p, dy_p, cramers_rule(sinfo.dx_b, sinfo.dy_b, sinfo.dx_a, sinfo.dy_a,
get<0>(q1) - get<0>(p1), get<0>(q1) - get<0>(p1),
get<1>(q1) - get<1>(p1), get<1>(q1) - get<1>(p1),
nominator_b, denominator_b); nominator_b, denominator_b);
math::detail::equals_factor_policy<coordinate_type> math::detail::equals_factor_policy<coordinate_type>
policy(dx_p, dy_p, dx_q, dy_q); policy(sinfo.dx_a, sinfo.dy_a, sinfo.dx_b, sinfo.dy_b);
coordinate_type const zero = 0; coordinate_type const zero = 0;
if (math::detail::equals_by_policy(denominator_a, zero, policy) if (math::detail::equals_by_policy(denominator_a, zero, policy)
|| math::detail::equals_by_policy(denominator_b, zero, policy)) || math::detail::equals_by_policy(denominator_b, zero, policy))
{ {
// If this is the case, no rescaling is done for FP precision.
// We set it to collinear, but it indicates a robustness issue. // We set it to collinear, but it indicates a robustness issue.
sides.set<0>(0, 0); sides.set<0>(0, 0);
sides.set<1>(0, 0); sides.set<1>(0, 0);
@ -500,18 +454,18 @@ struct cartesian_segments
} }
else else
{ {
sinfo.robust_ra.assign(nominator_a, denominator_a); sinfo.ra.assign(nominator_a, denominator_a);
sinfo.robust_rb.assign(nominator_b, denominator_b); sinfo.rb.assign(nominator_b, denominator_b);
} }
} }
if (collinear) if (collinear)
{ {
std::pair<bool, bool> const collinear_use_first std::pair<bool, bool> const collinear_use_first
= is_x_more_significant(geometry::math::abs(dx_p), = is_x_more_significant(geometry::math::abs(sinfo.dx_a),
geometry::math::abs(dy_p), geometry::math::abs(sinfo.dy_a),
geometry::math::abs(dx_q), geometry::math::abs(sinfo.dx_b),
geometry::math::abs(dy_q), geometry::math::abs(sinfo.dy_b),
p_is_point, q_is_point); p_is_point, q_is_point);
if (collinear_use_first.second) if (collinear_use_first.second)
@ -590,35 +544,35 @@ private:
typename RatioType, typename RatioType,
typename Segment1, typename Segment1,
typename Segment2, typename Segment2,
typename RobustPoint1, typename Point1,
typename RobustPoint2 typename Point2
> >
static inline typename Policy::return_type static inline typename Policy::return_type
relate_collinear(Segment1 const& a, relate_collinear(Segment1 const& a,
Segment2 const& b, Segment2 const& b,
RobustPoint1 const& robust_a1, RobustPoint1 const& robust_a2, Point1 const& a1, Point1 const& a2,
RobustPoint2 const& robust_b1, RobustPoint2 const& robust_b2, Point2 const& b1, Point2 const& b2,
bool a_is_point, bool b_is_point) bool a_is_point, bool b_is_point)
{ {
if (a_is_point) if (a_is_point)
{ {
return relate_one_degenerate<Policy, RatioType>(a, return relate_one_degenerate<Policy, RatioType>(a,
get<Dimension>(robust_a1), get<Dimension>(a1),
get<Dimension>(robust_b1), get<Dimension>(robust_b2), get<Dimension>(b1), get<Dimension>(b2),
true); true);
} }
if (b_is_point) if (b_is_point)
{ {
return relate_one_degenerate<Policy, RatioType>(b, return relate_one_degenerate<Policy, RatioType>(b,
get<Dimension>(robust_b1), get<Dimension>(b1),
get<Dimension>(robust_a1), get<Dimension>(robust_a2), get<Dimension>(a1), get<Dimension>(a2),
false); false);
} }
return relate_collinear<Policy, RatioType>(a, b, return relate_collinear<Policy, RatioType>(a, b,
get<Dimension>(robust_a1), get<Dimension>(a1),
get<Dimension>(robust_a2), get<Dimension>(a2),
get<Dimension>(robust_b1), get<Dimension>(b1),
get<Dimension>(robust_b2)); get<Dimension>(b2));
} }
/// Relate segments known collinear /// Relate segments known collinear

View File

@ -77,9 +77,6 @@ public:
int count_on_edge{0}; int count_on_edge{0};
CalculationType edge_min_fraction{(std::numeric_limits<CalculationType>::max)()}; CalculationType edge_min_fraction{(std::numeric_limits<CalculationType>::max)()};
#if defined(BOOST_GEOMETRY_USE_RESCALING)
CalculationType inside_min_measure{(std::numeric_limits<CalculationType>::max)()};
#endif
inline bool is_inside() const inline bool is_inside() const
{ {
@ -91,9 +88,6 @@ public:
return count_on_origin == 0 return count_on_origin == 0
&& (count_on_offsetted > 0 && (count_on_offsetted > 0
|| (count_on_edge > 0 && edge_min_fraction < 1.0e-3) || (count_on_edge > 0 && edge_min_fraction < 1.0e-3)
#if defined(BOOST_GEOMETRY_USE_RESCALING)
|| (count < 0 && inside_min_measure < 1.0e-5)
#endif
); );
} }
@ -186,15 +180,6 @@ public:
{ {
apply_on_boundary(point, s1, s2, place_on_ring, the_state); apply_on_boundary(point, s1, s2, place_on_ring, the_state);
} }
#if defined(BOOST_GEOMETRY_USE_RESCALING)
else if (side == -1)
{
auto const line = detail::make::make_infinite_line<CalculationType>(s1, s2);
auto const value = -arithmetic::side_value(line, point);
if (value > 0 && value < the_state.inside_min_measure) { the_state.inside_min_measure = value; }
}
#endif
} }
if (in_horizontal_range) if (in_horizontal_range)

View File

@ -2,7 +2,8 @@
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2016-2021, Oracle and/or its affiliates. // Copyright (c) 2016-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -23,7 +24,6 @@
#include <boost/geometry/algorithms/detail/assign_values.hpp> #include <boost/geometry/algorithms/detail/assign_values.hpp>
#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/recalculate.hpp>
#include <boost/geometry/formulas/andoyer_inverse.hpp> #include <boost/geometry/formulas/andoyer_inverse.hpp>
#include <boost/geometry/formulas/sjoberg_intersection.hpp> #include <boost/geometry/formulas/sjoberg_intersection.hpp>
@ -114,8 +114,8 @@ struct geographic_segments
CoordinateType lon; CoordinateType lon;
CoordinateType lat; CoordinateType lat;
SegmentRatio robust_ra; SegmentRatio ra;
SegmentRatio robust_rb; SegmentRatio rb;
intersection_point_flag ip_flag; intersection_point_flag ip_flag;
}; };
@ -489,8 +489,8 @@ private:
sinfo.lon = lon; sinfo.lon = lon;
sinfo.lat = lat; sinfo.lat = lat;
sinfo.robust_ra.assign(dist_a1_i1, dist_a1_a2); sinfo.ra.assign(dist_a1_i1, dist_a1_a2);
sinfo.robust_rb.assign(dist_b1_i1, dist_b1_b2); sinfo.rb.assign(dist_b1_i1, dist_b1_b2);
sinfo.ip_flag = ip_flag; sinfo.ip_flag = ip_flag;
return Policy::segments_crosses(sides, sinfo, a, b); return Policy::segments_crosses(sides, sinfo, a, b);

View File

@ -2,8 +2,9 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2015-2021. // This file was modified by Oracle on 2015-2024.
// Modifications copyright (c) 2015-2021 Oracle and/or its affiliates. // Modifications copyright (c) 2015-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -24,8 +25,8 @@ namespace boost { namespace geometry
template <typename SegmentRatio> template <typename SegmentRatio>
struct fraction_type struct fraction_type
{ {
SegmentRatio robust_ra; // TODO this can be renamed now to "ra" SegmentRatio ra;
SegmentRatio robust_rb; SegmentRatio rb;
bool initialized; bool initialized;
inline fraction_type() inline fraction_type()
@ -36,15 +37,15 @@ struct fraction_type
inline void assign(Info const& info) inline void assign(Info const& info)
{ {
initialized = true; initialized = true;
robust_ra = info.robust_ra; ra = info.ra;
robust_rb = info.robust_rb; rb = info.rb;
} }
inline void assign(SegmentRatio const& a, SegmentRatio const& b) inline void assign(SegmentRatio const& a, SegmentRatio const& b)
{ {
initialized = true; initialized = true;
robust_ra = a; ra = a;
robust_rb = b; rb = b;
} }
}; };

View File

@ -2,8 +2,9 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2016-2020. // This file was modified by Oracle on 2016-2024.
// Modifications copyright (c) 2016-2020, Oracle and/or its affiliates. // Modifications copyright (c) 2016-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -17,7 +18,6 @@
//#include <type_traits> //#include <type_traits>
#include <boost/geometry/policies/relate/intersection_policy.hpp> #include <boost/geometry/policies/relate/intersection_policy.hpp>
#include <boost/geometry/policies/robustness/segment_ratio_type.hpp>
#include <boost/geometry/strategies/intersection.hpp> #include <boost/geometry/strategies/intersection.hpp>
#include <boost/geometry/strategies/intersection_result.hpp> #include <boost/geometry/strategies/intersection_result.hpp>
@ -41,21 +41,15 @@ template
typename Geometry1, typename Geometry1,
typename Geometry2, typename Geometry2,
typename IntersectionPoint, typename IntersectionPoint,
typename RobustPolicy,
typename CalculationType = void typename CalculationType = void
> >
struct intersection_strategies struct intersection_strategies
{ {
private : private :
// for development BOOST_STATIC_ASSERT((! std::is_same<RobustPolicy, void>::type::value));
typedef segment_intersection_points typedef segment_intersection_points
< <
IntersectionPoint, IntersectionPoint,
typename detail::segment_ratio_type typename segment_ratio_type<IntersectionPoint>::type
<
IntersectionPoint, RobustPolicy
>::type
> ip_type; > ip_type;
public: public:
@ -69,14 +63,6 @@ public:
Tag, Tag,
CalculationType CalculationType
>::type segment_intersection_strategy_type; >::type segment_intersection_strategy_type;
typedef typename strategy::side::services::default_strategy
<
Tag,
CalculationType
>::type side_strategy_type;
typedef RobustPolicy rescale_policy_type;
}; };

View File

@ -4,6 +4,10 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2024.
// Modifications copyright (c) 2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@ -17,7 +21,7 @@
#include <cmath> #include <cmath>
#include <utility> #include <utility>
#if defined(BOOST_GEOMETRY_DEBUG_INTERSECTION) || defined(BOOST_GEOMETRY_DEBUG_ROBUSTNESS) #if defined(BOOST_GEOMETRY_DEBUG_INTERSECTION)
# include <iostream> # include <iostream>
#endif #endif
@ -146,7 +150,7 @@ public :
return sides[Which].first == 0 ? 0 : 1; return sides[Which].first == 0 ? 0 : 1;
} }
#if defined(BOOST_GEOMETRY_DEBUG_INTERSECTION) || defined(BOOST_GEOMETRY_DEBUG_ROBUSTNESS) #if defined(BOOST_GEOMETRY_DEBUG_INTERSECTION)
inline void debug() const inline void debug() const
{ {
std::cout << sides[0].first << " " std::cout << sides[0].first << " "

View File

@ -2,7 +2,8 @@
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2016-2021, Oracle and/or its affiliates. // Copyright (c) 2016-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -23,7 +24,6 @@
#include <boost/geometry/algorithms/detail/assign_values.hpp> #include <boost/geometry/algorithms/detail/assign_values.hpp>
#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/recalculate.hpp>
#include <boost/geometry/arithmetic/arithmetic.hpp> #include <boost/geometry/arithmetic/arithmetic.hpp>
#include <boost/geometry/arithmetic/cross_product.hpp> #include <boost/geometry/arithmetic/cross_product.hpp>
@ -133,8 +133,8 @@ struct ecef_segments
} }
Vector3d intersection_point; Vector3d intersection_point;
SegmentRatio robust_ra; SegmentRatio ra;
SegmentRatio robust_rb; SegmentRatio rb;
intersection_point_flag ip_flag; intersection_point_flag ip_flag;
CalcPolicy const& calc_policy; CalcPolicy const& calc_policy;
@ -424,8 +424,8 @@ struct ecef_segments
vec3d_t vec3d_t
> sinfo(calc_policy); > sinfo(calc_policy);
sinfo.robust_ra.assign(dist_a1_i1, dist_a1_a2); sinfo.ra.assign(dist_a1_i1, dist_a1_a2);
sinfo.robust_rb.assign(dist_b1_i1, dist_b1_b2); sinfo.rb.assign(dist_b1_i1, dist_b1_b2);
sinfo.intersection_point = i1; sinfo.intersection_point = i1;
sinfo.ip_flag = ip_flag; sinfo.ip_flag = ip_flag;

View File

@ -103,10 +103,8 @@ void test_one(std::string const& caseid, std::string const& wkt, double expected
settings.tolerance = 10000.0; settings.tolerance = 10000.0;
#if ! defined(BOOST_GEOMETRY_USE_RESCALING)
// in case robustness policies are changed, areas should be adapted // in case robustness policies are changed, areas should be adapted
settings.tolerance = boost::starts_with(caseid, "no") ? 200000.0 : 100000.0; settings.tolerance = boost::starts_with(caseid, "no") ? 200000.0 : 100000.0;
#endif
test_one<MP, P>(caseid, wkt, join_round, end_flat, test_one<MP, P>(caseid, wkt, join_round, end_flat,
expected_area, distance * 1000.0, settings); expected_area, distance * 1000.0, settings);
@ -213,7 +211,7 @@ int test_main(int, char* [])
#endif #endif
#if defined(BOOST_GEOMETRY_TEST_FAILURES) #if defined(BOOST_GEOMETRY_TEST_FAILURES)
BoostGeometryWriteExpectedFailures(1, BG_NO_FAILURES, 2, BG_NO_FAILURES); BoostGeometryWriteExpectedFailures(BG_NO_FAILURES, 2, BG_NO_FAILURES);
#endif #endif
return 0; return 0;

View File

@ -330,7 +330,6 @@ void test_all()
test_one<linestring, polygon>("issue_803", issue_803, join_round(36), end_round(36), 1664.0528, 10.0); test_one<linestring, polygon>("issue_803", issue_803, join_round(36), end_round(36), 1664.0528, 10.0);
} }
#if ! defined(BOOST_GEOMETRY_USE_RESCALING)
{ {
using bg::strategy::buffer::join_round; using bg::strategy::buffer::join_round;
using bg::strategy::buffer::end_round; using bg::strategy::buffer::end_round;
@ -338,7 +337,6 @@ void test_all()
test_one<linestring, polygon>("issue_988_b", issue_988, join_round(32), end_round(32), 0.0029614, 0.0101); test_one<linestring, polygon>("issue_988_b", issue_988, join_round(32), end_round(32), 0.0029614, 0.0101);
test_one<linestring, polygon>("issue_988_c", issue_988, join_round(32), end_round(32), 0.0031514, 0.011); test_one<linestring, polygon>("issue_988_c", issue_988, join_round(32), end_round(32), 0.0031514, 0.011);
} }
#endif
{ {
using bg::strategy::buffer::join_round; using bg::strategy::buffer::join_round;
@ -366,24 +364,17 @@ void test_all()
test_one<linestring, polygon>("mysql_23023665_1", mysql_23023665, join_round32, end_flat, 459.1051, 10); test_one<linestring, polygon>("mysql_23023665_1", mysql_23023665, join_round32, end_flat, 459.1051, 10);
test_one<linestring, polygon>("mysql_23023665_2", mysql_23023665, join_round32, end_flat, 6877.7097, 50); test_one<linestring, polygon>("mysql_23023665_2", mysql_23023665, join_round32, end_flat, 6877.7097, 50);
#if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES)
test_one<linestring, polygon>("mysql_25662426", mysql_25662426, join_round32, end_round32, 1, 0, 1660.6673, 10); test_one<linestring, polygon>("mysql_25662426", mysql_25662426, join_round32, end_round32, 1, 0, 1660.6673, 10);
#endif
// Test behaviour with different buffer sizes, generating internally turns on different locations // Test behaviour with different buffer sizes, generating internally turns on different locations
test_one<linestring, polygon>("mysql_25662426a_05", mysql_25662426a, join_round32, end_round32, 27.6156, 0.5); test_one<linestring, polygon>("mysql_25662426a_05", mysql_25662426a, join_round32, end_round32, 27.6156, 0.5);
test_one<linestring, polygon>("mysql_25662426a_1", mysql_25662426a, join_round32, end_round32, 54.9018, 1.0); test_one<linestring, polygon>("mysql_25662426a_1", mysql_25662426a, join_round32, end_round32, 54.9018, 1.0);
test_one<linestring, polygon>("mysql_25662426a_2", mysql_25662426a, join_round32, end_round32, 103.6072, 2.0); test_one<linestring, polygon>("mysql_25662426a_2", mysql_25662426a, join_round32, end_round32, 103.6072, 2.0);
#if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES)
test_one<linestring, polygon>("mysql_25662426a_3", mysql_25662426a, join_round32, end_round32, 152.1163, 3.0); test_one<linestring, polygon>("mysql_25662426a_3", mysql_25662426a, join_round32, end_round32, 152.1163, 3.0);
#endif
test_one<linestring, polygon>("mysql_25662426a_4", mysql_25662426a, join_round32, end_round32, 206.4831, 4.0); test_one<linestring, polygon>("mysql_25662426a_4", mysql_25662426a, join_round32, end_round32, 206.4831, 4.0);
test_one<linestring, polygon>("mysql_25662426a_5", mysql_25662426a, join_round32, end_round32, 266.8505, 5.0); test_one<linestring, polygon>("mysql_25662426a_5", mysql_25662426a, join_round32, end_round32, 266.8505, 5.0);
#if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES)
test_one<linestring, polygon>("mysql_25662426a_10", mysql_25662426a, join_round32, end_round32, 660.7355, 10.0); test_one<linestring, polygon>("mysql_25662426a_10", mysql_25662426a, join_round32, end_round32, 660.7355, 10.0);
#endif
test_one<linestring, polygon>("mysql_25662426a_05", mysql_25662426a, join_round32, end_flat, 26.8352, 0.5); test_one<linestring, polygon>("mysql_25662426a_05", mysql_25662426a, join_round32, end_flat, 26.8352, 0.5);
test_one<linestring, polygon>("mysql_25662426a_1", mysql_25662426a, join_round32, end_flat, 53.3411, 1.0); test_one<linestring, polygon>("mysql_25662426a_1", mysql_25662426a, join_round32, end_flat, 53.3411, 1.0);
test_one<linestring, polygon>("mysql_25662426a_2", mysql_25662426a, join_round32, end_flat, 97.3644, 2.0); test_one<linestring, polygon>("mysql_25662426a_2", mysql_25662426a, join_round32, end_flat, 97.3644, 2.0);
@ -480,7 +471,7 @@ int test_main(int, char* [])
#endif #endif
#if defined(BOOST_GEOMETRY_TEST_FAILURES) #if defined(BOOST_GEOMETRY_TEST_FAILURES)
BoostGeometryWriteExpectedFailures(2, 4, 11, 3); BoostGeometryWriteExpectedFailures(4, 11, 3);
#endif #endif
return 0; return 0;

View File

@ -257,7 +257,7 @@ void test_aimes()
double const aimes_width = width / 1000000.0; double const aimes_width = width / 1000000.0;
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
{ {
#if defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES) #if defined(BOOST_GEOMETRY_TEST_FAILURES)
// There are 4 false positives // There are 4 false positives
bool const possible_invalid = width == 18 && (i == 75 || i == 80 || i == 140); bool const possible_invalid = width == 18 && (i == 75 || i == 80 || i == 140);
settings.set_test_validity(! possible_invalid); settings.set_test_validity(! possible_invalid);
@ -297,7 +297,7 @@ int test_main(int, char* [])
#if defined(BOOST_GEOMETRY_TEST_FAILURES) #if defined(BOOST_GEOMETRY_TEST_FAILURES)
// Type float is not supported for these cases. // Type float is not supported for these cases.
// Type double has (judging the svg) 4 false negatives for validity // Type double has (judging the svg) 4 false negatives for validity
BoostGeometryWriteExpectedFailures(0, 0, 0, 0); BoostGeometryWriteExpectedFailures(0, 0, 0);
#endif #endif
return 0; return 0;

View File

@ -172,11 +172,7 @@ void test_all()
test_one<multi_linestring_type, polygon>("mysql_23023665_1", test_one<multi_linestring_type, polygon>("mysql_23023665_1",
mysql_23023665_1, join_round32, end_round32, 1, 1, 186.5504, 1.0); mysql_23023665_1, join_round32, end_round32, 1, 1, 186.5504, 1.0);
test_one<multi_linestring_type, polygon>("touching1_1", test_one<multi_linestring_type, polygon>("touching1_1",
touching1, join_round32, end_round32, 2, 0, 78.70773, 1.0 touching1, join_round32, end_round32, 2, 0, 78.70773, 1.0);
#if defined(BOOST_GEOMETRY_USE_RESCALING)
, ut_settings::ignore_validity() // false positive, due to rescaling. As we remove it, it is gone
#endif
);
test_one<multi_linestring_type, polygon>("touching2_1", test_one<multi_linestring_type, polygon>("touching2_1",
touching2, join_round32, end_round32, 1, 1, 107.8991, 1.0); touching2, join_round32, end_round32, 1, 1, 107.8991, 1.0);
test_one<multi_linestring_type, polygon>("mysql_23023665_1_09", test_one<multi_linestring_type, polygon>("mysql_23023665_1_09",
@ -239,7 +235,7 @@ int test_main(int, char* [])
#endif #endif
#if defined(BOOST_GEOMETRY_TEST_FAILURES) #if defined(BOOST_GEOMETRY_TEST_FAILURES)
BoostGeometryWriteExpectedFailures(9, 6, 9, 3); BoostGeometryWriteExpectedFailures(6, 9, 3);
#endif #endif
return 0; return 0;
} }

View File

@ -51,8 +51,8 @@ void test_all()
test_one<multi_point_type, polygon>("simplex3", simplex, join, end_flat, 44.5619, 3.0); test_one<multi_point_type, polygon>("simplex3", simplex, join, end_flat, 44.5619, 3.0);
test_one<multi_point_type, polygon>("three1", three, join, end_flat, 3.0 * expectation, 1.0); test_one<multi_point_type, polygon>("three1", three, join, end_flat, 3.0 * expectation, 1.0);
#if defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES) #if defined(BOOST_GEOMETRY_TEST_FAILURES)
// For no-rescaling, fails in CCW mode // fails in CCW mode
test_one<multi_point_type, polygon>("three2", three, join, end_flat, 36.7528, 2.0); test_one<multi_point_type, polygon>("three2", three, join, end_flat, 36.7528, 2.0);
#endif #endif
test_one<multi_point_type, polygon>("three19", three, join, end_flat, 33.6857, 1.9); test_one<multi_point_type, polygon>("three19", three, join, end_flat, 33.6857, 1.9);
@ -126,11 +126,7 @@ void test_many_points_per_circle()
using bg::strategy::buffer::point_circle; using bg::strategy::buffer::point_circle;
#if ! defined(BOOST_GEOMETRY_USE_RESCALING)
double const tolerance = 1000.0; double const tolerance = 1000.0;
#else
double const tolerance = 1.0;
#endif
// Area should be somewhat larger (~>) than pi*distance^2 // Area should be somewhat larger (~>) than pi*distance^2
// 6051788: area ~> 115058122875258 // 6051788: area ~> 115058122875258

View File

@ -547,11 +547,7 @@ void test_all()
test_one<multi_polygon_type, polygon_type>("rt_p14", rt_p14, join_miter, end_flat, 20.8284, 1.0); test_one<multi_polygon_type, polygon_type>("rt_p14", rt_p14, join_miter, end_flat, 20.8284, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_p15", rt_p15, join_miter, end_flat, 23.6569, 1.0); test_one<multi_polygon_type, polygon_type>("rt_p15", rt_p15, join_miter, end_flat, 23.6569, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_p16", rt_p16, join_miter, end_flat, 23.4853, 1.0); test_one<multi_polygon_type, polygon_type>("rt_p16", rt_p16, join_miter, end_flat, 23.4853, 1.0);
#if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES)
// Fails with rescaling after correcting the tolerance in sort_by_side
test_one<multi_polygon_type, polygon_type>("rt_p17", rt_p17, join_miter, end_flat, 25.3137, 1.0); test_one<multi_polygon_type, polygon_type>("rt_p17", rt_p17, join_miter, end_flat, 25.3137, 1.0);
#endif
test_one<multi_polygon_type, polygon_type>("rt_p18", rt_p18, join_miter, end_flat, 23.3137, 1.0); test_one<multi_polygon_type, polygon_type>("rt_p18", rt_p18, join_miter, end_flat, 23.3137, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_p19", rt_p19, join_miter, end_flat, 25.5637, 1.0); test_one<multi_polygon_type, polygon_type>("rt_p19", rt_p19, join_miter, end_flat, 25.5637, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_p20", rt_p20, join_miter, end_flat, 25.4853, 1.0); test_one<multi_polygon_type, polygon_type>("rt_p20", rt_p20, join_miter, end_flat, 25.4853, 1.0);
@ -577,15 +573,11 @@ void test_all()
test_one<multi_polygon_type, polygon_type>("rt_u4", rt_u4, join_round, end_flat, 126.9268, 1.0); test_one<multi_polygon_type, polygon_type>("rt_u4", rt_u4, join_round, end_flat, 126.9268, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_u5", rt_u5, join_round, end_flat, 78.4906, 1.0); test_one<multi_polygon_type, polygon_type>("rt_u5", rt_u5, join_round, end_flat, 78.4906, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_u6", rt_u6, join_round, end_flat, 115.4461, 1.0); test_one<multi_polygon_type, polygon_type>("rt_u6", rt_u6, join_round, end_flat, 115.4461, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_u7", rt_u7, join_miter, end_flat, 42.6421, 1.0); test_one<multi_polygon_type, polygon_type>("rt_u7", rt_u7, join_miter, end_flat, 42.6421, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_u7", rt_u7, join_round, end_flat, 35.6233, 1.0); test_one<multi_polygon_type, polygon_type>("rt_u7", rt_u7, join_round, end_flat, 35.6233, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_u7_rough", rt_u7, join_round_rough, end_flat, {35.1675, 35.2290}, 1.0); test_one<multi_polygon_type, polygon_type>("rt_u7_rough", rt_u7, join_round_rough, end_flat, {35.1675, 35.2290}, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_u8", rt_u8, join_miter, end_flat, 70.9142, 1.0); test_one<multi_polygon_type, polygon_type>("rt_u8", rt_u8, join_miter, end_flat, 70.9142, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_u9", rt_u9, join_miter, end_flat, 59.3063, 1.0); test_one<multi_polygon_type, polygon_type>("rt_u9", rt_u9, join_miter, end_flat, 59.3063, 1.0);
#if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES)
// Fails with rescaling after removing pretraversal
test_one<multi_polygon_type, polygon_type>("rt_u10", rt_u10, join_miter, end_flat, 144.0858, 1.0); test_one<multi_polygon_type, polygon_type>("rt_u10", rt_u10, join_miter, end_flat, 144.0858, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_u10_51", rt_u10, join_miter, end_flat, 0.16738, -0.51); test_one<multi_polygon_type, polygon_type>("rt_u10_51", rt_u10, join_miter, end_flat, 0.16738, -0.51);
test_one<multi_polygon_type, polygon_type>("rt_u10_c_51", rt_u10_c, join_miter, end_flat, 0.066952, -0.51); test_one<multi_polygon_type, polygon_type>("rt_u10_c_51", rt_u10_c, join_miter, end_flat, 0.066952, -0.51);
@ -593,21 +585,12 @@ void test_all()
// TODO: invalid - making a bow-tie // TODO: invalid - making a bow-tie
test_one<multi_polygon_type, polygon_type>("rt_u10_50", rt_u10, join_miter, end_flat, 0.214466, -0.50, ut_settings::ignore_validity()); test_one<multi_polygon_type, polygon_type>("rt_u10_50", rt_u10, join_miter, end_flat, 0.214466, -0.50, ut_settings::ignore_validity());
test_one<multi_polygon_type, polygon_type>("rt_u10_45", rt_u10, join_miter, end_flat, 1.3000, -0.45); test_one<multi_polygon_type, polygon_type>("rt_u10_45", rt_u10, join_miter, end_flat, 1.3000, -0.45);
#endif
test_one<multi_polygon_type, polygon_type>("rt_u10_25", rt_u10, join_miter, end_flat, 9.6682, -0.25); test_one<multi_polygon_type, polygon_type>("rt_u10_25", rt_u10, join_miter, end_flat, 9.6682, -0.25);
test_one<multi_polygon_type, polygon_type>("rt_u11", rt_u11, join_miter, end_flat, 131.3995, 1.0); test_one<multi_polygon_type, polygon_type>("rt_u11", rt_u11, join_miter, end_flat, 131.3995, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_u11_50", rt_u11, join_miter, end_flat, 0.04289, -0.50); test_one<multi_polygon_type, polygon_type>("rt_u11_50", rt_u11, join_miter, end_flat, 0.04289, -0.50);
test_one<multi_polygon_type, polygon_type>("rt_u11_25", rt_u11, join_miter, end_flat, 10.1449, -0.25); test_one<multi_polygon_type, polygon_type>("rt_u11_25", rt_u11, join_miter, end_flat, 10.1449, -0.25);
#if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES)
// Fails with rescaling after correcting the tolerance in sort_by_side
test_one<multi_polygon_type, polygon_type>("rt_u12", rt_u12, join_miter, end_flat, 142.1348, 1.0); test_one<multi_polygon_type, polygon_type>("rt_u12", rt_u12, join_miter, end_flat, 142.1348, 1.0);
#endif
#if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES)
// Fails with rescaling in combination with get_clusters
test_one<multi_polygon_type, polygon_type>("rt_u13", rt_u13, join_miter, end_flat, 115.4853, 1.0); test_one<multi_polygon_type, polygon_type>("rt_u13", rt_u13, join_miter, end_flat, 115.4853, 1.0);
#endif
test_one<multi_polygon_type, polygon_type>("rt_v1", rt_v1, join_round32, end_flat, 26.9994, 1.0); test_one<multi_polygon_type, polygon_type>("rt_v1", rt_v1, join_round32, end_flat, 26.9994, 1.0);
test_one<multi_polygon_type, polygon_type>("rt_v2", rt_v2, join_round32, end_flat, 47.3510, 1.0); test_one<multi_polygon_type, polygon_type>("rt_v2", rt_v2, join_round32, end_flat, 47.3510, 1.0);
@ -655,10 +638,7 @@ void test_all()
test_one<multi_polygon_type, polygon_type>("nores_b03e", nores_b03e, join_round32, end_flat, 14.4877, 1.0); test_one<multi_polygon_type, polygon_type>("nores_b03e", nores_b03e, join_round32, end_flat, 14.4877, 1.0);
test_one<multi_polygon_type, polygon_type>("res_ebc4", res_ebc4, join_round32, end_flat, 43.8877, 1.0); test_one<multi_polygon_type, polygon_type>("res_ebc4", res_ebc4, join_round32, end_flat, 43.8877, 1.0);
#if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES)
// Erroneous case with rescaling
test_one<multi_polygon_type, polygon_type>("res_8618", res_8618, join_round32, end_flat, 48.1085, 1.0); test_one<multi_polygon_type, polygon_type>("res_8618", res_8618, join_round32, end_flat, 48.1085, 1.0);
#endif
test_one<multi_polygon_type, polygon_type>("res_3b4d", res_3b4d, join_round32, end_flat, 48.4739, 1.0); test_one<multi_polygon_type, polygon_type>("res_3b4d", res_3b4d, join_round32, end_flat, 48.4739, 1.0);
test_one<multi_polygon_type, polygon_type>("neighbouring_small", test_one<multi_polygon_type, polygon_type>("neighbouring_small",
@ -704,7 +684,7 @@ int test_main(int, char* [])
#endif #endif
#if defined(BOOST_GEOMETRY_TEST_FAILURES) #if defined(BOOST_GEOMETRY_TEST_FAILURES)
BoostGeometryWriteExpectedFailures(3, 1, 3, 3); BoostGeometryWriteExpectedFailures(1, 3, 3);
#endif #endif
return 0; return 0;

View File

@ -538,12 +538,8 @@ void test_all()
join_round, end_flat, {11363180033, 11363180045}, 50.0 * 1000.0); join_round, end_flat, {11363180033, 11363180045}, 50.0 * 1000.0);
test_one<polygon_type, polygon_type>("italy_part1_60", italy_part1, test_one<polygon_type, polygon_type>("italy_part1_60", italy_part1,
join_round, end_flat, 15479097108.720, 60.0 * 1000.0); join_round, end_flat, 15479097108.720, 60.0 * 1000.0);
#if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES)
// Fails with rescaling after removing pretraverse
test_one<polygon_type, polygon_type>("italy_part2_5", italy_part2, test_one<polygon_type, polygon_type>("italy_part2_5", italy_part2,
join_round, end_flat, {12496082120, 12496082124}, 5 * 1000.0); join_round, end_flat, {12496082120, 12496082124}, 5 * 1000.0);
#endif
if (! BOOST_GEOMETRY_CONDITION((std::is_same<coor_type, float>::value))) if (! BOOST_GEOMETRY_CONDITION((std::is_same<coor_type, float>::value)))
{ {
@ -605,10 +601,7 @@ void test_all()
// Test issue 555 as reported (-0.000001) and some variants // Test issue 555 as reported (-0.000001) and some variants
bg::strategy::buffer::join_round jr(180); bg::strategy::buffer::join_round jr(180);
bg::strategy::buffer::end_round er(180); bg::strategy::buffer::end_round er(180);
#if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES)
// With rescaling the interior ring is missing
test_one<polygon_type, polygon_type>("issue_555", issue_555, jr, er, 4520.7942, -0.000001); test_one<polygon_type, polygon_type>("issue_555", issue_555, jr, er, 4520.7942, -0.000001);
#endif
test_one<polygon_type, polygon_type>("issue_555", issue_555, jr, er, 4520.7957, +0.000001); test_one<polygon_type, polygon_type>("issue_555", issue_555, jr, er, 4520.7957, +0.000001);
test_one<polygon_type, polygon_type>("issue_555_1000", issue_555, jr, er, 4521.6280, +0.001); test_one<polygon_type, polygon_type>("issue_555_1000", issue_555, jr, er, 4521.6280, +0.001);
test_one<polygon_type, polygon_type>("issue_555_1000", issue_555, jr, er, 4519.9627, -0.001); test_one<polygon_type, polygon_type>("issue_555_1000", issue_555, jr, er, 4519.9627, -0.001);
@ -948,7 +941,7 @@ int test_main(int, char* [])
#endif #endif
#if defined(BOOST_GEOMETRY_TEST_FAILURES) #if defined(BOOST_GEOMETRY_TEST_FAILURES)
BoostGeometryWriteExpectedFailures(2, 1, 9, 1); BoostGeometryWriteExpectedFailures(1, 9, 1);
#endif #endif
test_different(); test_different();

View File

@ -2,6 +2,10 @@
// Copyright (c) 2024 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2024 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2019-2024.
// Modifications copyright (c) 2019-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
@ -159,7 +163,6 @@ void test_buffer(std::string const& caseid, std::string const& wkt, std::vector<
distance_strategy, buffer_side_strategy, join_strategy, distance_strategy, buffer_side_strategy, join_strategy,
end_strategy, point_strategy, end_strategy, point_strategy,
strategy, strategy,
bg::detail::no_rescale_policy(),
visitor); visitor);
#if defined(TEST_WITH_SVG) #if defined(TEST_WITH_SVG)

View File

@ -3,8 +3,9 @@
// Copyright (c) 2010-2019 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2010-2019 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2016-2021. // This file was modified by Oracle on 2016-2024.
// Modifications copyright (c) 2016-2021, Oracle and/or its affiliates. // Modifications copyright (c) 2016-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -227,9 +228,6 @@ void test_buffer(std::string const& caseid,
<< (end_name.empty() ? "" : "_") << end_name << (end_name.empty() ? "" : "_") << end_name
<< (distance_strategy.negative() ? "_deflate" : "") << (distance_strategy.negative() ? "_deflate" : "")
<< (bg::point_order<GeometryOut>::value == bg::counterclockwise ? "_ccw" : "") << (bg::point_order<GeometryOut>::value == bg::counterclockwise ? "_ccw" : "")
#if defined(BOOST_GEOMETRY_USE_RESCALING)
<< "_rescaled"
#endif
// << "_" << point_buffer_count // << "_" << point_buffer_count
; ;
@ -272,15 +270,9 @@ void test_buffer(std::string const& caseid,
#endif #endif
typedef typename bg::point_type<Geometry>::type point_type; typedef typename bg::point_type<Geometry>::type point_type;
typedef typename bg::rescale_policy_type<point_type>::type
rescale_policy_type;
// Enlarge the box to get a proper rescale policy
bg::buffer(envelope, envelope, distance_strategy.max_distance(join_strategy, end_strategy)); bg::buffer(envelope, envelope, distance_strategy.max_distance(join_strategy, end_strategy));
rescale_policy_type rescale_policy
= bg::get_rescale_policy<rescale_policy_type>(envelope, strategy);
buffered.clear(); buffered.clear();
bg::detail::buffer::buffer_inserter<GeometryOut>(geometry, bg::detail::buffer::buffer_inserter<GeometryOut>(geometry,
std::back_inserter(buffered), std::back_inserter(buffered),
@ -290,7 +282,6 @@ void test_buffer(std::string const& caseid,
end_strategy, end_strategy,
point_strategy, point_strategy,
strategy, strategy,
rescale_policy,
visitor); visitor);
#if defined(TEST_WITH_CSV) #if defined(TEST_WITH_CSV)
@ -379,15 +370,12 @@ void test_buffer(std::string const& caseid,
join_strategy, join_strategy,
end_strategy, end_strategy,
point_strategy, point_strategy,
rescale_policy,
ptv); ptv);
ptv.map_input_output(geometry, buffered, distance_strategy.negative()); ptv.map_input_output(geometry, buffered, distance_strategy.negative());
// self_ips NYI here // self_ips NYI here
} }
#elif defined(TEST_WITH_SVG) #elif defined(TEST_WITH_SVG)
rescale_policy_type rescale_policy_output buffer_mapper.map_self_ips(mapper, buffered, strategy);
= bg::get_rescale_policy<rescale_policy_type>(envelope_output);
buffer_mapper.map_self_ips(mapper, buffered, strategy, rescale_policy_output);
#endif #endif
} }

View File

@ -3,8 +3,9 @@
// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2020-2021. // This file was modified by Oracle on 2020-2024.
// Modifications copyright (c) 2020-2021, Oracle and/or its affiliates. // Modifications copyright (c) 2020-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -39,7 +40,7 @@ void test_sectionalize(std::string const /*caseid*/, Geometry const& geometry, s
typedef std::integer_sequence<std::size_t, 0> dim2; typedef std::integer_sequence<std::size_t, 0> dim2;
sections s; sections s;
bg::sectionalize<Reverse, dim2>(geometry, bg::detail::no_rescale_policy(), s); bg::sectionalize<Reverse, dim2>(geometry, s);
BOOST_CHECK_EQUAL(s.size(), section_count); BOOST_CHECK_EQUAL(s.size(), section_count);

View File

@ -5,8 +5,9 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2020-2021. // This file was modified by Oracle on 2020-2024.
// Modifications copyright (c) 2020-2021, Oracle and/or its affiliates. // Modifications copyright (c) 2020-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
@ -61,7 +62,6 @@ void test_sectionalize_part()
Geometry geometry; Geometry geometry;
geometry.push_back(bg::make<point_type>(1, 1)); geometry.push_back(bg::make<point_type>(1, 1));
bg::detail::no_rescale_policy rescale_policy;
typename bg::strategies::relate::services::default_strategy typename bg::strategies::relate::services::default_strategy
< <
Geometry, Geometry Geometry, Geometry
@ -69,12 +69,12 @@ void test_sectionalize_part()
bg::ring_identifier ring_id; bg::ring_identifier ring_id;
sectionalize_part::apply(sections, geometry.begin(), geometry.end(), sectionalize_part::apply(sections, geometry.begin(), geometry.end(),
rescale_policy, strategy, ring_id, 10); strategy, ring_id, 10);
// There should not yet be anything generated, because it is only ONE point // There should not yet be anything generated, because it is only ONE point
geometry.push_back(bg::make<point_type>(2, 2)); geometry.push_back(bg::make<point_type>(2, 2));
sectionalize_part::apply(sections, geometry.begin(), geometry.end(), sectionalize_part::apply(sections, geometry.begin(), geometry.end(),
rescale_policy, strategy, ring_id, 10); strategy, ring_id, 10);
} }
@ -92,8 +92,7 @@ void test_sectionalize(std::string const& caseid, G const& g, std::size_t sectio
using sections= bg::sections<box, dimension_count>; using sections= bg::sections<box, dimension_count>;
sections s; sections s;
bg::sectionalize<Reverse, DimensionVector>(g, bg::sectionalize<Reverse, DimensionVector>(g, s, 0, max_count);
bg::detail::no_rescale_policy(), s, 0, max_count);
BOOST_CHECK_EQUAL(s.size(), section_count); BOOST_CHECK_EQUAL(s.size(), section_count);
@ -340,8 +339,8 @@ void test_large_integers()
bg::sections<bg::model::box<double_point_type>, 1> double_sections; bg::sections<bg::model::box<double_point_type>, 1> double_sections;
bg::sectionalize<false, dimensions>(int_poly, bg::detail::no_rescale_policy(), int_sections); bg::sectionalize<false, dimensions>(int_poly, int_sections);
bg::sectionalize<false, dimensions>(double_poly, bg::detail::no_rescale_policy(), double_sections); bg::sectionalize<false, dimensions>(double_poly, double_sections);
bool equally_sized = int_sections.size() == double_sections.size(); bool equally_sized = int_sections.size() == double_sections.size();
BOOST_CHECK(equally_sized); BOOST_CHECK(equally_sized);

View File

@ -3,6 +3,10 @@
// Copyright (c) 2022 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2022 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2024.
// Modifications copyright (c) 2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
@ -30,7 +34,7 @@ void test_sectionalize_on_const(Geometry const& geometry, std::size_t expected_s
using dim_type = std::integer_sequence<std::size_t, Dim>; using dim_type = std::integer_sequence<std::size_t, Dim>;
section_type sections; section_type sections;
bg::sectionalize<false, dim_type>(geometry, bg::detail::no_rescale_policy(), sections); bg::sectionalize<false, dim_type>(geometry, sections);
BOOST_CHECK_EQUAL(sections.size(), expected_section_count); BOOST_CHECK_EQUAL(sections.size(), expected_section_count);
} }

View File

@ -214,10 +214,7 @@ int test_main( int , char* [] )
{ {
test_all<bg::model::d2::point_xy<double> >(); test_all<bg::model::d2::point_xy<double> >();
test_all<bg::model::d2::point_xy<double>, bg::model::point<double, 2, bg::cs::cartesian> >(); test_all<bg::model::d2::point_xy<double>, bg::model::point<double, 2, bg::cs::cartesian> >();
#if ! defined(BOOST_GEOMETRY_RESCALE_TO_ROBUST)
test_all<bg::model::d2::point_xy<boost::rational<int> > >(); test_all<bg::model::d2::point_xy<boost::rational<int> > >();
#endif
return 0; return 0;
} }

View File

@ -159,10 +159,7 @@ int test_main( int , char* [] )
test_all<bg::model::d2::point_xy<float>, bg::model::point<double, 2, bg::cs::cartesian> >(); test_all<bg::model::d2::point_xy<float>, bg::model::point<double, 2, bg::cs::cartesian> >();
test_all<bg::model::d2::point_xy<double> >(); test_all<bg::model::d2::point_xy<double> >();
test_additional<bg::model::d2::point_xy<double> >(); test_additional<bg::model::d2::point_xy<double> >();
#if ! defined(BOOST_GEOMETRY_RESCALE_TO_ROBUST)
test_all<bg::model::d2::point_xy<boost::rational<int> > >(); test_all<bg::model::d2::point_xy<boost::rational<int> > >();
#endif
return 0; return 0;
} }

View File

@ -120,10 +120,7 @@ void test_all()
int test_main( int , char* [] ) int test_main( int , char* [] )
{ {
test_all<bg::model::d2::point_xy<double> >(); test_all<bg::model::d2::point_xy<double> >();
#if ! defined(BOOST_GEOMETRY_RESCALE_TO_ROBUST)
test_all<bg::model::d2::point_xy<boost::rational<int> > >(); test_all<bg::model::d2::point_xy<boost::rational<int> > >();
#endif
return 0; return 0;
} }

View File

@ -56,7 +56,7 @@ void geometry_to_svg(Geometry const& geometry, const std::string& case_id)
using turn_info = bg::detail::overlay::turn_info using turn_info = bg::detail::overlay::turn_info
< <
point_type, point_type,
typename bg::detail::segment_ratio_type<point_type, bg::detail::no_rescale_policy>::type typename bg::segment_ratio_type<point_type>::type
>; >;
using strategy_type = typename bg::strategies::relate::services::default_strategy using strategy_type = typename bg::strategies::relate::services::default_strategy
< <
@ -66,20 +66,13 @@ void geometry_to_svg(Geometry const& geometry, const std::string& case_id)
strategy_type strategy; strategy_type strategy;
#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
bg::detail::no_rescale_policy rescale_policy;
#else
using rescale_policy_type = typename bg::rescale_policy_type<point_type>::type;
rescale_policy_type rescale_policy = bg::get_rescale_policy<rescale_policy_type>(geometry, strategy);
#endif
std::vector<turn_info> turns; std::vector<turn_info> turns;
bg::detail::self_get_turn_points::no_interrupt_policy policy; bg::detail::self_get_turn_points::no_interrupt_policy policy;
bg::self_turns bg::self_turns
< <
bg::detail::overlay::assign_null_policy bg::detail::overlay::assign_null_policy
>(geometry, strategy, rescale_policy, turns, policy); >(geometry, strategy, turns, policy);
for (turn_info const& turn : turns) for (turn_info const& turn : turns)
{ {

View File

@ -3,8 +3,9 @@
// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2019-2021. // This file was modified by Oracle on 2019-2024.
// Modifications copyright (c) 2019-2021, Oracle and/or its affiliates. // Modifications copyright (c) 2019-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -31,8 +32,6 @@
#include <boost/geometry/io/wkt/read.hpp> #include <boost/geometry/io/wkt/read.hpp>
#include <boost/geometry/io/wkt/write.hpp> #include <boost/geometry/io/wkt/write.hpp>
#include <boost/geometry/policies/robustness/get_rescale_policy.hpp>
#include <boost/geometry/strategies/strategies.hpp> #include <boost/geometry/strategies/strategies.hpp>

View File

@ -3,8 +3,9 @@
// Copyright (c) 2021 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2021 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2021. // This file was modified by Oracle on 2021-2024.
// Modifications copyright (c) 2021, Oracle and/or its affiliates. // Modifications copyright (c) 2021-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -41,11 +42,10 @@ void do_test(std::string const& case_id,
std::size_t expected_cluster_count) std::size_t expected_cluster_count)
{ {
using coor_type = typename bg::coordinate_type<Point>::type; using coor_type = typename bg::coordinate_type<Point>::type;
using policy_type = bg::detail::no_rescale_policy;
using turn_info = bg::detail::overlay::turn_info using turn_info = bg::detail::overlay::turn_info
< <
Point, Point,
typename bg::detail::segment_ratio_type<Point, policy_type>::type typename bg::segment_ratio_type<Point>::type
>; >;
using cluster_type = std::map using cluster_type = std::map
@ -61,7 +61,7 @@ void do_test(std::string const& case_id,
} }
cluster_type clusters; cluster_type clusters;
bg::detail::overlay::get_clusters(turns, clusters, policy_type()); bg::detail::overlay::get_clusters(turns, clusters);
BOOST_CHECK_MESSAGE(expected_cluster_count == clusters.size(), BOOST_CHECK_MESSAGE(expected_cluster_count == clusters.size(),
"Case: " << case_id "Case: " << case_id
<< " ctype: " << string_from_type<coor_type>::name() << " ctype: " << string_from_type<coor_type>::name()

View File

@ -3,8 +3,9 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017-2021. // This file was modified by Oracle on 2017-2024.
// Modifications copyright (c) 2017-2021, Oracle and/or its affiliates. // Modifications copyright (c) 2017-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -77,24 +78,21 @@ void test_with_point(std::string const& caseid,
P, P P, P
>::type strategy_type; >::type strategy_type;
typedef typename bg::detail::no_rescale_policy rescale_policy_type;
typedef bg::detail::overlay::turn_info typedef bg::detail::overlay::turn_info
< <
P, P,
typename bg::detail::segment_ratio_type<P, rescale_policy_type>::type typename bg::segment_ratio_type<P>::type
> turn_info; > turn_info;
typedef std::vector<turn_info> tp_vector; typedef std::vector<turn_info> tp_vector;
turn_info model; turn_info model;
tp_vector info; tp_vector info;
strategy_type strategy; strategy_type strategy;
rescale_policy_type rescale_policy;
sub_range_from_points<P> sub_range_p(pi, pj, pk); sub_range_from_points<P> sub_range_p(pi, pj, pk);
sub_range_from_points<P> sub_range_q(qi, qj, qk); sub_range_from_points<P> sub_range_q(qi, qj, qk);
bg::detail::overlay::get_turn_info bg::detail::overlay::get_turn_info
< <
bg::detail::overlay::assign_null_policy bg::detail::overlay::assign_null_policy
>::apply(sub_range_p, sub_range_q, model, strategy, rescale_policy, std::back_inserter(info)); >::apply(sub_range_p, sub_range_q, model, strategy, std::back_inserter(info));
if (info.size() == 0) if (info.size() == 0)
{ {

View File

@ -5,8 +5,9 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2017-2021. // This file was modified by Oracle on 2017-2024.
// Modifications copyright (c) 2017-2021, Oracle and/or its affiliates. // Modifications copyright (c) 2017-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
@ -28,7 +29,6 @@
#include <boost/geometry/algorithms/correct.hpp> #include <boost/geometry/algorithms/correct.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp> #include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
#include <boost/geometry/policies/robustness/get_rescale_policy.hpp>
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp> #include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
@ -69,18 +69,12 @@ struct test_get_turns
G1, G2 G1, G2
>::type strategy_type; >::type strategy_type;
typedef typename bg::rescale_policy_type<point_type>::type
rescale_policy_type;
strategy_type strategy; strategy_type strategy;
rescale_policy_type rescale_policy
= bg::get_rescale_policy<rescale_policy_type>(g1, g2);
typedef bg::detail::overlay::turn_info typedef bg::detail::overlay::turn_info
< <
point_type, point_type,
typename bg::detail::segment_ratio_type<point_type, rescale_policy_type>::type typename bg::segment_ratio_type<point_type>::type
> turn_info; > turn_info;
std::vector<turn_info> turns; std::vector<turn_info> turns;
@ -89,7 +83,7 @@ struct test_get_turns
bg::get_turns bg::get_turns
< <
false, false, bg::detail::overlay::assign_null_policy false, false, bg::detail::overlay::assign_null_policy
>(g1, g2, strategy, rescale_policy, turns, policy); >(g1, g2, strategy, turns, policy);
BOOST_CHECK_MESSAGE( BOOST_CHECK_MESSAGE(
expected_count == boost::size(turns), expected_count == boost::size(turns),

View File

@ -3,6 +3,10 @@
// Copyright (c) 2022 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2022 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2024.
// Modifications copyright (c) 2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
@ -24,15 +28,14 @@ void test_get_turns_on_const(Ring1 const &ring1, Ring2 const &ring2,
{ {
namespace bg = boost::geometry; namespace bg = boost::geometry;
using rescale_policy_type = bg::detail::no_rescale_policy;
using strategy_type = typename bg::strategies::relate::services::default_strategy<Ring1, Ring2>::type; using strategy_type = typename bg::strategies::relate::services::default_strategy<Ring1, Ring2>::type;
using point_type = typename bg::point_type<Ring1>::type; using point_type = typename bg::point_type<Ring1>::type;
using writable_point_type = typename bg::helper_geometry<point_type>::type; using writable_point_type = typename bg::helper_geometry<point_type>::type;
using segment_ratio_type = typename bg::detail::segment_ratio_type using segment_ratio_type = typename bg::segment_ratio_type
< <
writable_point_type, rescale_policy_type writable_point_type
>::type; >::type;
using turn_info = bg::detail::overlay::turn_info using turn_info = bg::detail::overlay::turn_info
< <
@ -45,7 +48,7 @@ void test_get_turns_on_const(Ring1 const &ring1, Ring2 const &ring2,
bg::get_turns bg::get_turns
< <
false, false, bg::detail::overlay::assign_null_policy false, false, bg::detail::overlay::assign_null_policy
>(ring1, ring2, strategy, rescale_policy_type(), turns, policy); >(ring1, ring2, strategy, turns, policy);
BOOST_CHECK_EQUAL(turns.size(), expectation.size()); BOOST_CHECK_EQUAL(turns.size(), expectation.size());

View File

@ -5,9 +5,9 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2014, 2015. // This file was modified by Oracle on 2014-2024.
// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates. // Modifications copyright (c) 2014-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library

View File

@ -1,7 +1,8 @@
// Boost.Geometry // Boost.Geometry
// Unit Test // Unit Test
// Copyright (c) 2016, Oracle and/or its affiliates. // Copyright (c) 2016-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,

View File

@ -5,8 +5,9 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2014-2021. // This file was modified by Oracle on 2014-2024.
// Modifications copyright (c) 2014-2021 Oracle and/or its affiliates. // Modifications copyright (c) 2014-2024 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library

View File

@ -1,7 +1,8 @@
// Boost.Geometry // Boost.Geometry
// Unit Test // Unit Test
// Copyright (c) 2016-2021, Oracle and/or its affiliates. // Copyright (c) 2016-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,

View File

@ -3,8 +3,9 @@
// Copyright (c) 2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017-2021. // This file was modified by Oracle on 2017-2024.
// Modifications copyright (c) 2017-2021, Oracle and/or its affiliates. // Modifications copyright (c) 2017-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -363,9 +364,6 @@ void test_overlay(std::string const& caseid,
<< "_" << string_from_type<typename bg::coordinate_type<Geometry>::type>::name() << "_" << string_from_type<typename bg::coordinate_type<Geometry>::type>::name()
<< (ccw ? "_ccw" : "") << (ccw ? "_ccw" : "")
<< (open ? "_open" : "") << (open ? "_open" : "")
#if defined(BOOST_GEOMETRY_USE_RESCALING)
<< "_rescaled"
#endif
<< ".svg"; << ".svg";
std::ofstream svg(filename.str().c_str()); std::ofstream svg(filename.str().c_str());
@ -404,15 +402,6 @@ void test_overlay(std::string const& caseid,
strategy_type strategy; strategy_type strategy;
using rescale_policy_type = typename bg::rescale_overlay_policy_type
<
Geometry,
Geometry
>::type;
rescale_policy_type robust_policy
= bg::get_rescale_policy<rescale_policy_type>(g1, g2);
#if defined(TEST_WITH_SVG) #if defined(TEST_WITH_SVG)
map_visitor<svg_mapper> visitor(mapper); map_visitor<svg_mapper> visitor(mapper);
#else #else
@ -420,7 +409,7 @@ void test_overlay(std::string const& caseid,
#endif #endif
Geometry result; Geometry result;
overlay::apply(g1, g2, robust_policy, std::back_inserter(result), overlay::apply(g1, g2, std::back_inserter(result),
strategy, visitor); strategy, visitor);
std::string message; std::string message;

View File

@ -5,8 +5,9 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2017-2021. // This file was modified by Oracle on 2017-2024.
// Modifications copyright (c) 2017-2021, Oracle and/or its affiliates. // Modifications copyright (c) 2017-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
@ -28,7 +29,6 @@
#include <boost/geometry/algorithms/intersects.hpp> #include <boost/geometry/algorithms/intersects.hpp>
//#include <boost/geometry/algorithms/detail/overlay/self_intersection_points.hpp> //#include <boost/geometry/algorithms/detail/overlay/self_intersection_points.hpp>
#include <boost/geometry/algorithms/detail/overlay/self_turn_points.hpp> #include <boost/geometry/algorithms/detail/overlay/self_turn_points.hpp>
#include <boost/geometry/policies/robustness/get_rescale_policy.hpp>
#include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/linestring.hpp> #include <boost/geometry/geometries/linestring.hpp>
@ -54,24 +54,21 @@ static void test_self_intersection_points(std::string const& case_id,
double /*precision*/ = 0.001) double /*precision*/ = 0.001)
{ {
typedef typename bg::point_type<Geometry>::type point_type; typedef typename bg::point_type<Geometry>::type point_type;
//typedef typename bg::rescale_policy_type<point_type>::type rescale_policy_type;
typedef typename bg::strategies::relate::services::default_strategy typedef typename bg::strategies::relate::services::default_strategy
< <
Geometry, Geometry Geometry, Geometry
>::type strategy_type; >::type strategy_type;
typedef bg::detail::no_rescale_policy rescale_policy_type;
typedef bg::detail::overlay::turn_info<point_type> turn_info; typedef bg::detail::overlay::turn_info<point_type> turn_info;
std::vector<turn_info> turns; std::vector<turn_info> turns;
strategy_type strategy; strategy_type strategy;
rescale_policy_type rescale_policy;
bg::detail::self_get_turn_points::no_interrupt_policy policy; bg::detail::self_get_turn_points::no_interrupt_policy policy;
bg::self_turns bg::self_turns
< <
bg::detail::overlay::assign_null_policy bg::detail::overlay::assign_null_policy
>(geometry, strategy, rescale_policy, turns, policy); >(geometry, strategy, turns, policy);
typedef typename bg::coordinate_type<Geometry>::type ct; typedef typename bg::coordinate_type<Geometry>::type ct;
@ -91,12 +88,6 @@ static void test_self_intersection_points(std::string const& case_id,
BOOST_CHECK_EQUAL(expected_count, n); BOOST_CHECK_EQUAL(expected_count, n);
typedef typename bg::rescale_policy_type<point_type>::type
default_rescale_policy_type;
default_rescale_policy_type default_robust_policy
= bg::get_rescale_policy<default_rescale_policy_type>(geometry, strategy);
if (expected_count > 0) if (expected_count > 0)
{ {
BOOST_CHECK_EQUAL(bg::intersects(geometry), true); BOOST_CHECK_EQUAL(bg::intersects(geometry), true);
@ -105,7 +96,7 @@ static void test_self_intersection_points(std::string const& case_id,
{ {
try try
{ {
bg::detail::overlay::has_self_intersections(geometry, strategy, default_robust_policy); bg::detail::overlay::has_self_intersections(geometry, strategy);
BOOST_CHECK_MESSAGE(false, "Case " << case_id << " there are no self-intersections detected!"); BOOST_CHECK_MESSAGE(false, "Case " << case_id << " there are no self-intersections detected!");
} }
catch(...) catch(...)
@ -119,7 +110,7 @@ static void test_self_intersection_points(std::string const& case_id,
{ {
try try
{ {
bg::detail::overlay::has_self_intersections(geometry, strategy, default_robust_policy); bg::detail::overlay::has_self_intersections(geometry, strategy);
} }
catch(...) catch(...)
{ {

View File

@ -4,8 +4,9 @@
// Copyright (c) 2016 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2016 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2017-2021. // This file was modified by Oracle on 2017-2024.
// Modifications copyright (c) 2017-2021, Oracle and/or its affiliates. // Modifications copyright (c) 2017-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -124,11 +125,10 @@ template
bool Reverse1, bool Reverse2, bool ReverseOut, bool Reverse1, bool Reverse2, bool ReverseOut,
typename GeometryOut, typename GeometryOut,
typename Geometry1, typename Geometry2, typename Geometry1, typename Geometry2,
typename RobustPolicy, typename Strategy typename Strategy
> >
std::vector<std::size_t> apply_overlay( std::vector<std::size_t> apply_overlay(
Geometry1 const& geometry1, Geometry2 const& geometry2, Geometry1 const& geometry1, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
Strategy const& strategy) Strategy const& strategy)
{ {
using namespace boost::geometry; using namespace boost::geometry;
@ -137,7 +137,7 @@ std::vector<std::size_t> apply_overlay(
typedef bg::detail::overlay::traversal_turn_info typedef bg::detail::overlay::traversal_turn_info
< <
point_type, point_type,
typename bg::detail::segment_ratio_type<point_type, RobustPolicy>::type typename bg::segment_ratio_type<point_type>::type
> turn_info; > turn_info;
typedef std::deque<turn_info> turn_container_type; typedef std::deque<turn_info> turn_container_type;
@ -155,12 +155,12 @@ std::vector<std::size_t> apply_overlay(
< <
Reverse1, Reverse2, Reverse1, Reverse2,
detail::overlay::assign_null_policy detail::overlay::assign_null_policy
>(geometry1, geometry2, strategy, robust_policy, turns, policy); >(geometry1, geometry2, strategy, turns, policy);
cluster_type clusters; cluster_type clusters;
bg::enrich_intersection_points<Reverse1, Reverse2, OverlayType>(turns, bg::enrich_intersection_points<Reverse1, Reverse2, OverlayType>(turns,
clusters, geometry1, geometry2, robust_policy, strategy); clusters, geometry1, geometry2, strategy);
// Gather cluster properties, with test option // Gather cluster properties, with test option
return ::gather_cluster_properties<Reverse1, Reverse2, OverlayType>( return ::gather_cluster_properties<Reverse1, Reverse2, OverlayType>(
@ -188,15 +188,6 @@ void test_sort_by_side(std::string const& case_id,
typedef typename boost::range_value<Geometry>::type geometry_out; typedef typename boost::range_value<Geometry>::type geometry_out;
typedef typename bg::rescale_overlay_policy_type
<
Geometry,
Geometry
>::type rescale_policy_type;
rescale_policy_type robust_policy
= bg::get_rescale_policy<rescale_policy_type>(g1, g2);
typedef typename bg::strategies::relate::services::default_strategy typedef typename bg::strategies::relate::services::default_strategy
< <
Geometry, Geometry Geometry, Geometry
@ -207,7 +198,7 @@ void test_sort_by_side(std::string const& case_id,
std::vector<std::size_t> result = ::apply_overlay std::vector<std::size_t> result = ::apply_overlay
< <
OverlayType, false, false, false, geometry_out OverlayType, false, false, false, geometry_out
>(g1, g2, robust_policy, strategy); >(g1, g2, strategy);
BOOST_CHECK_MESSAGE(result == expected_open_count, BOOST_CHECK_MESSAGE(result == expected_open_count,
" caseid=" << case_id " caseid=" << case_id

View File

@ -4,8 +4,9 @@
// Copyright (c) 2017 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2017 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2017-2021. // This file was modified by Oracle on 2017-2024.
// Modifications copyright (c) 2017-2021, Oracle and/or its affiliates. // Modifications copyright (c) 2017-2024, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -49,12 +50,11 @@ std::string as_string(std::vector<T> const& v)
template template
< <
typename Geometry, typename Point, typename Geometry, typename Point,
typename RobustPolicy, typename Strategy typename Strategy
> >
std::vector<std::size_t> apply_get_turns(std::string const& case_id, std::vector<std::size_t> apply_get_turns(std::string const& case_id,
Geometry const& geometry1, Geometry const& geometry2, Geometry const& geometry1, Geometry const& geometry2,
Point const& turn_point, Point const& origin_point, Point const& turn_point, Point const& origin_point,
RobustPolicy const& robust_policy,
Strategy const& strategy, Strategy const& strategy,
std::size_t expected_open_count, std::size_t expected_open_count,
std::size_t expected_max_rank, std::size_t expected_max_rank,
@ -69,7 +69,7 @@ std::vector<std::size_t> apply_get_turns(std::string const& case_id,
typedef bg::detail::overlay::turn_info typedef bg::detail::overlay::turn_info
< <
point_type, point_type,
typename bg::detail::segment_ratio_type<point_type, RobustPolicy>::type typename bg::segment_ratio_type<point_type>::type
> turn_info; > turn_info;
typedef std::deque<turn_info> turn_container_type; typedef std::deque<turn_info> turn_container_type;
@ -80,7 +80,7 @@ std::vector<std::size_t> apply_get_turns(std::string const& case_id,
< <
false, false, false, false,
detail::overlay::assign_null_policy detail::overlay::assign_null_policy
>(geometry1, geometry2, strategy, robust_policy, turns, policy); >(geometry1, geometry2, strategy, turns, policy);
// Define sorter, sorting counter-clockwise such that polygons are on the // Define sorter, sorting counter-clockwise such that polygons are on the
@ -241,15 +241,6 @@ void test_basic(std::string const& case_id,
bg::correct(g1); bg::correct(g1);
bg::correct(g2); bg::correct(g2);
typedef typename bg::rescale_overlay_policy_type
<
multi_polygon,
multi_polygon
>::type rescale_policy_type;
rescale_policy_type robust_policy
= bg::get_rescale_policy<rescale_policy_type>(g1, g2);
typedef typename bg::strategies::relate::services::default_strategy typedef typename bg::strategies::relate::services::default_strategy
< <
multi_polygon, multi_polygon multi_polygon, multi_polygon
@ -258,7 +249,7 @@ void test_basic(std::string const& case_id,
strategy_type strategy; strategy_type strategy;
apply_get_turns(case_id, g1, g2, turn_point, origin_point, apply_get_turns(case_id, g1, g2, turn_point, origin_point,
robust_policy, strategy, strategy,
expected_open_count, expected_max_rank, expected_right_count); expected_open_count, expected_max_rank, expected_right_count);
} }

Some files were not shown because too many files have changed in this diff Show More