Skip to content

Commit da14168

Browse files
committed
Merge branch 'develop'
2 parents 600bac8 + fa36235 commit da14168

File tree

111 files changed

+768
-382
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+768
-382
lines changed

doc/release_notes.qbk

+12
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@
1919

2020
[section:release_notes Release Notes]
2121

22+
[/=================]
23+
[heading Boost 1.84]
24+
[/=================]
25+
26+
[*Solved issues]
27+
28+
* [@https://github.com/boostorg/geometry/issues/1138 1138] Fix difference of two polygons
29+
* [@https://github.com/boostorg/geometry/issues/1183 1183] Fix for union_ incomplete result polygon
30+
* [@https://github.com/boostorg/geometry/issues/1184 1184] Fix for intersection
31+
* [@https://github.com/boostorg/geometry/issues/1186 1186] Fix for union_ improper inner ring assignment
32+
* Various fixes of errors and warnings
33+
2234
[/=================]
2335
[heading Boost 1.83]
2436
[/=================]

include/boost/geometry/algorithms/assign.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ template <typename Geometry1, typename Geometry2>
216216
struct assign
217217
{
218218
static inline void
219-
apply(Geometry1& geometry1, const Geometry2& geometry2)
219+
apply(Geometry1& geometry1, Geometry2 const& geometry2)
220220
{
221221
concepts::check<Geometry1>();
222222
concepts::check<Geometry2 const>();

include/boost/geometry/algorithms/centroid.hpp

+1-8
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,9 @@ class centroid_exception : public geometry::exception
8282
{
8383
public:
8484

85-
/*!
86-
\brief The default constructor
87-
*/
8885
inline centroid_exception() {}
8986

90-
/*!
91-
\brief Returns the explanatory string.
92-
\return Pointer to a null-terminated string with explanatory information.
93-
*/
94-
virtual char const* what() const throw()
87+
char const* what() const noexcept override
9588
{
9689
return "Boost.Geometry Centroid calculation exception";
9790
}

include/boost/geometry/algorithms/correct_closure.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <boost/geometry/geometries/concepts/check.hpp>
2727

2828
#include <boost/geometry/util/range.hpp>
29+
#include <boost/range/size.hpp>
2930

3031
namespace boost { namespace geometry
3132
{

include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ struct buffered_piece_collection
698698
BOOST_GEOMETRY_ASSERT(pc.offsetted_count >= 0);
699699
}
700700

701-
inline void add_piece_point(piece& pc, const point_type& point, bool add_to_original)
701+
inline void add_piece_point(piece& pc, point_type const& point, bool add_to_original)
702702
{
703703
if (add_to_original && pc.type != strategy::buffer::buffered_concave)
704704
{

include/boost/geometry/algorithms/detail/buffer/line_line_intersection.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ struct line_line_intersection
7777
// | pa pa |
7878
// | qb qb |
7979
auto const denominator_pq = determinant<line, &line::a, &line::b>(p, q);
80-
constexpr decltype(denominator_pq) const zero = 0;
80+
static decltype(denominator_pq) const zero = 0;
8181

8282
if (equidistant)
8383
{

include/boost/geometry/algorithms/detail/buffer/piece_border.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <array>
1919

2020
#include <boost/core/addressof.hpp>
21+
#include <boost/range/size.hpp>
2122

2223
#include <boost/geometry/core/assert.hpp>
2324
#include <boost/geometry/core/config.hpp>

include/boost/geometry/algorithms/detail/buffer/turn_in_original_visitor.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616

1717

1818
#include <boost/core/ignore_unused.hpp>
19-
#include <boost/geometry/core/coordinate_type.hpp>
19+
#include <boost/range/size.hpp>
2020

21+
#include <boost/geometry/core/coordinate_type.hpp>
2122
#include <boost/geometry/algorithms/detail/buffer/buffer_policies.hpp>
2223
#include <boost/geometry/algorithms/detail/disjoint/interface.hpp>
2324
#include <boost/geometry/algorithms/expand.hpp>

include/boost/geometry/algorithms/detail/calculate_point_order.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
#include <vector>
1616

17+
#include <boost/range/size.hpp>
18+
1719
#include <boost/geometry/algorithms/area.hpp>
1820
#include <boost/geometry/core/point_order.hpp>
1921
#include <boost/geometry/core/radian_access.hpp>

include/boost/geometry/algorithms/detail/closest_feature/point_to_range.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#include <boost/range/begin.hpp>
1616
#include <boost/range/end.hpp>
17-
#include <boost/range/size.hpp>
1817

1918
#include <boost/geometry/core/assert.hpp>
2019
#include <boost/geometry/core/closure.hpp>

include/boost/geometry/algorithms/detail/closest_points/multipoint_to_geometry.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
#include <iterator>
1414

15+
#include <boost/range/size.hpp>
16+
1517
#include <boost/geometry/algorithms/covered_by.hpp>
1618
#include <boost/geometry/algorithms/detail/closest_points/range_to_geometry_rtree.hpp>
1719
#include <boost/geometry/algorithms/detail/closest_points/utilities.hpp>

include/boost/geometry/algorithms/detail/convex_hull/graham_andrew.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
#include <algorithm>
2424
#include <vector>
2525

26+
#include <boost/range/size.hpp>
27+
2628
#include <boost/geometry/algorithms/detail/for_each_range.hpp>
2729
#include <boost/geometry/core/assert.hpp>
2830
#include <boost/geometry/core/closure.hpp>

include/boost/geometry/algorithms/detail/convex_hull/interface.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
#include <array>
2626

27+
#include <boost/range/size.hpp>
28+
2729
#include <boost/geometry/algorithms/detail/assign_box_corners.hpp>
2830
#include <boost/geometry/algorithms/detail/convex_hull/graham_andrew.hpp>
2931
#include <boost/geometry/algorithms/detail/equals/point_point.hpp>

include/boost/geometry/algorithms/detail/disjoint/linear_segment_or_box.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_LINEAR_SEGMENT_OR_BOX_HPP
2323

2424

25+
#include <boost/range/size.hpp>
26+
2527
#include <boost/geometry/algorithms/detail/disjoint/multirange_geometry.hpp>
2628
#include <boost/geometry/algorithms/dispatch/disjoint.hpp>
2729
#include <boost/geometry/algorithms/not_implemented.hpp>

include/boost/geometry/algorithms/detail/distance/geometry_collection.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
#include <vector>
1414

15+
#include <boost/range/size.hpp>
16+
1517
#include <boost/geometry/algorithms/dispatch/distance.hpp>
1618
#include <boost/geometry/algorithms/detail/visit.hpp>
1719
#include <boost/geometry/core/assert.hpp>

include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222

2323
#include <boost/numeric/conversion/cast.hpp>
24+
#include <boost/range/size.hpp>
2425

2526
#include <boost/geometry/algorithms/detail/normalize.hpp>
2627
#include <boost/geometry/algorithms/not_implemented.hpp>

include/boost/geometry/algorithms/detail/has_self_intersections.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class overlay_invalid_input_exception : public geometry::exception
5353

5454
inline overlay_invalid_input_exception() {}
5555

56-
virtual char const* what() const throw()
56+
char const* what() const noexcept override
5757
{
5858
return "Boost.Geometry Overlay invalid input exception";
5959
}

include/boost/geometry/algorithms/detail/intersection/box_box.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717

1818
#include <boost/geometry/algorithms/detail/intersection/interface.hpp>
19-
#include <boost/geometry/algorithms/detail/overlay/intersection_box_box.hpp>
19+
#include <boost/geometry/algorithms/detail/intersection/box_box_implementation.hpp>
2020

2121

2222
namespace boost { namespace geometry

include/boost/geometry/algorithms/detail/overlay/intersection_box_box.hpp renamed to include/boost/geometry/algorithms/detail/intersection/box_box_implementation.hpp

+7-10
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@
1111
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
1212
// http://www.boost.org/LICENSE_1_0.txt)
1313

14-
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_INTERSECTION_BOX_BOX_HPP
15-
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_INTERSECTION_BOX_BOX_HPP
14+
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTION_BOX_BOX_IMPLEMENTATION_HPP
15+
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTION_BOX_BOX_IMPLEMENTATION_HPP
1616

1717

1818
#include <boost/geometry/core/access.hpp>
19-
#include <boost/geometry/core/coordinate_type.hpp>
2019

2120

2221
namespace boost { namespace geometry
@@ -42,18 +41,16 @@ struct intersection_box_box
4241
BoxOut& box_out,
4342
Strategy const& strategy)
4443
{
45-
typedef typename coordinate_type<BoxOut>::type ct;
46-
47-
ct max1 = get<max_corner, Dimension>(box1);
48-
ct min2 = get<min_corner, Dimension>(box2);
44+
auto max1 = get<max_corner, Dimension>(box1);
45+
auto min2 = get<min_corner, Dimension>(box2);
4946

5047
if (max1 < min2)
5148
{
5249
return false;
5350
}
5451

55-
ct max2 = get<max_corner, Dimension>(box2);
56-
ct min1 = get<min_corner, Dimension>(box1);
52+
auto max2 = get<max_corner, Dimension>(box2);
53+
auto min1 = get<min_corner, Dimension>(box1);
5754

5855
if (max2 < min1)
5956
{
@@ -93,4 +90,4 @@ struct intersection_box_box<DimensionCount, DimensionCount>
9390
}} // namespace boost::geometry
9491

9592

96-
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_INTERSECTION_BOX_BOX_HPP
93+
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTION_BOX_BOX_IMPLEMENTATION_HPP

include/boost/geometry/algorithms/detail/intersection/gc.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
#include <tuple>
1414

15+
#include <boost/range/size.hpp>
16+
1517
#include <boost/geometry/algorithms/detail/gc_make_rtree.hpp>
1618
#include <boost/geometry/algorithms/detail/intersection/interface.hpp>
1719
#include <boost/geometry/views/detail/geometry_collection_view.hpp>

include/boost/geometry/algorithms/detail/is_valid/multipolygon.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <boost/iterator/filter_iterator.hpp>
2121
#include <boost/range/begin.hpp>
2222
#include <boost/range/end.hpp>
23-
#include <boost/range/size.hpp>
2423
#include <boost/range/value_type.hpp>
2524

2625
#include <boost/geometry/core/exterior_ring.hpp>

include/boost/geometry/algorithms/detail/is_valid/ring.hpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
#include <deque>
1717

18+
#include <boost/range/size.hpp>
19+
1820
#include <boost/core/ignore_unused.hpp>
1921

2022
#include <boost/geometry/core/closure.hpp>
@@ -38,12 +40,11 @@
3840
#include <boost/geometry/algorithms/detail/is_valid/has_valid_self_turns.hpp>
3941
#include <boost/geometry/algorithms/dispatch/is_valid.hpp>
4042

41-
// TEMP - with UmberllaStrategy this will be not needed
43+
// TEMP - with UmbrellaStrategy this will be not needed
4244
#include <boost/geometry/strategy/area.hpp>
4345
#include <boost/geometry/strategies/area/services.hpp>
4446
// TODO: use point_order instead of area
4547

46-
4748
#ifdef BOOST_GEOMETRY_TEST_DEBUG
4849
#include <boost/geometry/io/dsv/write.hpp>
4950
#endif

include/boost/geometry/algorithms/detail/overlay/append_no_dups_or_spikes.hpp

+42-34
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ inline void append_no_dups_or_spikes(Range& range, Point const& point,
100100
return;
101101
}
102102

103-
auto append = [](auto& r, const auto& p)
103+
auto append = [](auto& r, auto const& p)
104104
{
105105
using point_t = typename boost::range_value<Range>::type;
106106
point_t rp;
@@ -168,56 +168,64 @@ inline void append_no_collinear(Range& range, Point const& point,
168168
}
169169
}
170170

171-
template <typename Range, typename Strategy, typename RobustPolicy>
172-
inline void clean_closing_dups_and_spikes(Range& range,
173-
Strategy const& strategy,
174-
RobustPolicy const& robust_policy)
171+
// Should only be called internally, from traverse.
172+
template <typename Ring, typename Strategy, typename RobustPolicy>
173+
inline void remove_spikes_at_closure(Ring& ring, Strategy const& strategy,
174+
RobustPolicy const& robust_policy)
175175
{
176-
std::size_t const minsize
177-
= core_detail::closure::minimum_ring_size
178-
<
179-
geometry::closure<Range>::value
180-
>::value;
181-
182-
if (boost::size(range) <= minsize)
176+
// It assumes a closed ring (whatever the closure value)
177+
constexpr std::size_t min_size
178+
= core_detail::closure::minimum_ring_size
179+
<
180+
geometry::closed
181+
>::value;
182+
183+
if (boost::size(ring) < min_size)
183184
{
185+
// Don't act on too small rings.
184186
return;
185187
}
186188

187-
static bool const closed = geometry::closure<Range>::value == geometry::closed;
188-
189-
// TODO: the following algorithm could be rewritten to first look for spikes
190-
// and then erase some number of points from the beginning of the Range
191-
192189
bool found = false;
193190
do
194191
{
195192
found = false;
196-
auto first = boost::begin(range);
197-
auto second = first + 1;
198-
auto ultimate = boost::end(range) - 1;
199-
if (BOOST_GEOMETRY_CONDITION(closed))
200-
{
201-
ultimate--;
202-
}
193+
auto const first = boost::begin(ring);
194+
auto const second = first + 1;
195+
auto const penultimate = boost::end(ring) - 2;
203196

204197
// Check if closing point is a spike (this is so if the second point is
205198
// considered as collinear w.r.t. the last segment)
206-
if (point_is_collinear(*second, *ultimate, *first,
199+
if (point_is_collinear(*second, *penultimate, *first,
207200
strategy.side(), // TODO: Pass strategy?
208201
robust_policy))
209202
{
210-
range::erase(range, first);
211-
if (BOOST_GEOMETRY_CONDITION(closed))
212-
{
213-
// Remove closing last point
214-
range::resize(range, boost::size(range) - 1);
215-
// Add new closing point
216-
range::push_back(range, range::front(range));
217-
}
203+
// Remove first point and last point
204+
range::erase(ring, first);
205+
range::resize(ring, boost::size(ring) - 1);
206+
// Close the ring again
207+
range::push_back(ring, range::front(ring));
208+
218209
found = true;
219210
}
220-
} while(found && boost::size(range) > minsize);
211+
} while (found && boost::size(ring) >= min_size);
212+
}
213+
214+
template <typename Ring, typename Strategy>
215+
inline void fix_closure(Ring& ring, Strategy const& strategy)
216+
{
217+
if (BOOST_GEOMETRY_CONDITION(geometry::closure<Ring>::value == geometry::open))
218+
{
219+
if (! boost::empty(ring)
220+
&& detail::equals::equals_point_point(range::front(ring), range::back(ring), strategy))
221+
{
222+
// Correct closure: traversal automatically closes rings.
223+
// Depending on the geometric configuration,
224+
// remove_spikes_at_closure can remove the closing point.
225+
// But it does not always do that. Therefore it is corrected here explicitly.
226+
range::resize(ring, boost::size(ring) - 1);
227+
}
228+
}
221229
}
222230

223231

0 commit comments

Comments
 (0)