Skip to content

Commit b935617

Browse files
committed
feat: include changes and tests changes
1 parent 3fc2739 commit b935617

22 files changed

+573
-70
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// Boost.Geometry (aka GGL, Generic Geometry Library)
2+
3+
// Copyright (c) 2007-2025 Barend Gehrels, Amsterdam, the Netherlands.
4+
// Copyright (c) 2023-2024 Adam Wulkiewicz, Lodz, Poland.
5+
6+
// This file was modified by Oracle on 2017-2024.
7+
// Modifications copyright (c) 2017-2024 Oracle and/or its affiliates.
8+
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
9+
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
10+
11+
// Use, modification and distribution is subject to the Boost Software License,
12+
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
13+
// http://www.boost.org/LICENSE_1_0.txt)
14+
15+
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_DEBUG_TRAVERSE_HPP
16+
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_DEBUG_TRAVERSE_HPP
17+
18+
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
19+
20+
#if defined(BOOST_GEOMETRY_DEBUG_INTERSECTION) \
21+
|| defined(BOOST_GEOMETRY_OVERLAY_REPORT_WKT) \
22+
|| defined(BOOST_GEOMETRY_DEBUG_TRAVERSE)
23+
# include <string>
24+
# include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
25+
# include <boost/geometry/io/wkt/wkt.hpp>
26+
#endif
27+
28+
namespace boost { namespace geometry
29+
{
30+
31+
#ifndef DOXYGEN_NO_DETAIL
32+
namespace detail { namespace overlay
33+
{
34+
35+
template <typename Turn, typename Operation>
36+
#ifdef BOOST_GEOMETRY_DEBUG_TRAVERSE
37+
inline void debug_traverse(Turn const& turn, Operation op,
38+
std::string const& header, bool condition = true)
39+
{
40+
if (! condition)
41+
{
42+
return;
43+
}
44+
std::cout << " " << header
45+
<< " at " << op.seg_id
46+
<< " meth: " << method_char(turn.method)
47+
<< " op: " << operation_char(op.operation)
48+
<< " of: " << operation_char(turn.operations[0].operation)
49+
<< operation_char(turn.operations[1].operation)
50+
<< " " << geometry::wkt(turn.point)
51+
<< std::endl;
52+
53+
if (boost::contains(header, "Finished"))
54+
{
55+
std::cout << std::endl;
56+
}
57+
}
58+
#else
59+
inline void debug_traverse(Turn const& , Operation, const char*, bool = true)
60+
{
61+
}
62+
#endif
63+
64+
}} // namespace detail::overlay
65+
#endif // DOXYGEN_NO_DETAIL
66+
67+
}} // namespace boost::geometry
68+
69+
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_DEBUG_TRAVERSE_HPP

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

+5-10
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ inline void enrich_assign(Operations& operations, Turns& turns)
138138
&& op.seg_id == next_operation().seg_id
139139
&& indexed.turn_index != operations[next_index].turn_index)
140140
{
141+
// In same cluster, on same segment, but not same turn
141142
next_index = advance(next_index);
142143
}
143144

@@ -286,15 +287,9 @@ inline auto create_map(Turns const& turns, IncludePolicy const& include_policy)
286287
auto const& op = op_item.value;
287288
if (include_policy.include(op.operation))
288289
{
289-
ring_identifier const ring_id
290+
mapped_vector[ring_id_by_seg_id(op.seg_id)].emplace_back
290291
(
291-
op.seg_id.source_index,
292-
op.seg_id.multi_index,
293-
op.seg_id.ring_index
294-
);
295-
mapped_vector[ring_id].emplace_back
296-
(
297-
index, op_index, op, turn.operations[1 - op_index].seg_id
292+
index, op_index, op, turn.operations[1 - op_index].seg_id
298293
);
299294
}
300295
}
@@ -403,8 +398,6 @@ inline void enrich_intersection_points(Turns& turns,
403398
// For all operations, discard xx and none/none
404399
// For intersections, remove uu to avoid the need to travel
405400
// a union (during intersection) in uu/cc clusters (e.g. #31,#32,#33)
406-
// The ux is necessary to indicate impossible paths
407-
// (especially if rescaling is removed)
408401

409402
// Similarly, for union, discard ii and ix
410403

@@ -457,6 +450,8 @@ inline void enrich_intersection_points(Turns& turns,
457450
strategy);
458451
}
459452

453+
// After cleaning up clusters assign the next turns
454+
460455
for (auto& pair : mapped_vector)
461456
{
462457
#ifdef BOOST_GEOMETRY_DEBUG_ENRICH

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

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <boost/geometry/algorithms/detail/covered_by/implementation.hpp>
2929
#include <boost/geometry/algorithms/detail/overlay/append_no_duplicates.hpp>
3030
#include <boost/geometry/algorithms/detail/overlay/copy_segments.hpp>
31+
#include <boost/geometry/algorithms/detail/overlay/debug_traverse.hpp>
3132
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
3233
#include <boost/geometry/algorithms/detail/point_on_border.hpp>
3334
#include <boost/geometry/algorithms/detail/relate/turns.hpp>

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

+1-30
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <boost/range/value_type.hpp>
2424

2525
#include <boost/geometry/algorithms/detail/overlay/cluster_info.hpp>
26+
#include <boost/geometry/algorithms/detail/overlay/debug_traverse.hpp>
2627
#include <boost/geometry/algorithms/detail/overlay/is_self_turn.hpp>
2728
#include <boost/geometry/algorithms/detail/overlay/sort_by_side.hpp>
2829
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
@@ -44,36 +45,6 @@ namespace boost { namespace geometry
4445
namespace detail { namespace overlay
4546
{
4647

47-
template <typename Turn, typename Operation>
48-
#ifdef BOOST_GEOMETRY_DEBUG_TRAVERSE
49-
inline void debug_traverse(Turn const& turn, Operation op,
50-
std::string const& header, bool condition = true)
51-
{
52-
if (! condition)
53-
{
54-
return;
55-
}
56-
std::cout << " " << header
57-
<< " at " << op.seg_id
58-
<< " meth: " << method_char(turn.method)
59-
<< " op: " << operation_char(op.operation)
60-
<< " vis: " << visited_char(op.visited)
61-
<< " of: " << operation_char(turn.operations[0].operation)
62-
<< operation_char(turn.operations[1].operation)
63-
<< " " << geometry::wkt(turn.point)
64-
<< std::endl;
65-
66-
if (boost::contains(header, "Finished"))
67-
{
68-
std::cout << std::endl;
69-
}
70-
}
71-
#else
72-
inline void debug_traverse(Turn const& , Operation, const char*, bool = true)
73-
{
74-
}
75-
#endif
76-
7748
template
7849
<
7950
bool Reverse1,

include/boost/geometry/strategies/relate/cartesian.hpp

+9
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include <boost/geometry/strategies/cartesian/point_in_poly_winding.hpp>
2323
#include <boost/geometry/strategies/cartesian/disjoint_box_box.hpp>
2424

25+
#include <boost/geometry/strategies/distance/detail.hpp>
26+
#include <boost/geometry/strategies/distance/services.hpp>
2527
#include <boost/geometry/strategies/envelope/cartesian.hpp>
2628
#include <boost/geometry/strategies/relate/services.hpp>
2729
#include <boost/geometry/strategies/detail.hpp>
@@ -155,6 +157,13 @@ class cartesian
155157
return strategy::intersection::cartesian_segments<CalculationType>();
156158
}
157159

160+
template <typename Geometry1, typename Geometry2>
161+
static auto comparable_distance(Geometry1 const&, Geometry2 const&,
162+
distance::detail::enable_if_pp_t<Geometry1, Geometry2> * = nullptr)
163+
{
164+
return strategy::distance::comparable::pythagoras<CalculationType>();
165+
}
166+
158167
// side
159168

160169
static auto side()

include/boost/geometry/strategies/relate/geographic.hpp

+12
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include <boost/geometry/strategies/spherical/point_in_point.hpp>
2121
#include <boost/geometry/strategies/spherical/disjoint_box_box.hpp>
2222

23+
#include <boost/geometry/strategies/distance/detail.hpp>
24+
#include <boost/geometry/strategies/distance/services.hpp>
2325
#include <boost/geometry/strategies/envelope/geographic.hpp>
2426
#include <boost/geometry/strategies/relate/services.hpp>
2527
#include <boost/geometry/strategies/detail.hpp>
@@ -78,6 +80,16 @@ class geographic
7880
>(base_t::m_spheroid);
7981
}
8082

83+
template <typename Geometry1, typename Geometry2>
84+
auto comparable_distance(Geometry1 const&, Geometry2 const&,
85+
distance::detail::enable_if_pp_t<Geometry1, Geometry2> * = nullptr) const
86+
{
87+
return strategy::distance::geographic
88+
<
89+
FormulaPolicy, Spheroid, CalculationType
90+
>(base_t::m_spheroid);
91+
}
92+
8193
// covered_by
8294

8395
template <typename Geometry1, typename Geometry2>

include/boost/geometry/strategies/relate/spherical.hpp

+12
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include <boost/geometry/strategies/spherical/point_in_poly_winding.hpp>
2121
#include <boost/geometry/strategies/spherical/disjoint_box_box.hpp>
2222

23+
#include <boost/geometry/strategies/distance/detail.hpp>
24+
#include <boost/geometry/strategies/distance/services.hpp>
2325
#include <boost/geometry/strategies/envelope/spherical.hpp>
2426
#include <boost/geometry/strategies/relate/services.hpp>
2527
#include <boost/geometry/strategies/detail.hpp>
@@ -77,6 +79,16 @@ class spherical
7779
>(base_t::radius());
7880
}
7981

82+
template <typename Geometry1, typename Geometry2>
83+
auto comparable_distance(Geometry1 const&, Geometry2 const&,
84+
distance::detail::enable_if_pp_t<Geometry1, Geometry2> * = nullptr) const
85+
{
86+
return strategy::distance::comparable::haversine
87+
<
88+
typename base_t::radius_type, CalculationType
89+
>(base_t::radius());
90+
}
91+
8092
// covered_by
8193

8294
template <typename Geometry1, typename Geometry2>

test/algorithms/buffer/CMakeLists.txt

+11-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ endforeach()
1515
# Tests for all geometry types, cartesian, for one floating point type
1616
foreach(item IN ITEMS
1717
buffer_point
18-
buffer_linestring
1918
buffer_ring
2019
buffer_polygon
2120
buffer_multi_point
@@ -38,6 +37,17 @@ foreach(item IN ITEMS
3837
target_compile_definitions(${BOOST_GEOMETRY_UNIT_TEST_NAME} PRIVATE BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
3938
endforeach()
4039

40+
# Tests which take a long time and are not run by default.
41+
# Besides that, the buffer_countries test requires the WKT files.
42+
foreach(item IN ITEMS
43+
buffer_countries
44+
buffer_linestring
45+
buffer_linestring_geo
46+
)
47+
boost_geometry_add_unit_test("algorithms" ${item} "not_run")
48+
target_compile_definitions(${BOOST_GEOMETRY_UNIT_TEST_NAME} PRIVATE BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
49+
endforeach()
50+
4151
# Other tests
4252
foreach(item IN ITEMS
4353
buffer_with_strategies

0 commit comments

Comments
 (0)