From 7d23591945f035f838616f2cda7b88fbbbf6a97f Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 1 Jul 2021 22:58:57 +0200 Subject: [PATCH 01/30] [strategy] Fix initializer_list narrowing conversion error in side_robust strategy. --- .../strategy/cartesian/side_robust.hpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/include/boost/geometry/strategy/cartesian/side_robust.hpp b/include/boost/geometry/strategy/cartesian/side_robust.hpp index 4ee4a1726..5362ed068 100644 --- a/include/boost/geometry/strategy/cartesian/side_robust.hpp +++ b/include/boost/geometry/strategy/cartesian/side_robust.hpp @@ -5,6 +5,11 @@ // Contributed and/or modified by Tinko Bartels, // as part of Google Summer of Code 2019 program. +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021, 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) @@ -49,10 +54,16 @@ public: static inline PromotedType side_value(P1 const& p1, P2 const& p2, P const& p) { - typedef ::boost::geometry::detail::precise_math::vec2d vec2d; - vec2d pa { get<0>(p1), get<1>(p1) }; - vec2d pb { get<0>(p2), get<1>(p2) }; - vec2d pc { get<0>(p), get<1>(p) }; + using vec2d = ::boost::geometry::detail::precise_math::vec2d; + vec2d pa; + pa.x = get<0>(p1); + pa.y = get<1>(p1); + vec2d pb; + pb.x = get<0>(p2); + pb.y = get<1>(p2); + vec2d pc; + pc.x = get<0>(p); + pc.y = get<1>(p); return ::boost::geometry::detail::precise_math::orient2d (pa, pb, pc); } From 3e681e31f3fd2cd909fbbbf9d201e8dc6d5fdcee Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 1 Jul 2021 23:23:44 +0200 Subject: [PATCH 02/30] [test] Fix initializer_list narrowing conversion error in get_clusters test. --- test/algorithms/overlay/get_clusters.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/test/algorithms/overlay/get_clusters.cpp b/test/algorithms/overlay/get_clusters.cpp index 0776d3dc7..75f1bbc7e 100644 --- a/test/algorithms/overlay/get_clusters.cpp +++ b/test/algorithms/overlay/get_clusters.cpp @@ -3,6 +3,10 @@ // Copyright (c) 2021 Barend Gehrels, Amsterdam, the Netherlands. +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021, 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) @@ -63,8 +67,8 @@ void do_test(std::string const& case_id, << " detected: " << clusters.size()); } -template -void test_get_clusters(T eps) +template +void test_get_clusters(typename bg::coordinate_type::type eps) { do_test("no", {{1.0, 1.0}, {1.0, 2.0}}, 0); do_test("simplex", {{1.0, 1.0}, {1.0, 1.0}}, 1); @@ -78,10 +82,10 @@ void test_get_clusters(T eps) 8); // Border cases - do_test("borderx_no", {{1.0, 1.0}, {1.0, 2.0}, {1.0 + eps * 10.0, 1.0}}, 0); - do_test("borderx_yes", {{1.0, 1.0}, {1.0, 2.0}, {1.0 + eps, 1.0}}, 1); - do_test("bordery_no", {{1.0, 1.0}, {2.0, 1.0}, {1.0 + eps * 10.0, 1.0}}, 0); - do_test("bordery_yes", {{1.0, 1.0}, {2.0, 1.0}, {1.0 + eps, 1.0}}, 1); + do_test("borderx_no", {{1, 1}, {1, 2}, {1 + eps * 10, 1}}, 0); + do_test("borderx_yes", {{1, 1}, {1, 2}, {1 + eps, 1}}, 1); + do_test("bordery_no", {{1, 1}, {2, 1}, {1 + eps * 10, 1}}, 0); + do_test("bordery_yes", {{1, 1}, {2, 1}, {1 + eps, 1}}, 1); } int test_main(int, char* []) @@ -89,7 +93,7 @@ int test_main(int, char* []) using fp = bg::model::point; using dp = bg::model::point; using ep = bg::model::point; - test_get_clusters(1.0e-8); + test_get_clusters(1.0e-8f); test_get_clusters(1.0e-13); test_get_clusters(1.0e-16); return 0; From ebbc58b52eb7ade7fc0dbe6b9671cc2e6b0aa1a7 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 5 Jul 2021 14:15:09 +0200 Subject: [PATCH 03/30] Fix various warnings, e.g. remove unused variables, etc. --- .../detail/sections/section_functions.hpp | 9 +++++---- include/boost/geometry/algorithms/difference.hpp | 6 +++--- .../geometry/iterators/concatenate_iterator.hpp | 4 ++++ .../boost/geometry/iterators/flatten_iterator.hpp | 2 ++ include/boost/geometry/srs/projections/factory.hpp | 8 ++++---- include/boost/geometry/srs/projections/proj/igh.hpp | 6 +++--- test/concepts/point_spherical_with_wrong_units.cpp | 8 ++++++-- test/core/coordinate_dimension.cpp | 12 ++++++++---- test/cs_undefined/test_relops.hpp | 13 ++++++------- test/geometries/initialization.cpp | 6 +++--- test/geometries/polygon.cpp | 10 ++++------ test/util/algorithm.cpp | 2 +- 12 files changed, 49 insertions(+), 37 deletions(-) diff --git a/include/boost/geometry/algorithms/detail/sections/section_functions.hpp b/include/boost/geometry/algorithms/detail/sections/section_functions.hpp index 44fb4665b..abc6de409 100644 --- a/include/boost/geometry/algorithms/detail/sections/section_functions.hpp +++ b/include/boost/geometry/algorithms/detail/sections/section_functions.hpp @@ -2,9 +2,8 @@ // Copyright (c) 2015 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2015, 2017, 2018. -// Modifications copyright (c) 2015-2018, Oracle and/or its affiliates. - +// This file was modified by Oracle on 2015-2021. +// Modifications copyright (c) 2015-2021, 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, @@ -132,9 +131,11 @@ static inline bool preceding(int dir, RobustPolicy const& robust_policy) { typename geometry::robust_point_type::type robust_point; - assert_coordinate_type_equal(robust_point, point_box); 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::apply(dir, robust_point, point_box, other_box); diff --git a/include/boost/geometry/algorithms/difference.hpp b/include/boost/geometry/algorithms/difference.hpp index 64df80e77..2155b9e54 100644 --- a/include/boost/geometry/algorithms/difference.hpp +++ b/include/boost/geometry/algorithms/difference.hpp @@ -161,10 +161,10 @@ struct call_intersection_insert typename Strategy > static inline OutputIterator apply(Geometry1 const& geometry1, - Geometry2 const& geometry2, - RobustPolicy const& robust_policy, + Geometry2 const& , + RobustPolicy const& , OutputIterator out, - Strategy const& strategy) + Strategy const& ) { base_t::access::get(out) = geometry::detail::convert_to_output < diff --git a/include/boost/geometry/iterators/concatenate_iterator.hpp b/include/boost/geometry/iterators/concatenate_iterator.hpp index d3266e975..42145ec25 100644 --- a/include/boost/geometry/iterators/concatenate_iterator.hpp +++ b/include/boost/geometry/iterators/concatenate_iterator.hpp @@ -86,6 +86,10 @@ public: , m_it2(other.m_it2) {} + concatenate_iterator(concatenate_iterator const& other) = default; + + concatenate_iterator& operator=(concatenate_iterator const& other) = default; + private: friend class boost::iterator_core_access; diff --git a/include/boost/geometry/iterators/flatten_iterator.hpp b/include/boost/geometry/iterators/flatten_iterator.hpp index 9b45d2efe..cfe232b4e 100644 --- a/include/boost/geometry/iterators/flatten_iterator.hpp +++ b/include/boost/geometry/iterators/flatten_iterator.hpp @@ -100,6 +100,8 @@ public: m_inner_it(other.m_inner_it) {} + flatten_iterator(flatten_iterator const& other) = default; + flatten_iterator& operator=(flatten_iterator const& other) { m_outer_it = other.m_outer_it; diff --git a/include/boost/geometry/srs/projections/factory.hpp b/include/boost/geometry/srs/projections/factory.hpp index 0fddb0a27..156fece80 100644 --- a/include/boost/geometry/srs/projections/factory.hpp +++ b/include/boost/geometry/srs/projections/factory.hpp @@ -2,8 +2,8 @@ // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2017-2020. -// Modifications copyright (c) 2017-2020, Oracle and/or its affiliates. +// This file was modified by Oracle on 2017-2021. +// Modifications copyright (c) 2017-2021, 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, @@ -145,7 +145,7 @@ struct factory_key { return par.id.name; } - static const char* get(const char* name, srs::dpar::value_proj id) + static const char* get(const char* name, srs::dpar::value_proj ) { return name; } @@ -160,7 +160,7 @@ struct factory_key > { return par.id.id; } - static srs::dpar::value_proj get(const char* name, srs::dpar::value_proj id) + static srs::dpar::value_proj get(const char* , srs::dpar::value_proj id) { return id; } diff --git a/include/boost/geometry/srs/projections/proj/igh.hpp b/include/boost/geometry/srs/projections/proj/igh.hpp index 385ac3031..8e01151c8 100644 --- a/include/boost/geometry/srs/projections/proj/igh.hpp +++ b/include/boost/geometry/srs/projections/proj/igh.hpp @@ -2,8 +2,8 @@ // Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2017, 2018, 2019. -// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates. +// This file was modified by Oracle on 2017-2021. +// Modifications copyright (c) 2017-2021, 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, @@ -287,7 +287,7 @@ namespace projections // Interrupted Goode Homolosine template - inline void setup_igh(Params const& params, Parameters& par, par_igh& proj_parm) + inline void setup_igh(Params const& , Parameters& par, par_igh& proj_parm) { static const T d0 = 0; static const T d4044118 = igh::d4044118(); diff --git a/test/concepts/point_spherical_with_wrong_units.cpp b/test/concepts/point_spherical_with_wrong_units.cpp index 960db4a4d..3ee23d2ce 100644 --- a/test/concepts/point_spherical_with_wrong_units.cpp +++ b/test/concepts/point_spherical_with_wrong_units.cpp @@ -1,15 +1,17 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test -// Copyright (c) 2014, Oracle and/or its affiliates. - +// Copyright (c) 2014-2021, 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 // Licensed under the Boost Software License version 1.0. // http://www.boost.org/users/license.html #include +#include + #include #include #include @@ -22,5 +24,7 @@ int main() { bg::model::point > p; + boost::ignore_unused(p); + return 0; } diff --git a/test/core/coordinate_dimension.cpp b/test/core/coordinate_dimension.cpp index 94a90bbfd..69291738a 100644 --- a/test/core/coordinate_dimension.cpp +++ b/test/core/coordinate_dimension.cpp @@ -3,6 +3,10 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021, 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) @@ -31,7 +35,7 @@ BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector) BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::deque) -template +template void test_geometry() { BOOST_CHECK_EQUAL(bg::dimension::type::value, Expected); @@ -66,9 +70,9 @@ int test_main(int, char* []) test_geometry, 2>(); test_geometry, 3>(); - test_all, 2 >(); - test_all, 2 >(); - test_all, 2 >(); + test_all, 2>(); + test_all, 2>(); + test_all, 2>(); return 0; } diff --git a/test/cs_undefined/test_relops.hpp b/test/cs_undefined/test_relops.hpp index 7a366bcd6..e9e2019b5 100644 --- a/test/cs_undefined/test_relops.hpp +++ b/test/cs_undefined/test_relops.hpp @@ -1,7 +1,6 @@ // Boost.Geometry -// Copyright (c) 2019, Oracle and/or its affiliates. - +// Copyright (c) 2019-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Licensed under the Boost Software License version 1.0. @@ -33,7 +32,7 @@ template struct call_equals { template - static void apply(G1 const& g1, G2 const& g2, S const& s) {} + static void apply(G1 const& , G2 const& , S const& ) {} }; template @@ -56,7 +55,7 @@ template struct call_overlaps { template - static void apply(G1 const& g1, G2 const& g2, S const& s) {} + static void apply(G1 const& , G2 const& , S const& ) {} }; template @@ -89,7 +88,7 @@ template struct call_touches { template - static void apply(G1 const& g1, G2 const& g2, S const& s) {} + static void apply(G1 const& , G2 const& , S const& ) {} }; template @@ -112,14 +111,14 @@ template struct call_crosses { template - static void apply(G1 const& g1, G2 const& g2, S const& s) {} + static void apply(G1 const& , G2 const& , S const& ) {} }; template struct call_crosses { template - static void apply(G1 const& g1, G2 const& g2, S const& s) {} + static void apply(G1 const& , G2 const& , S const& ) {} }; template diff --git a/test/geometries/initialization.cpp b/test/geometries/initialization.cpp index c71ae302b..491852075 100644 --- a/test/geometries/initialization.cpp +++ b/test/geometries/initialization.cpp @@ -3,8 +3,8 @@ // Copyright (c) 2014-2015 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2020. -// Modifications copyright (c) 2020 Oracle and/or its affiliates. +// This file was modified by Oracle on 2020-2021. +// Modifications copyright (c) 2020-2021 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, @@ -237,7 +237,7 @@ void test_sanity_check() V v = boost::assign::list_of(P(1, 1))(P(2, 2))(P(3, 3)); //v = boost::assign::list_of(P(1, 1))(P(2, 2))(P(3, 3)); - v.empty(); + //v.empty(); } } diff --git a/test/geometries/polygon.cpp b/test/geometries/polygon.cpp index bf9aeb337..a534746cf 100644 --- a/test/geometries/polygon.cpp +++ b/test/geometries/polygon.cpp @@ -3,6 +3,10 @@ // Copyright (c) 2020 Digvijay Janartha, Hamirpur, India. +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021, 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) @@ -27,10 +31,6 @@ BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) -#ifdef BOOST_NO_CXX11_HDR_INITIALIZER_LIST -#include -#endif//BOOST_NO_CXX11_HDR_INITIALIZER_LIST - template bg::model::polygon

create_polygon() { @@ -111,13 +111,11 @@ void test_all() template void test_custom_polygon(bg::model::ring

IL) { -#ifdef BOOST_NO_CXX11_HDR_INITIALIZER_LIST std::initializer_list > RIL = {IL}; bg::model::polygon

pl1(RIL); std::ostringstream out; out << bg::dsv(pl1); BOOST_CHECK_EQUAL(out.str(), "(((3, 3), (3, 0), (0, 0), (0, 3), (3, 3)))"); -#endif//BOOST_NO_CXX11_HDR_INITIALIZER_LIST } template diff --git a/test/util/algorithm.cpp b/test/util/algorithm.cpp index 0aef4ce37..dd3f35430 100644 --- a/test/util/algorithm.cpp +++ b/test/util/algorithm.cpp @@ -19,7 +19,7 @@ #include -void test_dimension(bg::util::index_constant<0> index) +void test_dimension(bg::util::index_constant<0>) { bool called = false; bg::detail::for_each_index<0>([&](auto index) { called = true; }); From f940c16fd6f7553d806e6570f2127de337e39e9d Mon Sep 17 00:00:00 2001 From: Vissarion Fisikopoulos Date: Mon, 5 Jul 2021 13:25:27 +0300 Subject: [PATCH 04/30] Remove sum_error function --- .../geometry/formulas/karney_inverse.hpp | 11 +++++--- include/boost/geometry/util/math.hpp | 25 +++---------------- test/formulas/inverse_cases_small_angles.hpp | 2 +- 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/include/boost/geometry/formulas/karney_inverse.hpp b/include/boost/geometry/formulas/karney_inverse.hpp index b6b17a8e8..936fbe22c 100644 --- a/include/boost/geometry/formulas/karney_inverse.hpp +++ b/include/boost/geometry/formulas/karney_inverse.hpp @@ -36,6 +36,7 @@ #include #include +#include #include #include @@ -51,16 +52,20 @@ namespace boost { namespace geometry { namespace math { template inline T difference_angle(T const& x, T const& y, T& e) { - T t, d = math::sum_error(std::remainder(-x, T(360)), std::remainder(y, T(360)), t); + auto res1 = boost::geometry::detail::precise_math::two_sum( + std::remainder(-x, T(360)), std::remainder(y, T(360))); - normalize_azimuth(d); + normalize_azimuth(res1[0]); // Here y - x = d + t (mod 360), exactly, where d is in (-180,180] and // abs(t) <= eps (eps = 2^-45 for doubles). The only case where the // addition of t takes the result outside the range (-180,180] is d = 180 // and t > 0. The case, d = -180 + eps, t = -eps, can't happen, since // sum_error would have returned the exact result in such a case (i.e., given t = 0). - return math::sum_error(d == 180 && t > 0 ? -180 : d, t, e); + auto res2 = boost::geometry::detail::precise_math::two_sum( + res1[0] == 180 && res1[1] > 0 ? -180 : res1[0], res1[1]); + e = res2[1]; + return res2[0]; } }}} // namespace boost::geometry::math diff --git a/include/boost/geometry/util/math.hpp b/include/boost/geometry/util/math.hpp index 60cbf2cf3..fc9d7a3be 100644 --- a/include/boost/geometry/util/math.hpp +++ b/include/boost/geometry/util/math.hpp @@ -4,12 +4,13 @@ // Copyright (c) 2008-2015 Bruno Lalande, Paris, France. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK. -// This file was modified by Oracle on 2014-2020. -// Modifications copyright (c) 2014-2020, Oracle and/or its affiliates. +// This file was modified by Oracle on 2014-2021. +// Modifications copyright (c) 2014-2021, Oracle and/or its affiliates. +// Contributed and/or modified by Adeel Ahmad, as part of Google Summer of Code 2018 program +// 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 Adam Wulkiewicz, on behalf of Oracle -// Contributed and/or modified by Adeel Ahmad, as part of Google Summer of Code 2018 program // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -847,24 +848,6 @@ inline T round_angle(T const& x) { return x < 0 ? -y : y; } - -/*! -\brief The error-free sum of two numbers. -*/ -template -inline T sum_error(T const& u, T const& v, T& t) -{ - volatile T s = u + v; - volatile T up = s - v; - volatile T vpp = s - up; - - up -= u; - vpp -= v; - t = -(up + vpp); - - return s; -} - /*! \brief Evaluate the polynomial in x using Horner's method. */ diff --git a/test/formulas/inverse_cases_small_angles.hpp b/test/formulas/inverse_cases_small_angles.hpp index 6fe9557c7..8784a9fcb 100644 --- a/test/formulas/inverse_cases_small_angles.hpp +++ b/test/formulas/inverse_cases_small_angles.hpp @@ -51,7 +51,7 @@ expected_results_small_angles expected_small_angles[] = { 20003931.45862544700503349304, -0.00000000000000000000, 180.00000000000000000000, 67125.61229850351810455322266, -1.00000000000000000000 }, },{ { 180, 0 },{ 1e-20, 0 }, - { 20003931.45862544700503349304, -0.00000000000000000000, 180.00000000000000000000, 67125.61229850351810455322266, -1.00000000000000000000 }, + { 20003931.45862544700503349304, -9.4938222885831061895e-19, 180.00000000000000000000, 67125.61229850351810455322266, -1.00000000000000000000 }, },{ { 180, 0 },{ 1e-10, 0 }, { 20003931.45862544700503349304, -9.501793528220011062168943853e-09, -179.9999999904981962117744843, 67125.61229850351810455322266, -1 }, From 954f9ee532e7f1d0490b1e7ce935de7ae303185f Mon Sep 17 00:00:00 2001 From: Vissarion Fisikopoulos Date: Mon, 5 Jul 2021 16:01:28 +0300 Subject: [PATCH 05/30] [tests] Remove duplicate check_inverse function --- test/formulas/inverse.cpp | 23 ---------------- test/formulas/inverse_karney.cpp | 23 ---------------- test/formulas/test_formula.hpp | 46 +++++++++++++++++++++++++++----- 3 files changed, 40 insertions(+), 52 deletions(-) diff --git a/test/formulas/inverse.cpp b/test/formulas/inverse.cpp index cab678200..54180440b 100644 --- a/test/formulas/inverse.cpp +++ b/test/formulas/inverse.cpp @@ -25,29 +25,6 @@ #include -template -void check_inverse(std::string const& name, - Result const& results, - bg::formula::result_inverse const& result, - expected_result const& expected, - expected_result const& reference, - double reference_error) -{ - std::stringstream ss; - ss << "(" << results.p1.lon << " " << results.p1.lat << ")->(" << results.p2.lon << " " << results.p2.lat << ")"; - - check_one(name + "_d " + ss.str(), - result.distance, expected.distance, reference.distance, reference_error); - check_one(name + "_a " + ss.str(), - result.azimuth, expected.azimuth, reference.azimuth, reference_error, true); - check_one(name + "_ra " + ss.str(), - result.reverse_azimuth, expected.reverse_azimuth, reference.reverse_azimuth, reference_error, true); - check_one(name + "_rl " + ss.str(), - result.reduced_length, expected.reduced_length, reference.reduced_length, reference_error); - check_one(name + "_gs " + ss.str(), - result.geodesic_scale, expected.geodesic_scale, reference.geodesic_scale, reference_error); -} - void test_all(expected_results const& results) { double const d2r = bg::math::d2r(); diff --git a/test/formulas/inverse_karney.cpp b/test/formulas/inverse_karney.cpp index a494a5ff2..d506d54ed 100644 --- a/test/formulas/inverse_karney.cpp +++ b/test/formulas/inverse_karney.cpp @@ -28,29 +28,6 @@ #include -template -void check_inverse(std::string const& name, - Result const& results, - bg::formula::result_inverse const& result, - expected_result const& expected, - expected_result const& reference, - double reference_error) -{ - std::stringstream ss; - ss << "(" << results.p1.lon << " " << results.p1.lat << ")->(" << results.p2.lon << " " << results.p2.lat << ")"; - - check_one(name + "_d " + ss.str(), - result.distance, expected.distance, reference.distance, reference_error); - check_one(name + "_a " + ss.str(), - result.azimuth, expected.azimuth, reference.azimuth, reference_error, true); - check_one(name + "_ra " + ss.str(), - result.reverse_azimuth, expected.reverse_azimuth, reference.reverse_azimuth, reference_error, true); - check_one(name + "_rl " + ss.str(), - result.reduced_length, expected.reduced_length, reference.reduced_length, reference_error); - check_one(name + "_gs " + ss.str(), - result.geodesic_scale, expected.geodesic_scale, reference.geodesic_scale, reference_error); -} - void test_all(expected_results const& results) { double lon1d = results.p1.lon * bg::math::d2r(); diff --git a/test/formulas/test_formula.hpp b/test/formulas/test_formula.hpp index 9e41bfcae..09f780163 100644 --- a/test/formulas/test_formula.hpp +++ b/test/formulas/test_formula.hpp @@ -14,6 +14,7 @@ #include +#include #include void normalize_deg(double & deg) @@ -42,22 +43,26 @@ void check_one(std::string const& name, double result, double expected) { bool is_close = abs_result <= 30 * eps && abs_expected <= 30 * eps; BOOST_CHECK_MESSAGE((is_close), - id << std::setprecision(20) << "result {" << result << "} different than expected {" << expected << "}."); + id << std::setprecision(20) << "result {" << result + << "} different than expected {" << expected << "}."); } else if (res_max > 100 * eps) { BOOST_GEOMETRY_CHECK_CLOSE(result, expected, 0.1, - id << std::setprecision(20) << "result {" << result << "} different than expected {" << expected << "}."); + id << std::setprecision(20) << "result {" << result + << "} different than expected {" << expected << "}."); } else if (res_max > 10 * eps) { BOOST_GEOMETRY_CHECK_CLOSE(result, expected, 10, - id << std::setprecision(20) << "result {" << result << "} different than expected {" << expected << "}."); + id << std::setprecision(20) << "result {" << result + << "} different than expected {" << expected << "}."); } else if (res_max > eps) { BOOST_GEOMETRY_CHECK_CLOSE(result, expected, 1000, - id << std::setprecision(20) << "result {" << result << "} different than expected {" << expected << "}."); + id << std::setprecision(20) << "result {" << result + << "} different than expected {" << expected << "}."); } } @@ -85,13 +90,42 @@ void check_one(std::string const& name, double ref_max = (std::max)(bg::math::abs(result), bg::math::abs(reference)); bool is_ref_close = ref_diff <= reference_error || ref_diff <= reference_error * ref_max; BOOST_CHECK_MESSAGE((is_ref_close), - id << std::setprecision(20) << "result {" << result << "} and reference {" << reference << "} not close enough."); + id << std::setprecision(20) << "result {" << result << "} and reference {" + << reference << "} not close enough."); } void check_one(double result, double expected, double reference, double reference_error, bool normalize = false, bool check_reference_only = false) { - check_one("", result, expected, reference, reference_error, normalize, check_reference_only); + check_one("", result, expected, reference, reference_error, normalize, + check_reference_only); +} + +template +void check_inverse(std::string const& name, + Result const& results, + boost::geometry::formula::result_inverse const& result, + ExpectedResult const& expected, + ExpectedResult const& reference, + double reference_error) +{ + std::stringstream ss; + ss << "(" << results.p1.lon << " " << results.p1.lat << ")->(" + << results.p2.lon << " " << results.p2.lat << ")"; + + check_one(name + "_d " + ss.str(), + result.distance, expected.distance, reference.distance, reference_error); + check_one(name + "_a " + ss.str(), + result.azimuth, expected.azimuth, reference.azimuth, reference_error, true); + check_one(name + "_ra " + ss.str(), + result.reverse_azimuth, expected.reverse_azimuth, reference.reverse_azimuth, + reference_error, true); + check_one(name + "_rl " + ss.str(), + result.reduced_length, expected.reduced_length, reference.reduced_length, + reference_error); + check_one(name + "_gs " + ss.str(), + result.geodesic_scale, expected.geodesic_scale, reference.geodesic_scale, + reference_error); } #endif // BOOST_GEOMETRY_TEST_FORMULA_HPP From 0bf96e09b41aff007111f92ed1943d5d379daddf Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 7 Jul 2021 15:01:52 +0200 Subject: [PATCH 06/30] [index] Use size_t instead of unsigned int --- .../geometry/index/detail/predicates.hpp | 64 +++++++++---------- .../detail/rtree/visitors/distance_query.hpp | 14 ++-- .../detail/rtree/visitors/spatial_query.hpp | 8 +-- include/boost/geometry/index/predicates.hpp | 8 +-- include/boost/geometry/index/rtree.hpp | 12 ++-- 5 files changed, 53 insertions(+), 53 deletions(-) diff --git a/include/boost/geometry/index/detail/predicates.hpp b/include/boost/geometry/index/detail/predicates.hpp index 08bc18e15..0ae8defe8 100644 --- a/include/boost/geometry/index/detail/predicates.hpp +++ b/include/boost/geometry/index/detail/predicates.hpp @@ -4,8 +4,8 @@ // // Copyright (c) 2011-2015 Adam Wulkiewicz, Lodz, Poland. // -// This file was modified by Oracle on 2019-2020. -// Modifications copyright (c) 2019-2020 Oracle and/or its affiliates. +// This file was modified by Oracle on 2019-2021. +// Modifications copyright (c) 2019-2021 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, @@ -91,12 +91,12 @@ struct nearest nearest() // : count(0) {} - nearest(PointOrRelation const& por, unsigned k) + nearest(PointOrRelation const& por, std::size_t k) : point_or_relation(por) , count(k) {} PointOrRelation point_or_relation; - unsigned count; + std::size_t count; }; template @@ -105,12 +105,12 @@ struct path path() // : count(0) {} - path(SegmentOrLinestring const& g, unsigned k) + path(SegmentOrLinestring const& g, std::size_t k) : geometry(g) , count(k) {} SegmentOrLinestring geometry; - unsigned count; + std::size_t count; }; } // namespace predicates @@ -520,31 +520,31 @@ struct predicate_check, bounds_tag> template struct predicates_length { - static const unsigned value = 1; + static const std::size_t value = 1; }; template struct predicates_length> { - static const unsigned value = std::tuple_size>::value; + static const std::size_t value = std::tuple_size>::value; }; // ------------------------------------------------------------------ // // predicates_element // ------------------------------------------------------------------ // -template +template struct predicates_element { BOOST_GEOMETRY_STATIC_ASSERT((I < 1), "Invalid I index.", - std::integral_constant); + std::integral_constant); typedef T type; static type const& get(T const& p) { return p; } }; -template +template struct predicates_element> { typedef std::tuple predicate_type; @@ -557,7 +557,7 @@ struct predicates_element> // predicates_check // ------------------------------------------------------------------ // -template +template struct predicates_check_tuple { template @@ -572,7 +572,7 @@ struct predicates_check_tuple } }; -template +template struct predicates_check_tuple { template @@ -582,13 +582,13 @@ struct predicates_check_tuple } }; -template +template struct predicates_check_impl { static const bool check = First < 1 && Last <= 1 && First <= Last; BOOST_GEOMETRY_STATIC_ASSERT((check), "Invalid First or Last index.", - std::integer_sequence); + std::integer_sequence); template static inline bool apply(Predicate const& p, Value const& v, Indexable const& i, Strategy const& s) @@ -597,16 +597,16 @@ struct predicates_check_impl } }; -template +template struct predicates_check_impl, Tag, First, Last> { typedef std::tuple predicates_type; - static const unsigned pred_len = std::tuple_size::value; + static const std::size_t pred_len = std::tuple_size::value; static const bool check = First < pred_len && Last <= pred_len && First <= Last; BOOST_GEOMETRY_STATIC_ASSERT((check), "Invalid First or Last index.", - std::integer_sequence); + std::integer_sequence); template static inline bool apply(predicates_type const& p, Value const& v, Indexable const& i, Strategy const& s) @@ -619,7 +619,7 @@ struct predicates_check_impl, Tag, First, Last> } }; -template +template inline bool predicates_check(Predicates const& p, Value const& v, Indexable const& i, Strategy const& s) { return detail::predicates_check_impl @@ -635,19 +635,19 @@ inline bool predicates_check(Predicates const& p, Value const& v, Indexable cons template struct predicates_is_distance { - static const unsigned value = 0; + static const std::size_t value = 0; }; template struct predicates_is_distance< predicates::nearest > { - static const unsigned value = 1; + static const std::size_t value = 1; }; template struct predicates_is_distance< predicates::path > { - static const unsigned value = 1; + static const std::size_t value = 1; }; // predicates_count_nearest @@ -655,13 +655,13 @@ struct predicates_is_distance< predicates::path > template struct predicates_count_distance { - static const unsigned value = predicates_is_distance::value; + static const std::size_t value = predicates_is_distance::value; }; -template +template struct predicates_count_distance_tuple { - static const unsigned value = + static const std::size_t value = predicates_is_distance::type>::value + predicates_count_distance_tuple::value; }; @@ -669,14 +669,14 @@ struct predicates_count_distance_tuple template struct predicates_count_distance_tuple { - static const unsigned value = + static const std::size_t value = predicates_is_distance::type>::value; }; template struct predicates_count_distance> { - static const unsigned value = predicates_count_distance_tuple< + static const std::size_t value = predicates_count_distance_tuple< std::tuple, std::tuple_size>::value >::value; @@ -687,16 +687,16 @@ struct predicates_count_distance> template struct predicates_find_distance { - static const unsigned value = predicates_is_distance::value ? 0 : 1; + static const std::size_t value = predicates_is_distance::value ? 0 : 1; }; -template +template struct predicates_find_distance_tuple { static const bool is_found = predicates_find_distance_tuple::is_found || predicates_is_distance::type>::value; - static const unsigned value = predicates_find_distance_tuple::is_found ? + static const std::size_t value = predicates_find_distance_tuple::is_found ? predicates_find_distance_tuple::value : (predicates_is_distance::type>::value ? N-1 : std::tuple_size::value); @@ -706,13 +706,13 @@ template struct predicates_find_distance_tuple { static const bool is_found = predicates_is_distance::type>::value; - static const unsigned value = is_found ? 0 : std::tuple_size::value; + static const std::size_t value = is_found ? 0 : std::tuple_size::value; }; template struct predicates_find_distance> { - static const unsigned value = predicates_find_distance_tuple< + static const std::size_t value = predicates_find_distance_tuple< std::tuple, std::tuple_size>::value >::value; diff --git a/include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp b/include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp index edf47f90b..f86e583c0 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp @@ -4,8 +4,8 @@ // // Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland. // -// This file was modified by Oracle on 2019. -// Modifications copyright (c) 2019 Oracle and/or its affiliates. +// This file was modified by Oracle on 2019-2021. +// Modifications copyright (c) 2019-2021 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, @@ -97,7 +97,7 @@ template < typename MembersHolder, typename Predicates, - unsigned DistancePredicateIndex, + std::size_t DistancePredicateIndex, typename OutIter > class distance_query @@ -125,7 +125,7 @@ public: typedef typename calculate_value_distance::result_type value_distance_type; typedef typename calculate_node_distance::result_type node_distance_type; - static const unsigned predicates_len = index::detail::predicates_length::value; + static const std::size_t predicates_len = index::detail::predicates_length::value; inline distance_query(parameters_type const& parameters, translator_type const& translator, Predicates const& pred, OutIter out_it) : m_parameters(parameters), m_translator(translator) @@ -299,7 +299,7 @@ private: template < typename MembersHolder, typename Predicates, - unsigned DistancePredicateIndex + std::size_t DistancePredicateIndex > class distance_query_incremental : public MembersHolder::visitor_const @@ -330,7 +330,7 @@ public: typedef typename allocators_type::const_reference const_reference; typedef typename allocators_type::node_pointer node_pointer; - static const unsigned predicates_len = index::detail::predicates_length::value; + static const std::size_t predicates_len = index::detail::predicates_length::value; typedef typename rtree::elements_type::type internal_elements; typedef typename internal_elements::const_iterator internal_iterator; @@ -590,7 +590,7 @@ private: return greatest_dist <= d; } - inline unsigned max_count() const + inline std::size_t max_count() const { return nearest_predicate_access::get(m_pred).count; } diff --git a/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp b/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp index cdef103b3..f0d30162c 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp @@ -4,8 +4,8 @@ // // Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland. // -// This file was modified by Oracle on 2019. -// Modifications copyright (c) 2019 Oracle and/or its affiliates. +// This file was modified by Oracle on 2019-2021. +// Modifications copyright (c) 2019-2021 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, @@ -35,7 +35,7 @@ struct spatial_query typedef typename allocators_type::size_type size_type; - static const unsigned predicates_len = index::detail::predicates_length::value; + static const std::size_t predicates_len = index::detail::predicates_length::value; inline spatial_query(parameters_type const& par, translator_type const& t, Predicates const& p, OutIter out_it) : tr(t), pred(p), out_iter(out_it), found_count(0), strategy(index::detail::get_strategy(par)) @@ -119,7 +119,7 @@ public: typedef typename rtree::elements_type::type leaf_elements; typedef typename rtree::elements_type::type::const_iterator leaf_iterator; - static const unsigned predicates_len = index::detail::predicates_length::value; + static const std::size_t predicates_len = index::detail::predicates_length::value; inline spatial_query_incremental() : m_translator(NULL) diff --git a/include/boost/geometry/index/predicates.hpp b/include/boost/geometry/index/predicates.hpp index 09faaaf20..6da0d0ec5 100644 --- a/include/boost/geometry/index/predicates.hpp +++ b/include/boost/geometry/index/predicates.hpp @@ -4,8 +4,8 @@ // // Copyright (c) 2011-2018 Adam Wulkiewicz, Lodz, Poland. // -// This file was modified by Oracle on 2019-2020. -// Modifications copyright (c) 2019-2020 Oracle and/or its affiliates. +// This file was modified by Oracle on 2019-2021. +// Modifications copyright (c) 2019-2021 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, @@ -338,7 +338,7 @@ Only one \c nearest() predicate may be used in a query. */ template inline detail::predicates::nearest -nearest(Geometry const& geometry, unsigned k) +nearest(Geometry const& geometry, std::size_t k) { return detail::predicates::nearest(geometry, k); } @@ -368,7 +368,7 @@ Only one distance predicate (\c nearest() or \c path()) may be used in a query. */ template inline detail::predicates::path -path(SegmentOrLinestring const& linestring, unsigned k) +path(SegmentOrLinestring const& linestring, std::size_t k) { return detail::predicates::path(linestring, k); } diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 1f54afac1..2b7e3811d 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -6,8 +6,8 @@ // Copyright (c) 2011-2019 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2020 Caian Benedicto, Campinas, Brazil. // -// This file was modified by Oracle on 2019-2020. -// Modifications copyright (c) 2019-2020 Oracle and/or its affiliates. +// This file was modified by Oracle on 2019-2021. +// Modifications copyright (c) 2019-2021 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, @@ -1082,7 +1082,7 @@ public: if ( !m_members.root ) return 0; - static const unsigned distance_predicates_count = detail::predicates_count_distance::value; + static const std::size_t distance_predicates_count = detail::predicates_count_distance::value; static const bool is_distance_predicate = 0 < distance_predicates_count; BOOST_GEOMETRY_STATIC_ASSERT((distance_predicates_count <= 1), "Only one distance predicate can be passed.", @@ -1252,7 +1252,7 @@ private: > qbegin_(Predicates const& predicates) const { - static const unsigned distance_predicates_count = detail::predicates_count_distance::value; + static const std::size_t distance_predicates_count = detail::predicates_count_distance::value; BOOST_GEOMETRY_STATIC_ASSERT((distance_predicates_count <= 1), "Only one distance predicate can be passed.", Predicates); @@ -1319,7 +1319,7 @@ private: > qend_(Predicates const& predicates) const { - static const unsigned distance_predicates_count = detail::predicates_count_distance::value; + static const std::size_t distance_predicates_count = detail::predicates_count_distance::value; BOOST_GEOMETRY_STATIC_ASSERT((distance_predicates_count <= 1), "Only one distance predicate can be passed.", Predicates); @@ -1916,7 +1916,7 @@ private: { BOOST_GEOMETRY_INDEX_ASSERT(m_members.root, "The root must exist"); - static const unsigned distance_predicate_index = detail::predicates_find_distance::value; + static const std::size_t distance_predicate_index = detail::predicates_find_distance::value; detail::rtree::visitors::distance_query< members_holder, Predicates, From 557f8e722bb10c1d5a4f474bd83d8c1c13ae65bd Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 7 Jul 2021 22:18:11 +0200 Subject: [PATCH 07/30] [index] Avoid traversing unnecessary nodes in distance_query_incremental. --- .../detail/rtree/visitors/distance_query.hpp | 160 +++++------------- 1 file changed, 45 insertions(+), 115 deletions(-) diff --git a/include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp b/include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp index f86e583c0..7d82814aa 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp @@ -19,6 +19,28 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { + +struct pair_first_less +{ + template + inline bool operator()(std::pair const& p1, + std::pair const& p2) const + { + return p1.first < p2.first; + } +}; + +struct pair_first_greater +{ + template + inline bool operator()(std::pair const& p1, + std::pair const& p2) const + { + return p1.first > p2.first; + } +}; + + template class distance_query_result { @@ -40,16 +62,16 @@ public: m_neighbors.push_back(std::make_pair(curr_comp_dist, val)); if ( m_neighbors.size() == m_count ) - std::make_heap(m_neighbors.begin(), m_neighbors.end(), neighbors_less); + std::make_heap(m_neighbors.begin(), m_neighbors.end(), pair_first_less()); } else { if ( curr_comp_dist < m_neighbors.front().first ) { - std::pop_heap(m_neighbors.begin(), m_neighbors.end(), neighbors_less); + std::pop_heap(m_neighbors.begin(), m_neighbors.end(), pair_first_less()); m_neighbors.back().first = curr_comp_dist; m_neighbors.back().second = val; - std::push_heap(m_neighbors.begin(), m_neighbors.end(), neighbors_less); + std::push_heap(m_neighbors.begin(), m_neighbors.end(), pair_first_less()); } } } @@ -80,13 +102,6 @@ public: } private: - inline static bool neighbors_less( - std::pair const& p1, - std::pair const& p2) - { - return p1.first < p2.first; - } - size_t m_count; OutIt m_out_it; @@ -186,7 +201,7 @@ public: return; // sort array - std::sort(active_branch_list.begin(), active_branch_list.end(), abl_less); + std::sort(active_branch_list.begin(), active_branch_list.end(), pair_first_less()); // recursively visit nodes for ( typename active_branch_list_type::const_iterator it = active_branch_list.begin(); @@ -209,7 +224,7 @@ public: // from the copying of the whole containers on resize of the ABLs container //// make a heap - //std::make_heap(active_branch_list.begin(), active_branch_list.end(), abl_greater); + //std::make_heap(active_branch_list.begin(), active_branch_list.end(), pair_first_greater()); //// recursively visit nodes //while ( !active_branch_list.empty() ) @@ -223,7 +238,7 @@ public: // rtree::apply_visitor(*this, *(active_branch_list.front().second)); - // std::pop_heap(active_branch_list.begin(), active_branch_list.end(), abl_greater); + // std::pop_heap(active_branch_list.begin(), active_branch_list.end(), pair_first_greater()); // active_branch_list.pop_back(); //} } @@ -262,20 +277,6 @@ public: } private: - static inline bool abl_less( - std::pair const& p1, - std::pair const& p2) - { - return p1.first < p2.first; - } - - //static inline bool abl_greater( - // std::pair const& p1, - // std::pair const& p2) - //{ - // return p1.first > p2.first; - //} - template static inline bool is_node_prunable(Distance const& greatest_dist, node_distance_type const& d) { @@ -337,31 +338,12 @@ public: typedef typename rtree::elements_type::type leaf_elements; typedef std::pair branch_data; - typedef typename index::detail::rtree::container_from_elements_type< - internal_elements, branch_data - >::type active_branch_list_type; - struct internal_stack_element - { - internal_stack_element() : current_branch(0) {} -#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES - // Required in c++03 for containers using Boost.Move - internal_stack_element & operator=(internal_stack_element const& o) - { - branches = o.branches; - current_branch = o.current_branch; - return *this; - } -#endif - active_branch_list_type branches; - typename active_branch_list_type::size_type current_branch; - }; - typedef std::vector internal_stack_type; + typedef std::vector internal_heap_type; inline distance_query_incremental() : m_translator(NULL) // , m_pred() , current_neighbor((std::numeric_limits::max)()) -// , next_closest_node_distance((std::numeric_limits::max)()) // , m_strategy_type() {} @@ -369,7 +351,6 @@ public: : m_translator(::boost::addressof(translator)) , m_pred(pred) , current_neighbor((std::numeric_limits::max)()) - , next_closest_node_distance((std::numeric_limits::max)()) , m_strategy(index::detail::get_strategy(params)) { BOOST_GEOMETRY_INDEX_ASSERT(0 < max_count(), "k must be greather than 0"); @@ -392,7 +373,7 @@ public: { size_type new_neighbor = current_neighbor == (std::numeric_limits::max)() ? 0 : current_neighbor + 1; - if ( internal_stack.empty() ) + if ( internal_heap.empty() ) { if ( new_neighbor < neighbors.size() ) current_neighbor = new_neighbor; @@ -407,20 +388,14 @@ public: } else { - active_branch_list_type & branches = internal_stack.back().branches; - typename active_branch_list_type::size_type & current_branch = internal_stack.back().current_branch; - - if ( branches.size() <= current_branch ) - { - internal_stack.pop_back(); - continue; - } + branch_data const& closest_branch = internal_heap.front(); + node_distance_type const& closest_distance = closest_branch.first; // if there are no nodes which can have closer values, set new value if ( new_neighbor < neighbors.size() && // here must be < because otherwise neighbours may be sorted in different order // if there is another value with equal distance - neighbors[new_neighbor].first < next_closest_node_distance ) + neighbors[new_neighbor].first < closest_distance) { current_neighbor = new_neighbor; return; @@ -429,19 +404,18 @@ public: // if node is further than the furthest neighbour, following nodes also will be further BOOST_GEOMETRY_INDEX_ASSERT(neighbors.size() <= max_count(), "unexpected neighbours count"); if ( max_count() <= neighbors.size() && - is_node_prunable(neighbors.back().first, branches[current_branch].first) ) + neighbors.back().first <= closest_distance ) { - // stop traversing current level - internal_stack.pop_back(); + internal_heap.clear(); continue; } else { - // new level - must increment current_branch before traversing of another level (mem reallocation) - ++current_branch; - rtree::apply_visitor(*this, *(branches[current_branch - 1].second)); + node_pointer ptr = closest_branch.second; + std::pop_heap(internal_heap.begin(), internal_heap.end(), pair_first_greater()); + internal_heap.pop_back(); - next_closest_node_distance = calc_closest_node_distance(internal_stack.begin(), internal_stack.end()); + rtree::apply_visitor(*this, *ptr); } } } @@ -470,9 +444,6 @@ public: typedef typename rtree::elements_type::type elements_type; elements_type const& elements = rtree::elements(n); - // add new element - internal_stack.resize(internal_stack.size()+1); - // fill active branch list array of nodes meeting predicates for ( typename elements_type::const_iterator it = elements.begin() ; it != elements.end() ; ++it ) { @@ -494,21 +465,16 @@ public: // if current node is further than found neighbors - don't analyze it if ( max_count() <= neighbors.size() && - is_node_prunable(neighbors.back().first, node_distance) ) + neighbors.back().first <= node_distance ) { continue; } - // add current node's data into the list - internal_stack.back().branches.push_back( std::make_pair(node_distance, it->second) ); + // add current node's data into the queue + internal_heap.push_back(std::make_pair(node_distance, it->second)); + std::push_heap(internal_heap.begin(), internal_heap.end(), pair_first_greater()); } } - - if ( internal_stack.back().branches.empty() ) - internal_stack.pop_back(); - else - // sort array - std::sort(internal_stack.back().branches.begin(), internal_stack.back().branches.end(), abl_less); } // Put values into the list of neighbours if those values meets predicates @@ -548,48 +514,13 @@ public: } // sort array - std::sort(neighbors.begin(), neighbors.end(), neighbors_less); + std::sort(neighbors.begin(), neighbors.end(), pair_first_less()); // remove furthest values if ( max_count() < neighbors.size() ) neighbors.resize(max_count()); } private: - static inline bool abl_less(std::pair const& p1, - std::pair const& p2) - { - return p1.first < p2.first; - } - - static inline bool neighbors_less(std::pair const& p1, - std::pair const& p2) - { - return p1.first < p2.first; - } - - node_distance_type - calc_closest_node_distance(typename internal_stack_type::const_iterator first, - typename internal_stack_type::const_iterator last) - { - node_distance_type result = (std::numeric_limits::max)(); - for ( ; first != last ; ++first ) - { - if ( first->branches.size() <= first->current_branch ) - continue; - - node_distance_type curr_dist = first->branches[first->current_branch].first; - if ( curr_dist < result ) - result = curr_dist; - } - return result; - } - - template - static inline bool is_node_prunable(Distance const& greatest_dist, node_distance_type const& d) - { - return greatest_dist <= d; - } - inline std::size_t max_count() const { return nearest_predicate_access::get(m_pred).count; @@ -604,10 +535,9 @@ private: Predicates m_pred; - internal_stack_type internal_stack; + internal_heap_type internal_heap; std::vector< std::pair > neighbors; size_type current_neighbor; - node_distance_type next_closest_node_distance; strategy_type m_strategy; }; From 8ad418bb1d858c823d8bf74f15089b5adfeba6fa Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 7 Jul 2021 22:47:37 +0200 Subject: [PATCH 08/30] [index] Avoid sorting already handled neighbors in distance_query_incremental. --- .../index/detail/rtree/visitors/distance_query.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp b/include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp index 7d82814aa..eb259777c 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp @@ -513,8 +513,13 @@ public: } } + // TODO: sort is probably suboptimal. + // An alternative would be std::set, but it'd probably add constant cost. + // Ideally replace this with double-ended priority queue, e.g. min-max heap. + // sort array - std::sort(neighbors.begin(), neighbors.end(), pair_first_less()); + size_type sort_first = current_neighbor == (std::numeric_limits::max)() ? 0 : current_neighbor; + std::sort(neighbors.begin() + sort_first, neighbors.end(), pair_first_less()); // remove furthest values if ( max_count() < neighbors.size() ) neighbors.resize(max_count()); From a1f679fe1707a1fa718da0f704e91c1746ace835 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 16 Jul 2021 12:18:04 +0200 Subject: [PATCH 09/30] [index] Do not gather all of the closest neighbors of same distance in qbegin(). Return as soon as possible. --- .../index/detail/rtree/visitors/distance_query.hpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp b/include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp index eb259777c..d17bc78a7 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp @@ -393,16 +393,15 @@ public: // if there are no nodes which can have closer values, set new value if ( new_neighbor < neighbors.size() && - // here must be < because otherwise neighbours may be sorted in different order - // if there is another value with equal distance - neighbors[new_neighbor].first < closest_distance) + // NOTE: In order to use <= current neighbor can't be sorted again + neighbors[new_neighbor].first <= closest_distance ) { current_neighbor = new_neighbor; return; } - // if node is further than the furthest neighbour, following nodes also will be further - BOOST_GEOMETRY_INDEX_ASSERT(neighbors.size() <= max_count(), "unexpected neighbours count"); + // if node is further than the furthest neighbor, following nodes will also be further + BOOST_GEOMETRY_INDEX_ASSERT(neighbors.size() <= max_count(), "unexpected neighbors count"); if ( max_count() <= neighbors.size() && neighbors.back().first <= closest_distance ) { @@ -516,6 +515,8 @@ public: // TODO: sort is probably suboptimal. // An alternative would be std::set, but it'd probably add constant cost. // Ideally replace this with double-ended priority queue, e.g. min-max heap. + // NOTE: A condition in increment() relies on the fact that current neighbor doesn't + // participate in sorting anymore. // sort array size_type sort_first = current_neighbor == (std::numeric_limits::max)() ? 0 : current_neighbor; From 406b48bb965e0808dbcb35a4d3673055354deeb1 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 16 Jul 2021 23:44:50 +0200 Subject: [PATCH 10/30] [index] Avoid sorting current neighbor in distance_query_incremental. --- .../geometry/index/detail/rtree/visitors/distance_query.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp b/include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp index d17bc78a7..a40dbfe84 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp @@ -519,7 +519,7 @@ public: // participate in sorting anymore. // sort array - size_type sort_first = current_neighbor == (std::numeric_limits::max)() ? 0 : current_neighbor; + size_type sort_first = current_neighbor == (std::numeric_limits::max)() ? 0 : current_neighbor + 1; std::sort(neighbors.begin() + sort_first, neighbors.end(), pair_first_less()); // remove furthest values if ( max_count() < neighbors.size() ) From 46e3d9231c2353b323796b6423f13cd61e0d585c Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 19 Jul 2021 15:10:12 +0200 Subject: [PATCH 11/30] [algorithms][formulas][strategies] Add missing includes. --- .../geometry/algorithms/detail/disjoint/box_box.hpp | 9 +++------ .../geometry/algorithms/detail/disjoint/point_box.hpp | 10 +++++----- include/boost/geometry/algorithms/line_interpolate.hpp | 3 ++- .../geometry/formulas/interpolate_point_spherical.hpp | 5 ++++- .../strategies/line_interpolate/geographic.hpp | 3 ++- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/include/boost/geometry/algorithms/detail/disjoint/box_box.hpp b/include/boost/geometry/algorithms/detail/disjoint/box_box.hpp index 8092ae4f8..02585b6f0 100644 --- a/include/boost/geometry/algorithms/detail/disjoint/box_box.hpp +++ b/include/boost/geometry/algorithms/detail/disjoint/box_box.hpp @@ -5,9 +5,8 @@ // Copyright (c) 2009-2015 Mateusz Loskot, London, UK. // Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2013-2020. -// Modifications copyright (c) 2013-2020, Oracle and/or its affiliates. - +// This file was modified by Oracle on 2013-2021. +// Modifications copyright (c) 2013-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle @@ -25,9 +24,7 @@ #include -// For backward compatibility -#include -#include +#include namespace boost { namespace geometry { diff --git a/include/boost/geometry/algorithms/detail/disjoint/point_box.hpp b/include/boost/geometry/algorithms/detail/disjoint/point_box.hpp index 99cdda9ed..186f48feb 100644 --- a/include/boost/geometry/algorithms/detail/disjoint/point_box.hpp +++ b/include/boost/geometry/algorithms/detail/disjoint/point_box.hpp @@ -5,9 +5,8 @@ // Copyright (c) 2009-2015 Mateusz Loskot, London, UK. // Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland -// This file was modified by Oracle on 2013-2020. -// Modifications copyright (c) 2013-2020, Oracle and/or its affiliates. - +// This file was modified by Oracle on 2013-2021. +// Modifications copyright (c) 2013-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle @@ -23,12 +22,13 @@ #include +#include + #include #include #include -#include -#include +#include namespace boost { namespace geometry { diff --git a/include/boost/geometry/algorithms/line_interpolate.hpp b/include/boost/geometry/algorithms/line_interpolate.hpp index 05a55a7c2..a3b4b2ba8 100644 --- a/include/boost/geometry/algorithms/line_interpolate.hpp +++ b/include/boost/geometry/algorithms/line_interpolate.hpp @@ -1,7 +1,6 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2018-2021 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 @@ -19,6 +18,8 @@ #include #include #include +#include +#include #include #include diff --git a/include/boost/geometry/formulas/interpolate_point_spherical.hpp b/include/boost/geometry/formulas/interpolate_point_spherical.hpp index 7141a5a9f..2e712d44c 100644 --- a/include/boost/geometry/formulas/interpolate_point_spherical.hpp +++ b/include/boost/geometry/formulas/interpolate_point_spherical.hpp @@ -1,6 +1,6 @@ // Boost.Geometry -// Copyright (c) 2019 Oracle and/or its affiliates. +// Copyright (c) 2019-2021 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 @@ -12,6 +12,9 @@ #ifndef BOOST_GEOMETRY_FORMULAS_INTERPOLATE_POINT_SPHERICAL_HPP #define BOOST_GEOMETRY_FORMULAS_INTERPOLATE_POINT_SPHERICAL_HPP +#include +#include + namespace boost { namespace geometry { namespace formula { diff --git a/include/boost/geometry/strategies/line_interpolate/geographic.hpp b/include/boost/geometry/strategies/line_interpolate/geographic.hpp index 5d57ea378..048f81c2c 100644 --- a/include/boost/geometry/strategies/line_interpolate/geographic.hpp +++ b/include/boost/geometry/strategies/line_interpolate/geographic.hpp @@ -1,7 +1,6 @@ // Boost.Geometry // Copyright (c) 2021, Oracle and/or its affiliates. - // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Licensed under the Boost Software License version 1.0. @@ -13,6 +12,8 @@ #include +#include + #include #include From ad7ea13b7aa3dbdf25c0455f39c69dfe29d90df8 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 19 Jul 2021 21:37:54 +0200 Subject: [PATCH 12/30] [test][index] Rebind allocator with container::allocator_traits<>. --- index/test/rtree/test_rtree.hpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/index/test/rtree/test_rtree.hpp b/index/test/rtree/test_rtree.hpp index 89aaf02dd..77f1f5312 100644 --- a/index/test/rtree/test_rtree.hpp +++ b/index/test/rtree/test_rtree.hpp @@ -3,8 +3,8 @@ // Copyright (c) 2011-2015 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2019. -// Modifications copyright (c) 2019, Oracle and/or its affiliates. +// This file was modified by Oracle on 2019-2021. +// Modifications copyright (c) 2019-2021, 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, @@ -1694,7 +1694,7 @@ void test_rtree_queries(Parameters const& parameters, Allocator const& allocator { typedef bgi::indexable I; typedef bgi::equal_to E; - typedef typename Allocator::template rebind::other A; + typedef typename boost::container::allocator_traits::template rebind_alloc A; typedef bgi::rtree Tree; typedef typename Tree::bounds_type B; @@ -1717,7 +1717,7 @@ void test_rtree_modifiers(Parameters const& parameters, Allocator const& allocat { typedef bgi::indexable I; typedef bgi::equal_to E; - typedef typename Allocator::template rebind::other A; + typedef typename boost::container::allocator_traits::template rebind_alloc A; typedef bgi::rtree Tree; typedef typename Tree::bounds_type B; @@ -1754,7 +1754,7 @@ void test_count_rtree_values(Parameters const& parameters, Allocator const& allo typedef bgi::indexable I; typedef bgi::equal_to E; - typedef typename Allocator::template rebind::other A; + typedef typename boost::container::allocator_traits::template rebind_alloc A; typedef bgi::rtree Tree; typedef typename Tree::bounds_type B; @@ -1797,7 +1797,7 @@ void test_rtree_count(Parameters const& parameters, Allocator const& allocator) typedef bgi::indexable I; typedef bgi::equal_to E; - typedef typename Allocator::template rebind::other A; + typedef typename boost::container::allocator_traits::template rebind_alloc A; typedef bgi::rtree Tree; typedef typename Tree::bounds_type B; @@ -1828,7 +1828,7 @@ void test_rtree_bounds(Parameters const& parameters, Allocator const& allocator) { typedef bgi::indexable I; typedef bgi::equal_to E; - typedef typename Allocator::template rebind::other A; + typedef typename boost::container::allocator_traits::template rebind_alloc A; typedef bgi::rtree Tree; typedef typename Tree::bounds_type B; //typedef typename bg::traits::point_type::type P; @@ -1886,7 +1886,7 @@ void test_rtree_range(Parameters const& parameters, Allocator const& allocator) typedef bgi::indexable I; typedef bgi::equal_to E; - typedef typename Allocator::template rebind::other A; + typedef typename boost::container::allocator_traits::template rebind_alloc A; typedef bgi::rtree Tree; typedef typename Tree::bounds_type B; From afa1f458a06dfd807569cee4929845ec455e8244 Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Wed, 14 Jul 2021 11:45:02 +0200 Subject: [PATCH 13/30] [test] add testcases (currently going well) --- test/algorithms/overlay/multi_overlay_cases.hpp | 13 +++++++++++++ .../set_operations/difference/difference_multi.cpp | 4 ++++ .../intersection/intersection_multi.cpp | 3 +++ .../algorithms/set_operations/union/union_multi.cpp | 3 +++ 4 files changed, 23 insertions(+) diff --git a/test/algorithms/overlay/multi_overlay_cases.hpp b/test/algorithms/overlay/multi_overlay_cases.hpp index 6dec464ba..21753cba9 100644 --- a/test/algorithms/overlay/multi_overlay_cases.hpp +++ b/test/algorithms/overlay/multi_overlay_cases.hpp @@ -1521,6 +1521,19 @@ static std::string issue_869_c[2] = "MULTIPOLYGON(((10 10,10 70,50 70,50 90,70 90,70 70,90 70,90 50,70 50,70 10,10 10)))" }; +// For difference +static std::string issue_888_34[2] = +{ + "MULTIPOLYGON(((0.450246 0.176853,0.476025 0.144909,0.468192 0.133251,0.448726 0.150373,0.450246 0.176853)),((0.719425 0.179933,0.778422 0.274563,0.76895 0.322197,0.791284 0.312445,0.791944 0.296253,0.799738 0.308754,0.959288 0.239088,0.958302 0.22776,0.745381 0.158712,0.719425 0.179933)),((0.701609 0.660841,0.666999 0.75257,0.681007 0.764449,0.701609 0.660841)),((0.594132 0.714429,0.606487 0.701251,0.594811 0.691349,0.594132 0.714429)),((0.224866 0.786223,0.382462 0.983231,0.466763 0.85994,0.47812 0.838165,0.39515 0.926659,0.476824 0.77908,0.50332 0.789847,0.525393 0.747525,0.505459 0.72734,0.547556 0.651273,0.482633 0.596213,0.577247 0.52647,0.570444 0.520834,0.600941 0.483052,0.603549 0.394417,0.517116 0.432156,0.563288 0.385417,0.492528 0.36544,0.577515 0.295956,0.550593 0.255888,0.452782 0.221035,0.459249 0.333709,0.441865 0.351136,0.370548 0.331001,0.385816 0.296593,0.394882 0.293488,0.387958 0.291767,0.423911 0.210747,0.392721 0.199633,0.310001 0.272391,0.236386 0.254095,0.304173 0.168082,0.296274 0.165267,0.207506 0.246917,0.0140798 0.198842,0.069792 0.24609,0.0159663 0.230894,0.0815688 0.362756,0.0156364 0.423401,0.0977468 0.395274,0.108341 0.416568,0.135246 0.382428,0.203132 0.359173,0.207309 0.362716,0.174164 0.39187,0.173365 0.391061,0.173401 0.392541,0.11983 0.439661,0.177364 0.555306,0.177972 0.580239,0.0906064 0.618386,0.127028 0.663916,0.0564116 0.721999,0.127196 0.664127,0.181673 0.732227,0.182236 0.755361,0.188638 0.740934,0.199131 0.754051,0.261029 0.691392,0.320648 0.715618,0.224866 0.786223),(0.216572 0.354569,0.27427 0.30382,0.323855 0.317819,0.216572 0.354569)),((0.224866 0.786223,0.199131 0.754051,0.013265 0.942202,0.224866 0.786223)),((0.598711 0.558841,0.547556 0.651273,0.566996 0.667759,0.59721 0.609827,0.598711 0.558841)),((0.598711 0.558841,0.604247 0.548838,0.59913 0.544599,0.598711 0.558841)),((0.604247 0.548838,0.621545 0.563169,0.680308 0.450499,0.643761 0.47744,0.604247 0.548838)),((0.643761 0.47744,0.668916 0.431986,0.656761 0.413896,0.600941 0.483052,0.60016 0.509579,0.643761 0.47744)))", + "MULTIPOLYGON(((0.663637 0.851798,0.60596 0.926301,0.651077 0.91496,0.663637 0.851798)),((0.696266 0.142785,0.611653 0.00706631,0.573697 0.0404517,0.625869 0.119956,0.696266 0.142785)),((0.315687 0.454629,0.297299 0.496067,0.328117 0.465171,0.315687 0.454629)),((0.211225 0.286021,0.236386 0.254095,0.207506 0.246917,0.175851 0.276034,0.211225 0.286021)),((0.211225 0.286021,0.173427 0.333981,0.203132 0.359173,0.216572 0.354569,0.207309 0.362716,0.315687 0.454629,0.370548 0.331001,0.323855 0.317819,0.385816 0.296593,0.387958 0.291767,0.310001 0.272391,0.27427 0.30382,0.211225 0.286021)),((0.175851 0.276034,0.069792 0.24609,0.14191 0.307253,0.175851 0.276034)),((0.14191 0.307253,0.0815688 0.362756,0.0977468 0.395274,0.135246 0.382428,0.173427 0.333981,0.14191 0.307253)),((0.684151 0.208773,0.603476 0.274731,0.607034 0.275999,0.605233 0.337207,0.634572 0.380871,0.710003 0.347935,0.727272 0.326541,0.717162 0.344809,0.76089 0.325716,0.684151 0.208773)),((0.450246 0.176853,0.425156 0.207942,0.423911 0.210747,0.452782 0.221035,0.450246 0.176853)),((0.527613 0.0809854,0.521709 0.086179,0.523067 0.0866194,0.527613 0.0809854)))" +}; + +static std::string issue_888_37[2] = +{ + "MULTIPOLYGON(((0.573697 0.0404517,0.5677 0.0313133,0.527613 0.0809854,0.573697 0.0404517)),((0.663637 0.851798,0.711342 0.790176,0.681007 0.764449,0.663637 0.851798)),((0.328117 0.465171,0.348942 0.482832,0.492528 0.36544,0.441865 0.351136,0.328117 0.465171)),((0.59913 0.544599,0.60016 0.509579,0.577247 0.52647,0.59913 0.544599)),((0.780115 0.586441,0.779691 0.59685,0.748247 0.550053,0.740154 0.558685,0.710619 0.636962,0.961172 0.844534,0.780115 0.586441)),((0.791944 0.296253,0.796543 0.183435,0.778422 0.274563,0.791944 0.296253)),((0.76089 0.325716,0.766538 0.334324,0.76895 0.322197,0.76089 0.325716)),((0.36551 0.585627,0.420902 0.641717,0.482633 0.596213,0.413212 0.537338,0.36551 0.585627)),((0.36551 0.585627,0.305289 0.524648,0.289209 0.531669,0.301942 0.521258,0.291026 0.510204,0.297299 0.496067,0.287131 0.506261,0.174164 0.39187,0.173401 0.392541,0.177364 0.555306,0.187664 0.576007,0.177972 0.580239,0.178814 0.61485,0.142867 0.650888,0.127028 0.663916,0.127196 0.664127,0.178983 0.621787,0.181673 0.732227,0.188638 0.740934,0.226862 0.654796,0.241025 0.683264,0.261029 0.691392,0.36551 0.585627),(0.279648 0.535844,0.277112 0.541559,0.201344 0.603505,0.197613 0.596005,0.240627 0.552881,0.279648 0.535844)),((0.413212 0.537338,0.517116 0.432156,0.366654 0.497853,0.413212 0.537338)),((0.590866 0.825421,0.591197 0.814158,0.544737 0.767113,0.517876 0.795762,0.590866 0.825421)),((0.590866 0.825421,0.586751 0.965255,0.666999 0.75257,0.606487 0.701251,0.685935 0.616513,0.621545 0.563169,0.59721 0.609827,0.594811 0.691349,0.566996 0.667759,0.525393 0.747525,0.544737 0.767113,0.594132 0.714429,0.591197 0.814158,0.609997 0.833195,0.590866 0.825421)),((0.420902 0.641717,0.320648 0.715618,0.476824 0.77908,0.505459 0.72734,0.420902 0.641717)),((0.685935 0.616513,0.70696 0.633931,0.717016 0.583363,0.685935 0.616513)))", + "MULTIPOLYGON(((0.594132 0.714429,0.606487 0.701251,0.594811 0.691349,0.594132 0.714429)),((0.663637 0.851798,0.60596 0.926301,0.651077 0.91496,0.663637 0.851798)),((0.550593 0.255888,0.603476 0.274731,0.684151 0.208773,0.625869 0.119956,0.523067 0.0866194,0.476025 0.144909,0.550593 0.255888)),((0.550593 0.255888,0.452782 0.221035,0.459249 0.333709,0.441865 0.351136,0.370548 0.331001,0.315687 0.454629,0.207309 0.362716,0.174164 0.39187,0.173365 0.391061,0.173401 0.392541,0.11983 0.439661,0.177364 0.555306,0.177972 0.580239,0.0906064 0.618386,0.127028 0.663916,0.0564116 0.721999,0.127196 0.664127,0.181673 0.732227,0.182236 0.755361,0.188638 0.740934,0.199131 0.754051,0.261029 0.691392,0.320648 0.715618,0.224866 0.786223,0.382462 0.983231,0.466763 0.85994,0.47812 0.838165,0.39515 0.926659,0.476824 0.77908,0.50332 0.789847,0.525393 0.747525,0.505459 0.72734,0.547556 0.651273,0.482633 0.596213,0.577247 0.52647,0.570444 0.520834,0.600941 0.483052,0.603549 0.394417,0.517116 0.432156,0.563288 0.385417,0.492528 0.36544,0.577515 0.295956,0.550593 0.255888),(0.366654 0.497853,0.305289 0.524648,0.301942 0.521258,0.348942 0.482832,0.366654 0.497853),(0.287131 0.506261,0.291026 0.510204,0.279648 0.535844,0.289209 0.531669,0.277112 0.541559,0.226862 0.654796,0.201344 0.603505,0.178983 0.621787,0.178814 0.61485,0.197613 0.596005,0.187664 0.576007,0.240627 0.552881,0.287131 0.506261),(0.315687 0.454629,0.328117 0.465171,0.297299 0.496067,0.315687 0.454629)),((0.50332 0.789847,0.47812 0.838165,0.517876 0.795762,0.50332 0.789847)),((0.476025 0.144909,0.468192 0.133251,0.448726 0.150373,0.450246 0.176853,0.476025 0.144909)),((0.521709 0.086179,0.399861 0.0466657,0.304173 0.168082,0.392721 0.199633,0.448726 0.150373,0.445833 0.0999749,0.468192 0.133251,0.521709 0.086179)),((0.521709 0.086179,0.523067 0.0866194,0.527613 0.0809854,0.521709 0.086179)),((0.577515 0.295956,0.605233 0.337207,0.607034 0.275999,0.603476 0.274731,0.577515 0.295956)),((0.304173 0.168082,0.296274 0.165267,0.207506 0.246917,0.236386 0.254095,0.304173 0.168082)),((0.392721 0.199633,0.310001 0.272391,0.387958 0.291767,0.423911 0.210747,0.392721 0.199633)),((0.108341 0.416568,0.0230624 0.524775,0.11983 0.439661,0.108341 0.416568)),((0.108341 0.416568,0.135246 0.382428,0.0977468 0.395274,0.108341 0.416568)),((0.668916 0.431986,0.729259 0.521793,0.766538 0.334324,0.788997 0.368549,0.791284 0.312445,0.76895 0.322197,0.778422 0.274563,0.719425 0.179933,0.684151 0.208773,0.76089 0.325716,0.717162 0.344809,0.668916 0.431986)),((0.668916 0.431986,0.656761 0.413896,0.600941 0.483052,0.60016 0.509579,0.643761 0.47744,0.668916 0.431986)),((0.603549 0.394417,0.634572 0.380871,0.605233 0.337207,0.603549 0.394417)),((0.625869 0.119956,0.696266 0.142785,0.611653 0.00706631,0.573697 0.0404517,0.625869 0.119956)),((0.656761 0.413896,0.710003 0.347935,0.634572 0.380871,0.656761 0.413896)),((0.696266 0.142785,0.719425 0.179933,0.745381 0.158712,0.696266 0.142785)),((0.701609 0.660841,0.710619 0.636962,0.70696 0.633931,0.701609 0.660841)),((0.701609 0.660841,0.666999 0.75257,0.681007 0.764449,0.701609 0.660841)),((0.788997 0.368549,0.783115 0.512864,0.842285 0.449754,0.788997 0.368549)),((0.959288 0.239088,0.799738 0.308754,0.992212 0.617482,0.959288 0.239088)),((0.959288 0.239088,0.973756 0.232771,0.958302 0.22776,0.959288 0.239088)),((0.717162 0.344809,0.727272 0.326541,0.710003 0.347935,0.717162 0.344809)),((0.783115 0.512864,0.751874 0.546184,0.780115 0.586441,0.783115 0.512864)),((0.745381 0.158712,0.958302 0.22776,0.938553 0.000778765,0.745381 0.158712)),((0.799738 0.308754,0.791944 0.296253,0.791284 0.312445,0.799738 0.308754)),((0.74515 0.545443,0.729259 0.521793,0.717016 0.583363,0.740154 0.558685,0.74515 0.545443)),((0.74515 0.545443,0.748247 0.550053,0.751874 0.546184,0.74732 0.539692,0.74515 0.545443)),((0.310001 0.272391,0.236386 0.254095,0.211225 0.286021,0.27427 0.30382,0.310001 0.272391)),((0.323855 0.317819,0.370548 0.331001,0.385816 0.296593,0.323855 0.317819)),((0.323855 0.317819,0.27427 0.30382,0.216572 0.354569,0.323855 0.317819)),((0.387958 0.291767,0.385816 0.296593,0.394882 0.293488,0.387958 0.291767)),((0.175851 0.276034,0.14191 0.307253,0.173427 0.333981,0.211225 0.286021,0.175851 0.276034)),((0.175851 0.276034,0.207506 0.246917,0.0140798 0.198842,0.069792 0.24609,0.175851 0.276034)),((0.173427 0.333981,0.135246 0.382428,0.203132 0.359173,0.173427 0.333981)),((0.203132 0.359173,0.207309 0.362716,0.216572 0.354569,0.203132 0.359173)),((0.069792 0.24609,0.0159663 0.230894,0.0815688 0.362756,0.14191 0.307253,0.069792 0.24609)),((0.0815688 0.362756,0.0156364 0.423401,0.0977468 0.395274,0.0815688 0.362756)),((0.224866 0.786223,0.199131 0.754051,0.013265 0.942202,0.224866 0.786223)),((0.643761 0.47744,0.604247 0.548838,0.621545 0.563169,0.680308 0.450499,0.643761 0.47744)),((0.604247 0.548838,0.59913 0.544599,0.598711 0.558841,0.604247 0.548838)),((0.452782 0.221035,0.450246 0.176853,0.425156 0.207942,0.423911 0.210747,0.452782 0.221035)),((0.547556 0.651273,0.566996 0.667759,0.59721 0.609827,0.598711 0.558841,0.547556 0.651273)))" +}; + static std::string bug_21155501[2] = { "MULTIPOLYGON(((-8.3935546875 27.449790329784214,4.9658203125 18.729501999072138,11.8212890625 23.563987128451217,9.7119140625 25.48295117535531,9.8876953125 31.728167146023935,8.3056640625 32.99023555965106,8.5693359375 37.16031654673677,-1.8896484375 35.60371874069731,-0.5712890625 32.02670629333614,-8.9208984375 29.458731185355344,-8.3935546875 27.449790329784214)))", diff --git a/test/algorithms/set_operations/difference/difference_multi.cpp b/test/algorithms/set_operations/difference/difference_multi.cpp index bd4454372..410a89d8e 100644 --- a/test/algorithms/set_operations/difference/difference_multi.cpp +++ b/test/algorithms/set_operations/difference/difference_multi.cpp @@ -213,6 +213,10 @@ void test_areal() // Generates a polygon with two interiors, i/o a multipoly with 3 rings TEST_DIFFERENCE(issue_869_a, 3, 3600, 0, 0, 1); #endif + + TEST_DIFFERENCE(issue_888_34, 22, 0.2506824, 6, 0.0253798, 28); + TEST_DIFFERENCE(issue_888_37, 15, 0.0451408, 65, 0.3014843, 80); + // Areas and #clips correspond with POSTGIS (except sym case) test_one("case_101_multi", case_101_multi[0], case_101_multi[1], diff --git a/test/algorithms/set_operations/intersection/intersection_multi.cpp b/test/algorithms/set_operations/intersection/intersection_multi.cpp index 5bd980a90..1edbdd6f4 100644 --- a/test/algorithms/set_operations/intersection/intersection_multi.cpp +++ b/test/algorithms/set_operations/intersection/intersection_multi.cpp @@ -380,6 +380,9 @@ void test_areal() TEST_INTERSECTION(issue_869_c, 3, -1, 3600); + TEST_INTERSECTION(issue_888_34, 7, -1, 0.0256838); + TEST_INTERSECTION(issue_888_37, 13, -1, 0.0567043); + TEST_INTERSECTION(mysql_23023665_7, 2, 11, 9.80505786783); TEST_INTERSECTION(mysql_23023665_12, 2, 0, 11.812440191387557); TEST_INTERSECTION(mysql_regression_1_65_2017_08_31, 2, -1, 29.9022122); diff --git a/test/algorithms/set_operations/union/union_multi.cpp b/test/algorithms/set_operations/union/union_multi.cpp index 64140a158..b7d9c725f 100644 --- a/test/algorithms/set_operations/union/union_multi.cpp +++ b/test/algorithms/set_operations/union/union_multi.cpp @@ -438,6 +438,9 @@ void test_areal() // generates only one polygon with two interiors) TEST_UNION(issue_869_b, 3, 1, -1, 3600); + TEST_UNION(issue_888_34, 15, 0, -1, 0.3017459); + TEST_UNION(issue_888_37, 52, 3, -1, 0.4033294); + #if defined(BOOST_GEOMETRY_USE_KRAMER_RULE) // Two polygons, should ideally be merged TEST_UNION(mail_2019_01_21_johan, 2, 0, -1, 0.00058896); From ad74f51fe1fefc8b00c626987c78b3cc1848c73d Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 21 Jul 2021 18:11:42 +0200 Subject: [PATCH 14/30] [doc] Add 1.77 release notes. --- doc/release_notes.qbk | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/doc/release_notes.qbk b/doc/release_notes.qbk index 8f225c79d..1f3bcbf9c 100644 --- a/doc/release_notes.qbk +++ b/doc/release_notes.qbk @@ -19,6 +19,33 @@ [section:release_notes Release Notes] +[/=================] +[heading Boost 1.77] +[/=================] + +[*Improvements] + +* [@https://github.com/boostorg/geometry/pull/812 812] Umbrella strategies for distance and comparable_distance (undocumented for now). +* [@https://github.com/boostorg/geometry/pull/840 840] Umbrella strategies for various algorithms (undocumented for now). +* [@https://github.com/boostorg/geometry/pull/850 850] Introduced DynamicGeometry and GeometryCollection concepts and support in some algorithms (undocumented for now). +* [@https://github.com/boostorg/geometry/pull/855 855] Various improvements related to strategies. Default strategies are now included with algorithms. + +[*Solved issues] + +* [@https://github.com/boostorg/geometry/issues/865 865] Exception thrown in rtree serialization. +* [@https://github.com/boostorg/geometry/issues/439 439] Invalid box spherical area computation. +* [@https://github.com/boostorg/geometry/issues/838 838] Invalid result of union_(). +* [@https://github.com/boostorg/geometry/issues/851 851] Invalid geographic disjoint segment/box result. +* [@https://github.com/boostorg/geometry/issues/861 861] Invalid result of intersection(). + +[*Bugfixes] + +* [@https://github.com/boostorg/geometry/pull/832 832] Fixed box spherical and geographic area computation. +* [@https://github.com/boostorg/geometry/pull/853 853] Fixed geographic disjoint segment/box. +* [@https://github.com/boostorg/geometry/pull/866 866] Fixed serialization of rtree containing lesser number of elements in root node than minimum. +* [@https://github.com/boostorg/geometry/pull/886 886] Fixed knn rtree query bug causing it to be slow for big k. +* Various fixes in set operations and buffer. + [/=================] [heading Boost 1.76] [/=================] From 08f7e66f79f168c61ef552382fb12ac4d1dbda4d Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 1 Jul 2021 22:26:05 +0200 Subject: [PATCH 15/30] [test] Drop library dependencies in tests. If possible drop type_traits, mpl, typeof, foreach, assign. Rearrange some includes. --- test/algorithms/area/area.cpp | 4 +- test/algorithms/area/area_sph_geo.cpp | 7 +- test/algorithms/buffer/buffer_linestring.cpp | 12 +- .../buffer/buffer_linestring_aimes.cpp | 6 +- .../buffer/buffer_multi_linestring.cpp | 6 +- .../buffer/buffer_multi_polygon.cpp | 6 +- test/algorithms/buffer/buffer_polygon.cpp | 12 +- test/algorithms/buffer/test_buffer.hpp | 17 +- test/algorithms/buffer/test_buffer_svg.hpp | 30 +- .../buffer/test_buffer_svg_per_turn.hpp | 7 +- test/algorithms/centroid.cpp | 7 +- test/algorithms/check_validity.hpp | 8 +- test/algorithms/comparable_distance.cpp | 65 ++- .../covered_by/covered_by_sph_geo.cpp | 8 +- .../detail/calculate_point_order.cpp | 5 +- test/algorithms/detail/partition.cpp | 51 +-- .../detail/sections/range_by_section.cpp | 4 +- .../detail/sections/sectionalize.cpp | 6 +- test/algorithms/detail/tupled_output.cpp | 7 +- test/algorithms/distance/distance.cpp | 25 +- .../distance/distance_brute_force.hpp | 27 +- .../distance/distance_geo_linear_box.cpp | 11 +- .../distance/distance_se_geo_ar_ar.cpp | 7 +- .../distance/distance_se_geo_l_ar.cpp | 9 +- .../distance/distance_se_geo_l_l.cpp | 9 +- .../distance/distance_se_geo_pl_ar.cpp | 9 +- .../distance/test_distance_common.hpp | 33 +- .../distance/test_distance_geo_common.hpp | 43 +- .../distance/test_distance_se_common.hpp | 37 +- .../envelope_expand/envelope_on_spheroid.cpp | 70 ++-- .../envelope_expand/expand_on_spheroid.cpp | 42 +- .../envelope_expand/test_envelope.hpp | 33 +- .../test_envelope_expand_on_spheroid.hpp | 7 +- test/algorithms/equals/equals.cpp | 13 +- test/algorithms/overlay/assemble.cpp | 24 +- test/algorithms/overlay/dissolver.cpp | 14 +- test/algorithms/overlay/get_turn_info.cpp | 17 +- test/algorithms/overlay/get_turns.cpp | 6 +- .../overlay/get_turns_linear_linear.cpp | 13 +- .../overlay/get_turns_linear_linear_sph.cpp | 8 +- test/algorithms/overlay/overlay.cpp | 15 +- test/algorithms/overlay/relative_order.cpp | 12 +- test/algorithms/overlay/select_rings.cpp | 43 +- .../overlay/self_intersection_points.cpp | 8 +- test/algorithms/overlay/sort_by_side.cpp | 68 ++- .../algorithms/overlay/sort_by_side_basic.cpp | 41 +- test/algorithms/overlay/split_rings.cpp | 6 +- test/algorithms/overlay/traverse.cpp | 65 ++- test/algorithms/overlay/traverse_ccw.cpp | 20 +- test/algorithms/point_on_surface.cpp | 9 +- test/algorithms/relate/nan_cases.hpp | 6 +- test/algorithms/relate/relate_areal_areal.cpp | 13 +- .../relate/relate_linear_areal_sph.cpp | 6 +- .../relate/relate_linear_linear.cpp | 29 +- .../relate/relate_linear_linear_sph.cpp | 27 +- test/algorithms/relate/test_relate.hpp | 15 +- .../set_operations/difference/difference.cpp | 6 +- .../difference/difference_areal_linear.cpp | 7 +- .../difference/difference_tupled.cpp | 50 +-- .../difference/test_difference.hpp | 1 - .../intersection/intersection.cpp | 8 +- .../intersection/test_intersection.hpp | 12 +- .../test_intersection_linear_linear.hpp | 18 +- .../test_set_ops_linear_linear.hpp | 91 +--- .../set_operations/test_set_ops_pointlike.hpp | 33 +- .../set_operations/union/test_union.hpp | 21 +- .../algorithms/set_operations/union/union.cpp | 6 +- test/algorithms/simplify_countries.cpp | 21 +- test/algorithms/transform.cpp | 9 +- .../within/within_pointlike_geometry.cpp | 30 +- test/core/point_type.cpp | 5 +- test/core/tag.cpp | 9 +- test/geometry_test_common.hpp | 9 +- test/iterators/flatten_iterator.cpp | 44 +- test/iterators/point_iterator.cpp | 75 ++-- test/iterators/segment_iterator.cpp | 391 +++++++++--------- test/policies/rescale_policy.cpp | 28 +- .../general_intersection_precision.cpp | 6 +- .../overlay/areal_areal/test_overlay_p_q.hpp | 13 +- .../overlay/areal_areal/ticket_9081.cpp | 88 ++-- .../overlay/buffer/multi_point_growth.cpp | 22 +- .../buffer/recursive_polygons_buffer.cpp | 10 +- .../recursive_polygons_linear_areal.cpp | 39 +- test/srs/proj4.hpp | 51 +-- test/srs/projection_interface_s.cpp | 4 +- test/srs/spar.cpp | 52 ++- test/strategies/distance.cpp | 8 +- test/strategies/distance_default_result.cpp | 33 +- test/strategies/douglas_peucker.cpp | 50 ++- test/strategies/pythagoras.cpp | 62 +-- test/strategies/pythagoras_point_box.cpp | 85 ++-- test/strategies/vincenty.cpp | 13 +- test/string_from_type.hpp | 10 +- test/test_common/test_point.hpp | 7 +- test/test_common/with_pointer.hpp | 7 +- test/test_geometries/custom_lon_lat_point.hpp | 10 +- test/to_svg.hpp | 17 +- test/util/calculation_type.cpp | 18 +- test/util/is_implemented.cpp | 4 +- test/util/math_sqrt.cpp | 123 +++--- test/util/promote_integral.cpp | 25 +- test/util/select_most_precise.cpp | 8 +- 102 files changed, 1255 insertions(+), 1492 deletions(-) diff --git a/test/algorithms/area/area.cpp b/test/algorithms/area/area.cpp index 7f6f28d88..ee107465e 100644 --- a/test/algorithms/area/area.cpp +++ b/test/algorithms/area/area.cpp @@ -73,13 +73,13 @@ void test_all() ("POLYGON((1 0,0 1,-1 0,0 -1,1 0))", 2); typedef typename bg::coordinate_type

::type coord_type; - if (BOOST_GEOMETRY_CONDITION((boost::is_same::value))) + if (BOOST_GEOMETRY_CONDITION((std::is_same::value))) { test_geometry > ("POLYGON((100000001 100000000, 100000000 100000001, \ 99999999 100000000, 100000000 99999999))", 2); } - else if (BOOST_GEOMETRY_CONDITION((boost::is_same::value))) + else if (BOOST_GEOMETRY_CONDITION((std::is_same::value))) { test_geometry > ("POLYGON((100001 100000, 100000 100001, \ diff --git a/test/algorithms/area/area_sph_geo.cpp b/test/algorithms/area/area_sph_geo.cpp index cda94d165..c9b47bfe1 100644 --- a/test/algorithms/area/area_sph_geo.cpp +++ b/test/algorithms/area/area_sph_geo.cpp @@ -6,9 +6,8 @@ // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2015, 2016, 2017. -// Modifications copyright (c) 2015-2017, Oracle and/or its affiliates. - +// This file was modified by Oracle on 2015-2021. +// Modifications copyright (c) 2015-2021, 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 @@ -430,7 +429,7 @@ void test_spherical_geo() /*if (polar) { // Create colatitudes (measured from pole) - BOOST_FOREACH(pt& p, aurha) + for (pt& p : aurha) { bg::set<1>(p, ct(90) - bg::get<1>(p)); } diff --git a/test/algorithms/buffer/buffer_linestring.cpp b/test/algorithms/buffer/buffer_linestring.cpp index 1c3f9dab4..b892ec30d 100644 --- a/test/algorithms/buffer/buffer_linestring.cpp +++ b/test/algorithms/buffer/buffer_linestring.cpp @@ -3,8 +3,8 @@ // Copyright (c) 2012-2019 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2016. -// Modifications copyright (c) 2016, Oracle and/or its affiliates. +// This file was modified by Oracle on 2016-2021. +// Modifications copyright (c) 2016-2021, 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, @@ -128,7 +128,7 @@ void test_all() ut_settings const settings; ut_settings const specific_settings - = BOOST_GEOMETRY_CONDITION((boost::is_same::value)) + = BOOST_GEOMETRY_CONDITION((std::is_same::value)) ? ut_settings(0.02) : settings; // Simplex (join-type is not relevant) @@ -258,7 +258,7 @@ void test_all() test_one("mysql_report_2015_04_01", mysql_report_2015_04_01, join_round(32), end_round(32), 632.234, d100); } - if (! BOOST_GEOMETRY_CONDITION((boost::is_same::value))) + if (! BOOST_GEOMETRY_CONDITION((std::is_same::value))) { ut_settings settings; settings.tolerance = 0.1; @@ -313,7 +313,7 @@ void test_all() 27862.733459829971, 5.9518403867035365); - if (BOOST_GEOMETRY_CONDITION((boost::is_same::value))) + if (BOOST_GEOMETRY_CONDITION((std::is_same::value))) { test_one("mysql_report_2015_09_08a", mysql_report_2015_09_08a, join_round32, end_round32, 0.0, 1.0); test_one("mysql_report_2015_09_08b", mysql_report_2015_09_08b, join_round32, end_round32, 0.0, 1099511627778.0); @@ -390,7 +390,7 @@ template void test_invalid() { typedef typename bg::coordinate_type

::type coor_type; - if (! BOOST_GEOMETRY_CONDITION((boost::is_same::value))) + if (! BOOST_GEOMETRY_CONDITION((std::is_same::value))) { return; } diff --git a/test/algorithms/buffer/buffer_linestring_aimes.cpp b/test/algorithms/buffer/buffer_linestring_aimes.cpp index d82708bb0..86279e0e1 100644 --- a/test/algorithms/buffer/buffer_linestring_aimes.cpp +++ b/test/algorithms/buffer/buffer_linestring_aimes.cpp @@ -3,6 +3,10 @@ // Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands. +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021, 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) @@ -425,7 +429,7 @@ void test_aimes() typedef bg::model::polygon

polygon; typedef typename bg::coordinate_type

::type coor_type; - if (BOOST_GEOMETRY_CONDITION((boost::is_same::value))) + if (BOOST_GEOMETRY_CONDITION((std::is_same::value))) { std::cout << "This unit test can't be tested with float," << " the coordinate values are too small." << std::endl; diff --git a/test/algorithms/buffer/buffer_multi_linestring.cpp b/test/algorithms/buffer/buffer_multi_linestring.cpp index 0c454111a..4b06877aa 100644 --- a/test/algorithms/buffer/buffer_multi_linestring.cpp +++ b/test/algorithms/buffer/buffer_multi_linestring.cpp @@ -3,8 +3,8 @@ // Copyright (c) 2012-2019 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2016. -// Modifications copyright (c) 2016, Oracle and/or its affiliates. +// This file was modified by Oracle on 2016-2021. +// Modifications copyright (c) 2016-2021, 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, @@ -141,7 +141,7 @@ void test_all() test_one("mikado4_small", mikado4, join_round32, end_flat, 1930.785, 10.0); } - if (! BOOST_GEOMETRY_CONDITION((boost::is_same::value))) + if (! BOOST_GEOMETRY_CONDITION((std::is_same::value))) { // Coordinates in one linestring vary so much that // length = geometry::math::sqrt(dx * dx + dy * dy); returns a value of inf for length diff --git a/test/algorithms/buffer/buffer_multi_polygon.cpp b/test/algorithms/buffer/buffer_multi_polygon.cpp index edd78d591..03ab006ae 100644 --- a/test/algorithms/buffer/buffer_multi_polygon.cpp +++ b/test/algorithms/buffer/buffer_multi_polygon.cpp @@ -3,8 +3,8 @@ // Copyright (c) 2012-2019 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2016. -// Modifications copyright (c) 2016, Oracle and/or its affiliates. +// This file was modified by Oracle on 2016-2021. +// Modifications copyright (c) 2016-2021, 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, @@ -657,7 +657,7 @@ void test_all() join_round32, end_round32, 0.0, -10.0); // Check cases with extreme coordinates on assertions - if (BOOST_GEOMETRY_CONDITION((boost::is_same::value))) + if (BOOST_GEOMETRY_CONDITION((std::is_same::value))) { test_one("mysql_report_2015_07_05_1", mysql_report_2015_07_05_1, diff --git a/test/algorithms/buffer/buffer_polygon.cpp b/test/algorithms/buffer/buffer_polygon.cpp index 6c1b70e7a..d1cd8e96a 100644 --- a/test/algorithms/buffer/buffer_polygon.cpp +++ b/test/algorithms/buffer/buffer_polygon.cpp @@ -3,8 +3,8 @@ // Copyright (c) 2012-2019 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2016, 2019. -// Modifications copyright (c) 2016, Oracle and/or its affiliates. +// This file was modified by Oracle on 2016-2021. +// Modifications copyright (c) 2016-2021, 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, @@ -535,7 +535,7 @@ void test_all() test_one("italy_part2_5", italy_part2, join_round, end_flat, {12496082120, 12496082124}, 5 * 1000.0); - if (! BOOST_GEOMETRY_CONDITION((boost::is_same::value))) + if (! BOOST_GEOMETRY_CONDITION((std::is_same::value))) { ut_settings settings; settings.set_test_validity(false); @@ -571,7 +571,7 @@ void test_all() test_one("ticket_10398_1_25", ticket_10398_1, join_miter, end_flat, 246.7329, -2.5); } - if (! BOOST_GEOMETRY_CONDITION((boost::is_same::value))) + if (! BOOST_GEOMETRY_CONDITION((std::is_same::value))) { // Test issue 369 as reported (1.15e-3) and some variants // Use high tolerance because output areas are very small @@ -590,7 +590,7 @@ void test_all() test_one("issue_369_1000", issue_369, jr, er, 7.881e-10, distance / 1000.0, specific); } - if (! BOOST_GEOMETRY_CONDITION((boost::is_same::value))) + if (! BOOST_GEOMETRY_CONDITION((std::is_same::value))) { // Test issue 555 as reported (-0.000001) and some variants bg::strategy::buffer::join_round jr(180); @@ -639,7 +639,7 @@ void test_all() mysql_report_2015_02_17_3, join_round32, end_round32, 64.0, -1.0); - if (BOOST_GEOMETRY_CONDITION((boost::is_same::value))) + if (BOOST_GEOMETRY_CONDITION((std::is_same::value))) { // These extreme testcases, containing huge coordinate differences // and huge buffer distances, are to verify assertions. diff --git a/test/algorithms/buffer/test_buffer.hpp b/test/algorithms/buffer/test_buffer.hpp index 8a3d92d12..3691e6127 100644 --- a/test/algorithms/buffer/test_buffer.hpp +++ b/test/algorithms/buffer/test_buffer.hpp @@ -24,7 +24,6 @@ #include #include -#include #include #include @@ -161,12 +160,12 @@ void test_buffer(std::string const& caseid, typedef typename bg::tag::type tag; // TODO use something different here: - std::string type = boost::is_same::value ? "poly" - : boost::is_same::value ? "line" - : boost::is_same::value ? "point" - : boost::is_same::value ? "multipoly" - : boost::is_same::value ? "multiline" - : boost::is_same::value ? "multipoint" + std::string type = std::is_same::value ? "poly" + : std::is_same::value ? "line" + : std::is_same::value ? "point" + : std::is_same::value ? "multipoly" + : std::is_same::value ? "multiline" + : std::is_same::value ? "multipoint" : "" ; @@ -184,8 +183,8 @@ void test_buffer(std::string const& caseid, std::string end_name = EndTestProperties::name(); if ( BOOST_GEOMETRY_CONDITION(( - boost::is_same::value - || boost::is_same::value )) ) + std::is_same::value + || std::is_same::value )) ) { join_name.clear(); } diff --git a/test/algorithms/buffer/test_buffer_svg.hpp b/test/algorithms/buffer/test_buffer_svg.hpp index 9d0fb9f85..f8df1b13f 100644 --- a/test/algorithms/buffer/test_buffer_svg.hpp +++ b/test/algorithms/buffer/test_buffer_svg.hpp @@ -3,8 +3,8 @@ // Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2020. -// Modifications copyright (c) 2020 Oracle and/or its affiliates. +// This file was modified by Oracle on 2020-2021. +// Modifications copyright (c) 2020-2021 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, @@ -28,8 +28,8 @@ # endif #endif -#include #include +#include #include @@ -116,8 +116,7 @@ private : std::map > offsets; - for (typename boost::range_iterator::type it = - boost::begin(turns); it != boost::end(turns); ++it) + for (auto it = boost::begin(turns); it != boost::end(turns); ++it) { if (m_zoom && bg::disjoint(it->point, m_alternate_box)) { @@ -192,9 +191,7 @@ private : typedef typename boost::range_value::type ring_type; typedef typename bg::point_type::type point_type; - for(typename boost::range_iterator::type it = boost::begin(pieces); - it != boost::end(pieces); - ++it) + for (auto it = boost::begin(pieces); it != boost::end(pieces); ++it) { const piece_type& piece = *it; bg::segment_identifier seg_id = piece.first_seg_id; @@ -274,8 +271,7 @@ private : template inline void map_traversed_rings(TraversedRings const& traversed_rings) { - for(typename boost::range_iterator::type it - = boost::begin(traversed_rings); it != boost::end(traversed_rings); ++it) + for (auto it = boost::begin(traversed_rings); it != boost::end(traversed_rings); ++it) { m_mapper.map(*it, "opacity:0.4;fill:none;stroke:rgb(0,255,0);stroke-width:2"); } @@ -284,8 +280,7 @@ private : template inline void map_offsetted_rings(OffsettedRings const& offsetted_rings) { - for(typename boost::range_iterator::type it - = boost::begin(offsetted_rings); it != boost::end(offsetted_rings); ++it) + for (auto it = boost::begin(offsetted_rings); it != boost::end(offsetted_rings); ++it) { if (it->discarded()) { @@ -349,14 +344,7 @@ public : void map_input_output(Mapper& mapper, Geometry const& geometry, GeometryBuffer const& buffered, bool negative) { - bool const areal = boost::is_same - < - typename bg::tag_cast - < - typename bg::tag::type, - bg::areal_tag - >::type, bg::areal_tag - >::type::value; + bool const areal = bg::util::is_areal::value; if (m_zoom) { @@ -385,7 +373,7 @@ public : bg::detail::overlay::assign_null_policy >(geometry, strategy, rescale_policy, turns, policy); - BOOST_FOREACH(turn_info const& turn, turns) + for (turn_info const& turn : turns) { mapper.map(turn.point, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1", 3); } diff --git a/test/algorithms/buffer/test_buffer_svg_per_turn.hpp b/test/algorithms/buffer/test_buffer_svg_per_turn.hpp index e48d333d1..be01f4b95 100644 --- a/test/algorithms/buffer/test_buffer_svg_per_turn.hpp +++ b/test/algorithms/buffer/test_buffer_svg_per_turn.hpp @@ -2,6 +2,11 @@ // Unit Test Helper // Copyright (c) 2010-2019 Barend Gehrels, Amsterdam, the Netherlands. + +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021, 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) @@ -132,7 +137,7 @@ public : return; } - BOOST_FOREACH(pair_type const& p, points) + for (pair_type const& p : points) { mappers.push_back(new mapper_visitor(complete_caseid, p.second, p.first)); } diff --git a/test/algorithms/centroid.cpp b/test/algorithms/centroid.cpp index 248ebc72b..e418cedce 100644 --- a/test/algorithms/centroid.cpp +++ b/test/algorithms/centroid.cpp @@ -5,9 +5,8 @@ // Copyright (c) 2008-2015 Bruno Lalande, Paris, France. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK. -// This file was modified by Oracle on 2014, 2015. -// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates. - +// This file was modified by Oracle on 2014-2021. +// Modifications copyright (c) 2014-2021 Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library @@ -91,7 +90,7 @@ void test_2d() coord_type m = (std::numeric_limits::max)(); bg::append(ls, P(coord_type(m), coord_type(-m))); bg::append(ls, P(coord_type(0.0001), coord_type(0.000))); - if (BOOST_GEOMETRY_CONDITION((boost::is_same::type, double>::value))) + if (BOOST_GEOMETRY_CONDITION((std::is_same::type, double>::value))) { // for doubles the INF is detected and the calculation stopped // currently for Geometries for which the centroid can't be calculated diff --git a/test/algorithms/check_validity.hpp b/test/algorithms/check_validity.hpp index 388ca6fad..c02ff3f01 100644 --- a/test/algorithms/check_validity.hpp +++ b/test/algorithms/check_validity.hpp @@ -2,6 +2,10 @@ // Copyright (c) 2017 Barend Gehrels, Amsterdam, the Netherlands. +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021, 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) @@ -9,8 +13,6 @@ #ifndef BOOST_GEOMETRY_TEST_CHECK_VALIDITY_HPP #define BOOST_GEOMETRY_TEST_CHECK_VALIDITY_HPP -#include - #include template @@ -64,7 +66,7 @@ struct check_validity std::string& message) { typedef typename boost::range_value::type single_type; - BOOST_FOREACH(single_type const& element, geometry) + for (single_type const& element : geometry) { if (! is_output_valid(element, case_id, g1, g2, message)) { diff --git a/test/algorithms/comparable_distance.cpp b/test/algorithms/comparable_distance.cpp index bb96dc205..1df2e6a45 100644 --- a/test/algorithms/comparable_distance.cpp +++ b/test/algorithms/comparable_distance.cpp @@ -6,9 +6,8 @@ // Copyright (c) 2009-2014 Mateusz Loskot, London, UK. // Copyright (c) 2013-2014 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2014, 2017. -// Modifications copyright (c) 2014-2017, Oracle and/or its affiliates. - +// This file was modified by Oracle on 2014-2021. +// Modifications copyright (c) 2014-2021, 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 @@ -22,9 +21,6 @@ #include -#include -#include -#include #include #include @@ -188,8 +184,8 @@ struct test_variant_different_default_strategy variant_type v1, v2; - BOOST_MPL_ASSERT(( - boost::is_same + BOOST_GEOMETRY_STATIC_ASSERT( + (std::is_same < typename bg::comparable_distance_result < @@ -199,8 +195,8 @@ struct test_variant_different_default_strategy < point_type, point_type, bg::default_strategy >::type - > - )); + >::value), + "Unexpected result type"); // Default strategy v1 = point; @@ -261,27 +257,27 @@ struct test_variant_same_default_strategy variant_type v1, v2; - BOOST_MPL_ASSERT(( - boost::is_same + BOOST_GEOMETRY_STATIC_ASSERT( + (std::is_same < typename bg::comparable_distance_result < variant_type, variant_type, bg::default_strategy >::type, ExpectedResultType - > - )); + >::value), + "Unexpected result type"); - BOOST_MPL_ASSERT(( - boost::is_same + BOOST_GEOMETRY_STATIC_ASSERT( + (std::is_same < typename bg::comparable_distance_result < point_type, point_type, bg::default_strategy >::type, ExpectedResultType - > - )); + >::value), + "Unexpected result type"); // Default strategy v1 = point; @@ -352,27 +348,27 @@ struct test_variant_with_strategy strategy_type strategy; - BOOST_MPL_ASSERT(( - boost::is_same + BOOST_GEOMETRY_STATIC_ASSERT( + (std::is_same < typename bg::comparable_distance_result < variant_type, variant_type, strategy_type >::type, ExpectedResultType - > - )); + >::value), + "Unexpected result type"); - BOOST_MPL_ASSERT(( - boost::is_same + BOOST_GEOMETRY_STATIC_ASSERT( + (std::is_same < typename bg::comparable_distance_result < segment_type, linestring_type, strategy_type >::type, ExpectedResultType - > - )); + >::value), + "Unexpected result type"); // Passed strategy v1 = seg; @@ -422,7 +418,7 @@ struct test_variant_with_strategy } }; -template ::value> +template ::value> struct check_result { template @@ -459,23 +455,24 @@ struct test_variant_boxes variant_type v1 = box1, v2 = box2; - typedef typename boost::mpl::if_c + typedef typename std::conditional < - boost::is_float::value, + std::is_floating_point::value, double, typename bg::util::detail::default_integral::type >::type expected_result_type; - BOOST_MPL_ASSERT(( - boost::is_same + BOOST_GEOMETRY_STATIC_ASSERT( + (std::is_same < typename bg::comparable_distance_result < variant_type, variant_type, bg::default_strategy >::type, expected_result_type - > - )); + >::value), + "Unexpected result type" + ); // Default strategy check_result::apply(bg::comparable_distance(v1, v2), @@ -491,7 +488,7 @@ struct test_variant_boxes int test_main(int, char* []) { test_double_result_from_integer(); - test_double_result_from_integer(); + test_double_result_from_integer(); test_all >(); test_all >(); diff --git a/test/algorithms/covered_by/covered_by_sph_geo.cpp b/test/algorithms/covered_by/covered_by_sph_geo.cpp index 665b2802f..94730d52c 100644 --- a/test/algorithms/covered_by/covered_by_sph_geo.cpp +++ b/test/algorithms/covered_by/covered_by_sph_geo.cpp @@ -1,6 +1,6 @@ // Boost.Geometry -// Copyright (c) 2016 Oracle and/or its affiliates. +// Copyright (c) 2016-2021 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, @@ -82,12 +82,12 @@ void test_box_box() template void test_point_polygon() { - typename boost::mpl::if_ + std::conditional_t < - boost::is_same::type, bg::geographic_tag>, + std::is_same::type, bg::geographic_tag>::value, bg::strategy::within::geographic_winding

, bg::strategy::within::spherical_winding

- >::type s; + > s; typedef bg::model::polygon

poly; diff --git a/test/algorithms/detail/calculate_point_order.cpp b/test/algorithms/detail/calculate_point_order.cpp index 401136313..38922155f 100644 --- a/test/algorithms/detail/calculate_point_order.cpp +++ b/test/algorithms/detail/calculate_point_order.cpp @@ -1,8 +1,7 @@ // Boost.Geometry // Unit Test -// Copyright (c) 2019, Oracle and/or its affiliates. - +// Copyright (c) 2019-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Licensed under the Boost Software License version 1.0. @@ -89,7 +88,7 @@ inline void test_one(std::string const& ring_wkt, bg::order_selector expected) std::rotate(boost::begin(ring), boost::begin(ring) + 1, boost::end(ring)); // it seems that area method doesn't work for invalid "opened" polygons - //if (! boost::is_same::value) + //if (! std::is_same::value) { P p = bg::range::front(ring); bg::range::push_back(ring, p); diff --git a/test/algorithms/detail/partition.cpp b/test/algorithms/detail/partition.cpp index 9d63668d8..c1549f729 100644 --- a/test/algorithms/detail/partition.cpp +++ b/test/algorithms/detail/partition.cpp @@ -3,8 +3,8 @@ // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. // -// This file was modified by Oracle on 2017, 2018. -// Modifications copyright (c) 2017-2018 Oracle and/or its affiliates. +// This file was modified by Oracle on 2017-2021. +// Modifications copyright (c) 2017-2021 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, @@ -15,19 +15,20 @@ #include +#include +#include +#include +#include +#include -#include #include #include #include -#include - -#include - #if defined(TEST_WITH_SVG) # include #endif +#include #include #include @@ -151,7 +152,7 @@ void test_boxes(std::string const& wkt_box_list, double expected_area, int expec std::vector boxes; int index = 1; - BOOST_FOREACH(std::string const& wkt, wkt_boxes) + for (std::string const& wkt : wkt_boxes) { boxes.push_back(sample(index++, wkt)); } @@ -229,10 +230,10 @@ void test_points(std::string const& wkt1, std::string const& wkt2, int expected_ bg::read_wkt(wkt2, mp2); int id = 1; - BOOST_FOREACH(point_item& p, mp1) + for (point_item& p : mp1) { p.id = id++; } id = 1; - BOOST_FOREACH(point_item& p, mp2) + for (point_item& p : mp2) { p.id = id++; } point_visitor visitor; @@ -352,9 +353,9 @@ void test_many_points(int seed, int size, int count) // Test equality in quadratic loop int expected_count = 0; - BOOST_FOREACH(point_item const& item1, mp1) + for (point_item const& item1 : mp1) { - BOOST_FOREACH(point_item const& item2, mp2) + for (point_item const& item2 : mp2) { if (bg::equals(item1, item2)) { @@ -395,11 +396,11 @@ void test_many_points(int seed, int size, int count) BOOST_CHECK_EQUAL(visitor.count, expected_count); #if defined(TEST_WITH_SVG) - BOOST_FOREACH(point_item const& item, mp1) + for (point_item const& item : mp1) { mapper.map(item, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1", 8); } - BOOST_FOREACH(point_item const& item, mp2) + for (point_item const& item : mp2) { mapper.map(item, "fill:rgb(0,128,255);stroke:rgb(0,0,100);stroke-width:1", 4); } @@ -447,9 +448,9 @@ void test_many_boxes(int seed, int size, int count) // Test equality in quadratic loop int expected_count = 0; double expected_area = 0.0; - BOOST_FOREACH(box_item const& item1, boxes) + for (box_item const& item1 : boxes) { - BOOST_FOREACH(box_item const& item2, boxes) + for (box_item const& item2 : boxes) { if (item1.id < item2.id) { @@ -478,7 +479,7 @@ void test_many_boxes(int seed, int size, int count) p.x = size + 1; p.y = size + 1; mapper.add(p); } - BOOST_FOREACH(box_item const& item, boxes) + for (box_item const& item : boxes) { mapper.map(item.box, "opacity:0.6;fill:rgb(50,50,210);stroke:rgb(0,0,0);stroke-width:1"); } @@ -515,9 +516,9 @@ void test_two_collections(int seed1, int seed2, int size, int count) // Get expectations in quadratic loop int expected_count = 0; double expected_area = 0.0; - BOOST_FOREACH(box_item const& item1, boxes1) + for (box_item const& item1 : boxes1) { - BOOST_FOREACH(box_item const& item2, boxes2) + for (box_item const& item2 : boxes2) { if (bg::intersects(item1.box, item2.box)) { @@ -543,11 +544,11 @@ void test_two_collections(int seed1, int seed2, int size, int count) p.x = size + 1; p.y = size + 1; mapper.add(p); } - BOOST_FOREACH(box_item const& item, boxes1) + for (box_item const& item : boxes1) { mapper.map(item.box, "opacity:0.6;fill:rgb(50,50,210);stroke:rgb(0,0,0);stroke-width:1"); } - BOOST_FOREACH(box_item const& item, boxes2) + for (box_item const& item : boxes2) { mapper.map(item.box, "opacity:0.6;fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:1"); } @@ -584,9 +585,9 @@ void test_heterogenuous_collections(int seed1, int seed2, int size, int count) // Get expectations in quadratic loop int expected_count = 0; - BOOST_FOREACH(point_item const& point, points) + for (point_item const& point : points) { - BOOST_FOREACH(box_item const& box_item, boxes) + for (box_item const& box_item : boxes) { if (bg::within(point, box_item.box)) { @@ -609,11 +610,11 @@ void test_heterogenuous_collections(int seed1, int seed2, int size, int count) p.x = size + 1; p.y = size + 1; mapper.add(p); } - BOOST_FOREACH(point_item const& point, points) + for (point_item const& point : points) { mapper.map(point, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1", 8); } - BOOST_FOREACH(box_item const& item, boxes) + for (box_item const& item : boxes) { mapper.map(item.box, "opacity:0.6;fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:1"); } diff --git a/test/algorithms/detail/sections/range_by_section.cpp b/test/algorithms/detail/sections/range_by_section.cpp index 1069c4905..b963a759d 100644 --- a/test/algorithms/detail/sections/range_by_section.cpp +++ b/test/algorithms/detail/sections/range_by_section.cpp @@ -11,7 +11,7 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include + #include #define BOOST_GEOMETRY_UNIT_TEST_SECTIONALIZE @@ -58,7 +58,7 @@ void test_sectionalize(std::string const /*caseid*/, Geometry const& geometry, s view_type const >::type range_iterator; - BOOST_FOREACH(typename sections::value_type const& sec, s) + for (typename sections::value_type const& sec : s) { cview_type cview(bg::range_by_section(geometry, sec)); view_type view(cview); diff --git a/test/algorithms/detail/sections/sectionalize.cpp b/test/algorithms/detail/sections/sectionalize.cpp index ce448a1fd..6493c2561 100644 --- a/test/algorithms/detail/sections/sectionalize.cpp +++ b/test/algorithms/detail/sections/sectionalize.cpp @@ -5,8 +5,8 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. -// This file was modified by Oracle on 2020. -// Modifications copyright (c) 2020, Oracle and/or its affiliates. +// This file was modified by Oracle on 2020-2021. +// Modifications copyright (c) 2020-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library @@ -102,7 +102,7 @@ void test_sectionalize(std::string const& caseid, G const& g, std::size_t sectio // Check if sections are consecutive and consistent int previous_index = -1; - BOOST_FOREACH(typename sections::value_type const& sec, s) + for (typename sections::value_type const& sec : s) { if (sec.begin_index > 0) { diff --git a/test/algorithms/detail/tupled_output.cpp b/test/algorithms/detail/tupled_output.cpp index 3454f307b..8b9265a2b 100644 --- a/test/algorithms/detail/tupled_output.cpp +++ b/test/algorithms/detail/tupled_output.cpp @@ -1,8 +1,7 @@ // Boost.Geometry // Unit Test -// Copyright (c) 2019 Oracle and/or its affiliates. - +// Copyright (c) 2019-2021 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, @@ -34,14 +33,14 @@ template void test_range_values() { typedef typename bgd::tupled_range_values::type tuple_s; - BOOST_CHECK_EQUAL((boost::is_same::value), true); + BOOST_CHECK_EQUAL((std::is_same::value), true); } template void test_back_inserters() { typedef typename bgd::tupled_back_inserters::type tuple_bi; - BOOST_CHECK_EQUAL((boost::is_same::value), true); + BOOST_CHECK_EQUAL((std::is_same::value), true); TupleM tup; bgd::tupled_back_inserters::apply(tup); diff --git a/test/algorithms/distance/distance.cpp b/test/algorithms/distance/distance.cpp index 30e8eb63f..dbf66afe0 100644 --- a/test/algorithms/distance/distance.cpp +++ b/test/algorithms/distance/distance.cpp @@ -5,6 +5,9 @@ // Copyright (c) 2008-2015 Bruno Lalande, Paris, France. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK. +// Copyright (c) 2021 Oracle and/or its affiliates. +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -20,8 +23,6 @@ #include "test_distance.hpp" #include -#include -#include #include #include @@ -81,7 +82,9 @@ void test_distance_point() BOOST_CONCEPT_ASSERT( (bg::concepts::PointDistanceStrategy) ); typedef typename services::return_type::type cab_return_type; - BOOST_MPL_ASSERT((boost::is_same::type>)); + BOOST_GEOMETRY_STATIC_ASSERT( + (std::is_same::type>::value), + "Unexpected result type"); taxicab_distance tcd; cab_return_type d = bg::distance(p1, p2, tcd); @@ -412,8 +415,8 @@ void test_large_integers() bg::read_wkt(a, da); bg::read_wkt(b, db); - BOOST_AUTO(idist, bg::distance(ia, ib)); - BOOST_AUTO(ddist, bg::distance(da, db)); + auto const idist = bg::distance(ia, ib); + auto const ddist = bg::distance(da, db); BOOST_CHECK_MESSAGE(std::abs(idist - ddist) < 0.1, "within different from within"); @@ -431,8 +434,8 @@ void test_large_integers() bg::read_wkt(a, da); bg::read_wkt(b, db); - BOOST_AUTO(idist, bg::distance(ia, ib)); - BOOST_AUTO(ddist, bg::distance(da, db)); + auto const idist = bg::distance(ia, ib); + auto const ddist = bg::distance(da, db); BOOST_CHECK_MESSAGE(std::abs(idist - ddist) < 0.1, "within different from within"); @@ -457,16 +460,16 @@ void test_variant() variant_type v1, v2; - BOOST_MPL_ASSERT(( - boost::is_same + BOOST_GEOMETRY_STATIC_ASSERT( + (std::is_same < typename bg::distance_result < variant_type, variant_type, bg::default_strategy >::type, double - > - )); + >::value), + "Unexpected result type"); // Default strategy v1 = point; diff --git a/test/algorithms/distance/distance_brute_force.hpp b/test/algorithms/distance/distance_brute_force.hpp index 1e5b8b998..64ad16cd6 100644 --- a/test/algorithms/distance/distance_brute_force.hpp +++ b/test/algorithms/distance/distance_brute_force.hpp @@ -1,8 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test -// Copyright (c) 2014-2020 Oracle and/or its affiliates. - +// Copyright (c) 2014-2021 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 Adam Wulkiewicz, on behalf of Oracle @@ -15,8 +14,6 @@ #include -#include -#include #include #include #include @@ -46,17 +43,13 @@ struct distance_from_bg { template struct use_distance_from_bg - { - typedef typename boost::mpl::or_ + : util::bool_constant < - boost::is_same::type, point_tag>, - typename boost::mpl::or_ - < - boost::is_same::type, segment_tag>, - boost::is_same::type, box_tag> - >::type - >::type type; - }; + std::is_same::type, point_tag>::value + || std::is_same::type, segment_tag>::value + || std::is_same::type, box_tag>::value + > + {}; template static inline @@ -65,8 +58,10 @@ struct distance_from_bg Geometry2 const& geometry2, Strategy const& strategy) { - BOOST_MPL_ASSERT((typename use_distance_from_bg::type)); - BOOST_MPL_ASSERT((typename use_distance_from_bg::type)); + BOOST_GEOMETRY_STATIC_ASSERT((use_distance_from_bg::value), + "Unexpected kind of Geometry1"); + BOOST_GEOMETRY_STATIC_ASSERT((use_distance_from_bg::value), + "Unexpected kind of Geometry1"); return geometry::distance(geometry1, geometry2, strategy); } diff --git a/test/algorithms/distance/distance_geo_linear_box.cpp b/test/algorithms/distance/distance_geo_linear_box.cpp index b7287201d..bb9abac29 100644 --- a/test/algorithms/distance/distance_geo_linear_box.cpp +++ b/test/algorithms/distance/distance_geo_linear_box.cpp @@ -1,25 +1,24 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test -// Copyright (c) 2017-2020 Oracle and/or its affiliates. - +// Copyright (c) 2017-2021 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 // Licensed under the Boost Software License version 1.0. // http://www.boost.org/users/license.html +#ifdef BOOST_GEOMETRY_TEST_DEBUG #include +#endif + +#include #ifndef BOOST_TEST_MODULE #define BOOST_TEST_MODULE test_distance_geographic_linear_areal #endif -#include - #include -#include -#include #include "test_distance_geo_common.hpp" //#include "test_empty_geometry.hpp" diff --git a/test/algorithms/distance/distance_se_geo_ar_ar.cpp b/test/algorithms/distance/distance_se_geo_ar_ar.cpp index 449ea50b0..a0b809af9 100644 --- a/test/algorithms/distance/distance_se_geo_ar_ar.cpp +++ b/test/algorithms/distance/distance_se_geo_ar_ar.cpp @@ -1,8 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test -// Copyright (c) 2017-2020 Oracle and/or its affiliates. - +// Copyright (c) 2017-2021 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 @@ -13,11 +12,7 @@ #define BOOST_TEST_MODULE test_distance_geographic_areal_areal #endif -#include - #include -#include -#include #include "test_distance_geo_common.hpp" #include "test_empty_geometry.hpp" diff --git a/test/algorithms/distance/distance_se_geo_l_ar.cpp b/test/algorithms/distance/distance_se_geo_l_ar.cpp index dca46a264..ae26ce6b7 100644 --- a/test/algorithms/distance/distance_se_geo_l_ar.cpp +++ b/test/algorithms/distance/distance_se_geo_l_ar.cpp @@ -1,25 +1,22 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test -// Copyright (c) 2017-2020 Oracle and/or its affiliates. - +// Copyright (c) 2017-2021 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 // Licensed under the Boost Software License version 1.0. // http://www.boost.org/users/license.html +#ifdef BOOST_GEOMETRY_TEST_DEBUG #include +#endif #ifndef BOOST_TEST_MODULE #define BOOST_TEST_MODULE test_distance_geographic_linear_areal #endif -#include - #include -#include -#include #include "test_distance_geo_common.hpp" #include "test_empty_geometry.hpp" diff --git a/test/algorithms/distance/distance_se_geo_l_l.cpp b/test/algorithms/distance/distance_se_geo_l_l.cpp index 7f0119f59..75d3b9b5e 100644 --- a/test/algorithms/distance/distance_se_geo_l_l.cpp +++ b/test/algorithms/distance/distance_se_geo_l_l.cpp @@ -1,25 +1,22 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test -// Copyright (c) 2018-2020 Oracle and/or its affiliates. - +// Copyright (c) 2018-2021 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 // Licensed under the Boost Software License version 1.0. // http://www.boost.org/users/license.html +#ifdef BOOST_GEOMETRY_TEST_DEBUG #include +#endif #ifndef BOOST_TEST_MODULE #define BOOST_TEST_MODULE test_distance_geographic_linear_linear #endif -#include - #include -#include -#include #include "test_distance_geo_common.hpp" #include "test_empty_geometry.hpp" diff --git a/test/algorithms/distance/distance_se_geo_pl_ar.cpp b/test/algorithms/distance/distance_se_geo_pl_ar.cpp index bd8fce71b..67ca9fadd 100644 --- a/test/algorithms/distance/distance_se_geo_pl_ar.cpp +++ b/test/algorithms/distance/distance_se_geo_pl_ar.cpp @@ -1,25 +1,22 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test -// Copyright (c) 2017-2020, Oracle and/or its affiliates. - +// Copyright (c) 2017-2021 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 // Licensed under the Boost Software License version 1.0. // http://www.boost.org/users/license.html +#ifdef BOOST_GEOMETRY_TEST_DEBUG #include +#endif #ifndef BOOST_TEST_MODULE #define BOOST_TEST_MODULE test_distance_geographic_pointlike_areal #endif -#include - #include -#include -#include #include "test_distance_geo_common.hpp" #include "test_empty_geometry.hpp" diff --git a/test/algorithms/distance/test_distance_common.hpp b/test/algorithms/distance/test_distance_common.hpp index fb8002f99..88c2747d5 100644 --- a/test/algorithms/distance/test_distance_common.hpp +++ b/test/algorithms/distance/test_distance_common.hpp @@ -1,8 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test -// Copyright (c) 2014-2017, Oracle and/or its affiliates. - +// Copyright (c) 2014-2021, 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 @@ -16,28 +15,16 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include + +#include #include #include -#include -#include -#include - #include #include @@ -207,11 +194,11 @@ private: Strategy, G1, G2 >::type distance_result_from_strategy; - static const bool same_regular = boost::is_same + static const bool same_regular = std::is_same < default_distance_result, distance_result_from_strategy - >::type::value; + >::value; BOOST_CHECK( same_regular ); @@ -231,11 +218,11 @@ private: G2 >::type comparable_distance_result_from_strategy; - static const bool same_comparable = boost::is_same + static const bool same_comparable = std::is_same < default_comparable_distance_result, comparable_distance_result_from_strategy - >::type::value; + >::value; BOOST_CHECK( same_comparable ); diff --git a/test/algorithms/distance/test_distance_geo_common.hpp b/test/algorithms/distance/test_distance_geo_common.hpp index 7620c883a..58695c16c 100644 --- a/test/algorithms/distance/test_distance_geo_common.hpp +++ b/test/algorithms/distance/test_distance_geo_common.hpp @@ -1,9 +1,9 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test -// Copyright (c) 2016-2017, Oracle and/or its affiliates. - +// Copyright (c) 2016-2021, 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 // Licensed under the Boost Software License version 1.0. // http://www.boost.org/users/license.html @@ -14,29 +14,18 @@ #include #include -#include -#include -#include +#include +#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include #include -#include -#include - #include +#include + #include #include @@ -229,7 +218,7 @@ template struct dispatch }; // Specialization for segments -template <> struct dispatch +template <> struct dispatch { template static inline Segment swap(Segment const& s) @@ -259,7 +248,7 @@ template <> struct dispatch }; // Specialization for boxes -template <> struct dispatch +template <> struct dispatch { template static inline T swap(T const& t) @@ -283,7 +272,7 @@ template <> struct dispatch // Specialization for points -template <> struct dispatch +template <> struct dispatch { template static inline T swap(T const& t) @@ -412,11 +401,11 @@ struct test_distance_of_geometries Strategy, Geometry1, Geometry2 >::type distance_result_from_strategy; - static const bool same_regular = boost::is_same + static const bool same_regular = std::is_same < default_distance_result, distance_result_from_strategy - >::type::value; + >::value; BOOST_CHECK(same_regular); @@ -482,12 +471,12 @@ struct test_distance_of_geometries { Geometry1 g1 = dispatch < - typename boost::geometry::tag::type + typename bg::tag::type >::swap(geometry1); Geometry2 g2 = dispatch < - typename boost::geometry::tag::type + typename bg::tag::type >::swap(geometry2); // check distance with given strategy @@ -510,12 +499,12 @@ struct test_distance_of_geometries { Geometry1 g1 = dispatch < - typename boost::geometry::tag::type + typename bg::tag::type >::mirror(geometry1); Geometry2 g2 = dispatch < - typename boost::geometry::tag::type + typename bg::tag::type >::mirror(geometry2); // check distance with given strategy diff --git a/test/algorithms/distance/test_distance_se_common.hpp b/test/algorithms/distance/test_distance_se_common.hpp index 1909c27f9..e8febcd75 100644 --- a/test/algorithms/distance/test_distance_se_common.hpp +++ b/test/algorithms/distance/test_distance_se_common.hpp @@ -1,8 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test -// Copyright (c) 2014-2017, Oracle and/or its affiliates. - +// Copyright (c) 2014-2021, 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 @@ -12,31 +11,21 @@ #ifndef BOOST_GEOMETRY_TEST_DISTANCE_SE_COMMON_HPP #define BOOST_GEOMETRY_TEST_DISTANCE_SE_COMMON_HPP +#ifdef BOOST_GEOMETRY_TEST_DEBUG #include +#endif + #include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - #include #include #include +#include + +#include +#include + #include #include @@ -192,11 +181,11 @@ struct test_distance_of_geometries Strategy, Geometry1, Geometry2 >::type distance_result_from_strategy; - static const bool same_regular = boost::is_same + static const bool same_regular = std::is_same < default_distance_result, distance_result_from_strategy - >::type::value; + >::value; BOOST_CHECK(same_regular); @@ -212,11 +201,11 @@ struct test_distance_of_geometries Geometry2 >::type comparable_distance_result_from_strategy; - static const bool same_comparable = boost::is_same + static const bool same_comparable = std::is_same < default_comparable_distance_result, comparable_distance_result_from_strategy - >::type::value; + >::value; BOOST_CHECK( same_comparable ); diff --git a/test/algorithms/envelope_expand/envelope_on_spheroid.cpp b/test/algorithms/envelope_expand/envelope_on_spheroid.cpp index 047955ecd..d09e7ddc3 100644 --- a/test/algorithms/envelope_expand/envelope_on_spheroid.cpp +++ b/test/algorithms/envelope_expand/envelope_on_spheroid.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test -// Copyright (c) 2015-2020, Oracle and/or its affiliates. +// Copyright (c) 2015-2021, 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 @@ -22,34 +22,24 @@ #include #include -#include -#include - #include -#include -#include -#include -#include - -#include - -#include - -#include -#include +#include +#include +#include "test_envelope_expand_on_spheroid.hpp" #include #include #include - +#include +#include +#include +#include #include - -#include "test_envelope_expand_on_spheroid.hpp" - -//TEMP -#include -#include +#include +#include +#include +#include template @@ -74,22 +64,22 @@ struct test_envelope typedef bg::strategy::envelope::spherical_box box_strategy_t; typedef bg::strategy::envelope::geographic, double> strategy_t; - typename boost::mpl::if_c + std::conditional_t < - boost::is_same::type, bg::point_tag>::value, + std::is_same::type, bg::point_tag>::value, point_strategy_t, - typename boost::mpl::if_c + std::conditional_t < - boost::is_same::type, bg::multi_point_tag>::value, + std::is_same::type, bg::multi_point_tag>::value, multi_point_strategy_t, - typename boost::mpl::if_c + std::conditional_t < - boost::is_same::type, bg::box_tag>::value, + std::is_same::type, bg::box_tag>::value, box_strategy_t, strategy_t - >::type - >::type - >::type strategy; + > + > + > strategy; bg::envelope(geometry, detected, strategy); } @@ -327,26 +317,16 @@ public: // test the reverse of a geometry if it is either linear or ring -template ::type> +template struct test_reverse_geometry { - static bool const is_linear = - boost::is_same::value - || boost::is_same::value - || boost::is_same::value; + static bool const is_linear = bg::util::is_linear::value; // currently disable rings static bool const is_ring = false; - // static bool const is_ring = boost::is_same::value; + // static bool const is_ring = bg::util::is_ring::value; - typedef typename boost::mpl::if_c - < - is_linear || is_ring, - boost::true_type, - boost::false_type - >::type type; - - static bool const value = type::value; + static bool const value = (is_linear || is_ring); }; template diff --git a/test/algorithms/envelope_expand/expand_on_spheroid.cpp b/test/algorithms/envelope_expand/expand_on_spheroid.cpp index 16c3a24bd..50e0fc387 100644 --- a/test/algorithms/envelope_expand/expand_on_spheroid.cpp +++ b/test/algorithms/envelope_expand/expand_on_spheroid.cpp @@ -1,8 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test -// Copyright (c) 2015-2020, Oracle and/or its affiliates. - +// Copyright (c) 2015-2021, 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 Adam Wulkiewicz, on behalf of Oracle @@ -17,41 +16,32 @@ #include #include - #include #include #include #include -#include - -#include -#include -#include - -#include - -#include - -#include - -#include -#include - #include #include #include #include #include -#include "test_envelope_expand_on_spheroid.hpp" +#include +#include +#include -// TEMP -#include -#include -#include -#include +#include + +#include +#include + +#include + +#include + +#include "test_envelope_expand_on_spheroid.hpp" class test_expand_on_spheroid @@ -353,7 +343,7 @@ public: basic_tester < - boost::is_same + std::is_same < typename bg::tag::type, bg::box_tag @@ -1070,7 +1060,7 @@ void test_expand_make_inverse() typedef bg::model::segment segment_type; typedef test_expand_on_spheroid tester; - box_type box = boost::geometry::make_inverse(); + box_type box = bg::make_inverse(); tester::apply("bi01", box, diff --git a/test/algorithms/envelope_expand/test_envelope.hpp b/test/algorithms/envelope_expand/test_envelope.hpp index c0dc91639..64792366c 100644 --- a/test/algorithms/envelope_expand/test_envelope.hpp +++ b/test/algorithms/envelope_expand/test_envelope.hpp @@ -2,6 +2,11 @@ // Unit Test // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. + +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021, 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) @@ -28,13 +33,13 @@ struct check_result template struct check_result { - typedef typename bg::coordinate_type::type ctype; - typedef typename boost::mpl::if_ - < - boost::is_arithmetic, - double, - ctype - >::type type; + using ctype = typename bg::coordinate_type::type; + using type = std::conditional_t + < + (std::is_integral::value || std::is_floating_point::value), + double, + ctype + >; static void apply(Box const& b, const type& x1, const type& y1, const type& /*z1*/, const type& x2, const type& y2, const type& /*z2*/) @@ -50,13 +55,13 @@ struct check_result template struct check_result { - typedef typename bg::coordinate_type::type ctype; - typedef typename boost::mpl::if_ - < - boost::is_arithmetic, - double, - ctype - >::type type; + using ctype = typename bg::coordinate_type::type; + using type = std::conditional_t + < + (std::is_integral::value || std::is_floating_point::value), + double, + ctype + >; static void apply(Box const& b, const type& x1, const type& y1, const type& z1, const type& x2, const type& y2, const type& z2) diff --git a/test/algorithms/envelope_expand/test_envelope_expand_on_spheroid.hpp b/test/algorithms/envelope_expand/test_envelope_expand_on_spheroid.hpp index cd6c0e2a8..caf5402f4 100644 --- a/test/algorithms/envelope_expand/test_envelope_expand_on_spheroid.hpp +++ b/test/algorithms/envelope_expand/test_envelope_expand_on_spheroid.hpp @@ -1,8 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test -// Copyright (c) 2015-2017, Oracle and/or its affiliates. - +// Copyright (c) 2015-2021, 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 @@ -18,8 +17,6 @@ #include #include -#include - #include #include #include @@ -66,7 +63,7 @@ struct rng template char const* units2string() { - if (BOOST_GEOMETRY_CONDITION((boost::is_same::value))) + if (BOOST_GEOMETRY_CONDITION((std::is_same::value))) { return "degrees"; } diff --git a/test/algorithms/equals/equals.cpp b/test/algorithms/equals/equals.cpp index 8e0d23848..dd347709d 100644 --- a/test/algorithms/equals/equals.cpp +++ b/test/algorithms/equals/equals.cpp @@ -3,9 +3,8 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2013-2020. -// Modifications copyright (c) 2013-2020 Oracle and/or its affiliates. - +// This file was modified by Oracle on 2013-2021. +// Modifications copyright (c) 2013-2021 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, @@ -14,8 +13,6 @@ #include "test_equals.hpp" -#include - #include #include @@ -59,7 +56,8 @@ void test_segment_segment() template void test_linestring_linestring() { - typedef bgm::linestring

ls; + using coord_t = typename bg::coordinate_type

::type; + using ls = bgm::linestring

; test_geometry("ls2d_1", "LINESTRING(1 1, 3 3)", "LINESTRING(3 3, 1 1)", true); test_geometry("ls2d_2", "LINESTRING(1 1, 3 3, 2 5)", "LINESTRING(1 1, 2 2, 3 3, 2 5)", true); @@ -82,8 +80,7 @@ void test_linestring_linestring() test_geometry("ls2d_overl_ring2", "LINESTRING(0 0,5 0,5 5,0 5,0 0)", "LINESTRING(5 5,5 0,0 0,0 5,5 5,5 0)", true); // https://svn.boost.org/trac/boost/ticket/10904 - if ( BOOST_GEOMETRY_CONDITION( - boost::is_floating_point::type>::value ) ) + if ( BOOST_GEOMETRY_CONDITION(std::is_floating_point::value) ) { test_geometry("ls2d_small1", "LINESTRING(5.6956521739130430148634331999347 -0.60869565217391330413931882503675,5.5 -0.50000000000000066613381477509392)", diff --git a/test/algorithms/overlay/assemble.cpp b/test/algorithms/overlay/assemble.cpp index 78965692a..d53bd9d4a 100644 --- a/test/algorithms/overlay/assemble.cpp +++ b/test/algorithms/overlay/assemble.cpp @@ -3,9 +3,8 @@ // Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2019. -// Modifications copyright (c) 2019, Oracle and/or its affiliates. - +// This file was modified by Oracle on 2019-2021. +// Modifications copyright (c) 2019-2021, 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, @@ -19,24 +18,22 @@ #include -#include - #include #include #include #include #include #include -#include #include #include -#include - #include #include +#include + +#include #if defined(TEST_WITH_SVG) @@ -60,19 +57,19 @@ inline void test_assemble(std::string const& id, Geometry const& p, Geometry con type area_i = 0, area_u = 0, area_d1 = 0, area_d2 = 0; - BOOST_FOREACH(Geometry const& g, u) + for (Geometry const& g : u) { area_u += bg::area(g); } - BOOST_FOREACH(Geometry const& g, i) + for (Geometry const& g : i) { area_i += bg::area(g); } - BOOST_FOREACH(Geometry const& g, d1) + for (Geometry const& g : d1) { area_d1 += bg::area(g); } - BOOST_FOREACH(Geometry const& g, d2) + for (Geometry const& g : d2) { area_d2 += bg::area(g); } @@ -111,7 +108,7 @@ inline void test_assemble(std::string const& id, Geometry const& p, Geometry con : d2 ; - BOOST_FOREACH(Geometry const& geometry, v) + for (Geometry const& geometry : v) { mapper.map(geometry, linestyle + "stroke-width:3;stroke-linejoin:round;stroke-linecap:square;stroke-dasharray:12,12;stroke:rgb(255,0,0);"); @@ -123,7 +120,6 @@ inline void test_assemble(std::string const& id, Geometry const& p, Geometry con template inline bool int_ok(Polygon const& poly) { - typename bg::point_type::type const& pi = bg::interior_rings(poly)[0].front(); diff --git a/test/algorithms/overlay/dissolver.cpp b/test/algorithms/overlay/dissolver.cpp index c928fa7b3..2d8e28a0f 100644 --- a/test/algorithms/overlay/dissolver.cpp +++ b/test/algorithms/overlay/dissolver.cpp @@ -3,6 +3,10 @@ // Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands. +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021 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) @@ -46,7 +50,7 @@ void test_dissolve_plusmin(std::string const& caseid, Collection const& input, T positive_area = T(); T negative_area = T(); - BOOST_FOREACH(geometry_type const& geometry, output) + for (geometry_type const& geometry : output) { T a = bg::area(geometry); if (a > zero) @@ -74,17 +78,17 @@ void test_dissolve_plusmin(std::string const& caseid, Collection const& input, bg::svg_mapper mapper(svg, 500, 500); typedef typename boost::range_value::type value_type; - BOOST_FOREACH(value_type const& geometry, input) + for (value_type const& geometry : input) { mapper.add(geometry); } - BOOST_FOREACH(value_type const& geometry, input) + for (value_type const& geometry : input) { mapper.map(geometry, "opacity:0.6;fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:0.5"); } - BOOST_FOREACH(geometry_type const& geometry, output) + for (geometry_type const& geometry : output) { mapper.map(geometry, bg::area(geometry) > 0 @@ -116,7 +120,7 @@ void test_geometry(std::string const& caseid, std::string const& wkt, typedef typename boost::range_value::type polygon_type; typedef typename bg::ring_type::type ring_type; std::vector rings; - BOOST_FOREACH(polygon_type const& polygon, multi_polygon) + for (polygon_type const& polygon : multi_polygon) { rings.push_back(bg::exterior_ring(polygon)); } diff --git a/test/algorithms/overlay/get_turn_info.cpp b/test/algorithms/overlay/get_turn_info.cpp index a70093de4..d8bb78356 100644 --- a/test/algorithms/overlay/get_turn_info.cpp +++ b/test/algorithms/overlay/get_turn_info.cpp @@ -3,31 +3,26 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2017-2020. -// Modifications copyright (c) 2017-2020, Oracle and/or its affiliates. +// This file was modified by Oracle on 2017-2021. +// Modifications copyright (c) 2017-2021, 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) + #include #include -#include -#include - +#include +#include #include #include -#include -#include #include -// TEMP -#include - #if defined(TEST_WITH_SVG) # include #endif @@ -57,7 +52,7 @@ struct sub_range_from_points } private : - boost::array m_points; + Point m_points[3]; }; template diff --git a/test/algorithms/overlay/get_turns.cpp b/test/algorithms/overlay/get_turns.cpp index 5db074ab3..14b7b0f04 100644 --- a/test/algorithms/overlay/get_turns.cpp +++ b/test/algorithms/overlay/get_turns.cpp @@ -5,8 +5,8 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. -// This file was modified by Oracle on 2017. -// Modifications copyright (c) 2017, Oracle and/or its affiliates. +// This file was modified by Oracle on 2017-2021. +// Modifications copyright (c) 2017-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library @@ -122,7 +122,7 @@ struct test_get_turns "stroke:rgb(51,51,153);stroke-width:3"); int index = 0; - BOOST_FOREACH(turn_info const& turn, turns) + for (turn_info const& turn : turns) { mapper.map(turn.point, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1"); diff --git a/test/algorithms/overlay/get_turns_linear_linear.cpp b/test/algorithms/overlay/get_turns_linear_linear.cpp index b6d0c8266..5cda27c34 100644 --- a/test/algorithms/overlay/get_turns_linear_linear.cpp +++ b/test/algorithms/overlay/get_turns_linear_linear.cpp @@ -5,9 +5,8 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. -// This file was modified by Oracle on 2014, 2015. -// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates. - +// This file was modified by Oracle on 2014-2021. +// Modifications copyright (c) 2014-2021 Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library @@ -215,7 +214,7 @@ void test_all() expected("muu++")); // 29.01.2015 - if ( BOOST_GEOMETRY_CONDITION((boost::is_same::value)) ) + if ( BOOST_GEOMETRY_CONDITION((std::is_same::value)) ) { // FAILING - possibly wrong IPs test_geometry("LINESTRING(3 -0.6,0 -0.9)", @@ -308,7 +307,7 @@ void test_all() // determinants. // See also: https://svn.boost.org/trac/boost/ticket/8379 // https://github.com/boostorg/geometry/pull/259 - if ( BOOST_GEOMETRY_CONDITION((boost::is_same::value)) ) + if ( BOOST_GEOMETRY_CONDITION((std::is_same::value)) ) { test_geometry("LINESTRING(0 0, 10 0, 20 1)", "LINESTRING(12 10, 13 0.3, 14 0.4, 15 0.5)", @@ -370,7 +369,7 @@ void test_all() //test_geometry("LINESTRING(0 0,2 2,3 3,4 4)", "LINESTRING(0 0,1 1,4 4)", "1FFF0FFF2"); - //if ( boost::is_same::value ) + //if ( std::is_same::value ) //{ // to_svg("LINESTRING(0 0,1 0,2 0,2.5 0,3 1)", "LINESTRING(0 0,2 0,2.5 0,3 1)", "test11.svg"); // to_svg("LINESTRING(0 0,1 0,2 0,2.5 0,3 1)", "LINESTRING(3 1,2.5 0,2 0,0 0)", "test12.svg"); @@ -520,7 +519,7 @@ void test_all() expected("tiu+=")("mui=+")); // parts of boundaries taken from union A/A buffer_mp1 - if ( BOOST_GEOMETRY_CONDITION((boost::is_same::value)) ) + if ( BOOST_GEOMETRY_CONDITION((std::is_same::value)) ) { test_geometry("LINESTRING(6.95629520146761 5.415823381635526,6.989043790736545 5.209056926535316,7 5,6.989043790736547 4.790943073464693,6.956295201467611 4.584176618364482)", "LINESTRING(7.415823381635519 5.043704798532389,7.209056926535308 5.010956209263453,7.000000000000001 5,6.790943073464693 5.010956209263453,6.584176618364483 5.043704798532389)", diff --git a/test/algorithms/overlay/get_turns_linear_linear_sph.cpp b/test/algorithms/overlay/get_turns_linear_linear_sph.cpp index a6fdd1330..1de65088f 100644 --- a/test/algorithms/overlay/get_turns_linear_linear_sph.cpp +++ b/test/algorithms/overlay/get_turns_linear_linear_sph.cpp @@ -1,7 +1,7 @@ // Boost.Geometry // Unit Test -// Copyright (c) 2016, Oracle and/or its affiliates. +// Copyright (c) 2016-2021, 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, @@ -73,7 +73,7 @@ void test_all() "LINESTRING(30 0,3 0,2.5 1,2 0,1 0,0 0,-1 -1)", expected("tuu==")("ecc==")("mii++")("muu==")("mii++")("muu==")("mii++")); - if (BOOST_GEOMETRY_CONDITION((boost::is_same::value))) + if (BOOST_GEOMETRY_CONDITION((std::is_same::value))) { test_geometry("LINESTRING(-1 0,1 0,2 1.0004570537241201524198894179384922,3 2)", "LINESTRING(4 5,3 2,1 0,0 0)", @@ -223,7 +223,7 @@ void test_all() "LINESTRING(2 0,0 0,-10 0)", expected("tiu+=")("mui=+")); - if ( BOOST_GEOMETRY_CONDITION((boost::is_same::value)) ) + if ( BOOST_GEOMETRY_CONDITION((std::is_same::value)) ) { test_geometry("LINESTRING(0 -1, 10 -1, 20 1)", "LINESTRING(12 10, 12.5 -0.50051443471392, 15 0, 17.5 0.50051443471392)", @@ -276,7 +276,7 @@ void test_all() //test_geometry("LINESTRING(0 0,2 2,3 3,4 4)", "LINESTRING(0 0,1 1,4 4)", "1FFF0FFF2"); - //if ( boost::is_same::value ) + //if ( std::is_same::value ) //{ // to_svg("LINESTRING(0 0,1 0,2 0,2.5 0,3 1)", "LINESTRING(0 0,2 0,2.5 0,3 1)", "test11.svg"); // to_svg("LINESTRING(0 0,1 0,2 0,2.5 0,3 1)", "LINESTRING(3 1,2.5 0,2 0,0 0)", "test12.svg"); diff --git a/test/algorithms/overlay/overlay.cpp b/test/algorithms/overlay/overlay.cpp index 5d3c04b21..ee1463216 100644 --- a/test/algorithms/overlay/overlay.cpp +++ b/test/algorithms/overlay/overlay.cpp @@ -3,8 +3,8 @@ // Copyright (c) 2015 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2017-2020. -// Modifications copyright (c) 2017-2020, Oracle and/or its affiliates. +// This file was modified by Oracle on 2017-2021. +// Modifications copyright (c) 2017-2021, 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, @@ -18,8 +18,6 @@ #include #include -#include - #if defined(TEST_WITH_SVG) # include #endif @@ -27,8 +25,9 @@ #include #include -#include +#include #include +#include #include //#include @@ -37,6 +36,8 @@ # include #endif +#include + #include "multi_overlay_cases.hpp" @@ -72,7 +73,7 @@ struct map_visitor { typedef typename boost::range_value::type turn_type; int index = 0; - BOOST_FOREACH(turn_type const& turn, turns) + for (turn_type const& turn : turns) { switch (phase) { @@ -129,7 +130,7 @@ struct map_visitor { typedef typename boost::range_value::type turn_type; int index = 0; - BOOST_FOREACH(turn_type const& turn, turns) + for (turn_type const& turn : turns) { if (turn.cluster_id >= 0) { diff --git a/test/algorithms/overlay/relative_order.cpp b/test/algorithms/overlay/relative_order.cpp index 8d2a5b47a..89fa77067 100644 --- a/test/algorithms/overlay/relative_order.cpp +++ b/test/algorithms/overlay/relative_order.cpp @@ -3,8 +3,8 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2017. -// Modifications copyright (c) 2017, Oracle and/or its affiliates. +// This file was modified by Oracle on 2017-2021. +// Modifications copyright (c) 2017-2021, 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, @@ -16,13 +16,9 @@ #include - -#include - -#include - #include #include +#include #include #include @@ -31,8 +27,8 @@ # include #endif -#include #include +#include template diff --git a/test/algorithms/overlay/select_rings.cpp b/test/algorithms/overlay/select_rings.cpp index 89f43732f..2870691f5 100644 --- a/test/algorithms/overlay/select_rings.cpp +++ b/test/algorithms/overlay/select_rings.cpp @@ -2,8 +2,8 @@ // // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // -// This file was modified by Oracle on 2017-2020. -// Modifications copyright (c) 2017-2020 Oracle and/or its affiliates. +// This file was modified by Oracle on 2017-2021. +// Modifications copyright (c) 2017-2021 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, @@ -12,14 +12,10 @@ #include -#include -#include -#include -#include +#include #include -#include #include #include @@ -28,18 +24,15 @@ #include -#include - - template < typename Geometry1, typename Geometry2, bg::overlay_type OverlayType, - typename RingIdVector + typename RingId > void test_geometry(std::string const& wkt1, std::string const& wkt2, - RingIdVector const& expected_ids) + std::initializer_list const& expected_ids) { typedef bg::detail::overlay::ring_properties < @@ -68,8 +61,8 @@ void test_geometry(std::string const& wkt1, std::string const& wkt2, if (selected.size() <= expected_ids.size()) { - BOOST_AUTO(eit, expected_ids.begin()); - for(typename map_type::const_iterator it = selected.begin(); it != selected.end(); ++it, ++eit) + auto eit = expected_ids.begin(); + for (auto it = selected.begin(); it != selected.end(); ++it, ++eit) { bg::ring_identifier const ring_id = it->first; BOOST_CHECK_EQUAL(ring_id.source_index, eit->source_index); @@ -90,21 +83,19 @@ void test_all() test_geometry, bg::model::polygon

, bg::overlay_union>( winded[0], winded[1], - boost::assign::list_of - (rid(0,-1,-1)) - (rid(0,-1, 0)) - (rid(0,-1, 1)) - (rid(0,-1, 3)) - (rid(1,-1, 1)) - (rid(1,-1, 2))); + { rid(0,-1,-1), + rid(0,-1, 0), + rid(0,-1, 1), + rid(0,-1, 3), + rid(1,-1, 1), + rid(1,-1, 2) }); test_geometry, bg::model::polygon

, bg::overlay_intersection>( winded[0], winded[1], - boost::assign::list_of - (rid(0,-1, 2)) - (rid(1,-1,-1)) - (rid(1,-1, 0)) - (rid(1,-1, 3))); + { rid(0,-1, 2), + rid(1,-1,-1), + rid(1,-1, 0), + rid(1,-1, 3), }); } diff --git a/test/algorithms/overlay/self_intersection_points.cpp b/test/algorithms/overlay/self_intersection_points.cpp index 16b8ed24f..54d853ae2 100644 --- a/test/algorithms/overlay/self_intersection_points.cpp +++ b/test/algorithms/overlay/self_intersection_points.cpp @@ -5,8 +5,8 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. -// This file was modified by Oracle on 2017-2020. -// Modifications copyright (c) 2017-2020, Oracle and/or its affiliates. +// This file was modified by Oracle on 2017-2021. +// Modifications copyright (c) 2017-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library @@ -77,7 +77,7 @@ static void test_self_intersection_points(std::string const& case_id, typedef typename bg::coordinate_type::type ct; ct zero = ct(); ct x = zero, y = zero; - BOOST_FOREACH(turn_info const& turn, turns) + for (turn_info const& turn : turns) { x += bg::get<0>(turn.point); y += bg::get<1>(turn.point); @@ -141,7 +141,7 @@ static void test_self_intersection_points(std::string const& case_id, mapper.map(geometry, "fill:rgb(255,255,128);stroke:rgb(0,0,0);stroke-width:1"); - BOOST_FOREACH(turn_info const& turn, turns) + for (turn_info const& turn : turns) { mapper.map(turn.point, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1"); } diff --git a/test/algorithms/overlay/sort_by_side.cpp b/test/algorithms/overlay/sort_by_side.cpp index 2966d2a44..c8ecc6b97 100644 --- a/test/algorithms/overlay/sort_by_side.cpp +++ b/test/algorithms/overlay/sort_by_side.cpp @@ -4,8 +4,8 @@ // Copyright (c) 2016 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2017-2020. -// Modifications copyright (c) 2017-2020, Oracle and/or its affiliates. +// This file was modified by Oracle on 2017-2021. +// Modifications copyright (c) 2017-2021, 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, @@ -14,11 +14,11 @@ #include -#include +#include #include +#include #include -#include -#include +#include #include "multi_overlay_cases.hpp" @@ -31,7 +31,7 @@ std::string as_string(std::vector const& v) { std::stringstream out; bool first = true; - BOOST_FOREACH(T const& value, v) + for (T const& value : v) { out << (first ? "[" : " , ") << value; first = false; @@ -217,13 +217,11 @@ void test_sort_by_side(std::string const& case_id, // Define two small macro's to avoid repetitions of testcases/names etc -#define TEST_INT(caseid, exp) { (test_sort_by_side) \ - ( #caseid "_int", caseid[0], caseid[1], exp); } +#define TEST_INT(caseid, exp, ...) { (test_sort_by_side) \ + ( #caseid "_int", caseid[0], caseid[1], exp, __VA_ARGS__); } -#define TEST_UNION(caseid, exp) { (test_sort_by_side) \ - ( #caseid "_union", caseid[0], caseid[1], exp); } - -using boost::assign::list_of; +#define TEST_UNION(caseid, exp, ...) { (test_sort_by_side) \ + ( #caseid "_union", caseid[0], caseid[1], exp, __VA_ARGS__); } template void test_all() @@ -234,31 +232,31 @@ void test_all() // Selection of test cases having only one cluster - TEST_INT(case_64_multi, list_of(1)); - TEST_INT(case_72_multi, list_of(3)); - TEST_INT(case_107_multi, list_of(2)); - TEST_INT(case_123_multi, list_of(3)); - TEST_INT(case_124_multi, list_of(3)); - TEST_INT(case_recursive_boxes_10, list_of(2)); - TEST_INT(case_recursive_boxes_20, list_of(2)); - TEST_INT(case_recursive_boxes_21, list_of(1)); - TEST_INT(case_recursive_boxes_22, list_of(0)); + TEST_INT(case_64_multi, {1}); + TEST_INT(case_72_multi, {3}); + TEST_INT(case_107_multi, {2}); + TEST_INT(case_123_multi, {3}); + TEST_INT(case_124_multi, {3}); + TEST_INT(case_recursive_boxes_10, {2}); + TEST_INT(case_recursive_boxes_20, {2}); + TEST_INT(case_recursive_boxes_21, {2}); + TEST_INT(case_recursive_boxes_22, {0}); - TEST_UNION(case_recursive_boxes_46, list_of(2)(1)(2)(1)(1)(2)(1)); + TEST_UNION(case_recursive_boxes_46, {2, 1, 2, 1, 1, 2, 1}); - TEST_UNION(case_62_multi, list_of(2)); - TEST_UNION(case_63_multi, list_of(2)); - TEST_UNION(case_64_multi, list_of(1)); - TEST_UNION(case_107_multi, list_of(1)); - TEST_UNION(case_123_multi, list_of(1)); - TEST_UNION(case_124_multi, list_of(1)); - TEST_UNION(case_recursive_boxes_10, list_of(1)); - TEST_UNION(case_recursive_boxes_18, list_of(3)); - TEST_UNION(case_recursive_boxes_19, list_of(3)); - TEST_UNION(case_recursive_boxes_20, list_of(2)); - TEST_UNION(case_recursive_boxes_21, list_of(1)); - TEST_UNION(case_recursive_boxes_22, list_of(1)); - TEST_UNION(case_recursive_boxes_23, list_of(3)); + TEST_UNION(case_62_multi, {2}); + TEST_UNION(case_63_multi, {2}); + TEST_UNION(case_64_multi, {1}); + TEST_UNION(case_107_multi, {1}); + TEST_UNION(case_123_multi, {1}); + TEST_UNION(case_124_multi, {1}); + TEST_UNION(case_recursive_boxes_10, {1}); + TEST_UNION(case_recursive_boxes_18, {3}); + TEST_UNION(case_recursive_boxes_19, {3}); + TEST_UNION(case_recursive_boxes_20, {2}); + TEST_UNION(case_recursive_boxes_21, {1}); + TEST_UNION(case_recursive_boxes_22, {1}); + TEST_UNION(case_recursive_boxes_23, {3}); } int test_main(int, char* []) diff --git a/test/algorithms/overlay/sort_by_side_basic.cpp b/test/algorithms/overlay/sort_by_side_basic.cpp index a77f2e4dd..4ce87c724 100644 --- a/test/algorithms/overlay/sort_by_side_basic.cpp +++ b/test/algorithms/overlay/sort_by_side_basic.cpp @@ -4,8 +4,8 @@ // Copyright (c) 2017 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2017-2020. -// Modifications copyright (c) 2017-2020, Oracle and/or its affiliates. +// This file was modified by Oracle on 2017-2021. +// Modifications copyright (c) 2017-2021, 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, @@ -14,18 +14,13 @@ #include -#include - -#include // for equals/within +#include #include #include -#include +#include #include -#include #include - -#include -#include +#include #if defined(TEST_WITH_SVG) #include "debug_sort_by_side_svg.hpp" @@ -40,7 +35,7 @@ std::string as_string(std::vector const& v) { std::stringstream out; bool first = true; - BOOST_FOREACH(T const& value, v) + for (T const& value : v) { out << (first ? "[" : " , ") << value; first = false; @@ -268,8 +263,6 @@ void test_basic(std::string const& case_id, expected_open_count, expected_max_rank, expected_right_count); } -using boost::assign::list_of; - template void test_all() { @@ -277,67 +270,67 @@ void test_all() "MULTIPOLYGON(((0 2,1 2,1 1,0 1,0 2)))", "MULTIPOLYGON(((1 0,1 1,2 1,2 0,1, 0)))", "POINT(1 1)", "POINT(1 0)", - 2, 3, list_of(-1)(1)(-1)(1)); + 2, 3, {-1, 1, -1, 1}); test_basic("dup1", "MULTIPOLYGON(((0 2,1 2,1 1,0 1,0 2)))", "MULTIPOLYGON(((1 0,1 1,2 1,2 0,1, 0)),((0 2,1 2,1 1,0 1,0 2)))", "POINT(1 1)", "POINT(1 0)", - 2, 3, list_of(-1)(1)(-1)(2)); + 2, 3, {-1, 1, -1, 2}); test_basic("dup2", "MULTIPOLYGON(((0 2,1 2,1 1,0 1,0 2)),((1 0,1 1,2 1,2 0,1, 0)))", "MULTIPOLYGON(((1 0,1 1,2 1,2 0,1, 0)))", "POINT(1 1)", "POINT(1 0)", - 2, 3, list_of(-1)(2)(-1)(1)); + 2, 3, {-1, 2, -1, 1}); test_basic("dup3", "MULTIPOLYGON(((0 2,1 2,1 1,0 1,0 2)),((1 0,1 1,2 1,2 0,1, 0)))", "MULTIPOLYGON(((1 0,1 1,2 1,2 0,1, 0)),((0 2,1 2,1 1,0 1,0 2)))", "POINT(1 1)", "POINT(1 0)", - 2, 3, list_of(-1)(2)(-1)(2)); + 2, 3, {-1, 2, -1, 2}); test_basic("threequart1", "MULTIPOLYGON(((0 2,1 2,1 1,0 1,0 2)),((1 0,1 1,2 1,2 0,1, 0)))", "MULTIPOLYGON(((1 2,2 2,2 1,1 1,1 2)))", "POINT(1 1)", "POINT(1 0)", - 1, 3, list_of(-1)(1)(1)(1)); + 1, 3, {-1, 1, 1, 1}); test_basic("threequart2", "MULTIPOLYGON(((0 2,1 2,1 1,0 1,0 2)),((1 0,1 1,2 1,2 0,1, 0)))", "MULTIPOLYGON(((1 2,2 2,2 1,1 1,1 2)),((2 0,1 0,1 1,2 0)))", "POINT(1 1)", "POINT(1 0)", - 1, 4, list_of(-1)(2)(1)(1)(1)); + 1, 4, {-1, 2, 1, 1, 1}); test_basic("threequart3", "MULTIPOLYGON(((0 2,1 2,1 1,0 1,0 2)),((1 0,1 1,2 1,2 0,1, 0)))", "MULTIPOLYGON(((1 2,2 2,2 1,1 1,1 2)),((2 0,1 0,1 1,2 0)),((0 1,0 2,1 1,0 1)))", "POINT(1 1)", "POINT(1 0)", - 1, 5, list_of(-1)(2)(1)(1)(-1)(2)); + 1, 5, {-1, 2, 1, 1, -1, 2}); test_basic("full1", "MULTIPOLYGON(((0 2,1 2,1 1,0 1,0 2)),((1 0,1 1,2 1,2 0,1, 0)))", "MULTIPOLYGON(((1 2,2 2,2 1,1 1,1 2)),((0 0,0 1,1 1,1 0,0 0)))", "POINT(1 1)", "POINT(1 0)", - 0, 3, list_of(1)(1)(1)(1)); + 0, 3, {1, 1, 1, 1}); test_basic("hole1", "MULTIPOLYGON(((0 0,0 3,2 3,2 2,3 2,3 0,0 0),(1 1,2 1,2 2,1 2,1 1)),((4 2,3 2,3 3,4 3,4 2)))", "MULTIPOLYGON(((1 0,1 1,2 1,2 2,1 2,1 4,4 4,4 0,1, 0),(3 2,3 3,2 3,2 2,3 2)))", "POINT(1 2)", "POINT(2 2)", - 1, 2, list_of(-1)(2)(1)); + 1, 2, {-1, 2, 1}); test_basic("hole2", "MULTIPOLYGON(((0 0,0 3,2 3,2 2,3 2,3 0,0 0),(1 1,2 1,2 2,1 2,1 1)),((4 2,3 2,3 3,4 3,4 2)))", "MULTIPOLYGON(((1 0,1 1,2 1,2 2,1 2,1 4,4 4,4 0,1, 0),(3 2,3 3,2 3,2 2,3 2)))", "POINT(2 2)", "POINT(2 1)", - 2, 3, list_of(-1)(2)(-1)(2)); + 2, 3, {-1, 2, -1, 2}); test_basic("hole3", "MULTIPOLYGON(((0 0,0 3,2 3,2 2,3 2,3 0,0 0),(1 1,2 1,2 2,1 2,1 1)),((4 2,3 2,3 3,4 3,4 2)))", "MULTIPOLYGON(((1 0,1 1,2 1,2 2,1 2,1 4,4 4,4 0,1, 0),(3 2,3 3,2 3,2 2,3 2)))", "POINT(3 2)", "POINT(2 2)", - 1, 3, list_of(-1)(2)(-1)(2)); + 1, 3, {-1, 2, -1, 2}); } diff --git a/test/algorithms/overlay/split_rings.cpp b/test/algorithms/overlay/split_rings.cpp index 00cf9f85b..90704de0e 100644 --- a/test/algorithms/overlay/split_rings.cpp +++ b/test/algorithms/overlay/split_rings.cpp @@ -5,6 +5,10 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021, Oracle and/or its affiliates. +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -62,7 +66,7 @@ struct test_split_rings mapper.map(geometry, "fill:rgb(255,255,128);stroke:rgb(0,0,0);stroke-width:1"); - BOOST_FOREACH(ring_type const& ring, rings) + for (ring_type const& ring : rings) { std::string style = "opacity:0.6;fill:rgb"; std::string color = bg::area(ring) > 0 ? "(255,0,0)" : "(0,0,255)"; diff --git a/test/algorithms/overlay/traverse.cpp b/test/algorithms/overlay/traverse.cpp index 2e4f801cc..50bd474fc 100644 --- a/test/algorithms/overlay/traverse.cpp +++ b/test/algorithms/overlay/traverse.cpp @@ -3,6 +3,10 @@ // Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands. +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021, 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) @@ -17,8 +21,6 @@ #include #include -#include - #include @@ -34,32 +36,28 @@ # define BOOST_GEOMETRY_DEBUG_IDENTIFIER #endif -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -#include - #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include - #if defined(TEST_WITH_SVG) # include #endif +#include + #include #include @@ -143,10 +141,10 @@ struct test_traverse //std::cout << bg::area(g1) << " " << bg::area(g2) << std::endl; #endif - typedef typename bg::strategy::side::services::default_strategy - < - typename bg::cs_tag::type - >::type side_strategy_type; + typename bg::strategy::intersection::services::default_strategy + < + typename bg::cs_tag::type + >::type strategy; typedef typename bg::point_type::type point_type; typedef typename bg::rescale_policy_type::type @@ -162,15 +160,11 @@ struct test_traverse > turn_info; std::vector turns; - bg::detail::overlay::operation_type const op = - OverlayType == bg::overlay_union - ? bg::detail::overlay::operation_union - : bg::detail::overlay::operation_intersection; + std::map clusters; bg::detail::get_turns::no_interrupt_policy policy; - bg::get_turns(g1, g2, rescale_policy, turns, policy); - bg::enrich_intersection_points(turns, op, - g1, g2, rescale_policy, side_strategy_type()); + bg::get_turns(g1, g2, strategy, rescale_policy, turns, policy); + bg::enrich_intersection_points(turns, clusters, g1, g2, rescale_policy, strategy); typedef bg::model::ring::type> ring_type; typedef std::vector out_vector; @@ -178,11 +172,13 @@ struct test_traverse bg::detail::overlay::overlay_null_visitor visitor; + // TODO: this function requires additional arguments bg::detail::overlay::traverse < Reverse1, Reverse2, - G1, G2 - >::apply(g1, g2, op, rescale_policy, turns, v, visitor); + G1, G2, + OverlayType + >::apply(g1, g2, strategy, rescale_policy, turns, v, visitor); // Check number of resulting rings BOOST_CHECK_MESSAGE(expected_count == boost::size(v), @@ -196,7 +192,7 @@ struct test_traverse // Check total area of resulting rings typename bg::default_area_result::type total_area = 0; - BOOST_FOREACH(ring_type const& ring, v) + for (ring_type const& ring : v) { total_area += bg::area(ring); //std::cout << bg::wkt(ring) << std::endl; @@ -225,7 +221,7 @@ struct test_traverse "stroke:rgb(51,51,153);stroke-width:3"); // Traversal rings in magenta outline/red fill -> over blue/green this gives brown - BOOST_FOREACH(ring_type const& ring, v) + for (ring_type const& ring : v) { mapper.map(ring, "fill-opacity:0.2;stroke-opacity:0.4;fill:rgb(255,0,0);" "stroke:rgb(255,0,255);stroke-width:8"); @@ -239,7 +235,7 @@ struct test_traverse int index = 0; int const margin = 5; - BOOST_FOREACH(turn_info const& turn, turns) + for (turn_info const& turn : turns) { int lineheight = 8; mapper.map(turn.point, "fill:rgb(255,128,0);" @@ -771,8 +767,7 @@ void test_all(bool test_self_tangencies = true, bool test_mixed = false) } */ - static const bool is_float - = boost::is_same::value; + static const bool is_float = std::is_same::value; static const double float_might_deviate_more = is_float ? 0.1 : 0.001; // In some cases up to 1 promille permitted diff --git a/test/algorithms/overlay/traverse_ccw.cpp b/test/algorithms/overlay/traverse_ccw.cpp index f93980860..a3f643606 100644 --- a/test/algorithms/overlay/traverse_ccw.cpp +++ b/test/algorithms/overlay/traverse_ccw.cpp @@ -3,6 +3,10 @@ // Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands. +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021, 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) @@ -13,11 +17,11 @@ #include #include -#include - #include -#include +#include +#include +#include #include #include #include @@ -26,14 +30,12 @@ # include #endif -#include #include #include template -struct rev : boost::mpl::if_c::value == bg::counterclockwise, boost::true_type, boost::false_type>::type -{}; +using rev = bg::util::bool_constant::value == bg::counterclockwise>; template inline typename bg::coordinate_type::type @@ -89,7 +91,7 @@ intersect(Geometry1 const& g1, Geometry2 const& g2, std::string const& name, >::apply(g1, g2, op, rescale_policy, turns, v); typename bg::coordinate_type::type result = 0.0; - BOOST_FOREACH(ring_type& ring, v) + for (ring_type& ring : v) { result += bg::area(ring); } @@ -117,7 +119,7 @@ intersect(Geometry1 const& g1, Geometry2 const& g2, std::string const& name, "stroke:rgb(51,51,153);stroke-width:3"); // Traversal rings in magenta/light yellow fill - BOOST_FOREACH(ring_type const& ring, v) + for (ring_type const& ring : v) { mapper.map(ring, "fill-opacity:0.3;stroke-opacity:0.4;fill:rgb(255,255,0);" "stroke:rgb(255,0,255);stroke-width:8"); @@ -132,7 +134,7 @@ intersect(Geometry1 const& g1, Geometry2 const& g2, std::string const& name, int const lineheight = 10; int const margin = 5; - BOOST_FOREACH(turn_info const& turn, turns) + for (turn_info const& turn : turns) { mapper.map(turn.point, "fill:rgb(255,128,0);" "stroke:rgb(0,0,0);stroke-width:1", 3); diff --git a/test/algorithms/point_on_surface.cpp b/test/algorithms/point_on_surface.cpp index 7ee5eb880..048635ecb 100644 --- a/test/algorithms/point_on_surface.cpp +++ b/test/algorithms/point_on_surface.cpp @@ -6,9 +6,8 @@ // Copyright (c) 2009-2015 Mateusz Loskot, London, UK. // Copyright (c) 2013-2017 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2014, 2015. -// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates. - +// This file was modified by Oracle on 2014-2021. +// Modifications copyright (c) 2014-2021 Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library @@ -101,7 +100,7 @@ void test_geometry(std::string const& case_id, Geometry const& geometry, double // Top (red/magenta) mapper.map(top_points, "stroke:rgb(255,0,0);stroke-width:2"); - BOOST_FOREACH(intruder_type const& intruder, top_intruders) + for (intruder_type const& intruder : top_intruders) { mapper.map(intruder, "stroke:rgb(255,0,255);stroke-width:2"); } @@ -111,7 +110,7 @@ void test_geometry(std::string const& case_id, Geometry const& geometry, double //// Right (blue/cyan) // (mostly commented, makes the picture less clear) //mapper.map(right_points, "stroke:rgb(0,0,255);stroke-width:2"); - //BOOST_FOREACH(intruder_type const& intruder, right_intruders) + //for (intruder_type const& intruder : right_intruders) //{ // mapper.map(intruder, "stroke:rgb(0,255,255);stroke-width:2"); //} diff --git a/test/algorithms/relate/nan_cases.hpp b/test/algorithms/relate/nan_cases.hpp index 24306202d..bbd888831 100644 --- a/test/algorithms/relate/nan_cases.hpp +++ b/test/algorithms/relate/nan_cases.hpp @@ -1,7 +1,6 @@ // Boost.Geometry -// Copyright (c) 2015 Oracle and/or its affiliates. - +// Copyright (c) 2015-2021 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, @@ -14,7 +13,6 @@ #include #include -#include template struct pusher @@ -125,6 +123,6 @@ struct is_nan_case_supported { typedef typename bg::coordinate_type::type coord_t; - static const bool value = boost::is_same::value + static const bool value = std::is_same::value && std::numeric_limits::has_quiet_NaN; }; diff --git a/test/algorithms/relate/relate_areal_areal.cpp b/test/algorithms/relate/relate_areal_areal.cpp index 739a37a35..bee45efa9 100644 --- a/test/algorithms/relate/relate_areal_areal.cpp +++ b/test/algorithms/relate/relate_areal_areal.cpp @@ -2,9 +2,8 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2013, 2014, 2015. -// Modifications copyright (c) 2013-2015 Oracle and/or its affiliates. - +// This file was modified by Oracle on 2013-2021. +// Modifications copyright (c) 2013-2021 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, @@ -19,8 +18,9 @@ template void test_polygon_polygon() { - typedef bg::model::polygon

poly; - typedef bg::model::ring

ring; + using coord_t = typename bg::coordinate_type

::type; + using poly = bg::model::polygon

; + using ring = bg::model::ring

; // touching test_geometry("POLYGON((0 0,0 10,10 10,10 0,0 0))", @@ -306,8 +306,7 @@ void test_polygon_polygon() "212101212"); } - if ( BOOST_GEOMETRY_CONDITION(( - boost::is_same::type, double>::value )) ) + if ( BOOST_GEOMETRY_CONDITION((std::is_same::value)) ) { // original - assertion for CCW //"POLYGON((-0.593220338983050821113352 -8.05084745762711939676137,1.14285714285714279370154 -4,1.50731707317073171381594 1.10243902439024443751237,1.73758865248226967992196 1.37588652482269591104114,1.21739130434782616418943 -3.82608695652173924628414,2 -2,2 1.68750000000000044408921,2.35384615384615436539661 2.10769230769230775379697,2 2.16666666666666651863693,2 4,1.81967213114754100544701 2.1967213114754100544701,1.5882352941176469673934 2.2352941176470588757752,1.8148148148148146585612 5.4074074074074074403029,-0.538461538461538546940233 4.23076923076923083755219,-1.76510067114094004736558 2.89261744966443012927471,-1.64864864864864868465588 2.7567567567567570208098,-1.83962264150943455298659 2.81132075471698161805989,-1.84337349397590433142113 2.80722891566265086993326,-2.14285714285714279370154 2.85714285714285720629846,-2.11111111111111116045436 2.88888888888888883954564,-2.87234042553191448732264 3.10638297872340407579372,-2.91803278688524558859285 3.4262295081967208965068,-3.1733333333333324510761 3.26666666666666660745477,-2.99999999999999822364316 3.14285714285714234961233,-3.25490196078431326398572 3.21568627450980359938626,-3.47368421052631504153396 3.07894736842105265495206,-7.32000000000000028421709 3.72000000000000019539925,-7.54716981132075481752963 3.62264150943396234794136,-7.75 3.79166666666666651863693,-7.79999999999999982236432 3.79999999999999982236432,-7.59999999999999964472863 3.60000000000000008881784,-8.8556701030927822415606 3.06185567010309300783888,-8.82945736434108674473009 2.8914728682170549589614,-7.73333333333333339254523 2.193939393939393855959,-8 2,-5.94736842105263185942476 -1.42105263157894645686952,-5.32558139534883689947264 -0.488372093023255016142059,-5.85714285714285765038767 1.00000000000000066613381,-4.78723404255319184841255 0.319148936170212838003835,-5.32558139534883689947264 -0.488372093023255016142059,-4.74019607843137258385013 -2.12745098039215774221589,-3.17647058823529437887601 -0.705882352941176627325603,-2.93103448275862055183438 -0.862068965517241436735674,-3 -1,-4.57894736842105309904127 -2.57894736842105265495206,-4.47887323943661996850096 -2.85915492957746497637572,-7.58620689655172419918472 -5.18965517241379359347775,-7.52525252525252508206677 -5.5858585858585865224768,-4.18644067796610119813749 -3.67796610169491522412955,-3.44041450777202051369841 -5.76683937823834202873741,-3.73611111111111116045436 -6.56944444444444464181743,-2.8823529411764705621124 -7.7647058823529411242248,-2.88235294117647100620161 -7.7647058823529411242248,-0.593220338983050821113352 -8.05084745762711939676137),(1.66666666666666696272614 1.59999999999999875655021,1.43749999999999911182158 1.8750000000000002220446,0.0869565217391310429917439 2.26086956521739113057379,0.466666666666667118157363 2.60606060606060552231611,1.04878048780487764801705 2.34146341463414664474385,1.43749999999999911182158 1.8750000000000002220446,1.56756756756756754356275 1.83783783783783771781373,1.66666666666666696272614 1.59999999999999875655021))" diff --git a/test/algorithms/relate/relate_linear_areal_sph.cpp b/test/algorithms/relate/relate_linear_areal_sph.cpp index e3034301c..630b0a0f7 100644 --- a/test/algorithms/relate/relate_linear_areal_sph.cpp +++ b/test/algorithms/relate/relate_linear_areal_sph.cpp @@ -1,8 +1,7 @@ // Boost.Geometry // Unit Test -// Copyright (c) 2016, Oracle and/or its affiliates. - +// Copyright (c) 2016-2021, 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, @@ -287,8 +286,7 @@ void test_multi_linestring_polygon() "POLYGON((5 0,0 -5,-5 0,0 5,5 0))", "1F10F0212"); - if ( BOOST_GEOMETRY_CONDITION(( - boost::is_same::value )) ) + if ( BOOST_GEOMETRY_CONDITION((std::is_same::value)) ) { // assertion failure in 1.57 test_geometry("MULTILINESTRING((-0.59322033898305082 -8.0508474576271194,-2.882352941176471 -7.7647058823529411,-2.8823529411764706 -7.7647058823529411,-3.7361111111111112 -6.5694444444444446,-3.4404145077720205 -5.766839378238342,-4.1864406779661012 -3.6779661016949152,-7.5252525252525251 -5.5858585858585865,-7.5862068965517242 -5.1896551724137936,-4.47887323943662 -2.859154929577465,-4.5789473684210531 -2.5789473684210527,-3 -1,-2.9310344827586206 -0.86206896551724144,-3.1764705882352944 -0.70588235294117663,-4.7401960784313726 -2.1274509803921577,-5.3255813953488369 -0.48837209302325502,-4.7872340425531918 0.31914893617021284,-5.8571428571428577 1.0000000000000007,-5.3255813953488369 -0.48837209302325502,-5.9473684210526319 -1.4210526315789465,-8 2,-7.7333333333333334 2.1939393939393939,-8.8294573643410867 2.891472868217055,-8.8556701030927822 3.061855670103093,-7.5999999999999996 3.6000000000000001,-7.7999999999999998 3.7999999999999998,-7.75 3.7916666666666665,-7.5471698113207548 3.6226415094339623,-7.3200000000000003 3.7200000000000002,-3.473684210526315 3.0789473684210527,-3.2549019607843133 3.2156862745098036,-2.9999999999999982 3.1428571428571423,-3.1733333333333325 3.2666666666666666,-2.9180327868852456 3.4262295081967209,-2.8723404255319145 3.1063829787234041,-2.1111111111111112 2.8888888888888888,-2.1428571428571428 2.8571428571428572,-1.8433734939759043 2.8072289156626509,-1.8396226415094346 2.8113207547169816,-1.6486486486486487 2.756756756756757,-1.76510067114094 2.8926174496644301,-0.53846153846153855 4.2307692307692308,1.8148148148148147 5.4074074074074074,1.588235294117647 2.2352941176470589,1.819672131147541 2.1967213114754101,2 4,2 2.1666666666666665,2.3538461538461544 2.1076923076923078,2 1.6875000000000004,2 -2,1.2173913043478262 -3.8260869565217392,1.7375886524822697 1.3758865248226959,1.5073170731707317 1.1024390243902444,1.1428571428571428 -4,-0.59322033898305082 -8.0508474576271194),(1.666666666666667 1.5999999999999988,1.5675675675675675 1.8378378378378377,1.4374999999999991 1.8750000000000002,1.0487804878048776 2.3414634146341466,0.46666666666666712 2.6060606060606055,0.086956521739131043 2.2608695652173911,1.4374999999999991 1.8750000000000002,1.666666666666667 1.5999999999999988))", diff --git a/test/algorithms/relate/relate_linear_linear.cpp b/test/algorithms/relate/relate_linear_linear.cpp index d109e8b92..0dbf139c1 100644 --- a/test/algorithms/relate/relate_linear_linear.cpp +++ b/test/algorithms/relate/relate_linear_linear.cpp @@ -2,9 +2,8 @@ // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2013, 2014, 2015. -// Modifications copyright (c) 2013-2015 Oracle and/or its affiliates. - +// This file was modified by Oracle on 2013-2021. +// Modifications copyright (c) 2013-2021 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, @@ -19,7 +18,8 @@ template void test_linestring_linestring() { - typedef bg::model::linestring

ls; + using coord_t = typename bg::coordinate_type

::type; + using ls = bg::model::linestring

; test_geometry("LINESTRING(0 0, 2 2, 3 2)", "LINESTRING(0 0, 2 2, 3 2)", "1FFF0FFF2"); test_geometry("LINESTRING(0 0,3 2)", "LINESTRING(0 0, 2 2, 3 2)", "FF1F0F1F2"); @@ -185,8 +185,7 @@ void test_linestring_linestring() // Point/Point //test_geometry("LINESTRING(0 0)", "LINESTRING(0 0)", "0FFFFFFF2"); - if ( BOOST_GEOMETRY_CONDITION( - boost::is_floating_point::type>::value ) ) + if ( BOOST_GEOMETRY_CONDITION(std::is_floating_point::value) ) { // https://svn.boost.org/trac/boost/ticket/10904 // very small segments @@ -198,8 +197,7 @@ void test_linestring_linestring() "FF1F00102", "F0FFFF102"); // on some platforms the first Linestring may be detected as degenerated to Point } - if ( BOOST_GEOMETRY_CONDITION(( - boost::is_same::type, double>::value )) ) + if ( BOOST_GEOMETRY_CONDITION((std::is_same::value)) ) { // detected as collinear test_geometry("LINESTRING(1 -10, 3.069359e+307 3.069359e+307)", @@ -247,8 +245,9 @@ void test_linestring_linestring() template void test_linestring_multi_linestring() { - typedef bg::model::linestring

ls; - typedef bg::model::multi_linestring mls; + using coord_t = typename bg::coordinate_type

::type; + using ls = bg::model::linestring

; + using mls = bg::model::multi_linestring; // LS disjoint test_geometry("LINESTRING(0 0,10 0)", "MULTILINESTRING((1 0,2 0),(1 1,2 1))", "101FF0102"); @@ -347,7 +346,7 @@ void test_linestring_multi_linestring() "10FF0F102"); // | // | - if ( BOOST_GEOMETRY_CONDITION(boost::is_floating_point::type>::value) ) + if ( BOOST_GEOMETRY_CONDITION(std::is_floating_point::value) ) { // related to https://svn.boost.org/trac/boost/ticket/10904 test_geometry("LINESTRING(-2305843009213693956 4611686018427387906, -33 -92, 78 83)", @@ -386,8 +385,9 @@ void test_linestring_multi_linestring() template void test_multi_linestring_multi_linestring() { - typedef bg::model::linestring

ls; - typedef bg::model::multi_linestring mls; + using coord_t = typename bg::coordinate_type

::type; + using ls = bg::model::linestring

; + using mls = bg::model::multi_linestring; test_geometry("MULTILINESTRING((0 0,0 0,18 0,18 0,19 0,19 0,19 0,30 0,30 0))", "MULTILINESTRING((0 10,5 0,20 0,20 0,30 0))", @@ -415,8 +415,7 @@ void test_multi_linestring_multi_linestring() "MULTILINESTRING((5 5,0 5),(5 5,5 0),(10 10,10 5,5 5,5 10,10 10))", "10FFFFFF2"); - if ( BOOST_GEOMETRY_CONDITION(( - boost::is_same::type, double>::value )) ) + if ( BOOST_GEOMETRY_CONDITION((std::is_same::value)) ) { // assertion failure in 1.57 test_geometry("MULTILINESTRING((-0.59322033898305082 -8.0508474576271194,-2.882352941176471 -7.7647058823529411,-2.8823529411764706 -7.7647058823529411,-3.7361111111111112 -6.5694444444444446,-3.4404145077720205 -5.766839378238342,-4.1864406779661012 -3.6779661016949152,-7.5252525252525251 -5.5858585858585865,-7.5862068965517242 -5.1896551724137936,-4.47887323943662 -2.859154929577465,-4.5789473684210531 -2.5789473684210527,-3 -1,-2.9310344827586206 -0.86206896551724144,-3.1764705882352944 -0.70588235294117663,-4.7401960784313726 -2.1274509803921577,-5.3255813953488369 -0.48837209302325502,-4.7872340425531918 0.31914893617021284,-5.8571428571428577 1.0000000000000007,-5.3255813953488369 -0.48837209302325502,-5.9473684210526319 -1.4210526315789465,-8 2,-7.7333333333333334 2.1939393939393939,-8.8294573643410867 2.891472868217055,-8.8556701030927822 3.061855670103093,-7.5999999999999996 3.6000000000000001,-7.7999999999999998 3.7999999999999998,-7.75 3.7916666666666665,-7.5471698113207548 3.6226415094339623,-7.3200000000000003 3.7200000000000002,-3.473684210526315 3.0789473684210527,-3.2549019607843133 3.2156862745098036,-2.9999999999999982 3.1428571428571423,-3.1733333333333325 3.2666666666666666,-2.9180327868852456 3.4262295081967209,-2.8723404255319145 3.1063829787234041,-2.1111111111111112 2.8888888888888888,-2.1428571428571428 2.8571428571428572,-1.8433734939759043 2.8072289156626509,-1.8396226415094346 2.8113207547169816,-1.6486486486486487 2.756756756756757,-1.76510067114094 2.8926174496644301,-0.53846153846153855 4.2307692307692308,1.8148148148148147 5.4074074074074074,1.588235294117647 2.2352941176470589,1.819672131147541 2.1967213114754101,2 4,2 2.1666666666666665,2.3538461538461544 2.1076923076923078,2 1.6875000000000004,2 -2,1.2173913043478262 -3.8260869565217392,1.7375886524822697 1.3758865248226959,1.5073170731707317 1.1024390243902444,1.1428571428571428 -4,-0.59322033898305082 -8.0508474576271194),(1.666666666666667 1.5999999999999988,1.5675675675675675 1.8378378378378377,1.4374999999999991 1.8750000000000002,1.0487804878048776 2.3414634146341466,0.46666666666666712 2.6060606060606055,0.086956521739131043 2.2608695652173911,1.4374999999999991 1.8750000000000002,1.666666666666667 1.5999999999999988))", diff --git a/test/algorithms/relate/relate_linear_linear_sph.cpp b/test/algorithms/relate/relate_linear_linear_sph.cpp index ec472c68e..b0c9ac226 100644 --- a/test/algorithms/relate/relate_linear_linear_sph.cpp +++ b/test/algorithms/relate/relate_linear_linear_sph.cpp @@ -1,8 +1,7 @@ // Boost.Geometry // Unit Test -// Copyright (c) 2016, Oracle and/or its affiliates. - +// Copyright (c) 2016-2021, 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, @@ -16,7 +15,8 @@ template void test_linestring_linestring() { - typedef bg::model::linestring

ls; + using coord_t = typename bg::coordinate_type

::type; + using ls = bg::model::linestring

; test_geometry("LINESTRING(0 0, 2 2, 3 2)", "LINESTRING(0 0, 2 2, 3 2)", "1FFF0FFF2"); test_geometry("LINESTRING(0 0,3 2)", "LINESTRING(0 0, 2 2, 3 2)", "FF1F0F1F2"); @@ -182,8 +182,7 @@ void test_linestring_linestring() // Point/Point //test_geometry("LINESTRING(0 0)", "LINESTRING(0 0)", "0FFFFFFF2"); - if ( BOOST_GEOMETRY_CONDITION( - boost::is_floating_point::type>::value ) ) + if ( BOOST_GEOMETRY_CONDITION(std::is_floating_point::value) ) { // https://svn.boost.org/trac/boost/ticket/10904 // very small segments @@ -195,8 +194,7 @@ void test_linestring_linestring() "*********"); // TODO: be more specific with the result } - if ( BOOST_GEOMETRY_CONDITION(( - boost::is_same::type, double>::value )) ) + if ( BOOST_GEOMETRY_CONDITION((std::is_same::value)) ) { // detected as collinear test_geometry("LINESTRING(1 -10, 3.069359e+307 3.069359e+307)", @@ -244,8 +242,9 @@ void test_linestring_linestring() template void test_linestring_multi_linestring() { - typedef bg::model::linestring

ls; - typedef bg::model::multi_linestring mls; + using coord_t = typename bg::coordinate_type

::type; + using ls = bg::model::linestring

; + using mls = bg::model::multi_linestring; // LS disjoint test_geometry("LINESTRING(0 0,10 0)", "MULTILINESTRING((1 0,2 0),(1 1,2 1))", "101FF0102"); @@ -344,7 +343,7 @@ void test_linestring_multi_linestring() "10FF0F102"); // | // | - if ( BOOST_GEOMETRY_CONDITION(boost::is_floating_point::type>::value) ) + if ( BOOST_GEOMETRY_CONDITION(std::is_floating_point::value) ) { // related to https://svn.boost.org/trac/boost/ticket/10904 test_geometry("LINESTRING(-2305843009213693956 4611686018427387906, -33 -92, 78 83)", @@ -389,8 +388,9 @@ void test_linestring_multi_linestring() template void test_multi_linestring_multi_linestring() { - typedef bg::model::linestring

ls; - typedef bg::model::multi_linestring mls; + using coord_t = typename bg::coordinate_type

::type; + using ls = bg::model::linestring

; + using mls = bg::model::multi_linestring; test_geometry("MULTILINESTRING((0 0,0 0,18 0,18 0,19 0,19 0,19 0,30 0,30 0))", "MULTILINESTRING((0 10,5 0,20 0,20 0,30 0))", @@ -418,8 +418,7 @@ void test_multi_linestring_multi_linestring() "MULTILINESTRING((5 5.0190018174896416,0 5),(5 5.0190018174896416,5 0),(10 10,10 5,5 5.0190018174896416,5 10,10 10))", "10FFFFFF2"); - if ( BOOST_GEOMETRY_CONDITION(( - boost::is_same::type, double>::value )) ) + if ( BOOST_GEOMETRY_CONDITION((std::is_same::value)) ) { // assertion failure in 1.57 test_geometry("MULTILINESTRING((-0.59322033898305082 -8.0508474576271194,-2.882352941176471 -7.7647058823529411,-2.8823529411764706 -7.7647058823529411,-3.7361111111111112 -6.5694444444444446,-3.4404145077720205 -5.766839378238342,-4.1864406779661012 -3.6779661016949152,-7.5252525252525251 -5.5858585858585865,-7.5862068965517242 -5.1896551724137936,-4.47887323943662 -2.859154929577465,-4.5789473684210531 -2.5789473684210527,-3 -1,-2.9310344827586206 -0.86206896551724144,-3.1764705882352944 -0.70588235294117663,-4.7401960784313726 -2.1274509803921577,-5.3255813953488369 -0.48837209302325502,-4.7872340425531918 0.31914893617021284,-5.8571428571428577 1.0000000000000007,-5.3255813953488369 -0.48837209302325502,-5.9473684210526319 -1.4210526315789465,-8 2,-7.7333333333333334 2.1939393939393939,-8.8294573643410867 2.891472868217055,-8.8556701030927822 3.061855670103093,-7.5999999999999996 3.6000000000000001,-7.7999999999999998 3.7999999999999998,-7.75 3.7916666666666665,-7.5471698113207548 3.6226415094339623,-7.3200000000000003 3.7200000000000002,-3.473684210526315 3.0789473684210527,-3.2549019607843133 3.2156862745098036,-2.9999999999999982 3.1428571428571423,-3.1733333333333325 3.2666666666666666,-2.9180327868852456 3.4262295081967209,-2.8723404255319145 3.1063829787234041,-2.1111111111111112 2.8888888888888888,-2.1428571428571428 2.8571428571428572,-1.8433734939759043 2.8072289156626509,-1.8396226415094346 2.8113207547169816,-1.6486486486486487 2.756756756756757,-1.76510067114094 2.8926174496644301,-0.53846153846153855 4.2307692307692308,1.8148148148148147 5.4074074074074074,1.588235294117647 2.2352941176470589,1.819672131147541 2.1967213114754101,2 4,2 2.1666666666666665,2.3538461538461544 2.1076923076923078,2 1.6875000000000004,2 -2,1.2173913043478262 -3.8260869565217392,1.7375886524822697 1.3758865248226959,1.5073170731707317 1.1024390243902444,1.1428571428571428 -4,-0.59322033898305082 -8.0508474576271194),(1.666666666666667 1.5999999999999988,1.5675675675675675 1.8378378378378377,1.4374999999999991 1.8750000000000002,1.0487804878048776 2.3414634146341466,0.46666666666666712 2.6060606060606055,0.086956521739131043 2.2608695652173911,1.4374999999999991 1.8750000000000002,1.666666666666667 1.5999999999999988))", diff --git a/test/algorithms/relate/test_relate.hpp b/test/algorithms/relate/test_relate.hpp index 859d29ade..bf8b550ee 100644 --- a/test/algorithms/relate/test_relate.hpp +++ b/test/algorithms/relate/test_relate.hpp @@ -2,8 +2,8 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2013, 2014, 2015, 2017. -// Modifications copyright (c) 2013-2017 Oracle and/or its affiliates. +// This file was modified by Oracle on 2013-2021. +// Modifications copyright (c) 2013-2021 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, @@ -17,18 +17,11 @@ #include -#include #include #include -#include #include -#include - #include - -#include -#include -#include +#include namespace bgdr = bg::detail::relate; @@ -190,7 +183,7 @@ void check_geometry(Geometry1 const& geometry1, // brake the expected output std::string expected_interrupt = expected1; bool changed = false; - BOOST_FOREACH(char & c, expected_interrupt) + for (char & c : expected_interrupt) { if ( c >= '0' && c <= '9' ) { diff --git a/test/algorithms/set_operations/difference/difference.cpp b/test/algorithms/set_operations/difference/difference.cpp index 0565f47aa..d6fda96d1 100644 --- a/test/algorithms/set_operations/difference/difference.cpp +++ b/test/algorithms/set_operations/difference/difference.cpp @@ -3,8 +3,8 @@ // Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2015, 2016. -// Modifications copyright (c) 2015-2016, Oracle and/or its affiliates. +// This file was modified by Oracle on 2015-2021. +// Modifications copyright (c) 2015-2021, 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 @@ -293,7 +293,7 @@ void test_all() 1, 61, 10.2717, 1, 61, 10.2717); - if ( BOOST_GEOMETRY_CONDITION((boost::is_same::value)) ) + if ( BOOST_GEOMETRY_CONDITION((std::is_same::value)) ) { test_one("buffer_mp2", buffer_mp2[0], buffer_mp2[1], diff --git a/test/algorithms/set_operations/difference/difference_areal_linear.cpp b/test/algorithms/set_operations/difference/difference_areal_linear.cpp index 80e535130..046b8c800 100644 --- a/test/algorithms/set_operations/difference/difference_areal_linear.cpp +++ b/test/algorithms/set_operations/difference/difference_areal_linear.cpp @@ -3,9 +3,8 @@ // Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2015, 2017. -// Modifications copyright (c) 2015-2017, Oracle and/or its affiliates. - +// This file was modified by Oracle on 2015-2021. +// Modifications copyright (c) 2015-2021, 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 @@ -116,7 +115,7 @@ void test_areal_linear() test_one_lp("case26", "LINESTRING(4 0,4 3,4 5,7 5)", poly_9, 2, 5, 5.0); test_one_lp("case27", "LINESTRING(4 4,4 5,5 5)", poly_9, 1, 3, 2.0); - if (BOOST_GEOMETRY_CONDITION( (! boost::is_same::value)) ) + if (BOOST_GEOMETRY_CONDITION( (! std::is_same::value)) ) { // Fails for float test_one_lp("case28", diff --git a/test/algorithms/set_operations/difference/difference_tupled.cpp b/test/algorithms/set_operations/difference/difference_tupled.cpp index 30ecd2d50..631bb2d89 100644 --- a/test/algorithms/set_operations/difference/difference_tupled.cpp +++ b/test/algorithms/set_operations/difference/difference_tupled.cpp @@ -1,29 +1,25 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) -// Copyright (c) 2020, Oracle and/or its affiliates. +// Copyright (c) 2020-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Licensed under the Boost Software License version 1.0. // http://www.boost.org/users/license.html + #include +#include + +#include + #include #include #include #include #include -#include -#include -#include - -#include - -// TEMP -#include -#include -#include +#include typedef bg::model::point Pt; @@ -34,12 +30,6 @@ typedef bg::model::multi_point MPt; typedef bg::model::multi_linestring MLs; typedef bg::model::multi_polygon MPo; -#ifdef BOOST_GEOMETRY_CXX11_TUPLE - -#include - -#endif - template inline void check(std::string const& wkt1, std::string const& wkt2, @@ -83,8 +73,6 @@ inline void check(std::string const& wkt1, check(wkt1, wkt2, pair.second, out_str); } -#ifdef BOOST_GEOMETRY_CXX11_TUPLE - template inline void check(std::string const& wkt1, std::string const& wkt2, @@ -94,22 +82,13 @@ inline void check(std::string const& wkt1, check(wkt1, wkt2, std::get(tup), out_str); } -#endif - template -struct out_id - : boost::mpl::if_c - < - boost::is_base_of::type>::value, - boost::mpl::int_<0>, - typename boost::mpl::if_c - < - boost::is_base_of::type>::value, - boost::mpl::int_<1>, - boost::mpl::int_<2> - >::type - >::type -{}; +using out_id = std::integral_constant + < + int, + (bg::util::is_pointlike::value ? 0 : + (bg::util::is_linear::value ? 1 : 2)) + >; template inline void test_one(std::string const& in1_str, @@ -403,10 +382,7 @@ int test_main(int, char* []) { test_pair >(); test_tuple >(); - -#ifdef BOOST_GEOMETRY_CXX11_TUPLE test_tuple >(); -#endif return 0; } diff --git a/test/algorithms/set_operations/difference/test_difference.hpp b/test/algorithms/set_operations/difference/test_difference.hpp index 3c9ce08a5..c700d2957 100644 --- a/test/algorithms/set_operations/difference/test_difference.hpp +++ b/test/algorithms/set_operations/difference/test_difference.hpp @@ -25,7 +25,6 @@ #include "../setop_output_type.hpp" #include -#include #include #include diff --git a/test/algorithms/set_operations/intersection/intersection.cpp b/test/algorithms/set_operations/intersection/intersection.cpp index d2b93b7e2..7f3b4938e 100644 --- a/test/algorithms/set_operations/intersection/intersection.cpp +++ b/test/algorithms/set_operations/intersection/intersection.cpp @@ -5,8 +5,8 @@ // Copyright (c) 2008-2015 Bruno Lalande, Paris, France. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK. -// This file was modified by Oracle on 2015, 2016, 2017. -// Modifications copyright (c) 2015-2017, Oracle and/or its affiliates. +// This file was modified by Oracle on 2015-2021. +// Modifications copyright (c) 2015-2021, 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 @@ -941,9 +941,7 @@ int test_main(int, char* []) test_ticket_10868("MULTIPOLYGON(((33520458 6878575,33480192 14931538,31446819 18947953,30772384 19615678,30101303 19612322,30114725 16928001,33520458 6878575)))"); } -#if defined(BOOST_HAS_LONG_LONG) - test_ticket_10868("MULTIPOLYGON(((33520458 6878575,33480192 14931538,31446819 18947953,30772384 19615678,30101303 19612322,30114725 16928001,33520458 6878575)))"); -#endif + test_ticket_10868("MULTIPOLYGON(((33520458 6878575,33480192 14931538,31446819 18947953,30772384 19615678,30101303 19612322,30114725 16928001,33520458 6878575)))"); #endif #endif diff --git a/test/algorithms/set_operations/intersection/test_intersection.hpp b/test/algorithms/set_operations/intersection/test_intersection.hpp index 12071d1b6..4583969ff 100644 --- a/test/algorithms/set_operations/intersection/test_intersection.hpp +++ b/test/algorithms/set_operations/intersection/test_intersection.hpp @@ -3,8 +3,8 @@ // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2016-2020. -// Modifications copyright (c) 2016-2020, Oracle and/or its affiliates. +// This file was modified by Oracle on 2016-2021. +// Modifications copyright (c) 2016-2021, 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, @@ -17,7 +17,6 @@ #include #include -#include #include #include @@ -31,10 +30,9 @@ #include -#include - #include +#include #if defined(TEST_WITH_SVG) # include @@ -73,9 +71,7 @@ void check_result(IntersectionOutput const& intersection_output, typename bg::default_area_result::type length_or_area = 0; int n = 0; std::size_t nholes = 0; - for (typename IntersectionOutput::const_iterator it = intersection_output.begin(); - it != intersection_output.end(); - ++it) + for (auto it = intersection_output.begin(); it != intersection_output.end(); ++it) { if (! expected_count.empty()) { diff --git a/test/algorithms/set_operations/intersection/test_intersection_linear_linear.hpp b/test/algorithms/set_operations/intersection/test_intersection_linear_linear.hpp index 0b47c4f75..99c18ba96 100644 --- a/test/algorithms/set_operations/intersection/test_intersection_linear_linear.hpp +++ b/test/algorithms/set_operations/intersection/test_intersection_linear_linear.hpp @@ -1,6 +1,6 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) -// Copyright (c) 2014-2020, Oracle and/or its affiliates. +// Copyright (c) 2014-2021, 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 @@ -14,7 +14,6 @@ #include #include -#include #include #include "../test_set_ops_linear_linear.hpp" @@ -212,19 +211,8 @@ public: Geometry2 rg2(geometry2); bg::reverse(rg2); - typedef typename bg::tag_cast - < - Geometry1, bg::linear_tag - >::type tag1_type; - - typedef typename bg::tag_cast - < - Geometry2, bg::linear_tag - >::type tag2_type; - - bool const are_linear - = boost::is_same::value - && boost::is_same::value; + static const bool are_linear = bg::util::is_linear::value + && bg::util::is_linear::value; test_get_turns_ll_invariance::apply(geometry1, geometry2); #ifdef BOOST_GEOMETRY_TEST_DEBUG diff --git a/test/algorithms/set_operations/test_set_ops_linear_linear.hpp b/test/algorithms/set_operations/test_set_ops_linear_linear.hpp index d9bf57c2c..1692fca4d 100644 --- a/test/algorithms/set_operations/test_set_ops_linear_linear.hpp +++ b/test/algorithms/set_operations/test_set_ops_linear_linear.hpp @@ -1,7 +1,6 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) -// Copyright (c) 2014-2020, Oracle and/or its affiliates. - +// Copyright (c) 2014-2021, 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 @@ -23,7 +22,6 @@ #include #include #include -#include #include #include @@ -35,14 +33,9 @@ namespace bg = ::boost::geometry; -template struct ls_less { - typedef typename boost::range_iterator::type Iterator1; - typedef typename boost::range_iterator::type Iterator2; - - typedef bg::less::type> point_less; - + template bool operator()(Linestring1 const& linestring1, Linestring2 const& linestring2) const { @@ -51,9 +44,10 @@ struct ls_less return boost::size(linestring1) < boost::size(linestring2); } - Iterator1 it1 = boost::begin(linestring1); - Iterator2 it2 = boost::begin(linestring2); - point_less less; + bg::less::type> less; + + auto it1 = boost::begin(linestring1); + auto it2 = boost::begin(linestring2); for (; it1 != boost::end(linestring1); ++it1, ++it2) { if (less(*it1, *it2)) @@ -70,21 +64,19 @@ struct ls_less }; -template struct ls_equal { + template bool operator()(Linestring1 const& linestring1, Linestring2 const& linestring2) const { - ls_less less; - + ls_less less; return ! less(linestring1, linestring2) && ! less(linestring2, linestring1); } }; -template class pt_equal { private: @@ -106,6 +98,7 @@ private: public: pt_equal(double tolerence) : m_tolerence(tolerence) {} + template bool operator()(Point1 const& point1, Point2 const& point2) const { // allow for some tolerence in testing equality of points @@ -121,11 +114,6 @@ struct multilinestring_equals template struct unique { - typedef typename boost::range_value::type Linestring; - typedef typename bg::point_type::type point_type; - typedef ls_equal linestring_equal; - typedef pt_equal point_equal; - template void apply_to_range(Range& range, EqualTo const& equal_to) { @@ -139,9 +127,9 @@ struct multilinestring_equals for (typename boost::range_iterator::type it = boost::begin(mls); it != boost::end(mls); ++it) { - apply_to_range(*it, point_equal(tolerance)); + apply_to_range(*it, pt_equal(tolerance)); } - apply_to_range(mls, linestring_equal()); + apply_to_range(mls, ls_equal()); } }; @@ -159,50 +147,11 @@ struct multilinestring_equals MultiLinestring2 const& multilinestring2, double tolerance) { - typedef typename boost::range_iterator - < - MultiLinestring1 const - >::type ls1_iterator; - - typedef typename boost::range_iterator - < - MultiLinestring2 const - >::type ls2_iterator; - - typedef typename boost::range_value::type Linestring1; - - typedef typename boost::range_value::type Linestring2; - - typedef typename boost::range_iterator - < - Linestring1 const - >::type point1_iterator; - - typedef typename boost::range_iterator - < - Linestring2 const - >::type point2_iterator; - - typedef ls_less linestring_less; - - typedef pt_equal - < - typename boost::range_value - < - typename boost::range_value::type - >::type, - typename boost::range_value - < - typename boost::range_value::type - >::type - > point_equal; - - MultiLinestring1 mls1 = multilinestring1; MultiLinestring2 mls2 = multilinestring2; - std::sort(boost::begin(mls1), boost::end(mls1), linestring_less()); - std::sort(boost::begin(mls2), boost::end(mls2), linestring_less()); + std::sort(boost::begin(mls1), boost::end(mls1), ls_less()); + std::sort(boost::begin(mls2), boost::end(mls2), ls_less()); unique()(mls1, tolerance); unique()(mls2, tolerance); @@ -212,19 +161,19 @@ struct multilinestring_equals return false; } - ls1_iterator it1 = boost::begin(mls1); - ls2_iterator it2 = boost::begin(mls2); + auto it1 = boost::begin(mls1); + auto it2 = boost::begin(mls2); for (; it1 != boost::end(mls1); ++it1, ++it2) { if (boost::size(*it1) != boost::size(*it2)) { return false; } - point1_iterator pit1 = boost::begin(*it1); - point2_iterator pit2 = boost::begin(*it2); + auto pit1 = boost::begin(*it1); + auto pit2 = boost::begin(*it2); for (; pit1 != boost::end(*it1); ++pit1, ++pit2) { - if (! point_equal(tolerance)(*pit1, *pit2)) + if (! pt_equal(tolerance)(*pit1, *pit2)) { return false; } @@ -257,9 +206,7 @@ private: convert_isolated_points_to_segments(MultiLinestring const& multilinestring, OutputIterator oit) { - BOOST_AUTO_TPL(it, boost::begin(multilinestring)); - - for (; it != boost::end(multilinestring); ++it) + for (auto it = boost::begin(multilinestring) ; it != boost::end(multilinestring); ++it) { if (boost::size(*it) == 1) { diff --git a/test/algorithms/set_operations/test_set_ops_pointlike.hpp b/test/algorithms/set_operations/test_set_ops_pointlike.hpp index 1cbe5de84..d9ac392ce 100644 --- a/test/algorithms/set_operations/test_set_ops_pointlike.hpp +++ b/test/algorithms/set_operations/test_set_ops_pointlike.hpp @@ -1,7 +1,6 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) -// Copyright (c) 2014-2020, Oracle and/or its affiliates. - +// Copyright (c) 2014-2021, 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 @@ -12,30 +11,27 @@ #define BOOST_GEOMETRY_TEST_SET_OPS_POINTLIKE_HPP -#include - -namespace bg = ::boost::geometry; - #include #include #include #include + #include #include #include #include -#include - -#include -#include - -#include -#include -#include -#include #include +#include +#include +#include +#include +#include +#include +#include + +namespace bg = ::boost::geometry; //================================================================== @@ -69,8 +65,7 @@ void set_operation_output(std::string const& set_op_id, mapper.map(g2, "stroke-opacity:1;stroke:rgb(153,204,0);stroke-width:4"); mapper.map(g1, "stroke-opacity:1;stroke:rgb(51,51,153);stroke-width:2"); - BOOST_AUTO_TPL(it, output.begin()); - for (; it != output.end(); ++it) + for (auto it = output.begin(); it != output.end(); ++it) { mapper.map(*it, "fill:rgb(255,0,255);stroke:rgb(0,0,0);stroke-width:1", @@ -106,8 +101,8 @@ struct equals return false; } - BOOST_AUTO_TPL(it1, boost::begin(mp1)); - BOOST_AUTO_TPL(it2, boost::begin(mp2)); + auto it1 = boost::begin(mp1); + auto it2 = boost::begin(mp2); for (; it1 != boost::end(mp1); ++it1, ++it2) { if ( !bg::equals(*it1, *it2) ) diff --git a/test/algorithms/set_operations/union/test_union.hpp b/test/algorithms/set_operations/union/test_union.hpp index e17012265..55c468134 100644 --- a/test/algorithms/set_operations/union/test_union.hpp +++ b/test/algorithms/set_operations/union/test_union.hpp @@ -3,8 +3,8 @@ // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2015-2020. -// Modifications copyright (c) 2015-2020 Oracle and/or its affiliates. +// This file was modified by Oracle on 2015-2021. +// Modifications copyright (c) 2015-2021 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 @@ -24,7 +24,6 @@ #include "../setop_output_type.hpp" #include -#include #include #include #include @@ -41,15 +40,15 @@ #include -#include - #include - #if defined(TEST_WITH_SVG) # include #endif +#include + + struct ut_settings : public ut_base_settings { ut_settings() @@ -80,8 +79,7 @@ template inline std::size_t num_points(Range const& rng, bool add_for_open = false) { std::size_t result = 0; - for (typename boost::range_iterator::type it = boost::begin(rng); - it != boost::end(rng); ++it) + for (auto it = boost::begin(rng); it != boost::end(rng); ++it) { result += bg::num_points(*it, add_for_open); } @@ -139,8 +137,7 @@ void test_union(std::string const& caseid, G1 const& g1, G2 const& g2, typename bg::default_area_result::type area = 0; std::size_t n = 0; std::size_t holes = 0; - for (typename result_type::iterator it = clip.begin(); - it != clip.end(); ++it) + for (auto it = clip.begin(); it != clip.end(); ++it) { area += bg::area(*it); holes += bg::num_interior_rings(*it); @@ -158,9 +155,7 @@ void test_union(std::string const& caseid, G1 const& g1, G2 const& g2, typename bg::default_area_result::type area_inserted = 0; int index = 0; - for (typename result_type::iterator it = inserted.begin(); - it != inserted.end(); - ++it, ++index) + for (auto it = inserted.begin(); it != inserted.end(); ++it, ++index) { // Skip the empty polygon created above to avoid the empty_input_exception if (! bg::is_empty(*it)) diff --git a/test/algorithms/set_operations/union/union.cpp b/test/algorithms/set_operations/union/union.cpp index 31b7c6204..7daec1990 100644 --- a/test/algorithms/set_operations/union/union.cpp +++ b/test/algorithms/set_operations/union/union.cpp @@ -5,8 +5,8 @@ // Copyright (c) 2008-2016 Bruno Lalande, Paris, France. // Copyright (c) 2009-2016 Mateusz Loskot, London, UK. -// This file was modified by Oracle on 2016,2017. -// Modifications copyright (c) 2016-2017, Oracle and/or its affiliates. +// This file was modified by Oracle on 2016-2021. +// Modifications copyright (c) 2016-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library @@ -45,7 +45,7 @@ void test_areal() typedef typename bg::coordinate_type::type ct; ut_settings ignore_validity_for_float; - if (BOOST_GEOMETRY_CONDITION((boost::is_same::value)) ) + if (BOOST_GEOMETRY_CONDITION((std::is_same::value)) ) { ignore_validity_for_float.set_test_validity(false); } diff --git a/test/algorithms/simplify_countries.cpp b/test/algorithms/simplify_countries.cpp index 87f674339..3b5dbb834 100644 --- a/test/algorithms/simplify_countries.cpp +++ b/test/algorithms/simplify_countries.cpp @@ -3,23 +3,32 @@ // Copyright (c) 2018 Barend Gehrels, Amsterdam, the Netherlands. +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021, 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) -#include -#include - -#include #include +#include + +#include +#include + +#include + +#include +#include + #if defined(TEST_WITH_SVG) # include #endif - template std::string read_from_file(std::string const& filename) { @@ -102,7 +111,7 @@ void test_one(std::string const& caseid, std::string const& wkt, mapper.map(geometry, "fill-opacity:0.5;fill:rgb(153,204,0);" "stroke:rgb(153,204,0);stroke-width:1"); - BOOST_FOREACH(polygon const& pol, simplified) + for (polygon const& pol : simplified) { mapper.map(pol, bg::area(pol) > 0 ? "fill:none;stroke:rgb(255,0,0);stroke-width:1" diff --git a/test/algorithms/transform.cpp b/test/algorithms/transform.cpp index bc938845d..9f88e0e89 100644 --- a/test/algorithms/transform.cpp +++ b/test/algorithms/transform.cpp @@ -5,6 +5,10 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021, Oracle and/or its affiliates. +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -15,7 +19,6 @@ #include #include -#include #include #include @@ -71,10 +74,10 @@ void test_transform_linestring(Value value) boost::variant v(line1); line2_type expected; - for (BOOST_AUTO(p, line1.begin()); p != line1.end(); ++p) + for (auto it = line1.begin(); it != line1.end(); ++it) { P2 new_point; - bg::assign(new_point, *p); + bg::assign(new_point, *it); bg::multiply_value(new_point, value); expected.push_back(new_point); } diff --git a/test/algorithms/within/within_pointlike_geometry.cpp b/test/algorithms/within/within_pointlike_geometry.cpp index d04b0762d..84028ee90 100644 --- a/test/algorithms/within/within_pointlike_geometry.cpp +++ b/test/algorithms/within/within_pointlike_geometry.cpp @@ -3,8 +3,8 @@ // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2014, 2015, 2016, 2017. -// Modifications copyright (c) 2014-2017 Oracle and/or its affiliates. +// This file was modified by Oracle on 2014-2021. +// Modifications copyright (c) 2014-2021 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, @@ -154,19 +154,19 @@ void test_spherical_geographic() { bg::model::polygon wrangel; - typename boost::mpl::if_ + std::conditional_t < - boost::is_same::type, bg::geographic_tag>, + std::is_same::type, bg::geographic_tag>::value, bg::strategy::within::geographic_winding, bg::strategy::within::spherical_winding - >::type ws; + > ws; - typename boost::mpl::if_ + std::conditional_t < - boost::is_same::type, bg::geographic_tag>, + std::is_same::type, bg::geographic_tag>::value, bg::strategy::side::geographic<>, bg::strategy::side::spherical_side_formula<> - >::type ss; + > ss; boost::ignore_unused(ws, ss); @@ -390,8 +390,8 @@ void test_large_integers() void test_tickets() { - typedef boost::geometry::model::d2::point_xy pt; - typedef boost::geometry::model::ring ring; + typedef bg::model::d2::point_xy pt; + typedef bg::model::ring ring; // https://svn.boost.org/trac/boost/ticket/9628 { @@ -408,9 +408,9 @@ void test_tickets() pt p( -12260.669324773118, 54820.312032458634 ); - //boost::geometry::correct(r); + //bg::correct(r); - bool within = boost::geometry::within(p, r); + bool within = bg::within(p, r); BOOST_CHECK_EQUAL(within, false); } // similar @@ -423,7 +423,7 @@ void test_tickets() pt p( -13826.0, 54820.312032458634 ); - bool within = boost::geometry::within(p, r); + bool within = bg::within(p, r); BOOST_CHECK_EQUAL(within, false); } @@ -433,9 +433,9 @@ void test_tickets() ring r; bg::read_wkt("POINT(0.1377 5.00)", p); bg::read_wkt("POLYGON((0.1277 4.97, 0.1277 5.00, 0.1278 4.9999999999999982, 0.1278 4.97, 0.1277 4.97))", r); - bool within = boost::geometry::within(p, r); + bool within = bg::within(p, r); BOOST_CHECK_EQUAL(within, false); - bool covered_by = boost::geometry::covered_by(p, r); + bool covered_by = bg::covered_by(p, r); BOOST_CHECK_EQUAL(covered_by, false); } } diff --git a/test/core/point_type.cpp b/test/core/point_type.cpp index be98d2edb..6829450f2 100644 --- a/test/core/point_type.cpp +++ b/test/core/point_type.cpp @@ -5,7 +5,6 @@ // This file was modified by Oracle on 2014-2021. // Modifications copyright (c) 2014-2021 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, @@ -15,8 +14,6 @@ #include -#include - #include #include @@ -45,7 +42,7 @@ void test_geometry() BOOST_CHECK_EQUAL(typeid(typename bg::point_type::type).name(), typeid(Expected).name()); - static const bool is_same = boost::is_same::type, Expected>::value; + static const bool is_same = std::is_same::type, Expected>::value; BOOST_CHECK(is_same); } diff --git a/test/core/tag.cpp b/test/core/tag.cpp index f67c58d4b..36bf3403b 100644 --- a/test/core/tag.cpp +++ b/test/core/tag.cpp @@ -3,9 +3,8 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2014. -// Modifications copyright (c) 2014 Oracle and/or its affiliates. - +// This file was modified by Oracle on 2014-2021. +// Modifications copyright (c) 2014-2021 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, @@ -15,8 +14,6 @@ #include -#include - #include #include @@ -42,7 +39,7 @@ void test_geometry() BOOST_CHECK_EQUAL(typeid(typename bg::tag::type).name(), typeid(Expected).name()); - static const bool is_same = boost::is_same::type, Expected>::value; + static const bool is_same = std::is_same::type, Expected>::value; BOOST_CHECK(is_same); } diff --git a/test/geometry_test_common.hpp b/test/geometry_test_common.hpp index 96866bde3..0c34e463a 100644 --- a/test/geometry_test_common.hpp +++ b/test/geometry_test_common.hpp @@ -4,6 +4,10 @@ // Copyright (c) 2008-2015 Bruno Lalande, Paris, France. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK. +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021 Oracle and/or its affiliates. +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -50,7 +54,6 @@ #include #include #include -#include #include @@ -171,14 +174,14 @@ using default_test_type = double; template inline T if_typed(T value_typed, T value) { - return boost::is_same::value ? value_typed : value; + return std::is_same::value ? value_typed : value; } //! Compile time function for expectations depending on high precision template inline T1 const& bg_if_mp(T1 const& value_mp, T2 const& value) { - return boost::is_same::type::value ? value_mp : value; + return std::is_same::type::value ? value_mp : value; } //! Macro for expectations depending on rescaling diff --git a/test/iterators/flatten_iterator.cpp b/test/iterators/flatten_iterator.cpp index 9f989594e..69acae554 100644 --- a/test/iterators/flatten_iterator.cpp +++ b/test/iterators/flatten_iterator.cpp @@ -1,9 +1,9 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test -// Copyright (c) 2014, Oracle and/or its affiliates. - +// Copyright (c) 2014-2021, 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 // Licensed under the Boost Software License version 1.0. // http://www.boost.org/users/license.html @@ -14,26 +14,24 @@ #include +#include #include #include +#include +#include #include #include -#include -#include - +#include #include -#include -#include -#include -#include #include #include -#include +#include + +#include #include "test_iterator_common.hpp" -#include using namespace boost::assign; @@ -41,12 +39,12 @@ using namespace boost::assign; template struct access_begin { - typedef typename boost::mpl::if_ - < - typename boost::is_const::type, - typename InnerContainer::const_iterator, - typename InnerContainer::iterator - >::type return_type; + using return_type = std::conditional_t + < + std::is_const::value, + typename InnerContainer::const_iterator, + typename InnerContainer::iterator + >; static inline return_type apply(InnerContainer& inner) { @@ -58,12 +56,12 @@ struct access_begin template struct access_end { - typedef typename boost::mpl::if_ - < - typename boost::is_const::type, - typename InnerContainer::const_iterator, - typename InnerContainer::iterator - >::type return_type; + using return_type = std::conditional_t + < + std::is_const::value, + typename InnerContainer::const_iterator, + typename InnerContainer::iterator + >; static inline return_type apply(InnerContainer& inner) { diff --git a/test/iterators/point_iterator.cpp b/test/iterators/point_iterator.cpp index 346021420..80af60a94 100644 --- a/test/iterators/point_iterator.cpp +++ b/test/iterators/point_iterator.cpp @@ -3,8 +3,7 @@ // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. -// Copyright (c) 2014-2017, Oracle and/or its affiliates. - +// Copyright (c) 2014-2021, 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 @@ -28,9 +27,11 @@ #include #include #include -#include #include -#include + +#include +#include +#include #include @@ -39,31 +40,23 @@ #include #include -#include -#include -#include - -#include - -#include - #include #include #include #include +#include + #include +#include + #include #include -// At the end because of conflicts with Boost.QVM -#include - namespace bg = ::boost::geometry; -namespace ba = ::boost::assign; typedef bg::model::point point_type; typedef bg::model::point point_type_3d; @@ -100,7 +93,7 @@ template inline Geometry from_wkt(std::string const& wkt) { Geometry geometry; - boost::geometry::read_wkt(wkt, geometry); + bg::read_wkt(wkt, geometry); return geometry; } @@ -147,7 +140,7 @@ template < typename Geometry, bool Enable = true, - bool IsConst = boost::is_const::value + bool IsConst = std::is_const::value > struct test_iterator_concepts { @@ -456,7 +449,7 @@ struct test_point_iterator_of_geometry // testing dereferencing/assignment - bool const is_reference = boost::is_reference + bool const is_reference = std::is_reference < typename std::iterator_traits::reference >::value; @@ -535,7 +528,7 @@ BOOST_AUTO_TEST_CASE( test_linestring_point_iterator ) ); tester::apply(from_wkt("LINESTRING(3 3,4 4,5 5)"), - ba::tuple_list_of(3,3)(4,4)(5,5) + TMP{{3,3},{4,4},{5,5}} ); #ifdef BOOST_GEOMETRY_TEST_DEBUG @@ -568,15 +561,15 @@ BOOST_AUTO_TEST_CASE( test_polygon_point_iterator ) ); tester::apply(from_wkt

("POLYGON((1 1,9 1,9 9,1 9),(5 5,6 5,6 6,5 6))"), - ba::tuple_list_of(1,1)(9,1)(9,9)(1,9)(5,5)(6,5)(6,6)(5,6) + TMP{{1,1},{9,1},{9,9},{1,9},{5,5},{6,5},{6,6},{5,6}} ); tester::apply(from_wkt

("POLYGON((3 3,4 4,5 5),(),(),(),(6 6,7 7,8 8),(),(),(9 9),())"), - ba::tuple_list_of(3,3)(4,4)(5,5)(6,6)(7,7)(8,8)(9,9) + TMP{{3,3},{4,4},{5,5},{6,6},{7,7},{8,8},{9,9}} ); tester::apply(from_wkt

("POLYGON((),(3 3,4 4,5 5),(),(),(6 6,7 7,8 8),(),(),(9 9),())"), - ba::tuple_list_of(3,3)(4,4)(5,5)(6,6)(7,7)(8,8)(9,9) + TMP{{3,3},{4,4},{5,5},{6,6},{7,7},{8,8},{9,9}} ); #ifdef BOOST_GEOMETRY_TEST_DEBUG @@ -605,7 +598,7 @@ BOOST_AUTO_TEST_CASE( test_multipoint_point_iterator ) ); tester::apply(from_wkt("MULTIPOINT(3 3,4 4,5 5)"), - ba::tuple_list_of(3,3)(4,4)(5,5) + TMP{{3,3},{4,4},{5,5}} ); #ifdef BOOST_GEOMETRY_TEST_DEBUG @@ -634,7 +627,7 @@ BOOST_AUTO_TEST_CASE( test_multipoint_3d_point_iterator ) ); tester::apply(from_wkt("MULTIPOINT(3 3 3,4 4 4,5 5 5)"), - ba::tuple_list_of(3,3,3)(4,4,4)(5,5,5) + TMP{{3,3,3},{4,4,4},{5,5,5}} ); #ifdef BOOST_GEOMETRY_TEST_DEBUG @@ -671,11 +664,11 @@ BOOST_AUTO_TEST_CASE( test_multilinestring_point_iterator ) ); tester::apply(from_wkt("MULTILINESTRING((1 1,2 2,3 3),(3 3,4 4,5 5),(6 6))"), - ba::tuple_list_of(1,1)(2,2)(3,3)(3,3)(4,4)(5,5)(6,6) + TMP{{1,1},{2,2},{3,3},{3,3},{4,4},{5,5},{6,6}} ); tester::apply(from_wkt("MULTILINESTRING((),(),(1 1,2 2,3 3),(),(),(3 3,4 4,5 5),(),(6 6),(),(),())"), - ba::tuple_list_of(1,1)(2,2)(3,3)(3,3)(4,4)(5,5)(6,6) + TMP{{1,1},{2,2},{3,3},{3,3},{4,4},{5,5},{6,6}} ); #ifdef BOOST_GEOMETRY_TEST_DEBUG @@ -716,18 +709,18 @@ BOOST_AUTO_TEST_CASE( test_multipolygon_point_iterator ) ); tester::apply(from_wkt("MULTIPOLYGON(((3 3,4 4,5 5),(6 6,7 7,8 8),(9 9)),((1 1,2 2,10 10),(11 11,12 12)))"), - ba::tuple_list_of(3,3)(4,4)(5,5)(6,6)(7,7)(8,8)(9,9)\ - (1,1)(2,2)(10,10)(11,11)(12,12) + TMP{{3,3},{4,4},{5,5},{6,6},{7,7},{8,8},{9,9}, + {1,1},{2,2},{10,10},{11,11},{12,12}} ); tester::apply(from_wkt("MULTIPOLYGON(((3 3,4 4,5 5),(),(),(),(6 6,7 7,8 8),(),(),(9 9),()),((),(1 1,2 2,10 10),(),(),(),(11 11,12 12),(),(),(13 13),()))"), - ba::tuple_list_of(3,3)(4,4)(5,5)(6,6)(7,7)(8,8)(9,9)\ - (1,1)(2,2)(10,10)(11,11)(12,12)(13,13) + TMP{{3,3},{4,4},{5,5},{6,6},{7,7},{8,8},{9,9}, + {1,1},{2,2},{10,10},{11,11},{12,12},{13,13}} ); tester::apply(from_wkt("MULTIPOLYGON(((3 3,4 4,5 5),(),(),(),(6 6,7 7,8 8),(),(),(9 9),()),((),(1 1,2 2,10 10),(),(),(),(11 11,12 12),(),(),(13 13),()),((),(),()))"), - ba::tuple_list_of(3,3)(4,4)(5,5)(6,6)(7,7)(8,8)(9,9)\ - (1,1)(2,2)(10,10)(11,11)(12,12)(13,13) + TMP{{3,3},{4,4},{5,5},{6,6},{7,7},{8,8},{9,9}, + {1,1},{2,2},{10,10},{11,11},{12,12},{13,13}} ); #ifdef BOOST_GEOMETRY_TEST_DEBUG @@ -765,8 +758,8 @@ BOOST_AUTO_TEST_CASE( test_multipoint_of_point_pointers ) typedef test_point_iterator_of_geometry tester; tester::apply(multipoint, - ba::tuple_list_of(1,-1)(2,-2)(3,-3)(4,-4)(5,-5)(6,-6)\ - (7,-7)(8,-8)(9,-9), + TMP{{1,-1},{2,-2},{3,-3},{4,-4},{5,-5},{6,-6}, + {7,-7},{8,-8},{9,-9}}, zero ); @@ -807,8 +800,8 @@ BOOST_AUTO_TEST_CASE( test_linestring_of_point_pointers ) typedef test_point_iterator_of_geometry tester; tester::apply(linestring, - ba::tuple_list_of(1,-1)(2,-2)(3,-3)(4,-4)(5,-5)(6,-6)\ - (7,-7)(8,-8)(9,-9), + TMP{{1,-1},{2,-2},{3,-3},{4,-4},{5,-5},{6,-6}, + {7,-7},{8,-8},{9,-9}}, zero ); @@ -849,8 +842,8 @@ BOOST_AUTO_TEST_CASE( test_multipoint_copy_on_dereference ) tester::apply(multipoint, // from_wkt("MULTIPOINT(1 -1,2 -2,3 -3,4 -4,5 -5,6 -6, 7 -7,8 -8,9 -9)"), - ba::tuple_list_of(1,-1)(2,-2)(3,-3)(4,-4)(5,-5)(6,-6)\ - (7,-7)(8,-8)(9,-9) + TMP{{1,-1},{2,-2},{3,-3},{4,-4},{5,-5},{6,-6}, + {7,-7},{8,-8},{9,-9}} ); } @@ -875,7 +868,7 @@ BOOST_AUTO_TEST_CASE( test_linestring_copy_on_dereference ) > tester; tester::apply(from_wkt("LINESTRING(1 -1,2 -2,3 -3,4 -4,5 -5,6 -6, 7 -7,8 -8,9 -9)"), - ba::tuple_list_of(1,-1)(2,-2)(3,-3)(4,-4)(5,-5)(6,-6)\ - (7,-7)(8,-8)(9,-9) + TMP{{1,-1},{2,-2},{3,-3},{4,-4},{5,-5},{6,-6}, + {7,-7},{8,-8},{9,-9}} ); } diff --git a/test/iterators/segment_iterator.cpp b/test/iterators/segment_iterator.cpp index fdfe90ef5..53bd5ce63 100644 --- a/test/iterators/segment_iterator.cpp +++ b/test/iterators/segment_iterator.cpp @@ -3,9 +3,9 @@ // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. -// Copyright (c) 2014, Oracle and/or its affiliates. - +// Copyright (c) 2014-2021, 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 // Licensed under the Boost Software License version 1.0. // http://www.boost.org/users/license.html @@ -23,12 +23,17 @@ #include -#include #include #include #include #include +#include +#include +#include + +#include + #include #include #include @@ -37,25 +42,13 @@ #include #include -#include - -#include -#include -#include - -#include - #include -// TEMP -#include -#include -#include +#include #include #include -namespace ba = ::boost::assign; namespace bg = ::boost::geometry; namespace bgm = bg::model; @@ -87,7 +80,7 @@ template inline Geometry from_wkt(std::string const& wkt) { Geometry geometry; - boost::geometry::read_wkt(wkt, geometry); + bg::read_wkt(wkt, geometry); return geometry; } @@ -325,22 +318,23 @@ BOOST_AUTO_TEST_CASE( test_linestring_segment_iterator ) typedef test_segment_iterator_of_geometry tester; tester::apply(from_wkt("LINESTRING(0 0,1 1,2 2,3 3,4 4)"), - ba::list_of - ( ba::tuple_list_of(0,0)(1,1) ) - ( ba::tuple_list_of(1,1)(2,2) ) - ( ba::tuple_list_of(2,2)(3,3) ) - ( ba::tuple_list_of(3,3)(4,4) ) - ); + TML{ + {{0,0},{1,1}}, + {{1,1},{2,2}}, + {{2,2},{3,3}}, + {{3,3},{4,4}} + }); // linestring with no points tester::apply(from_wkt("LINESTRING()"), - ba::list_of() + TML() ); // linestring with a single point tester::apply(from_wkt("LINESTRING(1 0)"), - ba::list_of - ( ba::tuple_list_of(1,0)(1,0) ), + TML{ + {{1,0},{1,0}} + }, false ); @@ -365,80 +359,82 @@ BOOST_AUTO_TEST_CASE( test_ring_segment_iterator ) typedef dual_tester tester; tester::apply(from_wkt("POLYGON((0 0,0 10,10 10,10 0))"), - ba::list_of - ( ba::tuple_list_of(0,0)(0,10) ) - ( ba::tuple_list_of(0,10)(10,10) ) - ( ba::tuple_list_of(10,10)(10,0) ) - ( ba::tuple_list_of(10,0)(0,0) ) - ); + TML{ + {{0,0},{0,10}}, + {{0,10},{10,10}}, + {{10,10},{10,0}}, + {{10,0},{0,0}} + }); // open ring with no points tester::apply(from_wkt("POLYGON(())"), - ba::list_of() + TML() ); // open ring with a single point (one segment) tester::apply(from_wkt("POLYGON((0 0))"), - ba::list_of - ( ba::tuple_list_of(0,0)(0,0) ), + TML{ + {{0,0},{0,0}} + }, false ); // open ring with a two points (two segments) tester::apply(from_wkt("POLYGON((0 0,0 10))"), - ba::list_of - ( ba::tuple_list_of(0,0)(0,10) ) - ( ba::tuple_list_of(0,10)(0,0) ) - ); + TML{ + {{0,0},{0,10}}, + {{0,10},{0,0}} + }); // open ring with a three points (three segments) tester::apply(from_wkt("POLYGON((0 0,0 10,10 10))"), - ba::list_of - ( ba::tuple_list_of(0,0)(0,10) ) - ( ba::tuple_list_of(0,10)(10,10) ) - ( ba::tuple_list_of(10,10)(0,0) ) - ); + TML{ + {{0,0},{0,10}}, + {{0,10},{10,10}}, + {{10,10},{0,0}} + }); tester::apply(from_wkt("POLYGON((0 0,0 10,10 10,10 0,0 0))"), - ba::list_of - ( ba::tuple_list_of(0,0)(0,10) ) - ( ba::tuple_list_of(0,10)(10,10) ) - ( ba::tuple_list_of(10,10)(10,0) ) - ( ba::tuple_list_of(10,0)(0,0) ) - ); + TML{ + {{0,0},{0,10}}, + {{0,10},{10,10}}, + {{10,10},{10,0}}, + {{10,0},{0,0}} + }); // closed ring with no points tester::apply(from_wkt("POLYGON(())"), - ba::list_of() + TML() ); // closed ring with a single point (one segment) tester::apply(from_wkt("POLYGON((0 0))"), - ba::list_of - ( ba::tuple_list_of(0,0)(0,0) ), + TML{ + {{0,0},{0,0}} + }, false ); // closed ring with two points (one segment) tester::apply(from_wkt("POLYGON((0 0,0 0))"), - ba::list_of - ( ba::tuple_list_of(0,0)(0,0) ) - ); + TML{ + {{0,0},{0,0}} + }); // closed ring with three points (two segments) tester::apply(from_wkt("POLYGON((0 0,0 10,0 0))"), - ba::list_of - ( ba::tuple_list_of(0,0)(0,10) ) - ( ba::tuple_list_of(0,10)(0,0) ) - ); + TML{ + {{0,0},{0,10}}, + {{0,10},{0,0}} + }); // closed ring with four points (three segments) tester::apply(from_wkt("POLYGON((0 0,0 10,10 10,0 0))"), - ba::list_of - ( ba::tuple_list_of(0,0)(0,10) ) - ( ba::tuple_list_of(0,10)(10,10) ) - ( ba::tuple_list_of(10,10)(0,0) ) - ); + TML{ + {{0,0},{0,10}}, + {{0,10},{10,10}}, + {{10,10},{0,0}} + }); #ifdef BOOST_GEOMETRY_TEST_DEBUG std::cout << std::endl << std::endl << std::endl; @@ -461,85 +457,89 @@ BOOST_AUTO_TEST_CASE( test_polygon_segment_iterator ) typedef dual_tester tester; tester::apply(from_wkt("POLYGON((0 0,0 10,10 10,10 0),(1 1,9 1,9 9,1 9))"), - ba::list_of - ( ba::tuple_list_of(0,0)(0,10) ) - ( ba::tuple_list_of(0,10)(10,10) ) - ( ba::tuple_list_of(10,10)(10,0) ) - ( ba::tuple_list_of(10,0)(0,0) ) - ( ba::tuple_list_of(1,1)(9,1) ) - ( ba::tuple_list_of(9,1)(9,9) ) - ( ba::tuple_list_of(9,9)(1,9) ) - ( ba::tuple_list_of(1,9)(1,1) ) - ); + TML{ + {{0,0},{0,10}}, + {{0,10},{10,10}}, + {{10,10},{10,0}}, + {{10,0},{0,0}}, + {{1,1},{9,1}}, + {{9,1},{9,9}}, + {{9,9},{1,9}}, + {{1,9},{1,1}} + }); // open polygon with no points tester::apply(from_wkt("POLYGON(())"), - ba::list_of() + TML() ); // open polygons with single-point rings tester::apply(from_wkt("POLYGON((0 0,0 10,10 10,10 0),(1 1))"), - ba::list_of - ( ba::tuple_list_of(0,0)(0,10) ) - ( ba::tuple_list_of(0,10)(10,10) ) - ( ba::tuple_list_of(10,10)(10,0) ) - ( ba::tuple_list_of(10,0)(0,0) ) - ( ba::tuple_list_of(1,1)(1,1) ), + TML{ + {{0,0},{0,10}}, + {{0,10},{10,10}}, + {{10,10},{10,0}}, + {{10,0},{0,0}}, + {{1,1},{1,1}} + }, false ); tester::apply(from_wkt("POLYGON((0 0),(1 1,9 1,9 9,1 9))"), - ba::list_of - ( ba::tuple_list_of(0,0)(0,0) ) - ( ba::tuple_list_of(1,1)(9,1) ) - ( ba::tuple_list_of(9,1)(9,9) ) - ( ba::tuple_list_of(9,9)(1,9) ) - ( ba::tuple_list_of(1,9)(1,1) ), + TML{ + {{0,0},{0,0}}, + {{1,1},{9,1}}, + {{9,1},{9,9}}, + {{9,9},{1,9}}, + {{1,9},{1,1}} + }, false ); tester::apply(from_wkt("POLYGON((0 0,0 10,10 10,10 0,0 0),(1 1,9 1,9 9,1 9,1 1))"), - ba::list_of - ( ba::tuple_list_of(0,0)(0,10) ) - ( ba::tuple_list_of(0,10)(10,10) ) - ( ba::tuple_list_of(10,10)(10,0) ) - ( ba::tuple_list_of(10,0)(0,0) ) - ( ba::tuple_list_of(1,1)(9,1) ) - ( ba::tuple_list_of(9,1)(9,9) ) - ( ba::tuple_list_of(9,9)(1,9) ) - ( ba::tuple_list_of(1,9)(1,1) ) - ); + TML{ + {{0,0},{0,10}}, + {{0,10},{10,10}}, + {{10,10},{10,0}}, + {{10,0},{0,0}}, + {{1,1},{9,1}}, + {{9,1},{9,9}}, + {{9,9},{1,9}}, + {{1,9},{1,1}} + }); // closed polygons with no points tester::apply(from_wkt("POLYGON(())"), - ba::list_of() + TML() ); tester::apply(from_wkt("POLYGON((),())"), - ba::list_of() + TML() ); tester::apply(from_wkt("POLYGON((),(),())"), - ba::list_of() + TML() ); // closed polygons with single-point rings tester::apply(from_wkt("POLYGON((0 0,0 10,10 10,10 0,0 0),(1 1))"), - ba::list_of - ( ba::tuple_list_of(0,0)(0,10) ) - ( ba::tuple_list_of(0,10)(10,10) ) - ( ba::tuple_list_of(10,10)(10,0) ) - ( ba::tuple_list_of(10,0)(0,0) ) - ( ba::tuple_list_of(1,1)(1,1) ), + TML{ + {{0,0},{0,10}}, + {{0,10},{10,10}}, + {{10,10},{10,0}}, + {{10,0},{0,0}}, + {{1,1},{1,1}}, + }, false ); tester::apply(from_wkt("POLYGON((0 0),(1 1,9 1,9 9,1 9,1 1))"), - ba::list_of - ( ba::tuple_list_of(0,0)(0,0) ) - ( ba::tuple_list_of(1,1)(9,1) ) - ( ba::tuple_list_of(9,1)(9,9) ) - ( ba::tuple_list_of(9,9)(1,9) ) - ( ba::tuple_list_of(1,9)(1,1) ), + TML{ + {{0,0},{0,0}}, + {{1,1},{9,1}}, + {{9,1},{9,9}}, + {{9,9},{1,9}}, + {{1,9},{1,1}} + }, false ); @@ -563,37 +563,38 @@ BOOST_AUTO_TEST_CASE( test_multi_linestring_segment_iterator ) typedef test_segment_iterator_of_geometry tester; tester::apply(from_wkt("MULTILINESTRING((0 0,1 1,2 2,3 3,4 4),(5 5,6 6,7 7,8 8),(9 9,10 10))"), - ba::list_of - ( ba::tuple_list_of(0,0)(1,1) ) - ( ba::tuple_list_of(1,1)(2,2) ) - ( ba::tuple_list_of(2,2)(3,3) ) - ( ba::tuple_list_of(3,3)(4,4) ) - ( ba::tuple_list_of(5,5)(6,6) ) - ( ba::tuple_list_of(6,6)(7,7) ) - ( ba::tuple_list_of(7,7)(8,8) ) - ( ba::tuple_list_of(9,9)(10,10) ) - ); + TML{ + {{0,0},{1,1}}, + {{1,1},{2,2}}, + {{2,2},{3,3}}, + {{3,3},{4,4}}, + {{5,5},{6,6}}, + {{6,6},{7,7}}, + {{7,7},{8,8}}, + {{9,9},{10,10}} + }); // empty multi-linestrings tester::apply(from_wkt("MULTILINESTRING()"), - ba::list_of() + TML() ); tester::apply(from_wkt("MULTILINESTRING(())"), - ba::list_of() + TML() ); tester::apply(from_wkt("MULTILINESTRING((),())"), - ba::list_of() + TML() ); // multi-linestring with a linestring with one point tester::apply(from_wkt("MULTILINESTRING((0 0,1 1,2 2,3 3,4 4),(5 5),(9 9,10 10))"), - ba::list_of - ( ba::tuple_list_of(0,0)(1,1) ) - ( ba::tuple_list_of(1,1)(2,2) ) - ( ba::tuple_list_of(2,2)(3,3) ) - ( ba::tuple_list_of(3,3)(4,4) ) - ( ba::tuple_list_of(5,5)(5,5) ) - ( ba::tuple_list_of(9,9)(10,10) ), + TML{ + {{0,0},{1,1}}, + {{1,1},{2,2}}, + {{2,2},{3,3}}, + {{3,3},{4,4}}, + {{5,5},{5,5}}, + {{9,9},{10,10}} + }, false ); @@ -618,63 +619,63 @@ BOOST_AUTO_TEST_CASE( test_multi_polygon_segment_iterator ) typedef dual_tester tester; tester::apply(from_wkt("MULTIPOLYGON(((0 0,0 10,10 10,10 0),(1 1,9 1,9 9,1 9)),((20 0,20 10,30 10,30 0),(21 1,29 1,29 9,21 9)))"), - ba::list_of - ( ba::tuple_list_of(0,0)(0,10) ) - ( ba::tuple_list_of(0,10)(10,10) ) - ( ba::tuple_list_of(10,10)(10,0) ) - ( ba::tuple_list_of(10,0)(0,0) ) - ( ba::tuple_list_of(1,1)(9,1) ) - ( ba::tuple_list_of(9,1)(9,9) ) - ( ba::tuple_list_of(9,9)(1,9) ) - ( ba::tuple_list_of(1,9)(1,1) ) - ( ba::tuple_list_of(20,0)(20,10) ) - ( ba::tuple_list_of(20,10)(30,10) ) - ( ba::tuple_list_of(30,10)(30,0) ) - ( ba::tuple_list_of(30,0)(20,0) ) - ( ba::tuple_list_of(21,1)(29,1) ) - ( ba::tuple_list_of(29,1)(29,9) ) - ( ba::tuple_list_of(29,9)(21,9) ) - ( ba::tuple_list_of(21,9)(21,1) ) - ); + TML{ + {{0,0},{0,10}}, + {{0,10},{10,10}}, + {{10,10},{10,0}}, + {{10,0},{0,0}}, + {{1,1},{9,1}}, + {{9,1},{9,9}}, + {{9,9},{1,9}}, + {{1,9},{1,1}}, + {{20,0},{20,10}}, + {{20,10},{30,10}}, + {{30,10},{30,0}}, + {{30,0},{20,0}}, + {{21,1},{29,1}}, + {{29,1},{29,9}}, + {{29,9},{21,9}}, + {{21,9},{21,1}} + }); tester::apply(from_wkt("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(1 1,9 1,9 9,1 9,1 1)),((20 0,20 10,30 10,30 0,20 0),(21 1,29 1,29 9,21 9,21 1)))"), - ba::list_of - ( ba::tuple_list_of(0,0)(0,10) ) - ( ba::tuple_list_of(0,10)(10,10) ) - ( ba::tuple_list_of(10,10)(10,0) ) - ( ba::tuple_list_of(10,0)(0,0) ) - ( ba::tuple_list_of(1,1)(9,1) ) - ( ba::tuple_list_of(9,1)(9,9) ) - ( ba::tuple_list_of(9,9)(1,9) ) - ( ba::tuple_list_of(1,9)(1,1) ) - ( ba::tuple_list_of(20,0)(20,10) ) - ( ba::tuple_list_of(20,10)(30,10) ) - ( ba::tuple_list_of(30,10)(30,0) ) - ( ba::tuple_list_of(30,0)(20,0) ) - ( ba::tuple_list_of(21,1)(29,1) ) - ( ba::tuple_list_of(29,1)(29,9) ) - ( ba::tuple_list_of(29,9)(21,9) ) - ( ba::tuple_list_of(21,9)(21,1) ) - ); + TML{ + {{0,0},{0,10}}, + {{0,10},{10,10}}, + {{10,10},{10,0}}, + {{10,0},{0,0}}, + {{1,1},{9,1}}, + {{9,1},{9,9}}, + {{9,9},{1,9}}, + {{1,9},{1,1}}, + {{20,0},{20,10}}, + {{20,10},{30,10}}, + {{30,10},{30,0}}, + {{30,0},{20,0}}, + {{21,1},{29,1}}, + {{29,1},{29,9}}, + {{29,9},{21,9}}, + {{21,9},{21,1}} + }); // test empty closed multi-polygons tester::apply(from_wkt("MULTIPOLYGON()"), - ba::list_of() + TML() ); tester::apply(from_wkt("MULTIPOLYGON((()))"), - ba::list_of() + TML() ); tester::apply(from_wkt("MULTIPOLYGON(((),()))"), - ba::list_of() + TML() ); tester::apply(from_wkt("MULTIPOLYGON(((),(),()))"), - ba::list_of() + TML() ); tester::apply(from_wkt("MULTIPOLYGON(((),(),()),(()))"), - ba::list_of() + TML() ); tester::apply(from_wkt("MULTIPOLYGON(((),(),()),((),()))"), - ba::list_of() + TML() ); #ifdef BOOST_GEOMETRY_TEST_DEBUG @@ -711,16 +712,16 @@ BOOST_AUTO_TEST_CASE( test_linestring_of_point_pointers ) typedef test_segment_iterator_of_geometry tester; tester::apply(linestring, - ba::list_of - ( ba::tuple_list_of(1,-1)(2,-2) ) - ( ba::tuple_list_of(2,-2)(3,-3) ) - ( ba::tuple_list_of(3,-3)(4,-4) ) - ( ba::tuple_list_of(4,-4)(5,-5) ) - ( ba::tuple_list_of(5,-5)(6,-6) ) - ( ba::tuple_list_of(6,-6)(7,-7) ) - ( ba::tuple_list_of(7,-7)(8,-8) ) - ( ba::tuple_list_of(8,-8)(9,-9) ) - ); + TML{ + {{1,-1},{2,-2}}, + {{2,-2},{3,-3}}, + {{3,-3},{4,-4}}, + {{4,-4},{5,-5}}, + {{5,-5},{6,-6}}, + {{6,-6},{7,-7}}, + {{7,-7},{8,-8}}, + {{8,-8},{9,-9}} + }); for (unsigned int i = 0; i < linestring.size(); i++) { @@ -744,14 +745,14 @@ BOOST_AUTO_TEST_CASE( test_linestring_copy_on_dereference ) typedef test_segment_iterator_of_geometry tester; tester::apply(from_wkt("LINESTRING(1 -1,2 -2,3 -3,4 -4,5 -5,6 -6, 7 -7,8 -8,9 -9)"), - ba::list_of - ( ba::tuple_list_of(1,-1)(2,-2) ) - ( ba::tuple_list_of(2,-2)(3,-3) ) - ( ba::tuple_list_of(3,-3)(4,-4) ) - ( ba::tuple_list_of(4,-4)(5,-5) ) - ( ba::tuple_list_of(5,-5)(6,-6) ) - ( ba::tuple_list_of(6,-6)(7,-7) ) - ( ba::tuple_list_of(7,-7)(8,-8) ) - ( ba::tuple_list_of(8,-8)(9,-9) ) - ); + TML{ + {{1,-1},{2,-2}}, + {{2,-2},{3,-3}}, + {{3,-3},{4,-4}}, + {{4,-4},{5,-5}}, + {{5,-5},{6,-6}}, + {{6,-6},{7,-7}}, + {{7,-7},{8,-8}}, + {{8,-8},{9,-9}} + }); } diff --git a/test/policies/rescale_policy.cpp b/test/policies/rescale_policy.cpp index c91f31988..f86b95bd7 100644 --- a/test/policies/rescale_policy.cpp +++ b/test/policies/rescale_policy.cpp @@ -5,6 +5,10 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021 Oracle and/or its affiliates. +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -15,21 +19,15 @@ #include #include -#include - #include #include #include #include -#include -#include -#include -#include -#include - #include - - +#include +#include +#include +#include #include @@ -94,14 +92,14 @@ static std::string simplex_large[2] = template void test_rescale(std::string const& expected_normal, std::string const& expected_large) { - typedef bg::model::polygon

polygon; + using polygon = bg::model::polygon

; - typedef typename boost::mpl::if_c + using rescale_policy_type = std::conditional_t < Rescale, - typename bg::rescale_policy_type

::type , + typename bg::rescale_policy_type

::type, bg::detail::no_rescale_policy - >::type rescale_policy_type; + >; test_one( simplex_normal[0], simplex_normal[1], @@ -125,7 +123,7 @@ int test_main(int, char* []) test_all("-5000000 -3000000", "-5000000 -3000000"); test_all("-5000000 -3000000", "-5000000 -3000000"); test_all("0 1", "0 1000"); - test_all("0 1", "0 1000"); + test_all("0 1", "0 1000"); // test_all(); // compiles but overflows return 0; diff --git a/test/robustness/overlay/areal_areal/general_intersection_precision.cpp b/test/robustness/overlay/areal_areal/general_intersection_precision.cpp index 6413f2d18..afd1bdbac 100644 --- a/test/robustness/overlay/areal_areal/general_intersection_precision.cpp +++ b/test/robustness/overlay/areal_areal/general_intersection_precision.cpp @@ -3,6 +3,10 @@ // Copyright (c) 2019 Barend Gehrels, Amsterdam, the Netherlands. +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021, 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) @@ -13,8 +17,6 @@ #include #include -#include - #include #include diff --git a/test/robustness/overlay/areal_areal/test_overlay_p_q.hpp b/test/robustness/overlay/areal_areal/test_overlay_p_q.hpp index 57813450f..2e1f421ce 100644 --- a/test/robustness/overlay/areal_areal/test_overlay_p_q.hpp +++ b/test/robustness/overlay/areal_areal/test_overlay_p_q.hpp @@ -1,7 +1,12 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Robustness Test -// + // Copyright (c) 2009-2020 Barend Gehrels, Amsterdam, the Netherlands. + +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021, 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) @@ -14,8 +19,6 @@ #include #include -#include - #include // For mixing int/float @@ -274,12 +277,12 @@ static bool test_overlay_p_q(std::string const& caseid, if (settings.also_difference) { - for (BOOST_AUTO(it, out_d1.begin()); it != out_d1.end(); ++it) + for (auto it = out_d1.begin(); it != out_d1.end(); ++it) { mapper.map(*it, "opacity:0.8;fill:none;stroke:rgb(255,128,0);stroke-width:4;stroke-dasharray:1,7;stroke-linecap:round"); } - for (BOOST_AUTO(it, out_d2.begin()); it != out_d2.end(); ++it) + for (auto it = out_d2.begin(); it != out_d2.end(); ++it) { mapper.map(*it, "opacity:0.8;fill:none;stroke:rgb(255,0,255);stroke-width:4;stroke-dasharray:1,7;stroke-linecap:round"); diff --git a/test/robustness/overlay/areal_areal/ticket_9081.cpp b/test/robustness/overlay/areal_areal/ticket_9081.cpp index 91f336c6f..6de0d1ce6 100644 --- a/test/robustness/overlay/areal_areal/ticket_9081.cpp +++ b/test/robustness/overlay/areal_areal/ticket_9081.cpp @@ -2,6 +2,10 @@ // Copyright (c) 2013-2015 Barend Gehrels, Amsterdam, the Netherlands. +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021, 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) @@ -11,23 +15,30 @@ #define CHECK_SELF_INTERSECTIONS #define LIST_WKT - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - -#include -#include -#include -#include #include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +namespace bg = boost::geometry; typedef boost::geometry::model::d2::point_xy pt; typedef boost::geometry::model::polygon polygon; @@ -62,7 +73,7 @@ inline void debug_with_svg(int index, char method, Geometry const& a, Geometry c mapper.map(a, "fill-opacity:0.5;fill:rgb(153,204,0);stroke:rgb(153,204,0);stroke-width:2"); mapper.map(b, "fill-opacity:0.3;fill:rgb(51,51,153);stroke:rgb(51,51,153);stroke-width:2"); - BOOST_FOREACH(polygon const& g, output) + for(polygon const& g : output) { mapper.map(g, "opacity:0.8;fill:none;stroke:rgb(255,128,0);stroke-width:4;stroke-dasharray:1,7;stroke-linecap:round"); } @@ -87,6 +98,14 @@ int main() std::string wkt1, wkt2, operation; + + typename bg::strategies::relate::services::default_strategy + < + multi_polygon, multi_polygon + >::type strategy; + + using rescale_policy_type = typename bg::rescale_policy_type::type; + try { @@ -94,19 +113,23 @@ int main() boost::timer t; std::vector poly_list; - for(int i=0;i(mp, strategy); + + bg::detail::overlay::has_self_intersections(mp, strategy, robust_policy); std::ostringstream out; out << "original " << poly_list.size(); @@ -119,7 +142,7 @@ int main() } - for(int j=0;j(mp_i, strategy); + try { - boost::geometry::detail::overlay::has_self_intersections(mp_i); + boost::geometry::detail::overlay::has_self_intersections(mp_i, strategy, robust_policy_i); } catch(...) { @@ -162,7 +189,7 @@ int main() std::cout << boost::geometry::wkt(mp_i) << std::endl; try { - boost::geometry::detail::overlay::has_self_intersections(mp_i); + boost::geometry::detail::overlay::has_self_intersections(mp_i, strategy, robust_policy_i); } catch(...) { @@ -170,9 +197,12 @@ int main() break; } + rescale_policy_type robust_policy_d + = bg::get_rescale_policy(mp_d, strategy); + try { - boost::geometry::detail::overlay::has_self_intersections(mp_d); + boost::geometry::detail::overlay::has_self_intersections(mp_d, strategy, robust_policy_d); } catch(...) { @@ -182,9 +212,13 @@ int main() std::cout << boost::geometry::wkt(mp_d) << std::endl; break; } + + rescale_policy_type robust_policy_e + = bg::get_rescale_policy(mp_e, strategy); + try { - boost::geometry::detail::overlay::has_self_intersections(mp_e); + boost::geometry::detail::overlay::has_self_intersections(mp_e, strategy, robust_policy_e); } catch(...) { diff --git a/test/robustness/overlay/buffer/multi_point_growth.cpp b/test/robustness/overlay/buffer/multi_point_growth.cpp index 4aed939cf..5058346eb 100644 --- a/test/robustness/overlay/buffer/multi_point_growth.cpp +++ b/test/robustness/overlay/buffer/multi_point_growth.cpp @@ -3,16 +3,24 @@ // Copyright (c) 2012-2015 Barend Gehrels, Amsterdam, the Netherlands. +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021, 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) -#include -#include - -#include -#include +#include #include +#include + +#include + +#include +#include +#include +#include namespace bg = boost::geometry; @@ -73,7 +81,7 @@ double test_growth(Geometry const& geometry, int n, int d, double distance) typename bg::default_area_result::type area = 0; - BOOST_FOREACH(GeometryOut const& polygon, buffered) + for (GeometryOut const& polygon : buffered) { area += bg::area(polygon); } @@ -82,7 +90,7 @@ double test_growth(Geometry const& geometry, int n, int d, double distance) // Map input geometry in green mapper.map(geometry, "opacity:0.5;fill:rgb(0,128,0);stroke:rgb(0,128,0);stroke-width:10"); - BOOST_FOREACH(GeometryOut const& polygon, buffered) + for (GeometryOut const& polygon : buffered) { mapper.map(polygon, "opacity:0.4;fill:rgb(255,255,128);stroke:rgb(0,0,0);stroke-width:3"); } diff --git a/test/robustness/overlay/buffer/recursive_polygons_buffer.cpp b/test/robustness/overlay/buffer/recursive_polygons_buffer.cpp index 3fe64a3bc..13dba836b 100644 --- a/test/robustness/overlay/buffer/recursive_polygons_buffer.cpp +++ b/test/robustness/overlay/buffer/recursive_polygons_buffer.cpp @@ -3,10 +3,10 @@ // Copyright (c) 2012-2020 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2015. -// Modifications copyright (c) 2015 Oracle and/or its affiliates. - +// This file was modified by Oracle on 2015-2021. +// Modifications copyright (c) 2015-2021 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 @@ -39,8 +39,8 @@ #include #include -#include -#include +#include +#include struct buffer_settings : public common_settings diff --git a/test/robustness/overlay/linear_areal/recursive_polygons_linear_areal.cpp b/test/robustness/overlay/linear_areal/recursive_polygons_linear_areal.cpp index b3a5311b4..adb6a65ac 100644 --- a/test/robustness/overlay/linear_areal/recursive_polygons_linear_areal.cpp +++ b/test/robustness/overlay/linear_areal/recursive_polygons_linear_areal.cpp @@ -3,6 +3,10 @@ // Copyright (c) 2012-2015 Barend Gehrels, Amsterdam, the Netherlands. +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021, 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) @@ -15,7 +19,6 @@ #include #include -#include #include #include #include @@ -23,15 +26,21 @@ #include #include -#include +#include +#include +#include +#include +#include + +#include + #include #include #include -#include -#include -#include +#include +#include namespace bg = boost::geometry; @@ -197,20 +206,18 @@ public : typedef typename bg::point_type::type pt; typedef bg::model::segment segment_type; - typedef bg::strategy::intersection::relate_cartesian_segments - < - bg::policies::relate::segments_intersection_points - < - segment_type, - segment_type, - bg::segment_intersection_points - > - > policy; + bg::strategy::intersection::cartesian_segments<> strategy; + bg::policies::relate::segments_intersection_points + < + bg::segment_intersection_points + > policy; segment_type seg1, seg2; bg::convert(m_segment, seg1); bg::convert(segment, seg2); - bg::segment_intersection_points is = policy::apply(seg1, seg2); + + // TODO: this function requires unique subranges now + bg::segment_intersection_points is = strategy.apply(seg1, seg2); if (is.count == 2) { @@ -297,7 +304,7 @@ bool verify(std::string const& caseid, MultiPolygon const& mp, Linestring const& bg::for_each_segment(difference, bc); // 3) check also the mid-points from the difference to remove false positives - BOOST_FOREACH(Linestring const& d, difference) + for (Linestring const& d : difference) { Linestring difference_midpoints; bg::midpoints(d, false, std::back_inserter(difference_midpoints)); diff --git a/test/srs/proj4.hpp b/test/srs/proj4.hpp index 10a7f4dd5..e59970136 100644 --- a/test/srs/proj4.hpp +++ b/test/srs/proj4.hpp @@ -1,6 +1,6 @@ // Boost.Geometry -// Copyright (c) 2017-2019, Oracle and/or its affiliates. +// Copyright (c) 2017-2021, 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, @@ -14,6 +14,7 @@ #include #include +#include #if defined(TEST_WITH_PROJ6) #define TEST_WITH_PROJ5 @@ -152,30 +153,14 @@ struct pj_transformation forward(in_xy[i], out_xy[i]); } - template - void forward(In const& in, Out & out, - typename boost::enable_if_c - < - boost::is_same - < - typename boost::geometry::tag::type, - boost::geometry::point_tag - >::value - >::type* dummy = 0) const + template = 0> + void forward(In const& in, Out & out) const { transform_point(in, out, m_from, m_to); } - template - void inverse(In const& in, Out & out, - typename boost::enable_if_c - < - boost::is_same - < - typename boost::geometry::tag::type, - boost::geometry::point_tag - >::value - >::type* dummy = 0) const + template = 0> + void inverse(In const& in, Out & out) const { transform_point(in, out, m_to, m_from); } @@ -256,16 +241,8 @@ struct proj5_transformation out = std::move(in); } - template - void forward(In const& in, Out & out, - typename boost::enable_if_c - < - boost::is_same - < - typename boost::geometry::tag::type, - boost::geometry::point_tag - >::value - >::type* dummy = 0) const + template = 0> + void forward(In const& in, Out & out) const { PJ_COORD c; c.lp.lam = boost::geometry::get_as_radian<0>(in); @@ -300,16 +277,8 @@ struct proj6_transformation out = std::move(in); } - template - void forward(In const& in, Out & out, - typename boost::enable_if_c - < - boost::is_same - < - typename boost::geometry::tag::type, - boost::geometry::point_tag - >::value - >::type* dummy = 0) const + template = 0> + void forward(In const& in, Out & out) const { PJ_COORD c; c.lp.lam = boost::geometry::get_as_radian<0>(in); diff --git a/test/srs/projection_interface_s.cpp b/test/srs/projection_interface_s.cpp index 571eb3ac9..9e260bf05 100644 --- a/test/srs/projection_interface_s.cpp +++ b/test/srs/projection_interface_s.cpp @@ -82,8 +82,8 @@ int test_main(int, char*[]) // compile-time errors { - point_ll pt_ll(1, 1); - point_xy pt_xy(0, 0); + //point_ll pt_ll(1, 1); + //point_xy pt_xy(0, 0); //projection > prj1; //projection prj2; diff --git a/test/srs/spar.cpp b/test/srs/spar.cpp index c8650d8b8..76701f61a 100644 --- a/test/srs/spar.cpp +++ b/test/srs/spar.cpp @@ -1,7 +1,7 @@ // Boost.Geometry // Unit Test -// Copyright (c) 2018, Oracle and/or its affiliates. +// Copyright (c) 2018-2021, 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, @@ -27,30 +27,40 @@ int test_main(int, char* []) typedef par::o_proj o_proj; typedef par::guam guam; - BOOST_MPL_ASSERT_MSG((par::detail::is_param_tr::pred::value), - PROJ, (proj)); - BOOST_MPL_ASSERT_MSG((!par::detail::is_param_tr::pred::value), - NOT_PROJ, (int)); + BOOST_GEOMETRY_STATIC_ASSERT( + (par::detail::is_param_tr::pred::value), + "proj", proj); + BOOST_GEOMETRY_STATIC_ASSERT( + (!par::detail::is_param_tr::pred::value), + "not proj", int); - BOOST_MPL_ASSERT_MSG((par::detail::is_param_tr::pred::value), - ELLPS, (ellps)); - BOOST_MPL_ASSERT_MSG((!par::detail::is_param_tr::pred::value), - NOT_ELLPS, (int)); + BOOST_GEOMETRY_STATIC_ASSERT( + (par::detail::is_param_tr::pred::value), + "ellps", ellps); + BOOST_GEOMETRY_STATIC_ASSERT( + (!par::detail::is_param_tr::pred::value), + "not ellps", int); - BOOST_MPL_ASSERT_MSG((par::detail::is_param_tr::pred::value), - DATUM, (datum)); - BOOST_MPL_ASSERT_MSG((!par::detail::is_param_tr::pred::value), - NOT_DATUM, (int)); + BOOST_GEOMETRY_STATIC_ASSERT( + (par::detail::is_param_tr::pred::value), + "datum", datum); + BOOST_GEOMETRY_STATIC_ASSERT( + (!par::detail::is_param_tr::pred::value), + "not datum", int); - BOOST_MPL_ASSERT_MSG((par::detail::is_param_t::pred::value), - O_PROJ, (o_proj)); - BOOST_MPL_ASSERT_MSG((!par::detail::is_param_t::pred::value), - NOT_O_PROJ, (int)); + BOOST_GEOMETRY_STATIC_ASSERT( + (par::detail::is_param_t::pred::value), + "o_proj", o_proj); + BOOST_GEOMETRY_STATIC_ASSERT( + (!par::detail::is_param_t::pred::value), + "not o_proj", int); - BOOST_MPL_ASSERT_MSG((par::detail::is_param::pred::value), - GUAM, (guam)); - BOOST_MPL_ASSERT_MSG((!par::detail::is_param::pred::value), - NOT_GUAM, (int)); + BOOST_GEOMETRY_STATIC_ASSERT( + (par::detail::is_param::pred::value), + "guam", guam); + BOOST_GEOMETRY_STATIC_ASSERT( + (!par::detail::is_param::pred::value), + "not guam", int); typedef par::parameters params; typedef par::parameters params_e; diff --git a/test/strategies/distance.cpp b/test/strategies/distance.cpp index f4dd5381a..e2ff21944 100644 --- a/test/strategies/distance.cpp +++ b/test/strategies/distance.cpp @@ -1,8 +1,8 @@ // Boost.Geometry -// Copyright (c) 2017 Oracle and/or its affiliates. - +// Copyright (c) 2017-2021 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 @@ -28,8 +28,8 @@ typedef bg::strategy::vincenty vincenty_formula; template bool non_precise_ct() { - typedef typename bg::coordinate_type

::type ct; - return boost::is_integral::value || boost::is_float::value; + using ct = typename bg::coordinate_type

::type; + return std::is_integral::value || std::is_floating_point::value; } template diff --git a/test/strategies/distance_default_result.cpp b/test/strategies/distance_default_result.cpp index 4ee721bbd..a51404cfa 100644 --- a/test/strategies/distance_default_result.cpp +++ b/test/strategies/distance_default_result.cpp @@ -1,9 +1,9 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test -// Copyright (c) 2014, Oracle and/or its affiliates. - +// Copyright (c) 2014-2021, 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 // Licensed under the Boost Software License version 1.0. // http://www.boost.org/users/license.html @@ -17,10 +17,6 @@ #include -#include -#include -#include - #include #include @@ -35,17 +31,12 @@ namespace bg = ::boost::geometry; template -struct assert_equal_types +inline void assert_equal_types() { - assert_equal_types() - { - static const bool are_same = - boost::is_same::type::value; - - BOOST_MPL_ASSERT_MSG((are_same), - WRONG_DEFAULT_DISTANCE_RESULT, - (types)); - } + BOOST_GEOMETRY_STATIC_ASSERT( + (std::is_same::value), + "Wrong default distance result", + DefaultResult, ExpectedResult); }; //========================================================================= @@ -179,20 +170,20 @@ struct test_distance_result_box template inline void test_segment_all() { - typedef typename boost::mpl::if_ + using fp_return_type = std::conditional_t < - typename boost::is_same::type, + std::is_same::value, double, float - >::type float_return_type; + >; test_distance_result_segment(); test_distance_result_segment(); test_distance_result_segment(); test_distance_result_segment(); - test_distance_result_segment(); - test_distance_result_segment(); + test_distance_result_segment(); + test_distance_result_segment(); test_distance_result_segment(); test_distance_result_segment(); diff --git a/test/strategies/douglas_peucker.cpp b/test/strategies/douglas_peucker.cpp index c9216d555..c3a6193b9 100644 --- a/test/strategies/douglas_peucker.cpp +++ b/test/strategies/douglas_peucker.cpp @@ -2,7 +2,6 @@ // Unit Test // Copyright (c) 2015-2021, 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 @@ -24,11 +23,20 @@ #include #include +#include #include +#include + +#include +#include +#include #include #include +#include +#include + #include #include @@ -36,21 +44,8 @@ #include #include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - namespace bg = ::boost::geometry; -namespace ba = ::boost::assign; namespace services = bg::strategy::distance::services; typedef boost::tuple tuple_point_type; @@ -91,7 +86,7 @@ template inline Geometry from_wkt(std::string const& wkt) { Geometry geometry; - boost::geometry::read_wkt(wkt, geometry); + bg::read_wkt(wkt, geometry); return geometry; } @@ -151,14 +146,15 @@ struct equals template struct test_one_case { - template + using point_type = typename bg::point_type::type; + + template static inline void apply(std::string const& case_id, std::string const& wkt, double max_distance, Strategy const& strategy, - Range const& expected_result) + std::initializer_list const& expected_result) { - typedef typename bg::point_type::type point_type; std::vector result; Geometry geometry = from_wkt(wkt); @@ -227,7 +223,7 @@ inline void test_with_strategy(std::string label) "LINESTRING(12 -3, 4 8,-6 -13,-9 4,0 -15,-12 5)", 10, strategy, - ba::tuple_list_of(12,-3)(4,8)(-6,-13)(-12,5) + {{12,-3},{4,8},{-6,-13},{-12,5}} ); } else @@ -236,7 +232,7 @@ inline void test_with_strategy(std::string label) "LINESTRING(12 -3, 4 8,-6 -13,-9 4,0 -15,-12 5)", 10, strategy, - ba::tuple_list_of(12,-3)(4,8)(-6,-13)(-9,4)(0,-15)(-12,5) + {{12,-3},{4,8},{-6,-13},{-9,4},{0,-15},{-12,5}} ); } } @@ -245,21 +241,21 @@ inline void test_with_strategy(std::string label) "LINESTRING(-6 -13,-9 4,0 -15,-12 5)", 10, strategy, - ba::tuple_list_of(-6,-13)(-12,5) + {{-6,-13},{-12,5}} ); tester::apply("l03" + label, "LINESTRING(12 -3, 4 8,-6 -13,-9 4,0 -14,-12 5)", 10, strategy, - ba::tuple_list_of(12,-3)(4,8)(-6,-13)(-12,5) + {{12,-3},{4,8},{-6,-13},{-12,5}} ); tester::apply("l04" + label, "LINESTRING(12 -3, 4 8,-6 -13,-9 4,0 -14,-12 5)", 14, strategy, - ba::tuple_list_of(12,-3)(-6,-13)(-12,5) + {{12,-3},{-6,-13},{-12,5}} ); { @@ -306,13 +302,13 @@ inline void test_with_strategy(std::string label) wkt, 1, strategy, - ba::tuple_list_of(0,0)(5,0)(0,-1)(5,-1)(0,-2)(5,-2)(0,-3)(5,-4)(0,0) + {{0,0},{5,0},{0,-1},{5,-1},{0,-2},{5,-2},{0,-3},{5,-4},{0,0}} ); tester::apply("l05c1a" + label, wkt, 2, strategy, - ba::tuple_list_of(0,0)(5,0)(0,-1)(5,-1)(0,-2)(5,-4)(0,0) + {{0,0},{5,0},{0,-1},{5,-1},{0,-2},{5,-4},{0,0}} ); } else @@ -321,13 +317,13 @@ inline void test_with_strategy(std::string label) wkt, 1, strategy, - ba::tuple_list_of(0,0)(5,0)(0,-1)(5,-1)(0,-2)(5,-2)(0,-4)(5,-4)(0,0) + {{0,0},{5,0},{0,-1},{5,-1},{0,-2},{5,-2},{0,-4},{5,-4},{0,0}} ); tester::apply("l05c2a" + label, wkt, 2, strategy, - ba::tuple_list_of(0,0)(5,0)(0,-1)(5,-1)(0,-4)(5,-4)(0,0) + {{0,0},{5,0},{0,-1},{5,-1},{0,-4},{5,-4},{0,0}} ); } } diff --git a/test/strategies/pythagoras.cpp b/test/strategies/pythagoras.cpp index 66fd77634..bfa406160 100644 --- a/test/strategies/pythagoras.cpp +++ b/test/strategies/pythagoras.cpp @@ -5,6 +5,10 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021 Oracle and/or its affiliates. +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -19,7 +23,8 @@ # pragma warning( disable : 4101 ) #endif -#include +// TODO move this to another non-unit test +//#include #include #include @@ -289,37 +294,38 @@ void test_all_3d() test_all_3d >(); } -template -void time_compare_s(int const n) -{ - boost::timer t; - P p1, p2; - bg::assign_values(p1, 1, 1); - bg::assign_values(p2, 2, 2); - Strategy strategy; - typename bg::strategy::distance::services::return_type::type s = 0; - for (int i = 0; i < n; i++) - { - for (int j = 0; j < n; j++) - { - bg::set<0>(p2, bg::get<0>(p2) + 0.001); - s += strategy.apply(p1, p2); - } - } - std::cout << "s: " << s << " t: " << t.elapsed() << std::endl; -} - -template -void time_compare(int const n) -{ - time_compare_s >(n); - time_compare_s >(n); -} +// TODO move this to another non-unit test +//template +//void time_compare_s(int const n) +//{ +// boost::timer t; +// P p1, p2; +// bg::assign_values(p1, 1, 1); +// bg::assign_values(p2, 2, 2); +// Strategy strategy; +// typename bg::strategy::distance::services::return_type::type s = 0; +// for (int i = 0; i < n; i++) +// { +// for (int j = 0; j < n; j++) +// { +// bg::set<0>(p2, bg::get<0>(p2) + 0.001); +// s += strategy.apply(p1, p2); +// } +// } +// std::cout << "s: " << s << " t: " << t.elapsed() << std::endl; +//} +// +//template +//void time_compare(int const n) +//{ +// time_compare_s >(n); +// time_compare_s >(n); +//} int test_main(int, char* []) { test_integer(true); - test_integer(true); + test_integer(true); test_integer(false); test_all_3d(); diff --git a/test/strategies/pythagoras_point_box.cpp b/test/strategies/pythagoras_point_box.cpp index 1596454d3..cc5a5fe25 100644 --- a/test/strategies/pythagoras_point_box.cpp +++ b/test/strategies/pythagoras_point_box.cpp @@ -5,9 +5,8 @@ // Copyright (c) 2008-2014 Bruno Lalande, Paris, France. // Copyright (c) 2009-2014 Mateusz Loskot, London, UK. -// This file was modified by Oracle on 2014-2020. -// Modifications copyright (c) 2014-2020, Oracle and/or its affiliates. - +// This file was modified by Oracle on 2014-2021. +// Modifications copyright (c) 2014-2021, 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 @@ -29,7 +28,9 @@ #endif #include -#include + +// TODO move this to another non-unit test +//#include #include #include @@ -365,8 +366,8 @@ inline void test_integer(bool check_types) if (check_types) { - BOOST_CHECK((boost::is_same::type::value)); - BOOST_CHECK((boost::is_same::type::value)); + BOOST_CHECK((std::is_same::type::value)); + BOOST_CHECK((std::is_same::type::value)); } } @@ -394,41 +395,43 @@ void test_all_3d() test_all_3d >(); } -template -void time_compare_s(int const n) -{ - typedef bg::model::box

box_type; - boost::timer t; - P p; - box_type b; - bg::assign_values(b, 0, 0, 1, 1); - bg::assign_values(p, 2, 2); - Strategy strategy; - typename bg::strategy::distance::services::return_type - < - Strategy, P, box_type - >::type s = 0; - for (int i = 0; i < n; i++) - { - for (int j = 0; j < n; j++) - { - bg::set<0>(p, bg::get<0>(p) + 0.001); - s += strategy.apply(p, b); - } - } - std::cout << "s: " << s << " t: " << t.elapsed() << std::endl; -} - -template -inline void time_compare(int const n) -{ - time_compare_s >(n); - time_compare_s - < - P, bg::strategy::distance::comparable::pythagoras_point_box<> - >(n); -} +// TODO move this to another non-unit test +//template +//void time_compare_s(int const n) +//{ +// typedef bg::model::box

box_type; +// +// boost::timer t; +// P p; +// box_type b; +// bg::assign_values(b, 0, 0, 1, 1); +// bg::assign_values(p, 2, 2); +// Strategy strategy; +// typename bg::strategy::distance::services::return_type +// < +// Strategy, P, box_type +// >::type s = 0; +// for (int i = 0; i < n; i++) +// { +// for (int j = 0; j < n; j++) +// { +// bg::set<0>(p, bg::get<0>(p) + 0.001); +// s += strategy.apply(p, b); +// } +// } +// std::cout << "s: " << s << " t: " << t.elapsed() << std::endl; +//} +// +//template +//inline void time_compare(int const n) +//{ +// time_compare_s >(n); +// time_compare_s +// < +// P, bg::strategy::distance::comparable::pythagoras_point_box<> +// >(n); +//} @@ -436,7 +439,7 @@ inline void time_compare(int const n) BOOST_AUTO_TEST_CASE( test_integer_all ) { test_integer(true); - test_integer(true); + test_integer(true); test_integer(false); } diff --git a/test/strategies/vincenty.cpp b/test/strategies/vincenty.cpp index e0b0e4059..dd4e5f4d8 100644 --- a/test/strategies/vincenty.cpp +++ b/test/strategies/vincenty.cpp @@ -5,9 +5,8 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. -// This file was modified by Oracle on 2014, 2015, 2016, 2017. -// Modifications copyright (c) 2014-2017 Oracle and/or its affiliates. - +// This file was modified by Oracle on 2014-2021. +// Modifications copyright (c) 2014-2021 Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library @@ -96,8 +95,8 @@ double azimuth(double deg, double min) template bool non_precise_ct() { - typedef typename bg::coordinate_type

::type ct; - return boost::is_integral::value || boost::is_float::value; + using ct = typename bg::coordinate_type

::type; + return std::is_integral::value || std::is_floating_point::value; } template @@ -248,8 +247,8 @@ void test_all() // Test fractional coordinates only for non-integral types if ( BOOST_GEOMETRY_CONDITION( - ! boost::is_integral::type>::value - && ! boost::is_integral::type>::value ) ) + ! std::is_integral::type>::value + && ! std::is_integral::type>::value ) ) { // Flinders Peak -> Buninyong test_vincenty(azimuth(144,25,29.52440), azimuth(-37,57,3.72030), diff --git a/test/string_from_type.hpp b/test/string_from_type.hpp index 8d2bd6db8..6d02b8b15 100644 --- a/test/string_from_type.hpp +++ b/test/string_from_type.hpp @@ -4,10 +4,10 @@ // Copyright (c) 2008-2015 Bruno Lalande, Paris, France. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK. -// This file was modified by Oracle on 2015. -// Modifications copyright (c) 2015, Oracle and/or its affiliates. - +// This file was modified by Oracle on 2015-2021. +// Modifications copyright (c) 2015-2021, 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 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -50,11 +50,9 @@ template <> struct string_from_type template <> struct string_from_type { static std::string name() { return "m"; } }; -#if defined(BOOST_HAS_LONG_LONG) // this is what g++ and clang++ use -template <> struct string_from_type +template <> struct string_from_type { static std::string name() { return "x"; } }; -#endif #if defined(BOOST_HAS_INT128) // this is what g++ and clang++ use diff --git a/test/test_common/test_point.hpp b/test/test_common/test_point.hpp index 31b124867..3f888a2f5 100644 --- a/test/test_common/test_point.hpp +++ b/test/test_common/test_point.hpp @@ -3,6 +3,11 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. + +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021 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) @@ -60,7 +65,7 @@ template<> struct coordinate_system { typedef cs::cartesian type; }; template<> -struct dimension: boost::mpl::int_<3> {}; +struct dimension : std::integral_constant {}; template<> struct access { diff --git a/test/test_common/with_pointer.hpp b/test/test_common/with_pointer.hpp index 9c7b95db7..1e77e0e64 100644 --- a/test/test_common/with_pointer.hpp +++ b/test/test_common/with_pointer.hpp @@ -3,6 +3,11 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. + +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021 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) @@ -48,7 +53,7 @@ template<> struct coordinate_type template<> struct coordinate_system { typedef cs::cartesian type; }; -template<> struct dimension : boost::mpl::int_<2> {}; +template<> struct dimension : std::integral_constant {}; template<> struct access diff --git a/test/test_geometries/custom_lon_lat_point.hpp b/test/test_geometries/custom_lon_lat_point.hpp index 1d49dcc00..5c0dc0d9d 100644 --- a/test/test_geometries/custom_lon_lat_point.hpp +++ b/test/test_geometries/custom_lon_lat_point.hpp @@ -1,9 +1,9 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test -// Copyright (c) 2014, Oracle and/or its affiliates. - +// Copyright (c) 2014-2021, 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 // Licensed under the Boost Software License version 1.0. // http://www.boost.org/users/license.html @@ -11,8 +11,6 @@ #ifndef BOOST_GEOMETRY_TEST_TEST_GEOMETRIES_CUSTOM_LON_LAT_POINT_HPP #define BOOST_GEOMETRY_TEST_TEST_GEOMETRIES_CUSTOM_LON_LAT_POINT_HPP -#include - #include #include #include @@ -51,7 +49,7 @@ struct coordinate_system > template struct dimension > - : boost::mpl::int_<2> + : std::integral_constant {}; template @@ -109,7 +107,7 @@ struct coordinate_system > template struct dimension > - : boost::mpl::int_<2> + : std::integral_constant {}; template diff --git a/test/to_svg.hpp b/test/to_svg.hpp index 10c13f800..6897fcf96 100644 --- a/test/to_svg.hpp +++ b/test/to_svg.hpp @@ -2,32 +2,31 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2014. -// Modifications copyright (c) 2014 Oracle and/or its affiliates. +// This file was modified by Oracle on 2014-2021. +// Modifications copyright (c) 2014-2021 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) -// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle - #ifndef BOOST_GEOMETRY_TEST_TO_SVG_HPP #define BOOST_GEOMETRY_TEST_TO_SVG_HPP #include -#include -#include #include #include #include #include #include #include -#include - #include +#include +#include + + template inline void turns_to_svg(Turns const& turns, Mapper & mapper, bool /*enrich*/ = false) { @@ -42,7 +41,7 @@ inline void turns_to_svg(Turns const& turns, Mapper & mapper, bool /*enrich*/ = int index = 0; int const margin = 5; - BOOST_FOREACH(turn_info const& turn, turns) + for (turn_info const& turn : turns) { int lineheight = 10; mapper.map(turn.point, "fill:rgb(255,128,0);" diff --git a/test/util/calculation_type.cpp b/test/util/calculation_type.cpp index 6e026676f..7ddc989fb 100644 --- a/test/util/calculation_type.cpp +++ b/test/util/calculation_type.cpp @@ -5,6 +5,10 @@ // Copyright (c) 2012 Bruno Lalande, Paris, France. // Copyright (c) 2012 Mateusz Loskot, London, UK. +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021, 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) @@ -58,7 +62,7 @@ void test() std::string const caption = helper(); - BOOST_CHECK_MESSAGE((boost::is_same::type::value), + BOOST_CHECK_MESSAGE((std::is_same::value), "Failure, types do not agree;" << " input: " << caption << " defaults: " << typeid(DefaultFP).name() @@ -88,7 +92,7 @@ void test_with_calculation_type() std::string const caption = helper(); - BOOST_CHECK_MESSAGE((boost::is_same::type::value), + BOOST_CHECK_MESSAGE((std::is_same::value), "Failure, types do not agree;" << " input: " << caption << " calculation type: " << typeid(CalculationType).name() @@ -114,7 +118,7 @@ void test_unary() DefaultInt >::type type; - BOOST_CHECK_MESSAGE((boost::is_same::type::value), + BOOST_CHECK_MESSAGE((std::is_same::value), "Failure, types do not agree;" << " input: " << typeid(typename bg::coordinate_type::type).name() << " defaults: " << typeid(DefaultFP).name() @@ -148,7 +152,7 @@ void test_ternary() std::string const caption = helper3(); - BOOST_CHECK_MESSAGE((boost::is_same::type::value), + BOOST_CHECK_MESSAGE((std::is_same::value), "Failure, types do not agree;" << " input: " << caption << " defaults: " << typeid(DefaultFP).name() @@ -169,7 +173,7 @@ int test_main(int, char* []) typedef model::point i; typedef model::point c; typedef model::point s; - typedef model::point ll; + typedef model::point ll; typedef model::point u; // Calculation type "void" so @@ -187,11 +191,11 @@ int test_main(int, char* []) test(); test(); test(); - test(); + test(); // Even if we specify "int" as default-calculation-type, it should never go downwards. // So it will select "long long" - test(); + test(); // user defined test(); diff --git a/test/util/is_implemented.cpp b/test/util/is_implemented.cpp index 3eed994b4..dd6e09b0f 100644 --- a/test/util/is_implemented.cpp +++ b/test/util/is_implemented.cpp @@ -74,14 +74,14 @@ int test_main(int, char* []) typedef bg::model::d2::point_xy point_type; BOOST_MPL_ASSERT(( - boost::is_same< + std::is_same< bg::util::is_implemented2 < point_type, point_type, bg::algorithm_archetype >::type, boost::mpl::false_ - > + >::value )); return 0; diff --git a/test/util/math_sqrt.cpp b/test/util/math_sqrt.cpp index 0907990ab..e06bc05af 100644 --- a/test/util/math_sqrt.cpp +++ b/test/util/math_sqrt.cpp @@ -1,9 +1,9 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test -// Copyright (c) 2014, Oracle and/or its affiliates. - +// Copyright (c) 2014-2021, 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 // Licensed under the Boost Software License version 1.0. // http://www.boost.org/users/license.html @@ -14,11 +14,11 @@ #include #include +#include #include #include -#include #include "number_types.hpp" @@ -26,8 +26,8 @@ // otherwise the test will fail for the custom number type: // custom_with_global_sqrt -#include #include +#include namespace bg = boost::geometry; @@ -35,68 +35,44 @@ namespace bg = boost::geometry; // call BOOST_CHECK -template -struct check +template +< + typename Argument, typename Result, + std::enable_if_t::value, int> = 0 +> +inline void check(Argument const& arg, Result const& result) { - template - static inline void apply(Argument const& arg, Result const& result) - { - BOOST_CHECK_CLOSE(static_cast(bg::math::sqrt(arg)), - static_cast(result), - 0.00001); - } -}; + BOOST_CHECK_CLOSE(static_cast(bg::math::sqrt(arg)), + static_cast(result), + 0.00001); +} - -template -struct check +template +< + typename Argument, typename Result, + std::enable_if_t::value, int> = 0 +> +inline void check(Argument const& arg, Result const& result) { - template - static inline void apply(Argument const& arg, Result const& result) - { - Result const tol(0.00001); - BOOST_CHECK( bg::math::abs(bg::math::sqrt(arg) - result) < tol ); - } -}; - - - - + Result const tol(0.00001); + BOOST_CHECK( bg::math::abs(bg::math::sqrt(arg) - result) < tol ); +} // test sqrt return type and value -template -< - typename Argument, - typename ExpectedResult, - typename Result = typename bg::math::detail::square_root - < - Argument - >::return_type, - bool IsFundamental = boost::is_fundamental::value -> -struct check_sqrt - : bg::not_implemented -{}; - - -template -struct check_sqrt +template +inline void check_sqrt(Argument const& arg, Result const& result) { - static inline void apply(Argument const& arg, Result const& result) - { + using return_type = typename bg::math::detail::square_root::return_type; + BOOST_GEOMETRY_STATIC_ASSERT((std::is_same::value), "Wrong return type"); + #ifdef BOOST_GEOMETRY_TEST_DEBUG - std::cout << "testing: " << typeid(Result).name() - << " sqrt(" << typeid(Argument).name() - << ")" << std::endl; + std::cout << "testing: " << typeid(Result).name() + << " sqrt(" << typeid(Argument).name() + << ")" << std::endl; #endif - check::apply(arg, result); - } -}; - - - - + check(arg, result); +} // test cases @@ -106,24 +82,17 @@ BOOST_AUTO_TEST_CASE( test_math_sqrt_fundamental ) static const long double sqrt2L = std::sqrt(2.0L); static const float sqrt2F = std::sqrt(2.0F); - check_sqrt::apply(2.0F, sqrt2F); - check_sqrt::apply(2.0, sqrt2); - check_sqrt::apply(2.0L, sqrt2L); + check_sqrt(2.0F, sqrt2F); + check_sqrt(2.0, sqrt2); + check_sqrt(2.0L, sqrt2L); - check_sqrt::apply(2, sqrt2); - check_sqrt::apply(2, sqrt2); - check_sqrt::apply(2, sqrt2); - check_sqrt::apply(2, sqrt2); - check_sqrt::apply(2L, sqrt2); -#if !defined(BOOST_NO_LONG_LONG) - check_sqrt::apply(2LL, sqrt2); -#endif -#ifdef BOOST_HAS_LONG_LONG - check_sqrt - < - boost::long_long_type, double - >::apply(boost::long_long_type(2), sqrt2); -#endif + check_sqrt(2, sqrt2); + check_sqrt(2, sqrt2); + check_sqrt(2, sqrt2); + check_sqrt(2, sqrt2); + check_sqrt(2L, sqrt2); + + check_sqrt(2LL, sqrt2); } @@ -135,7 +104,7 @@ BOOST_AUTO_TEST_CASE( test_math_sqrt_custom ) static const double sqrt2 = std::sqrt(2.0); - check_sqrt::apply(custom1(2.0), custom1(sqrt2)); - check_sqrt::apply(custom2(2.0), custom2(sqrt2)); - check_sqrt::apply(custom3(2.0), custom3(sqrt2)); + check_sqrt(custom1(2.0), custom1(sqrt2)); + check_sqrt(custom2(2.0), custom2(sqrt2)); + check_sqrt(custom3(2.0), custom3(sqrt2)); } diff --git a/test/util/promote_integral.cpp b/test/util/promote_integral.cpp index 670f78904..babad6491 100644 --- a/test/util/promote_integral.cpp +++ b/test/util/promote_integral.cpp @@ -1,8 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test -// Copyright (c) 2015-2020, Oracle and/or its affiliates. - +// Copyright (c) 2015-2021, 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 @@ -290,12 +289,10 @@ struct test_promotion { tester::template apply(case_id); } -#if defined(BOOST_HAS_LONG_LONG) - else if (bit_size() >= min_size) + else if (bit_size() >= min_size) { - tester::template apply(case_id); + tester::template apply(case_id); } -#endif #if defined(BOOST_HAS_INT128) && defined(BOOST_GEOMETRY_ENABLE_INT128) else if (bit_size() >= min_size) { @@ -360,12 +357,10 @@ struct test_promotion { tester::apply(case_id); } -#if defined(BOOST_HAS_LONG_LONG) - else if (bit_size() >= min_size) + else if (bit_size() >= min_size) { - tester::template apply(case_id); + tester::template apply(case_id); } -#endif #if defined(BOOST_HAS_INT128) && defined(BOOST_GEOMETRY_ENABLE_INT128) else if (bit_size() >= min_size) { @@ -438,15 +433,13 @@ BOOST_AUTO_TEST_CASE( test_std_size_t ) test_promotion::apply("size_t"); } -#ifdef BOOST_HAS_LONG_LONG BOOST_AUTO_TEST_CASE( test_long_long ) { - test_promotion::apply("long long"); - test_promotion::apply("long long"); - test_promotion::apply("ulong long"); - test_promotion::apply("ulong long"); + test_promotion::apply("long long"); + test_promotion::apply("long long"); + test_promotion::apply("ulong long"); + test_promotion::apply("ulong long"); } -#endif #if defined(BOOST_HAS_INT128) && defined(BOOST_GEOMETRY_ENABLE_INT128) BOOST_AUTO_TEST_CASE( test_int128 ) diff --git a/test/util/select_most_precise.cpp b/test/util/select_most_precise.cpp index 3ec2dec73..c4146089c 100644 --- a/test/util/select_most_precise.cpp +++ b/test/util/select_most_precise.cpp @@ -5,6 +5,10 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021, Oracle and/or its affiliates. +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -23,8 +27,8 @@ struct user_defined {}; template void test() { - typedef typename bg::select_most_precise::type type; - bool is_same = boost::is_same::type::value; + using type = typename bg::select_most_precise::type; + bool is_same = std::is_same::value; BOOST_CHECK_MESSAGE(is_same, "The most precise of types " << From 14df20453fa456b7eb8f1e140b5d09ad8d205651 Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Wed, 21 Jul 2021 18:56:23 +0200 Subject: [PATCH 16/30] [test] remove the non used KRAMER define and rephrase/include/exclude some tests --- include/boost/geometry/core/config.hpp | 6 +- .../set_operations/difference/difference.cpp | 160 +++++++++--------- .../difference/difference_multi.cpp | 34 ++-- .../difference/test_difference.hpp | 15 +- .../intersection/intersection.cpp | 4 +- .../intersection/intersection_multi.cpp | 8 +- .../set_operations/union/union_multi.cpp | 17 +- test/geometry_test_common.hpp | 15 +- 8 files changed, 117 insertions(+), 142 deletions(-) diff --git a/include/boost/geometry/core/config.hpp b/include/boost/geometry/core/config.hpp index 1c6fab8e0..3066586c4 100644 --- a/include/boost/geometry/core/config.hpp +++ b/include/boost/geometry/core/config.hpp @@ -1,6 +1,6 @@ // Boost.Geometry -// Copyright (c) 2019 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2019-2021 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2018-2020 Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -23,10 +23,6 @@ #define BOOST_GEOMETRY_CXX11_TUPLE #endif -// Defining this selects Kramer rule for segment-intersection -// That is default behaviour. -#define BOOST_GEOMETRY_USE_KRAMER_RULE - // Rescaling is turned on, unless NO_ROBUSTNESS is defined // In future versions of Boost.Geometry, it will be turned off by default #if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS) diff --git a/test/algorithms/set_operations/difference/difference.cpp b/test/algorithms/set_operations/difference/difference.cpp index 0565f47aa..9e2db27d0 100644 --- a/test/algorithms/set_operations/difference/difference.cpp +++ b/test/algorithms/set_operations/difference/difference.cpp @@ -48,19 +48,10 @@ void test_all() typedef typename bg::coordinate_type

::type ct; - ut_settings sym_settings; -#if ! defined(BOOST_GEOMETRY_USE_RESCALING) - sym_settings.sym_difference = false; -#endif - - ut_settings ignore_validity_settings; - ignore_validity_settings.set_test_validity(false); - test_one("simplex_normal", simplex_normal[0], simplex_normal[1], 3, 12, 2.52636706856656, - 3, 12, 3.52636706856656, - sym_settings); + 3, 12, 3.52636706856656); test_one("simplex_with_empty", simplex_normal[0], polygon_empty, @@ -70,8 +61,7 @@ void test_all() test_one( "star_ring", example_star, example_ring, 5, 22, 1.1901714, - 5, 27, 1.6701714, - sym_settings); + 5, 27, 1.6701714); test_one("two_bends", two_bends[0], two_bends[1], @@ -81,8 +71,7 @@ void test_all() test_one("star_comb_15", star_comb_15[0], star_comb_15[1], 30, -1, 227.658275102812, - 30, -1, 480.485775259312, - sym_settings); + 30, -1, 480.485775259312); test_one("new_hole", new_hole[0], new_hole[1], @@ -115,17 +104,22 @@ void test_all() 1, 5, 9.0, 1, 5, 9.0); - test_one("only_hole_intersections1", - only_hole_intersections[0], only_hole_intersections[1], - 2, 10, 1.9090909, - 4, 16, 10.9090909, - sym_settings); + { + ut_settings settings; + settings.sym_difference_validity = BG_IF_RESCALED(true, false); - test_one("only_hole_intersection2", - only_hole_intersections[0], only_hole_intersections[2], - 3, 20, 30.9090909, - 4, 16, 10.9090909, - sym_settings); + test_one("only_hole_intersections1", + only_hole_intersections[0], only_hole_intersections[1], + 2, 10, 1.9090909, + 4, 16, 10.9090909, + settings); + + test_one("only_hole_intersection2", + only_hole_intersections[0], only_hole_intersections[2], + 3, 20, 30.9090909, + 4, 16, 10.9090909, + settings); + } test_one("first_within_second", first_within_second[1], first_within_second[0], @@ -148,20 +142,24 @@ void test_all() 4, 20, 11.533333, 5, 26, 29.783333); - test_one("intersect_holes_intersect_and_disjoint", - intersect_holes_intersect_and_disjoint[0], intersect_holes_intersect_and_disjoint[1], - 2, 16, 15.75, - 3, 17, 6.75, - ignore_validity_settings); + { + ut_settings settings; + settings.sym_difference_validity = BG_IF_RESCALED(false, true); + test_one("intersect_holes_intersect_and_disjoint", + intersect_holes_intersect_and_disjoint[0], intersect_holes_intersect_and_disjoint[1], + 2, 16, 15.75, + 3, 17, 6.75, + settings); - test_one("intersect_holes_intersect_and_touch", - intersect_holes_intersect_and_touch[0], intersect_holes_intersect_and_touch[1], - 3, 21, 16.25, - 3, 17, 6.25, - ignore_validity_settings); + test_one("intersect_holes_intersect_and_touch", + intersect_holes_intersect_and_touch[0], intersect_holes_intersect_and_touch[1], + 3, 21, 16.25, + 3, 17, 6.25, + settings); + } { - ut_settings settings = sym_settings; + ut_settings settings; settings.percentage = 0.01; test_one("intersect_holes_new_ring", intersect_holes_new_ring[0], intersect_holes_new_ring[1], @@ -180,17 +178,20 @@ void test_all() 2, 14, 16.0, 2, 10, 6.0); - test_one("intersect_holes_intersect", - intersect_holes_intersect[0], intersect_holes_intersect[1], - 2, 16, 15.75, - 2, 12, 5.75, - ignore_validity_settings); + { + ut_settings settings; + settings.sym_difference_validity = BG_IF_RESCALED(false, true); + test_one("intersect_holes_intersect", + intersect_holes_intersect[0], intersect_holes_intersect[1], + 2, 16, 15.75, + 2, 12, 5.75, + settings); + } test_one( "case4", case_4[0], case_4[1], 6, 28, 2.77878787878788, - 4, 22, 4.77878787878788, - sym_settings); + 4, 22, 4.77878787878788); test_one( "case5", case_5[0], case_5[1], @@ -248,7 +249,8 @@ void test_all() TEST_DIFFERENCE(case_precision_9, optional(), optional_sliver(), 1, 59.0, count_set(1, 2)); TEST_DIFFERENCE_WITH(case_precision_10, optional(), optional_sliver(), 1, 59, count_set(1, 2), ut_settings(0.001)); -#if ! defined(BOOST_GEOMETRY_USE_KRAMER_RULE) || defined(BOOST_GEOMETRY_TEST_FAILURES) +#if defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES) + // Fails without rescaling TEST_DIFFERENCE(case_precision_11, optional(), optional_sliver(), 1, 59.0, count_set(1, 2)); #endif @@ -295,12 +297,10 @@ void test_all() if ( BOOST_GEOMETRY_CONDITION((boost::is_same::value)) ) { - test_one("buffer_mp2", - buffer_mp2[0], buffer_mp2[1], - 1, 91, 12.09857, - 1, 155, 24.19714, - {1, 2}, -1, 12.09857 + 24.19714, - sym_settings); + ut_settings settings; + settings.sym_difference_validity = BG_IF_RESCALED(true, false); + TEST_DIFFERENCE_WITH(buffer_mp2, 1, 12.09857, 1, 24.19714, + count_set(1, 2), settings); } /*** TODO: self-tangencies for difference @@ -364,14 +364,12 @@ void test_all() geos_3[0], geos_3[1], 1, -1, 16211128.5, 1, -1, 13180420.0, - {1, 2}, -1, 16211128.5 + 13180420.0, - sym_settings); + {1, 2}, -1, 16211128.5 + 13180420.0); test_one("geos_4", geos_4[0], geos_4[1], 1, -1, 971.9163115, - 1, -1, 1332.4163115, - sym_settings); + 1, -1, 1332.4163115); test_one("ggl_list_20110306_javier", ggl_list_20110306_javier[0], ggl_list_20110306_javier[1], @@ -391,16 +389,15 @@ void test_all() 1, 58456.4964294434, 1); -#if defined(BOOST_GEOMETRY_USE_RESCALING) \ - || ! defined(BOOST_GEOMETRY_USE_KRAMER_RULE) \ - || defined(BOOST_GEOMETRY_TEST_FAILURES) + { + ut_settings settings(0.0001, false); // Symmetric difference should output one polygon // Using rescaling, it currently outputs two. TEST_DIFFERENCE_WITH(ggl_list_20110820_christophe, 1, 2.8570121719168924, 1, 64.498061986388564, - count_set(1, 2), ut_settings(0.0001, false)); -#endif + count_set(1, 2), settings); + } test_one("ggl_list_20120717_volker", ggl_list_20120717_volker[0], ggl_list_20120717_volker[1], @@ -428,6 +425,7 @@ void test_all() // With rescaling, difference of output a-b and a sym b is invalid ut_settings settings; settings.set_test_validity(BG_IF_RESCALED(false, true)); + settings.sym_difference_validity = BG_IF_RESCALED(false, true); TEST_DIFFERENCE_WITH(ggl_list_20190307_matthieu_1, count_set(1, 2), 0.18461532, count_set(1, 2), 0.617978, @@ -472,8 +470,7 @@ void test_all() test_one("ticket_10108_a", ticket_10108_a[0], ticket_10108_a[1], 1, 4, {0.0145036, 0.0145037}, - 1, 4, 0.029019232, - sym_settings); + 1, 4, 0.029019232); #endif test_one("ticket_10108_b", @@ -504,14 +501,12 @@ void test_all() test_one( "star_ring_ring", example_star, example_ring, 5, 22, 1.1901714, - 5, 27, 1.6701714, - sym_settings); + 5, 27, 1.6701714); test_one( "ring_star_ring", example_ring, example_star, 5, 27, 1.6701714, - 5, 22, 1.1901714, - sym_settings); + 5, 22, 1.1901714); static std::string const clip = "POLYGON((2.5 0.5,5.5 2.5))"; @@ -530,18 +525,15 @@ void test_all() test_one( "star_ring_ccw", example_star, example_ring, 5, 22, 1.1901714, - 5, 27, 1.6701714, - sym_settings); + 5, 27, 1.6701714); test_one( "star_ring_ccw1", example_star, example_ring, 5, 22, 1.1901714, - 5, 27, 1.6701714, - sym_settings); + 5, 27, 1.6701714); test_one( "star_ring_ccw2", example_star, example_ring, 5, 22, 1.1901714, - 5, 27, 1.6701714, - sym_settings); + 5, 27, 1.6701714); } // Multi/box (should be moved to multi) @@ -568,10 +560,15 @@ void test_all() optional(), optional_sliver(1.0e-5), count_set(1, 2)); - TEST_DIFFERENCE(issue_838, - count_set(1, 2), expectation_limits(0.000026, 0.0002823), - count_set(1, 2), expectation_limits(0.67257, 0.67499), - count_set(2, 3, 4)); + { + ut_settings settings; + settings.set_test_validity(BG_IF_RESCALED(true, false)); + TEST_DIFFERENCE_WITH(issue_838, + count_set(1, 2), expectation_limits(0.000026, 0.0002823), + count_set(1, 2), expectation_limits(0.67257, 0.67499), + count_set(2, 3, 4), + settings); + } TEST_DIFFERENCE(mysql_21977775, 2, 160.856568913, 2, 92.3565689126, 4); TEST_DIFFERENCE(mysql_21965285, 1, 92.0, 1, 14.0, 1); @@ -579,13 +576,13 @@ void test_all() TEST_DIFFERENCE(mysql_23023665_2, 1, 96.0, 1, 16.0, 2); TEST_DIFFERENCE(mysql_23023665_3, 1, 225.0, 1, 66.0, 2); TEST_DIFFERENCE(mysql_23023665_5, 2, 165.23735, 2, 105.73735, 4); -#if defined(BOOST_GEOMETRY_USE_RESCALING) \ - || ! defined(BOOST_GEOMETRY_USE_KRAMER_RULE) \ - || defined(BOOST_GEOMETRY_TEST_FAILURES) - // Testcases going wrong with Kramer's rule and no rescaling - TEST_DIFFERENCE(mysql_23023665_6, 2, 105.68756, 3, 10.18756, 5); + { + // Without recaling it is invalid + ut_settings settings; + settings.set_test_validity(BG_IF_RESCALED(true, false)); + TEST_DIFFERENCE_WITH(mysql_23023665_6, 2, 105.68756, 3, 10.18756, 5, settings); + } TEST_DIFFERENCE(mysql_23023665_13, 3, 99.74526, 3, 37.74526, 6); -#endif } @@ -629,7 +626,8 @@ int test_main(int, char* []) #if defined(BOOST_GEOMETRY_TEST_FAILURES) // Not yet fully tested for float and long double. // The difference algorithm can generate (additional) slivers - BoostGeometryWriteExpectedFailures(12, 5, 11, 6); + // Many of the failures are self-intersection points. + BoostGeometryWriteExpectedFailures(12, 10, 17, 12); #endif return 0; diff --git a/test/algorithms/set_operations/difference/difference_multi.cpp b/test/algorithms/set_operations/difference/difference_multi.cpp index 410a89d8e..af45b0d4f 100644 --- a/test/algorithms/set_operations/difference/difference_multi.cpp +++ b/test/algorithms/set_operations/difference/difference_multi.cpp @@ -152,25 +152,19 @@ void test_areal() TEST_DIFFERENCE_WITH(0, 1, ggl_list_20120221_volker, 2, 7962.66, 2, 2775258.93, 4); } +#if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES) { - // With rescaling, A is invalid (this is a robustness problem) and the other - // output is discarded because of zero area - // POSTGIS areas: 3.75893745345145, 2.5810000723917e-15 + // 1: Very small sliver for B (discarded when rescaling) + // 2: sym difference is not considered as valid + // 3: with rescaling A is considered as invalid (robustness problem) ut_settings settings; - settings.sym_difference = BG_IF_RESCALED(false, true); - settings.set_test_validity(BG_IF_RESCALED(false, true)); -#if defined(BOOST_GEOMETRY_USE_RESCALING) || ! defined(BOOST_GEOMETRY_USE_KRAMER_RULE) - // No output for B - TEST_DIFFERENCE_WITH(0, 1, bug_21155501, 1, 3.758937, 0, 0.0, 1); -#else - // Very small sliver for B, and sym difference is not considered valid - settings.set_test_validity(false); + settings.sym_difference_validity = false; TEST_DIFFERENCE_WITH(0, 1, bug_21155501, (count_set(1, 4)), expectation_limits(3.75893, 3.75894), (count_set(1, 4)), (expectation_limits(1.776357e-15, 7.661281e-15)), (count_set(2, 5))); -#endif } +#endif #if defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES) { @@ -178,6 +172,7 @@ void test_areal() // Without rescaling, one ring is missing (for a and s) ut_settings settings; settings.set_test_validity(BG_IF_RESCALED(false, true)); + settings.sym_difference_validity = BG_IF_RESCALED(false, true); TEST_DIFFERENCE_WITH(0, 1, ticket_9081, 2, 0.0907392476356186, 4, 0.126018011439877, @@ -400,14 +395,14 @@ void test_areal() TEST_DIFFERENCE(case_precision_m2, count_set(1, 2), 1.0, 1, 57.75, count_set(2, 3)); { - ut_settings sym_settings; - sym_settings.sym_difference = BG_IF_RESCALED(true, BG_IF_TEST_FAILURES); + ut_settings settings; + settings.sym_difference = BG_IF_RESCALED(true, BG_IF_TEST_FAILURES); test_one("mysql_21965285_b", mysql_21965285_b[0], mysql_21965285_b[1], 2, -1, 183.71376870369406, 2, -1, 131.21376870369406, - sym_settings); + settings); } TEST_DIFFERENCE(mysql_regression_1_65_2017_08_31, @@ -473,10 +468,6 @@ void test_specific_areal() } { -#if defined(BOOST_GEOMETRY_USE_KRAMER) || defined(BOOST_GEOMETRY_TEST_FAILURES) - // Fails completely with general line form intersection - // There is something with scale. - // TODO GENERAL FORM const std::string a_min_b = TEST_DIFFERENCE(ticket_10661, 2, 1441632.5, 2, 13167454, 4); @@ -485,17 +476,14 @@ void test_specific_areal() 1, 8, 825192.0, 1, 10, expectation_limits(27226370, 27842812), 1, -1, 825192.0 + 27226370.5); -#endif } { ut_settings settings; settings.sym_difference = false; -#if defined(BOOST_GEOMETRY_USE_KRAMER) || defined(BOOST_GEOMETRY_TEST_FAILURES) TEST_DIFFERENCE_WITH(0, 1, ticket_9942, 4, expectation_limits(7427727.5), 4, expectation_limits(130083, 131507), 4); -#endif TEST_DIFFERENCE_WITH(0, 1, ticket_9942a, 2, expectation_limits(412676, 413184), 2, expectation_limits(76779, 76925), 4); @@ -525,7 +513,7 @@ int test_main(int, char* []) #if defined(BOOST_GEOMETRY_TEST_FAILURES) // Not yet fully tested for float. // The difference algorithm can generate (additional) slivers - BoostGeometryWriteExpectedFailures(22, 12, 16, 7); + BoostGeometryWriteExpectedFailures(28, 15, 19, 10); #endif return 0; diff --git a/test/algorithms/set_operations/difference/test_difference.hpp b/test/algorithms/set_operations/difference/test_difference.hpp index 3c9ce08a5..0c01d94cb 100644 --- a/test/algorithms/set_operations/difference/test_difference.hpp +++ b/test/algorithms/set_operations/difference/test_difference.hpp @@ -65,13 +65,13 @@ struct ut_settings : ut_base_settings { double percentage; bool sym_difference; - bool remove_spikes; + bool sym_difference_validity = true; + bool remove_spikes = false; - explicit ut_settings(double p = 0.0001, bool tv = true, bool sd = true) - : ut_base_settings(tv) + explicit ut_settings(double p = 0.0001, bool validity = true, bool sd = true) + : ut_base_settings(validity) , percentage(p) , sym_difference(sd) - , remove_spikes(false) {} }; @@ -192,7 +192,12 @@ std::string test_difference(std::string const& caseid, G1 const& g1, G2 const& g typename bg::default_area_result::type const area = bg::area(result); #if ! defined(BOOST_GEOMETRY_NO_BOOST_TEST) - if (settings.test_validity()) + bool const test_validity + = sym + ? (settings.sym_difference_validity || BG_IF_TEST_FAILURES) + : settings.test_validity(); + + if (test_validity) { // std::cout << bg::dsv(result) << std::endl; typedef bg::model::multi_polygon result_type; diff --git a/test/algorithms/set_operations/intersection/intersection.cpp b/test/algorithms/set_operations/intersection/intersection.cpp index d2b93b7e2..38a2272d2 100644 --- a/test/algorithms/set_operations/intersection/intersection.cpp +++ b/test/algorithms/set_operations/intersection/intersection.cpp @@ -232,10 +232,8 @@ void test_areal() TEST_INTERSECTION(ggl_list_20190307_matthieu_1, 2, -1, 0.035136); TEST_INTERSECTION(ggl_list_20190307_matthieu_2, 1, -1, 3.64285); -#if defined(BOOST_GEOMETRY_USE_RESCALING) || ! defined(BOOST_GEOMETRY_USE_KRAMER_RULE) || defined(BOOST_GEOMETRY_TEST_FAILURES) test_one("buffer_rt_f", buffer_rt_f[0], buffer_rt_f[1], 1, 4, expectation_limits(0.00029437, 0.000294380)); -#endif test_one("buffer_rt_g", buffer_rt_g[0], buffer_rt_g[1], 1, 0, 2.914213562373); @@ -950,7 +948,7 @@ int test_main(int, char* []) #if defined(BOOST_GEOMETRY_TEST_FAILURES) // llb_touch generates a polygon with 1 point and is therefore invalid everywhere // TODO: this should be easy to fix - BoostGeometryWriteExpectedFailures(5, 2, 6, 1); + BoostGeometryWriteExpectedFailures(6, 2, 7, 1); #endif return 0; diff --git a/test/algorithms/set_operations/intersection/intersection_multi.cpp b/test/algorithms/set_operations/intersection/intersection_multi.cpp index 1edbdd6f4..48cd5f73f 100644 --- a/test/algorithms/set_operations/intersection/intersection_multi.cpp +++ b/test/algorithms/set_operations/intersection/intersection_multi.cpp @@ -367,13 +367,13 @@ void test_areal() // Result is wrong with rescaling TEST_INTERSECTION(issue_630_a, 1, -1, 0.1770); #endif -#if ! defined(BOOST_GEOMETRY_USE_KRAMER_RULE) || defined(BOOST_GEOMETRY_TEST_FAILURES) - // Two cases produce either too large, or no output if Kramer rule is used + TEST_INTERSECTION(issue_630_b, 1, -1, expectation_limits(0.1713911, 0.1714)); - TEST_INTERSECTION(issue_630_c, 1, -1, 0.1770); -#endif #if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES) + // Result is missing with rescaling + TEST_INTERSECTION(issue_630_c, 1, -1, 0.1770); + // Result is missing with rescaling TEST_INTERSECTION(issue_643, 1, -1, 3.4615); #endif diff --git a/test/algorithms/set_operations/union/union_multi.cpp b/test/algorithms/set_operations/union/union_multi.cpp index b7d9c725f..e80c72da3 100644 --- a/test/algorithms/set_operations/union/union_multi.cpp +++ b/test/algorithms/set_operations/union/union_multi.cpp @@ -422,13 +422,13 @@ void test_areal() // Failure with rescaling TEST_UNION(issue_630_a, 1, 0, -1, 2.200326); #endif + TEST_UNION(issue_630_b, 1, 0, -1, 1.675976); -#if ! defined(BOOST_GEOMETRY_USE_KRAMER_RULE) || defined(BOOST_GEOMETRY_TEST_FAILURES) - // Failure with Kramer rule, it doesn't generate any output - TEST_UNION(issue_630_c, 1, 0, -1, 1.670367); -#endif #if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES) + // With rescaling the smaller rectangle is added on top of the outer polygon + TEST_UNION(issue_630_c, 1, 0, -1, 1.670367); + // With rescaling the small polygon is added on top of the outer polygon TEST_UNION(issue_643, 1, 0, -1, 80.0); #endif @@ -441,13 +441,8 @@ void test_areal() TEST_UNION(issue_888_34, 15, 0, -1, 0.3017459); TEST_UNION(issue_888_37, 52, 3, -1, 0.4033294); -#if defined(BOOST_GEOMETRY_USE_KRAMER_RULE) - // Two polygons, should ideally be merged - TEST_UNION(mail_2019_01_21_johan, 2, 0, -1, 0.00058896); -#else - // Correct: one polygon - TEST_UNION(mail_2019_01_21_johan, 1, 0, -1, 0.00058896); -#endif + // One or two polygons, the ideal case is 1 + TEST_UNION(mail_2019_01_21_johan, count_set(1, 2), 0, -1, 0.00058896); TEST_UNION(mysql_23023665_7, 1, 1, -1, 99.19494); TEST_UNION(mysql_23023665_8, 1, 2, -1, 1400.0); diff --git a/test/geometry_test_common.hpp b/test/geometry_test_common.hpp index 96866bde3..78928a599 100644 --- a/test/geometry_test_common.hpp +++ b/test/geometry_test_common.hpp @@ -132,18 +132,18 @@ struct mathematical_policy struct ut_base_settings { - explicit ut_base_settings(bool val = true) + explicit ut_base_settings(bool validity = true) : m_test_validity(true) { - set_test_validity(val); + set_test_validity(validity); } - inline void set_test_validity(bool val) + inline void set_test_validity(bool validity) { #if defined(BOOST_GEOMETRY_TEST_FAILURES) - boost::ignore_unused(val); + boost::ignore_unused(validity); #else - m_test_validity = val; + m_test_validity = validity; #endif } @@ -207,11 +207,6 @@ inline void BoostGeometryWriteTestConfiguration() #if defined(BOOST_GEOMETRY_USE_RESCALING) std::cout << " - Using rescaling" << std::endl; #endif -#if defined(BOOST_GEOMETRY_USE_KRAMER_RULE) - std::cout << " - Using Kramer rule" << std::endl; -#else - std::cout << " - Using general form" << std::endl; -#endif #if defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) std::cout << " - Testing only one type" << std::endl; #endif From 01f8e23b0c2e1fa2871213f457995395825a02bc Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Thu, 8 Jul 2021 12:51:01 +0200 Subject: [PATCH 17/30] [traverse] reverse meaning of isolation in difference --- .../detail/overlay/is_self_turn.hpp | 3 +- .../algorithms/detail/overlay/traversal.hpp | 102 ++++++++++-------- .../overlay/traversal_switch_detector.hpp | 49 +++++++-- .../algorithms/detail/overlay/turn_info.hpp | 5 + .../difference/difference_multi.cpp | 6 +- .../difference/test_difference.hpp | 13 ++- 6 files changed, 114 insertions(+), 64 deletions(-) diff --git a/include/boost/geometry/algorithms/detail/overlay/is_self_turn.hpp b/include/boost/geometry/algorithms/detail/overlay/is_self_turn.hpp index 448c04404..1606c31e9 100644 --- a/include/boost/geometry/algorithms/detail/overlay/is_self_turn.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/is_self_turn.hpp @@ -26,8 +26,7 @@ struct is_self_turn_check template static inline bool apply(Turn const& turn) { - return turn.operations[0].seg_id.source_index - == turn.operations[1].seg_id.source_index; + return turn.is_self(); } }; diff --git a/include/boost/geometry/algorithms/detail/overlay/traversal.hpp b/include/boost/geometry/algorithms/detail/overlay/traversal.hpp index a0149789c..b65f00424 100644 --- a/include/boost/geometry/algorithms/detail/overlay/traversal.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/traversal.hpp @@ -621,31 +621,32 @@ public : return m_turns[rp.turn_index].operations[rp.operation_index]; } - inline sort_by_side::rank_type select_rank(sbs_type const& sbs, - bool skip_isolated) const + inline sort_by_side::rank_type select_rank(sbs_type const& sbs) const { + static bool const is_intersection + = target_operation == operation_intersection; + // Take the first outgoing rank corresponding to incoming region, // or take another region if it is not isolated - turn_operation_type const& incoming_op - = operation_from_rank(sbs.m_ranked_points.front()); + auto const& in_op = operation_from_rank(sbs.m_ranked_points.front()); for (std::size_t i = 0; i < sbs.m_ranked_points.size(); i++) { - typename sbs_type::rp const& rp = sbs.m_ranked_points[i]; + auto const& rp = sbs.m_ranked_points[i]; if (rp.rank == 0 || rp.direction == sort_by_side::dir_from) { continue; } - turn_operation_type const& op = operation_from_rank(rp); + auto const& out_op = operation_from_rank(rp); - if (op.operation != target_operation - && op.operation != operation_continue) + if (out_op.operation != target_operation + && out_op.operation != operation_continue) { continue; } - if (op.enriched.region_id == incoming_op.enriched.region_id - || (skip_isolated && ! op.enriched.isolated)) + if (in_op.enriched.region_id == out_op.enriched.region_id + || (is_intersection && ! out_op.enriched.isolated)) { // Region corresponds to incoming region, or (for intersection) // there is a non-isolated other region which should be taken @@ -660,7 +661,7 @@ public : int& op_index, sbs_type const& sbs, signed_size_type start_turn_index, int start_op_index) const { - sort_by_side::rank_type const selected_rank = select_rank(sbs, false); + sort_by_side::rank_type const selected_rank = select_rank(sbs); int current_priority = 0; for (std::size_t i = 1; i < sbs.m_ranked_points.size(); i++) @@ -688,49 +689,59 @@ public : inline bool analyze_cluster_intersection(signed_size_type& turn_index, int& op_index, sbs_type const& sbs) const { - sort_by_side::rank_type const selected_rank = select_rank(sbs, true); + // Select the rank based on regions and isolation + sort_by_side::rank_type const selected_rank = select_rank(sbs); - if (selected_rank > 0) + if (selected_rank <= 0) { - typename turn_operation_type::comparable_distance_type - min_remaining_distance = 0; + return false; + } - std::size_t selected_index = sbs.m_ranked_points.size(); - for (std::size_t i = 0; i < sbs.m_ranked_points.size(); i++) + // From these ranks, select the index: the first, or the one with + // the smallest remaining distance + typename turn_operation_type::comparable_distance_type + min_remaining_distance = 0; + + std::size_t selected_index = sbs.m_ranked_points.size(); + for (std::size_t i = 0; i < sbs.m_ranked_points.size(); i++) + { + auto const& ranked_point = sbs.m_ranked_points[i]; + + if (ranked_point.rank > selected_rank) { - typename sbs_type::rp const& ranked_point = sbs.m_ranked_points[i]; - - if (ranked_point.rank == selected_rank) - { - turn_operation_type const& op = operation_from_rank(ranked_point); - - if (op.visited.finalized()) - { - // This direction is already traveled before, the same - // cannot be traveled again - continue; - } - - // Take turn with the smallest remaining distance - if (selected_index == sbs.m_ranked_points.size() - || op.remaining_distance < min_remaining_distance) - { - selected_index = i; - min_remaining_distance = op.remaining_distance; - } - } + break; } - - if (selected_index < sbs.m_ranked_points.size()) + else if (ranked_point.rank == selected_rank) { - typename sbs_type::rp const& ranked_point = sbs.m_ranked_points[selected_index]; - turn_index = ranked_point.turn_index; - op_index = ranked_point.operation_index; - return true; + auto const& op = operation_from_rank(ranked_point); + + if (op.visited.finalized()) + { + // This direction is already traveled, + // it cannot be traveled again + continue; + } + + if (selected_index == sbs.m_ranked_points.size() + || op.remaining_distance < min_remaining_distance) + { + // It was unassigned or it is better + selected_index = i; + min_remaining_distance = op.remaining_distance; + } } } - return false; + if (selected_index == sbs.m_ranked_points.size()) + { + // Should not happen, there must be points with the selected rank + return false; + } + + auto const& ranked_point = sbs.m_ranked_points[selected_index]; + turn_index = ranked_point.turn_index; + op_index = ranked_point.operation_index; + return true; } inline bool fill_sbs(sbs_type& sbs, @@ -819,6 +830,7 @@ public : return result; } + // Analyzes a non-clustered "ii" intersection, as if it is clustered. inline bool analyze_ii_intersection(signed_size_type& turn_index, int& op_index, turn_type const& current_turn, segment_identifier const& previous_seg_id) diff --git a/include/boost/geometry/algorithms/detail/overlay/traversal_switch_detector.hpp b/include/boost/geometry/algorithms/detail/overlay/traversal_switch_detector.hpp index ad248826d..ae2e7b5c8 100644 --- a/include/boost/geometry/algorithms/detail/overlay/traversal_switch_detector.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/traversal_switch_detector.hpp @@ -89,7 +89,6 @@ struct traversal_switch_detector enum isolation_type { - isolation_unknown = -1, isolation_no = 0, isolation_yes = 1, isolation_multiple = 2 @@ -121,7 +120,7 @@ struct traversal_switch_detector struct region_properties { signed_size_type region_id = -1; - isolation_type isolated = isolation_unknown; + isolation_type isolated = isolation_no; set_type unique_turn_ids; connection_map connected_region_counts; }; @@ -374,7 +373,7 @@ struct traversal_switch_detector { region_properties& properties = key_val.second; - if (properties.isolated == isolation_unknown + if (properties.isolated == isolation_no && has_only_isolated_children(properties)) { properties.isolated = isolation_yes; @@ -388,13 +387,36 @@ struct traversal_switch_detector { for (turn_type& turn : m_turns) { + // For difference, for the input walked through in reverse, + // the meaning is reversed: what is isolated is actually not, + // and vice versa. + bool const reverseMeaningInTurn + = (Reverse1 || Reverse2) + && ! turn.is_self() + && ! turn.is_clustered() + && uu_or_ii(turn) + && turn.operations[0].enriched.region_id + != turn.operations[1].enriched.region_id; + for (auto& op : turn.operations) { auto mit = m_connected_regions.find(op.enriched.region_id); if (mit != m_connected_regions.end()) { + bool const reverseMeaningInOp + = reverseMeaningInTurn + && ((op.seg_id.source_index == 0 && Reverse1) + || (op.seg_id.source_index == 1 && Reverse2)); + + // It is assigned to isolated if it's property is "Yes", + // (one connected interior, or chained). + // "Multiple" doesn't count for isolation, + // neither for intersection, neither for difference. region_properties const& prop = mit->second; - op.enriched.isolated = prop.isolated == isolation_yes; + op.enriched.isolated + = reverseMeaningInOp + ? prop.isolated == isolation_no + : prop.isolated == isolation_yes; } } } @@ -478,8 +500,12 @@ struct traversal_switch_detector // Discarded turns don't connect rings to the same region // Also xx are not relevant // (otherwise discarded colocated uu turn could make a connection) - return ! turn.discarded - && ! turn.both(operation_blocked); + return ! turn.discarded && ! turn.both(operation_blocked); + } + + inline bool uu_or_ii(turn_type const& turn) const + { + return turn.both(operation_union) || turn.both(operation_intersection); } inline bool connects_same_region(turn_type const& turn) const @@ -492,7 +518,7 @@ struct traversal_switch_detector if (! turn.is_clustered()) { // If it is a uu/ii-turn (non clustered), it is never same region - return ! (turn.both(operation_union) || turn.both(operation_intersection)); + return ! uu_or_ii(turn); } if (BOOST_GEOMETRY_CONDITION(target_operation == operation_union)) @@ -568,7 +594,10 @@ struct traversal_switch_detector void iterate() { #if defined(BOOST_GEOMETRY_DEBUG_TRAVERSAL_SWITCH_DETECTOR) - std::cout << "BEGIN SWITCH DETECTOR (region_ids and isolation)" << std::endl; + std::cout << "BEGIN SWITCH DETECTOR (region_ids and isolation)" + << (Reverse1 ? " REVERSE_1" : "") + << (Reverse2 ? " REVERSE_2" : "") + << std::endl; #endif // Collect turns per ring @@ -613,14 +642,14 @@ struct traversal_switch_detector { turn_type const& turn = m_turns[turn_index]; - if ((turn.both(operation_union) || turn.both(operation_intersection)) - && ! turn.is_clustered()) + if (uu_or_ii(turn) && ! turn.is_clustered()) { std::cout << (turn.both(operation_union) ? "UU" : "II") << " " << turn_index << " (" << geometry::get<0>(turn.point) << ", " << geometry::get<1>(turn.point) << ")" << " -> " << std::boolalpha + << " [" << turn.operations[0].seg_id.source_index << "/" << turn.operations[1].seg_id.source_index << "] " << "(" << turn.operations[0].enriched.region_id << " " << turn.operations[0].enriched.isolated << ") / (" << turn.operations[1].enriched.region_id diff --git a/include/boost/geometry/algorithms/detail/overlay/turn_info.hpp b/include/boost/geometry/algorithms/detail/overlay/turn_info.hpp index 7dcbf4c8e..08cb516cf 100644 --- a/include/boost/geometry/algorithms/detail/overlay/turn_info.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/turn_info.hpp @@ -138,6 +138,11 @@ struct turn_info { return cluster_id > 0; } + inline bool is_self() const + { + return operations[0].seg_id.source_index + == operations[1].seg_id.source_index; + } private : inline bool has12(operation_type type1, operation_type type2) const diff --git a/test/algorithms/set_operations/difference/difference_multi.cpp b/test/algorithms/set_operations/difference/difference_multi.cpp index af45b0d4f..a4efdad25 100644 --- a/test/algorithms/set_operations/difference/difference_multi.cpp +++ b/test/algorithms/set_operations/difference/difference_multi.cpp @@ -204,10 +204,8 @@ void test_areal() #endif } -#if defined(BOOST_GEOMETRY_TEST_FAILURES) - // Generates a polygon with two interiors, i/o a multipoly with 3 rings - TEST_DIFFERENCE(issue_869_a, 3, 3600, 0, 0, 1); -#endif + // Requires reveral of isolation in ii turns. There should be 3 rings. + TEST_DIFFERENCE(issue_869_a, 3, 3600, 0, 0, 3); TEST_DIFFERENCE(issue_888_34, 22, 0.2506824, 6, 0.0253798, 28); TEST_DIFFERENCE(issue_888_37, 15, 0.0451408, 65, 0.3014843, 80); diff --git a/test/algorithms/set_operations/difference/test_difference.hpp b/test/algorithms/set_operations/difference/test_difference.hpp index 0c01d94cb..6c93acb2a 100644 --- a/test/algorithms/set_operations/difference/test_difference.hpp +++ b/test/algorithms/set_operations/difference/test_difference.hpp @@ -327,11 +327,14 @@ std::string test_one(std::string const& caseid, bg::correct(g1); bg::correct(g2); - std::string result = test_difference(caseid + "_a", g1, g2, + std::string result; + +#if ! defined(BOOST_GEOMETRY_TEST_DIFFERENCE_ONLY_B) + result = test_difference(caseid + "_a", g1, g2, expected_count1, expected_rings_count1, expected_point_count1, expected_area1, false, settings); - -#ifdef BOOST_GEOMETRY_DEBUG_ASSEMBLE +#endif +#if defined(BOOST_GEOMETRY_TEST_DIFFERENCE_ONLY_A) return result; #endif @@ -339,6 +342,10 @@ std::string test_one(std::string const& caseid, expected_count2, expected_rings_count2, expected_point_count2, expected_area2, false, settings); +#if defined(BOOST_GEOMETRY_TEST_DIFFERENCE_ONLY_B) + return result; +#endif + #if ! defined(BOOST_GEOMETRY_TEST_ALWAYS_CHECK_SYMDIFFERENCE) if (settings.sym_difference) #endif From 7f1e294a61c6989ba12f1fa161bfd4c36af8314f Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Wed, 14 Jul 2021 13:52:37 +0200 Subject: [PATCH 18/30] [traverse] avoid using isolated for originally non-isolated regions --- .../overlay/traversal_switch_detector.hpp | 100 +++++++++++++----- 1 file changed, 72 insertions(+), 28 deletions(-) diff --git a/include/boost/geometry/algorithms/detail/overlay/traversal_switch_detector.hpp b/include/boost/geometry/algorithms/detail/overlay/traversal_switch_detector.hpp index ae2e7b5c8..be0f2bcd8 100644 --- a/include/boost/geometry/algorithms/detail/overlay/traversal_switch_detector.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/traversal_switch_detector.hpp @@ -415,7 +415,7 @@ struct traversal_switch_detector region_properties const& prop = mit->second; op.enriched.isolated = reverseMeaningInOp - ? prop.isolated == isolation_no + ? false : prop.isolated == isolation_yes; } } @@ -591,6 +591,76 @@ struct traversal_switch_detector } } +#if defined(BOOST_GEOMETRY_DEBUG_TRAVERSAL_SWITCH_DETECTOR) + void debug_show_results() + { + auto isolation_to_string = [](isolation_type const& iso) -> std::string + { + switch(iso) + { + case isolation_no : return "no"; + case isolation_yes : return "yes"; + case isolation_multiple : return "multiple"; + } + return "error"; + }; + auto set_to_string = [](auto const& s) -> std::string + { + std::ostringstream result; + for (auto item : s) { result << " " << item; } + return result.str(); + }; + + for (auto const& kv : m_connected_regions) + { + auto const& prop = kv.second; + + std::ostringstream sub; + sub << "[turns" << set_to_string(prop.unique_turn_ids) + << "] regions"; + for (auto const& kvs : prop.connected_region_counts) + { + sub << " { " << kvs.first + << " : via [" << set_to_string(kvs.second.unique_turn_ids) + << " ] }"; + } + + std::cout << "REGION " << prop.region_id + << " " << isolation_to_string(prop.isolated) + << " " << sub.str() + << std::endl; + } + + for (std::size_t turn_index = 0; turn_index < m_turns.size(); ++turn_index) + { + turn_type const& turn = m_turns[turn_index]; + + if (uu_or_ii(turn) && ! turn.is_clustered()) + { + std::cout << (turn.both(operation_union) ? "UU" : "II") + << " " << turn_index + << " (" << geometry::get<0>(turn.point) + << ", " << geometry::get<1>(turn.point) << ")" + << " -> " << std::boolalpha + << " [" << turn.operations[0].seg_id.source_index + << "/" << turn.operations[1].seg_id.source_index << "] " + << "(" << turn.operations[0].enriched.region_id + << " " << turn.operations[0].enriched.isolated + << ") / (" << turn.operations[1].enriched.region_id + << " " << turn.operations[1].enriched.isolated << ")" + << std::endl; + } + } + + for (auto const& key_val : m_clusters) + { + cluster_info const& cinfo = key_val.second; + std::cout << "CL RESULT " << key_val.first + << " -> " << cinfo.open_count << std::endl; + } + } +#endif + void iterate() { #if defined(BOOST_GEOMETRY_DEBUG_TRAVERSAL_SWITCH_DETECTOR) @@ -637,33 +707,7 @@ struct traversal_switch_detector #if defined(BOOST_GEOMETRY_DEBUG_TRAVERSAL_SWITCH_DETECTOR) std::cout << "END SWITCH DETECTOR" << std::endl; - - for (std::size_t turn_index = 0; turn_index < m_turns.size(); ++turn_index) - { - turn_type const& turn = m_turns[turn_index]; - - if (uu_or_ii(turn) && ! turn.is_clustered()) - { - std::cout << (turn.both(operation_union) ? "UU" : "II") - << " " << turn_index - << " (" << geometry::get<0>(turn.point) - << ", " << geometry::get<1>(turn.point) << ")" - << " -> " << std::boolalpha - << " [" << turn.operations[0].seg_id.source_index << "/" << turn.operations[1].seg_id.source_index << "] " - << "(" << turn.operations[0].enriched.region_id - << " " << turn.operations[0].enriched.isolated - << ") / (" << turn.operations[1].enriched.region_id - << " " << turn.operations[1].enriched.isolated << ")" - << std::endl; - } - } - - for (auto const& key_val : m_clusters) - { - cluster_info const& cinfo = key_val.second; - std::cout << "CL RESULT " << key_val.first - << " -> " << cinfo.open_count << std::endl; - } + debug_show_results(); #endif } From 42edbd30f246fff720a271c2c9f8e45df0156414 Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Wed, 21 Jul 2021 12:32:41 +0200 Subject: [PATCH 19/30] [test] add testcase for issue #888 polygon 53 --- test/algorithms/overlay/multi_overlay_cases.hpp | 6 ++++++ .../set_operations/difference/difference_multi.cpp | 13 +++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/test/algorithms/overlay/multi_overlay_cases.hpp b/test/algorithms/overlay/multi_overlay_cases.hpp index 21753cba9..3b1e4c342 100644 --- a/test/algorithms/overlay/multi_overlay_cases.hpp +++ b/test/algorithms/overlay/multi_overlay_cases.hpp @@ -1534,6 +1534,12 @@ static std::string issue_888_37[2] = "MULTIPOLYGON(((0.594132 0.714429,0.606487 0.701251,0.594811 0.691349,0.594132 0.714429)),((0.663637 0.851798,0.60596 0.926301,0.651077 0.91496,0.663637 0.851798)),((0.550593 0.255888,0.603476 0.274731,0.684151 0.208773,0.625869 0.119956,0.523067 0.0866194,0.476025 0.144909,0.550593 0.255888)),((0.550593 0.255888,0.452782 0.221035,0.459249 0.333709,0.441865 0.351136,0.370548 0.331001,0.315687 0.454629,0.207309 0.362716,0.174164 0.39187,0.173365 0.391061,0.173401 0.392541,0.11983 0.439661,0.177364 0.555306,0.177972 0.580239,0.0906064 0.618386,0.127028 0.663916,0.0564116 0.721999,0.127196 0.664127,0.181673 0.732227,0.182236 0.755361,0.188638 0.740934,0.199131 0.754051,0.261029 0.691392,0.320648 0.715618,0.224866 0.786223,0.382462 0.983231,0.466763 0.85994,0.47812 0.838165,0.39515 0.926659,0.476824 0.77908,0.50332 0.789847,0.525393 0.747525,0.505459 0.72734,0.547556 0.651273,0.482633 0.596213,0.577247 0.52647,0.570444 0.520834,0.600941 0.483052,0.603549 0.394417,0.517116 0.432156,0.563288 0.385417,0.492528 0.36544,0.577515 0.295956,0.550593 0.255888),(0.366654 0.497853,0.305289 0.524648,0.301942 0.521258,0.348942 0.482832,0.366654 0.497853),(0.287131 0.506261,0.291026 0.510204,0.279648 0.535844,0.289209 0.531669,0.277112 0.541559,0.226862 0.654796,0.201344 0.603505,0.178983 0.621787,0.178814 0.61485,0.197613 0.596005,0.187664 0.576007,0.240627 0.552881,0.287131 0.506261),(0.315687 0.454629,0.328117 0.465171,0.297299 0.496067,0.315687 0.454629)),((0.50332 0.789847,0.47812 0.838165,0.517876 0.795762,0.50332 0.789847)),((0.476025 0.144909,0.468192 0.133251,0.448726 0.150373,0.450246 0.176853,0.476025 0.144909)),((0.521709 0.086179,0.399861 0.0466657,0.304173 0.168082,0.392721 0.199633,0.448726 0.150373,0.445833 0.0999749,0.468192 0.133251,0.521709 0.086179)),((0.521709 0.086179,0.523067 0.0866194,0.527613 0.0809854,0.521709 0.086179)),((0.577515 0.295956,0.605233 0.337207,0.607034 0.275999,0.603476 0.274731,0.577515 0.295956)),((0.304173 0.168082,0.296274 0.165267,0.207506 0.246917,0.236386 0.254095,0.304173 0.168082)),((0.392721 0.199633,0.310001 0.272391,0.387958 0.291767,0.423911 0.210747,0.392721 0.199633)),((0.108341 0.416568,0.0230624 0.524775,0.11983 0.439661,0.108341 0.416568)),((0.108341 0.416568,0.135246 0.382428,0.0977468 0.395274,0.108341 0.416568)),((0.668916 0.431986,0.729259 0.521793,0.766538 0.334324,0.788997 0.368549,0.791284 0.312445,0.76895 0.322197,0.778422 0.274563,0.719425 0.179933,0.684151 0.208773,0.76089 0.325716,0.717162 0.344809,0.668916 0.431986)),((0.668916 0.431986,0.656761 0.413896,0.600941 0.483052,0.60016 0.509579,0.643761 0.47744,0.668916 0.431986)),((0.603549 0.394417,0.634572 0.380871,0.605233 0.337207,0.603549 0.394417)),((0.625869 0.119956,0.696266 0.142785,0.611653 0.00706631,0.573697 0.0404517,0.625869 0.119956)),((0.656761 0.413896,0.710003 0.347935,0.634572 0.380871,0.656761 0.413896)),((0.696266 0.142785,0.719425 0.179933,0.745381 0.158712,0.696266 0.142785)),((0.701609 0.660841,0.710619 0.636962,0.70696 0.633931,0.701609 0.660841)),((0.701609 0.660841,0.666999 0.75257,0.681007 0.764449,0.701609 0.660841)),((0.788997 0.368549,0.783115 0.512864,0.842285 0.449754,0.788997 0.368549)),((0.959288 0.239088,0.799738 0.308754,0.992212 0.617482,0.959288 0.239088)),((0.959288 0.239088,0.973756 0.232771,0.958302 0.22776,0.959288 0.239088)),((0.717162 0.344809,0.727272 0.326541,0.710003 0.347935,0.717162 0.344809)),((0.783115 0.512864,0.751874 0.546184,0.780115 0.586441,0.783115 0.512864)),((0.745381 0.158712,0.958302 0.22776,0.938553 0.000778765,0.745381 0.158712)),((0.799738 0.308754,0.791944 0.296253,0.791284 0.312445,0.799738 0.308754)),((0.74515 0.545443,0.729259 0.521793,0.717016 0.583363,0.740154 0.558685,0.74515 0.545443)),((0.74515 0.545443,0.748247 0.550053,0.751874 0.546184,0.74732 0.539692,0.74515 0.545443)),((0.310001 0.272391,0.236386 0.254095,0.211225 0.286021,0.27427 0.30382,0.310001 0.272391)),((0.323855 0.317819,0.370548 0.331001,0.385816 0.296593,0.323855 0.317819)),((0.323855 0.317819,0.27427 0.30382,0.216572 0.354569,0.323855 0.317819)),((0.387958 0.291767,0.385816 0.296593,0.394882 0.293488,0.387958 0.291767)),((0.175851 0.276034,0.14191 0.307253,0.173427 0.333981,0.211225 0.286021,0.175851 0.276034)),((0.175851 0.276034,0.207506 0.246917,0.0140798 0.198842,0.069792 0.24609,0.175851 0.276034)),((0.173427 0.333981,0.135246 0.382428,0.203132 0.359173,0.173427 0.333981)),((0.203132 0.359173,0.207309 0.362716,0.216572 0.354569,0.203132 0.359173)),((0.069792 0.24609,0.0159663 0.230894,0.0815688 0.362756,0.14191 0.307253,0.069792 0.24609)),((0.0815688 0.362756,0.0156364 0.423401,0.0977468 0.395274,0.0815688 0.362756)),((0.224866 0.786223,0.199131 0.754051,0.013265 0.942202,0.224866 0.786223)),((0.643761 0.47744,0.604247 0.548838,0.621545 0.563169,0.680308 0.450499,0.643761 0.47744)),((0.604247 0.548838,0.59913 0.544599,0.598711 0.558841,0.604247 0.548838)),((0.452782 0.221035,0.450246 0.176853,0.425156 0.207942,0.423911 0.210747,0.452782 0.221035)),((0.547556 0.651273,0.566996 0.667759,0.59721 0.609827,0.598711 0.558841,0.547556 0.651273)))" }; +static std::string issue_888_53[2] = +{ + "MULTIPOLYGON(((0.101361 0.873249,0.301118 0.633252,0.285957 0.592644,0.135028 0.636275,0.344319 0.39052,0.0807768 0.389475,0.101361 0.873249)),((0.101361 0.873249,0.0361477 0.951599,0.103672 0.927553,0.101361 0.873249)),((0.301118 0.633252,0.315174 0.670899,0.33042 0.651962,0.330739 0.654302,0.315658 0.672196,0.323461 0.693095,0.334835 0.684373,0.341221 0.73125,0.338625 0.733712,0.34324 0.746072,0.344189 0.75304,0.324735 0.787732,0.287708 0.782026,0.152761 0.910072,0.226024 0.883982,0.215588 0.892864,0.277228 0.872453,0.241092 0.936893,0.327022 0.855964,0.37797 0.839093,0.425729 0.967012,0.529874 0.788791,0.558286 0.779383,0.556701 0.766224,0.65607 0.730838,0.692351 0.704562,0.697876 0.71595,0.702942 0.714146,0.707042 0.706142,0.711407 0.711132,0.799272 0.679842,0.779237 0.641637,0.833376 0.602428,0.780122 0.563447,0.810992 0.50317,0.757461 0.431674,0.767273 0.423323,0.781644 0.335916,0.749286 0.355358,0.709115 0.319338,0.732915 0.280433,0.713883 0.297463,0.704049 0.313171,0.706561 0.317049,0.703397 0.314212,0.686139 0.341775,0.674939 0.332312,0.670981 0.335853,0.658385 0.328037,0.657071 0.317215,0.623065 0.288482,0.644713 0.261593,0.628117 0.246712,0.6106 0.27795,0.602526 0.271128,0.590314 0.2858,0.571143 0.273905,0.578518 0.250844,0.426472 0.122377,0.364986 0.0297914,0.445637 0.196032,0.26697 0.0851721,0.292758 0.232593,0.387037 0.34036,0.344319 0.39052,0.424949 0.39084,0.282042 0.582159,0.285957 0.592644,0.320962 0.582524,0.324109 0.60563,0.301118 0.633252),(0.526427 0.362556,0.553002 0.330628,0.536289 0.382885,0.526427 0.362556),(0.510405 0.381806,0.511534 0.391183,0.502629 0.391148,0.510405 0.381806),(0.484614 0.50262,0.503361 0.485845,0.487873 0.534273,0.4628 0.541521,0.484614 0.50262),(0.632981 0.455744,0.625653 0.461363,0.632188 0.455163,0.632981 0.455744),(0.521031 0.470034,0.521942 0.477601,0.515424 0.475051,0.521031 0.470034),(0.664289 0.376674,0.665904 0.389973,0.664792 0.391791,0.654849 0.391752,0.664289 0.376674),(0.716114 0.391995,0.698833 0.391926,0.716805 0.374873,0.721777 0.371886,0.731559 0.380151,0.716114 0.391995),(0.476049 0.442104,0.497 0.445061,0.488199 0.455992,0.476049 0.442104),(0.417634 0.770625,0.48428 0.664179,0.524665 0.629807,0.541078 0.636494,0.54301 0.652544,0.417634 0.770625),(0.417634 0.770625,0.406699 0.78809,0.409979 0.777834,0.417634 0.770625),(0.562537 0.36366,0.602098 0.293112,0.613594 0.300245,0.562537 0.36366),(0.590531 0.494689,0.590473 0.49457,0.597976 0.482587,0.58827 0.49003,0.57156 0.455585,0.611365 0.461203,0.620502 0.446609,0.62793 0.452047,0.621457 0.462628,0.623608 0.462931,0.619207 0.466306,0.617496 0.469103,0.62395 0.462979,0.647385 0.466287,0.677877 0.488607,0.679066 0.498397,0.6847 0.493601,0.697077 0.50266,0.682592 0.527448,0.684251 0.541111,0.676403 0.53804,0.640975 0.598666,0.617678 0.550644,0.646318 0.526268,0.59637 0.506724,0.594746 0.503377,0.590761 0.504529,0.585522 0.502479,0.590205 0.494998,0.590531 0.494689),(0.544962 0.391316,0.54201 0.389156,0.562537 0.36366,0.547024 0.391324,0.608717 0.391569,0.580186 0.417099,0.546427 0.392389,0.543464 0.397674,0.561152 0.434132,0.541862 0.451393,0.518387 0.44808,0.517823 0.443399,0.515759 0.44708,0.51758 0.441384,0.515288 0.422347,0.529192 0.405077,0.533607 0.391271,0.540286 0.391297,0.540339 0.391232,0.540371 0.391298,0.544962 0.391316)),((0.152761 0.910072,0.103672 0.927553,0.104862 0.955521,0.152761 0.910072)),((0.590531 0.494689,0.594746 0.503377,0.596912 0.502751,0.617496 0.469103,0.590531 0.494689)),((0.645636 0.223015,0.645246 0.219802,0.644295 0.220945,0.645636 0.223015)),((0.645636 0.223015,0.649585 0.255543,0.644713 0.261593,0.651004 0.267233,0.657071 0.317215,0.674939 0.332312,0.699286 0.310525,0.703397 0.314212,0.704049 0.313171,0.701216 0.308798,0.713883 0.297463,0.756461 0.22946,0.79194 0.273302,0.808697 0.171384,0.794671 0.168431,0.81435 0.137,0.832141 0.0287975,0.730585 0.154935,0.462894 0.0985647,0.590598 0.213071,0.578518 0.250844,0.602526 0.271128,0.6251 0.244006,0.628117 0.246712,0.638996 0.227311,0.644295 0.220945,0.643368 0.219514,0.644883 0.216813,0.645246 0.219802,0.697673 0.156814,0.713413 0.176264,0.659074 0.243756,0.645636 0.223015)),((0.544962 0.391316,0.546427 0.392389,0.547024 0.391324,0.544962 0.391316)),((0.543464 0.397674,0.540371 0.391298,0.540286 0.391297,0.529192 0.405077,0.51758 0.441384,0.517823 0.443399,0.543464 0.397674)),((0.900875 0.327668,0.810992 0.50317,0.86705 0.57804,0.942565 0.52335,0.900875 0.327668)),((0.900875 0.327668,0.947768 0.236106,0.888903 0.271473,0.900875 0.327668)),((0.808697 0.171384,0.824352 0.174681,0.840911 0.300307,0.888903 0.271473,0.848599 0.0822989,0.81435 0.137,0.808697 0.171384)),((0.840911 0.300307,0.822665 0.31127,0.846188 0.340338,0.840911 0.300307)),((0.79194 0.273302,0.781644 0.335916,0.822665 0.31127,0.79194 0.273302)),((0.86705 0.57804,0.833376 0.602428,0.948285 0.686538,0.86705 0.57804)))", + "MULTIPOLYGON(((0.659074 0.243756,0.649585 0.255543,0.651004 0.267233,0.699286 0.310525,0.701216 0.308798,0.659074 0.243756)),((0.65607 0.730838,0.614949 0.760619,0.558286 0.779383,0.569893 0.875763,0.926464 0.956953,0.711407 0.711132,0.702942 0.714146,0.699891 0.720104,0.697876 0.71595,0.65607 0.730838)),((0.6251 0.244006,0.638996 0.227311,0.643368 0.219514,0.606658 0.162855,0.590598 0.213071,0.6251 0.244006)),((0.338625 0.733712,0.323461 0.693095,0.220913 0.771732,0.287708 0.782026,0.338625 0.733712)),((0.315174 0.670899,0.28149 0.712736,0.315658 0.672196,0.315174 0.670899)),((0.625653 0.461363,0.623608 0.462931,0.62395 0.462979,0.625653 0.461363)),((0.794671 0.168431,0.730585 0.154935,0.713413 0.176264,0.756461 0.22946,0.794671 0.168431)),((0.597976 0.482587,0.619207 0.466306,0.621457 0.462628,0.611365 0.461203,0.597976 0.482587)),((0.679066 0.498397,0.646318 0.526268,0.676403 0.53804,0.682592 0.527448,0.679066 0.498397)),((0.402869 0.800065,0.401491 0.804374,0.540911 0.757512,0.402869 0.800065)),((0.402869 0.800065,0.406699 0.78809,0.398324 0.801466,0.402869 0.800065)),((0.719855 0.46368,0.757461 0.431674,0.746845 0.417494,0.719855 0.46368)),((0.719855 0.46368,0.696391 0.483651,0.701969 0.494288,0.719855 0.46368)),((0.746845 0.417494,0.77151 0.375285,0.749286 0.355358,0.736399 0.363101,0.750855 0.385413,0.725474 0.369665,0.721777 0.371886,0.701659 0.354888,0.691299 0.34846,0.665904 0.389973,0.666125 0.391796,0.698833 0.391926,0.669517 0.419742,0.670404 0.427047,0.716114 0.391995,0.727787 0.392041,0.746845 0.417494)),((0.708595 0.320188,0.709115 0.319338,0.706561 0.317049,0.708595 0.320188)),((0.708595 0.320188,0.692237 0.346927,0.701659 0.354888,0.725474 0.369665,0.736399 0.363101,0.708595 0.320188)),((0.473998 0.577658,0.465083 0.605533,0.471121 0.607993,0.530823 0.551344,0.52892 0.535542,0.473998 0.577658)),((0.473998 0.577658,0.487873 0.534273,0.527391 0.522848,0.524311 0.49727,0.509505 0.480347,0.503361 0.485845,0.506294 0.476676,0.501948 0.471709,0.484614 0.50262,0.430805 0.55077,0.4628 0.541521,0.434005 0.592872,0.447166 0.598234,0.473998 0.577658)),((0.509505 0.480347,0.515424 0.475051,0.507771 0.472056,0.506294 0.476676,0.509505 0.480347)),((0.502836 0.470125,0.507771 0.472056,0.515566 0.447682,0.515432 0.447663,0.502836 0.470125)),((0.502836 0.470125,0.499379 0.468772,0.501948 0.471709,0.502836 0.470125)),((0.502031 0.312271,0.526427 0.362556,0.518569 0.371997,0.535749 0.384573,0.533607 0.391271,0.511534 0.391183,0.515288 0.422347,0.497 0.445061,0.515432 0.447663,0.515759 0.44708,0.515566 0.447682,0.518387 0.44808,0.521031 0.470034,0.541862 0.451393,0.57156 0.455585,0.561152 0.434132,0.580186 0.417099,0.620502 0.446609,0.654849 0.391752,0.608717 0.391569,0.660475 0.345254,0.658385 0.328037,0.613594 0.300245,0.623065 0.288482,0.6106 0.27795,0.602098 0.293112,0.590314 0.2858,0.553002 0.330628,0.571143 0.273905,0.445637 0.196032,0.494788 0.297342,0.499477 0.291064,0.502031 0.312271),(0.537856 0.386115,0.535749 0.384573,0.536289 0.382885,0.537856 0.386115),(0.537856 0.386115,0.54201 0.389156,0.540339 0.391232,0.537856 0.386115)),((0.502031 0.312271,0.494788 0.297342,0.467142 0.334354,0.50832 0.364495,0.502031 0.312271)),((0.50832 0.364495,0.510405 0.381806,0.518569 0.371997,0.50832 0.364495)),((0.509635 0.623684,0.524665 0.629807,0.538821 0.617759,0.534711 0.583632,0.509635 0.623684)),((0.509635 0.623684,0.471121 0.607993,0.461323 0.617289,0.432133 0.708562,0.48428 0.664179,0.509635 0.623684)),((0.465083 0.605533,0.447166 0.598234,0.418801 0.619985,0.373678 0.700452,0.461323 0.617289,0.465083 0.605533)),((0.374931 0.830954,0.37797 0.839093,0.529874 0.788791,0.539477 0.772358,0.374931 0.830954)),((0.374931 0.830954,0.369376 0.816075,0.340592 0.843183,0.374931 0.830954)),((0.524311 0.49727,0.542793 0.518396,0.556414 0.514458,0.576592 0.498985,0.521942 0.477601,0.524311 0.49727)),((0.530823 0.551344,0.534711 0.583632,0.561889 0.540224,0.553113 0.530193,0.530823 0.551344)),((0.527391 0.522848,0.52892 0.535542,0.5462 0.522291,0.542793 0.518396,0.527391 0.522848)),((0.539477 0.772358,0.556701 0.766224,0.55437 0.746871,0.539477 0.772358)),((0.483053 0.462384,0.453094 0.450661,0.359867 0.562668,0.372228 0.567704,0.406154 0.557896,0.483053 0.462384)),((0.483053 0.462384,0.499379 0.468772,0.488199 0.455992,0.483053 0.462384)),((0.430805 0.55077,0.406154 0.557896,0.391829 0.575689,0.399476 0.578805,0.430805 0.55077)),((0.359867 0.562668,0.315812 0.54472,0.320962 0.582524,0.350431 0.574005,0.359867 0.562668)),((0.467142 0.334354,0.420948 0.300541,0.387037 0.34036,0.427828 0.386985,0.467142 0.334354)),((0.431222 0.390865,0.467936 0.43283,0.502629 0.391148,0.431222 0.390865)),((0.431222 0.390865,0.427828 0.386985,0.424949 0.39084,0.431222 0.390865)),((0.467936 0.43283,0.461881 0.440105,0.476049 0.442104,0.467936 0.43283)),((0.453094 0.450661,0.461881 0.440105,0.405934 0.432208,0.453094 0.450661)),((0.340592 0.843183,0.281925 0.864075,0.277228 0.872453,0.327022 0.855964,0.340592 0.843183)),((0.350431 0.574005,0.324109 0.60563,0.33042 0.651962,0.391829 0.575689,0.372228 0.567704,0.350431 0.574005)),((0.354048 0.77502,0.369376 0.816075,0.409979 0.777834,0.432133 0.708562,0.354048 0.77502)),((0.354048 0.77502,0.345181 0.751271,0.344189 0.75304,0.347896 0.780256,0.354048 0.77502)),((0.434005 0.592872,0.399476 0.578805,0.378706 0.59739,0.330739 0.654302,0.334835 0.684373,0.418801 0.619985,0.434005 0.592872)),((0.373678 0.700452,0.341221 0.73125,0.34324 0.746072,0.345181 0.751271,0.373678 0.700452)),((0.281925 0.864075,0.311609 0.81114,0.226024 0.883982,0.281925 0.864075)),((0.311609 0.81114,0.336908 0.789608,0.324735 0.787732,0.311609 0.81114)),((0.347896 0.780256,0.336908 0.789608,0.349433 0.791538,0.347896 0.780256)),((0.712142 0.513687,0.759426 0.603857,0.780122 0.563447,0.712142 0.513687)),((0.712142 0.513687,0.701969 0.494288,0.697077 0.50266,0.712142 0.513687)),((0.582796 0.506832,0.561889 0.540224,0.590925 0.573414,0.617678 0.550644,0.59637 0.506724,0.590761 0.504529,0.582796 0.506832)),((0.582796 0.506832,0.585522 0.502479,0.583256 0.501592,0.575516 0.508936,0.582796 0.506832)),((0.575516 0.508936,0.556414 0.514458,0.5462 0.522291,0.553113 0.530193,0.575516 0.508936)),((0.759426 0.603857,0.716989 0.686719,0.779237 0.641637,0.759426 0.603857)),((0.675652 0.470277,0.670404 0.427047,0.632981 0.455744,0.647385 0.466287,0.675652 0.470277)),((0.675652 0.470277,0.677877 0.488607,0.6847 0.493601,0.696391 0.483651,0.690475 0.472369,0.675652 0.470277)),((0.669517 0.419742,0.666125 0.391796,0.664792 0.391791,0.62793 0.452047,0.632188 0.455163,0.669517 0.419742)),((0.660475 0.345254,0.664289 0.376674,0.684569 0.344284,0.670981 0.335853,0.660475 0.345254)),((0.576592 0.498985,0.583256 0.501592,0.590205 0.494998,0.590473 0.49457,0.58827 0.49003,0.576592 0.498985)),((0.692237 0.346927,0.686139 0.341775,0.684569 0.344284,0.691299 0.34846,0.692237 0.346927)),((0.675782 0.67041,0.640975 0.598666,0.629779 0.617826,0.675782 0.67041)),((0.675782 0.67041,0.692351 0.704562,0.700498 0.698662,0.675782 0.67041)),((0.629779 0.617826,0.590925 0.573414,0.538821 0.617759,0.541078 0.636494,0.554323 0.64189,0.54301 0.652544,0.55437 0.746871,0.629779 0.617826)),((0.716989 0.686719,0.700498 0.698662,0.707042 0.706142,0.716989 0.686719)))" +}; + static std::string bug_21155501[2] = { "MULTIPOLYGON(((-8.3935546875 27.449790329784214,4.9658203125 18.729501999072138,11.8212890625 23.563987128451217,9.7119140625 25.48295117535531,9.8876953125 31.728167146023935,8.3056640625 32.99023555965106,8.5693359375 37.16031654673677,-1.8896484375 35.60371874069731,-0.5712890625 32.02670629333614,-8.9208984375 29.458731185355344,-8.3935546875 27.449790329784214)))", diff --git a/test/algorithms/set_operations/difference/difference_multi.cpp b/test/algorithms/set_operations/difference/difference_multi.cpp index a4efdad25..7d7cad485 100644 --- a/test/algorithms/set_operations/difference/difference_multi.cpp +++ b/test/algorithms/set_operations/difference/difference_multi.cpp @@ -204,11 +204,16 @@ void test_areal() #endif } - // Requires reveral of isolation in ii turns. There should be 3 rings. - TEST_DIFFERENCE(issue_869_a, 3, 3600, 0, 0, 3); + // Cases below go (or went) wrong in either a ( [0] - [1] ) or b ( [1] - [0] ) + // Requires reversal of isolation in ii turns. There should be 3 rings. + TEST_DIFFERENCE(issue_869_a, 3, 3600, 0, 0, 3); // a went wrong - TEST_DIFFERENCE(issue_888_34, 22, 0.2506824, 6, 0.0253798, 28); - TEST_DIFFERENCE(issue_888_37, 15, 0.0451408, 65, 0.3014843, 80); + TEST_DIFFERENCE(issue_888_34, 22, 0.2506824, 6, 0.0253798, 28); // a went wrong + TEST_DIFFERENCE(issue_888_37, 15, 0.0451408, 65, 0.3014843, 80); // b went wrong + +#if defined(BOOST_GEOMETRY_TEST_FAILURES) + TEST_DIFFERENCE(issue_888_53, 117, 0.2973268, 17, 0.0525798, 134); // a goes wrong +#endif // Areas and #clips correspond with POSTGIS (except sym case) test_one("case_101_multi", From efff23114a1ed7c87d0b58551ff7e184070c5f84 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 30 Jul 2021 19:06:29 +0200 Subject: [PATCH 20/30] [test] Fix static asserts by passing types. --- test/algorithms/comparable_distance.cpp | 104 ++++++++---------- test/algorithms/distance/distance.cpp | 19 ++-- .../distance/distance_brute_force.hpp | 6 +- test/util/math_sqrt.cpp | 4 +- 4 files changed, 62 insertions(+), 71 deletions(-) diff --git a/test/algorithms/comparable_distance.cpp b/test/algorithms/comparable_distance.cpp index 1df2e6a45..8ecbc57ee 100644 --- a/test/algorithms/comparable_distance.cpp +++ b/test/algorithms/comparable_distance.cpp @@ -184,19 +184,18 @@ struct test_variant_different_default_strategy variant_type v1, v2; + using variant_cdistance_t = typename bg::comparable_distance_result + < + variant_type, variant_type, bg::default_strategy + >::type; + using cdistance_t = typename bg::comparable_distance_result + < + point_type, point_type, bg::default_strategy + >::type; BOOST_GEOMETRY_STATIC_ASSERT( - (std::is_same - < - typename bg::comparable_distance_result - < - variant_type, variant_type, bg::default_strategy - >::type, - typename bg::comparable_distance_result - < - point_type, point_type, bg::default_strategy - >::type - >::value), - "Unexpected result type"); + (std::is_same::value), + "Unexpected result type", + variant_cdistance_t, cdistance_t); // Default strategy v1 = point; @@ -257,27 +256,23 @@ struct test_variant_same_default_strategy variant_type v1, v2; + using variant_cdistance_t = typename bg::comparable_distance_result + < + variant_type, variant_type, bg::default_strategy + >::type; BOOST_GEOMETRY_STATIC_ASSERT( - (std::is_same - < - typename bg::comparable_distance_result - < - variant_type, variant_type, bg::default_strategy - >::type, - ExpectedResultType - >::value), - "Unexpected result type"); + (std::is_same::value), + "Unexpected result type", + variant_cdistance_t, ExpectedResultType); + using cdistance_t = typename bg::comparable_distance_result + < + point_type, point_type, bg::default_strategy + >::type; BOOST_GEOMETRY_STATIC_ASSERT( - (std::is_same - < - typename bg::comparable_distance_result - < - point_type, point_type, bg::default_strategy - >::type, - ExpectedResultType - >::value), - "Unexpected result type"); + (std::is_same::value), + "Unexpected result type", + cdistance_t, ExpectedResultType); // Default strategy v1 = point; @@ -348,27 +343,23 @@ struct test_variant_with_strategy strategy_type strategy; + using variant_cdistance_t = typename bg::comparable_distance_result + < + variant_type, variant_type, strategy_type + >::type; BOOST_GEOMETRY_STATIC_ASSERT( - (std::is_same - < - typename bg::comparable_distance_result - < - variant_type, variant_type, strategy_type - >::type, - ExpectedResultType - >::value), - "Unexpected result type"); + (std::is_same::value), + "Unexpected result type", + variant_cdistance_t, ExpectedResultType); + using cdistance_t = typename bg::comparable_distance_result + < + segment_type, linestring_type, strategy_type + >::type; BOOST_GEOMETRY_STATIC_ASSERT( - (std::is_same - < - typename bg::comparable_distance_result - < - segment_type, linestring_type, strategy_type - >::type, - ExpectedResultType - >::value), - "Unexpected result type"); + (std::is_same::value), + "Unexpected result type", + cdistance_t, ExpectedResultType); // Passed strategy v1 = seg; @@ -462,17 +453,14 @@ struct test_variant_boxes typename bg::util::detail::default_integral::type >::type expected_result_type; + using variant_cdistance_t = typename bg::comparable_distance_result + < + variant_type, variant_type, bg::default_strategy + >::type; BOOST_GEOMETRY_STATIC_ASSERT( - (std::is_same - < - typename bg::comparable_distance_result - < - variant_type, variant_type, bg::default_strategy - >::type, - expected_result_type - >::value), - "Unexpected result type" - ); + (std::is_same::value), + "Unexpected result type", + variant_cdistance_t, expected_result_type); // Default strategy check_result::apply(bg::comparable_distance(v1, v2), diff --git a/test/algorithms/distance/distance.cpp b/test/algorithms/distance/distance.cpp index dbf66afe0..6f1a7b6a4 100644 --- a/test/algorithms/distance/distance.cpp +++ b/test/algorithms/distance/distance.cpp @@ -84,7 +84,8 @@ void test_distance_point() typedef typename services::return_type::type cab_return_type; BOOST_GEOMETRY_STATIC_ASSERT( (std::is_same::type>::value), - "Unexpected result type"); + "Unexpected result type", + cab_return_type, typename bg::coordinate_type

::type); taxicab_distance tcd; cab_return_type d = bg::distance(p1, p2, tcd); @@ -460,16 +461,14 @@ void test_variant() variant_type v1, v2; + using distance_t = typename bg::distance_result + < + variant_type, variant_type, bg::default_strategy + >::type; BOOST_GEOMETRY_STATIC_ASSERT( - (std::is_same - < - typename bg::distance_result - < - variant_type, variant_type, bg::default_strategy - >::type, - double - >::value), - "Unexpected result type"); + (std::is_same::value), + "Unexpected result type", + distance_t, double); // Default strategy v1 = point; diff --git a/test/algorithms/distance/distance_brute_force.hpp b/test/algorithms/distance/distance_brute_force.hpp index 64ad16cd6..7c975cc1f 100644 --- a/test/algorithms/distance/distance_brute_force.hpp +++ b/test/algorithms/distance/distance_brute_force.hpp @@ -59,9 +59,11 @@ struct distance_from_bg Strategy const& strategy) { BOOST_GEOMETRY_STATIC_ASSERT((use_distance_from_bg::value), - "Unexpected kind of Geometry1"); + "Unexpected kind of Geometry1", + Geometry1); BOOST_GEOMETRY_STATIC_ASSERT((use_distance_from_bg::value), - "Unexpected kind of Geometry1"); + "Unexpected kind of Geometry2", + Geometry2); return geometry::distance(geometry1, geometry2, strategy); } diff --git a/test/util/math_sqrt.cpp b/test/util/math_sqrt.cpp index e06bc05af..9e3688b3d 100644 --- a/test/util/math_sqrt.cpp +++ b/test/util/math_sqrt.cpp @@ -64,7 +64,9 @@ template inline void check_sqrt(Argument const& arg, Result const& result) { using return_type = typename bg::math::detail::square_root::return_type; - BOOST_GEOMETRY_STATIC_ASSERT((std::is_same::value), "Wrong return type"); + BOOST_GEOMETRY_STATIC_ASSERT((std::is_same::value), + "Wrong return type", + return_type, Result); #ifdef BOOST_GEOMETRY_TEST_DEBUG std::cout << "testing: " << typeid(Result).name() From 135b9264fda22ea29aa92207f7e62d698f273c9c Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 2 Aug 2021 16:49:37 +0200 Subject: [PATCH 21/30] [test] Fix test case in sort_by_side and gcc variadic macros compilation error. --- test/algorithms/overlay/sort_by_side.cpp | 26 ++++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/test/algorithms/overlay/sort_by_side.cpp b/test/algorithms/overlay/sort_by_side.cpp index c8ecc6b97..5776d7040 100644 --- a/test/algorithms/overlay/sort_by_side.cpp +++ b/test/algorithms/overlay/sort_by_side.cpp @@ -217,11 +217,11 @@ void test_sort_by_side(std::string const& case_id, // Define two small macro's to avoid repetitions of testcases/names etc -#define TEST_INT(caseid, exp, ...) { (test_sort_by_side) \ - ( #caseid "_int", caseid[0], caseid[1], exp, __VA_ARGS__); } +#define TEST_INTER(caseid, ...) { (test_sort_by_side) \ + ( #caseid "_inter", caseid[0], caseid[1], __VA_ARGS__); } -#define TEST_UNION(caseid, exp, ...) { (test_sort_by_side) \ - ( #caseid "_union", caseid[0], caseid[1], exp, __VA_ARGS__); } +#define TEST_UNION(caseid, ...) { (test_sort_by_side) \ + ( #caseid "_union", caseid[0], caseid[1], __VA_ARGS__); } template void test_all() @@ -232,15 +232,15 @@ void test_all() // Selection of test cases having only one cluster - TEST_INT(case_64_multi, {1}); - TEST_INT(case_72_multi, {3}); - TEST_INT(case_107_multi, {2}); - TEST_INT(case_123_multi, {3}); - TEST_INT(case_124_multi, {3}); - TEST_INT(case_recursive_boxes_10, {2}); - TEST_INT(case_recursive_boxes_20, {2}); - TEST_INT(case_recursive_boxes_21, {2}); - TEST_INT(case_recursive_boxes_22, {0}); + TEST_INTER(case_64_multi, {1}); + TEST_INTER(case_72_multi, {3}); + TEST_INTER(case_107_multi, {2}); + TEST_INTER(case_123_multi, {3}); + TEST_INTER(case_124_multi, {3}); + TEST_INTER(case_recursive_boxes_10, {2}); + TEST_INTER(case_recursive_boxes_20, {2}); + TEST_INTER(case_recursive_boxes_21, {1}); + TEST_INTER(case_recursive_boxes_22, {0}); TEST_UNION(case_recursive_boxes_46, {2, 1, 2, 1, 1, 2, 1}); From eb617fa1c814b7428cee47d08e8d70724ec9a9aa Mon Sep 17 00:00:00 2001 From: Nicholas Devenish Date: Tue, 3 Aug 2021 11:11:25 +0100 Subject: [PATCH 22/30] Fix error checking for failure type in example validity_failure_type is an enum, not a bitflag. Correct example code that looked like it was trying to treat it as a bitflag, but instead assumed that any failure was fixable. --- doc/src/examples/algorithms/is_valid_failure.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/examples/algorithms/is_valid_failure.cpp b/doc/src/examples/algorithms/is_valid_failure.cpp index f566e23a2..9569ba6ad 100644 --- a/doc/src/examples/algorithms/is_valid_failure.cpp +++ b/doc/src/examples/algorithms/is_valid_failure.cpp @@ -32,7 +32,7 @@ int main() // if the invalidity is only due to lack of closing points and/or wrongly oriented rings, then bg::correct can fix it bool could_be_fixed = (failure == boost::geometry::failure_not_closed - || boost::geometry::failure_wrong_orientation); + || failure == boost::geometry::failure_wrong_orientation); std::cout << "is valid? " << (valid ? "yes" : "no") << std::endl; if (! valid) { From 1030bd0d70168d1522a0e3dd80ff4287e88cd9c8 Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Wed, 28 Jul 2021 15:41:13 +0200 Subject: [PATCH 23/30] [test] add cases for issues #690 #875 #876 --- test/algorithms/check_validity.hpp | 44 ++++++++++++++----- test/algorithms/overlay/overlay_cases.hpp | 24 ++++++++++ .../set_operations/difference/difference.cpp | 8 +++- .../set_operations/union/test_union.hpp | 36 ++------------- .../algorithms/set_operations/union/union.cpp | 13 +++++- 5 files changed, 79 insertions(+), 46 deletions(-) diff --git a/test/algorithms/check_validity.hpp b/test/algorithms/check_validity.hpp index c02ff3f01..31e4f2df9 100644 --- a/test/algorithms/check_validity.hpp +++ b/test/algorithms/check_validity.hpp @@ -15,22 +15,38 @@ #include +template +inline bool input_is_valid(std::string const& case_id, std::string const& subcase, + Geometry const& geometry) +{ + std::string message; + bool const result = bg::is_valid(geometry, message); + if (! result) + { + std::cout << "WARNING: " << case_id << " Input [" << subcase + << "] is not considered as valid (" + << message << ") this can cause that output is invalid: " + << case_id << std::endl; + } + return result; +} + + template inline bool is_output_valid(Geometry const& geometry, std::string const& case_id, G1 const& g1, G2 const& g2, + bool ignore_validity_on_invalid_input, std::string& message) { - bool const result = bg::is_valid(geometry, message); - if (! result) + bool result = bg::is_valid(geometry, message); + if (! result && ignore_validity_on_invalid_input) { - // Check if input was valid. If not, do not report output validity - if (! bg::is_valid(g1) || ! bg::is_valid(g2)) + if (! input_is_valid(case_id, "a", g1) + || ! input_is_valid(case_id, "b", g2)) { - std::cout << "WARNING: Input is not considered as valid; " - << "this can cause that output is invalid: " << case_id - << std::endl; - return true; + // Because input is invalid, output validity is ignored + result = true; } } return result; @@ -48,9 +64,11 @@ struct check_validity bool apply(Geometry const& geometry, std::string const& case_id, G1 const& g1, G2 const& g2, - std::string& message) + std::string& message, + bool ignore_validity_on_invalid_input = true) { - return is_output_valid(geometry, case_id, g1, g2, message); + return is_output_valid(geometry, case_id, g1, g2, + ignore_validity_on_invalid_input, message); } }; @@ -63,12 +81,14 @@ struct check_validity bool apply(Geometry const& geometry, std::string const& case_id, G1 const& g1, G2 const& g2, - std::string& message) + std::string& message, + bool ignore_validity_on_invalid_input = true) { typedef typename boost::range_value::type single_type; for (single_type const& element : geometry) { - if (! is_output_valid(element, case_id, g1, g2, message)) + if (! is_output_valid(element, case_id, g1, g2, + ignore_validity_on_invalid_input, message)) { return false; } diff --git a/test/algorithms/overlay/overlay_cases.hpp b/test/algorithms/overlay/overlay_cases.hpp index a1aa5e475..225275240 100644 --- a/test/algorithms/overlay/overlay_cases.hpp +++ b/test/algorithms/overlay/overlay_cases.hpp @@ -1041,6 +1041,12 @@ static std::string issue_566_b[2] = "POLYGON((0 0,0.148086 -7.06952,10.1459 -6.86009,9.99781 0.209424,0 0))" }; +static std::string issue_690[2] = +{ + "POLYGON((667.934919263624237828481 -491.49318253425167313253,963.147330411699954311189 -168.898750642006632460834,972.814262587873145093909 -165.027657854956288474568,981.868038427448027505307 -170.171982894396819574467,983.490980059854678074771 -180.457944080522594276772,980.852669588300045688811 -185.101249357993367539166,290.852669588299988845392 -939.101249357993424382585,281.185737412126854906091 -942.972342145043739947141,272.131961572551972494693 -937.828017105603180425533,270.50901994014526508181 -927.542055919477434144937,273.147330411700011154608 -922.898750642006575617415,652.663832735933624462632 -508.180717667409339810547,658.329748792524242162472 -512.69913494618185723084,650.188373585171007107419 -506.206604869410682567832,650.188373585171007107419 -495.793395130589317432168,658.329748792524242162472 -489.30086505381814276916,667.934919263624237828481 -491.49318253425167313253))", + "POLYGON((925 686,920.481877622304750730109 676.618022210383628589625,910.329748792524242162472 674.30086505381814276916,902.188373585171007107419 680.793395130589260588749,902.188373585171007107419 691.206604869410739411251,910.329748792524242162472 697.69913494618185723084,920.481877622304750730109 695.381977789616371410375,925 686))" +}; + static std::string issue_838[2] = { "POLYGON((27162.5232832765 -40045.435290614478,27162.764636849268 -40045.321663646188,27164.74034168441 -40044.391828870466,27164.854765308635 -40044.634874609801,27164.613411735867 -40044.748501578091,27162.637706900725 -40045.678336353812,27162.5232832765 -40045.435290614478))", @@ -1053,6 +1059,24 @@ static std::string issue_861[2] = "POLYGON((0.999994299999858893279736093973 0.000000000000000000000000000000 , 0.239056281157559169514570385218 0.000000000000000000000000000000 , 0.073239184141848157061360780062 0.213576637616646664019626200570 , 0.999994299999858893279736093973 0.000000000000000000000000000000))" }; +static std::string issue_875[2] = +{ + "POLYGON((-46.499997761818364 -23.318506263117456,-46.499999998470159 26.305250946791375,-5.3405104310993323 15.276598956337693,37.500000001521741 -9.4573812741570009,37.500000001521741 -29.970448623772313,-38.166710648232517 -29.970440761860232,-46.094160894726727 -23.318520183850637,-46.499997761818364 -23.318506263117456))", + "POLYGON((-67.554314795325794 -23.318900735763236,-62.596713294359084 -17.33359695046795,-60.775620215083222 -15.852879652420938,-58.530163386780792 -15.186307709861694,-56.202193256444019 -15.435360658555282,-54.146122173314907 -16.562122444733632,-46.093707539928616 -23.318900593694593,-67.554314795325794 -23.318900735763236))" +}; + +static std::string issue_876a[2] = +{ + "POLYGON((-12.348592836283077 -24.307738740001128,-41.849629816470362 0.44657841289972566,-43.93192354390343 1.5953436102420255,-46.29667314132071 1.8752581961977057,-46.50000184857911 1.8191141367510681,-46.499999998470003 33.093636483932755,37.500000001521677 33.093636483932414,37.500000001521677 -33.09363648327178,-1.8779562757967945 -33.093638112618237,-12.348592836283077 -24.307738740001128))", + "POLYGON((-24.958697324691109 -13.726596811192508,-23.487544907371284 -15.559526963320764,-22.825279893545986 -17.819579221226945,-23.07272612812282 -20.162681116069621,-24.165778212709604 -22.183251915571645,-89.244978527106397 -22.179296124972666,-78.129783911175977 -8.7599622312850443,-30.874278746584466 -8.7628346218826891,-24.958697324691109 -13.726596811192508))" +}; + +static std::string issue_876b[2] = +{ + "POLYGON((-24.0482387183879496 -37.4313973992433375,-33.3495047556582449 -29.626708497888103,-36.5200226063477373 -27.5648148400831587,-39.4272653484940747 -26.8296944564690421,-41.9200722819054548 -27.2887150170597579,-43.732554394428881 -28.7766577741327865,-46.4999999984738537 -32.7358335543285648,-46.4999999984700025 37.4313974000880307,37.5000000015215846 37.4313974000876897,37.5000000015215846 -37.4313973992433375,-24.0482387183879496 -37.4313973992433375))", + "POLYGON((-71.6230763305201634 -132.587678014412745,-106.959839171856814 -102.936613347248112,-40.4477408440520776 -23.6705812141075285,-5.11097800271543878 -53.3216458812721612,-71.6230763305201634 -132.587678014412745))" +}; + static std::string ggl_list_20120229_volker[3] = { "POLYGON((1716 1554,2076 2250,2436 2352,2796 1248,3156 2484,3516 2688,3516 2688,3156 2484,2796 1248,2436 2352,2076 2250, 1716 1554))", diff --git a/test/algorithms/set_operations/difference/difference.cpp b/test/algorithms/set_operations/difference/difference.cpp index b77d82c0a..403c79e83 100644 --- a/test/algorithms/set_operations/difference/difference.cpp +++ b/test/algorithms/set_operations/difference/difference.cpp @@ -570,6 +570,12 @@ void test_all() settings); } + TEST_DIFFERENCE(issue_875, 1, 3468.77515, 1, 105.425816, 2); +#if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES) + TEST_DIFFERENCE(issue_876a, 1, 4728.89916, 1, 786.29563, 2); +#endif + TEST_DIFFERENCE(issue_876b, 1, 6114.18234, 1, 4754.29449, count_set(1, 2)); + TEST_DIFFERENCE(mysql_21977775, 2, 160.856568913, 2, 92.3565689126, 4); TEST_DIFFERENCE(mysql_21965285, 1, 92.0, 1, 14.0, 1); TEST_DIFFERENCE(mysql_23023665_1, 1, 92.0, 1, 142.5, 2); @@ -627,7 +633,7 @@ int test_main(int, char* []) // Not yet fully tested for float and long double. // The difference algorithm can generate (additional) slivers // Many of the failures are self-intersection points. - BoostGeometryWriteExpectedFailures(12, 10, 17, 12); + BoostGeometryWriteExpectedFailures(19, 10, 17, 12); #endif return 0; diff --git a/test/algorithms/set_operations/union/test_union.hpp b/test/algorithms/set_operations/union/test_union.hpp index 55c468134..3ea139d59 100644 --- a/test/algorithms/set_operations/union/test_union.hpp +++ b/test/algorithms/set_operations/union/test_union.hpp @@ -51,30 +51,10 @@ struct ut_settings : public ut_base_settings { - ut_settings() - : percentage(0.001) - {} - - double percentage; + double percentage = 0.001; + bool ignore_validity_on_invalid_input = true; }; -#if defined(BOOST_GEOMETRY_TEST_CHECK_VALID_INPUT) -template -inline void check_input_validity(std::string const& caseid, int case_index, - Geometry const& geometry) -{ - std::string message; - if (!bg::is_valid(geometry, message)) - { - std::cout << caseid << " Input [" - << case_index << "] not valid" << std::endl - << " (" << message << ")" << std::endl; - } -} -#endif - - - template inline std::size_t num_points(Range const& rng, bool add_for_open = false) { @@ -100,15 +80,6 @@ void test_union(std::string const& caseid, G1 const& g1, G2 const& g2, typedef typename setop_output_type::type result_type; result_type clip; -#if defined(BOOST_GEOMETRY_DEBUG_ROBUSTNESS) - std::cout << "*** UNION " << caseid << std::endl; -#endif - -#if defined(BOOST_GEOMETRY_TEST_CHECK_VALID_INPUT) - check_input_validity(caseid, 0, g1); - check_input_validity(caseid, 1, g2); -#endif - // Check normal behaviour bg::union_(g1, g2, clip); @@ -128,7 +99,8 @@ void test_union(std::string const& caseid, G1 const& g1, G2 const& g2, if (settings.test_validity()) { std::string message; - bool const valid = check_validity::apply(clip, caseid, g1, g2, message); + bool const valid = check_validity::apply(clip, caseid, + g1, g2, message, settings.ignore_validity_on_invalid_input); BOOST_CHECK_MESSAGE(valid, "union: " << caseid << " not valid: " << message << " type: " << (type_for_assert_message())); diff --git a/test/algorithms/set_operations/union/union.cpp b/test/algorithms/set_operations/union/union.cpp index 7daec1990..005e13e7e 100644 --- a/test/algorithms/set_operations/union/union.cpp +++ b/test/algorithms/set_operations/union/union.cpp @@ -430,6 +430,17 @@ void test_areal() TEST_UNION_REV(issue_566_a, 1, 0, -1, 214.3728); TEST_UNION_REV(issue_566_b, 1, 0, -1, 214.3728); +#if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES) + { + // With rescaling, the input (was already an output of a previous step) + // is somehow considered as invalid. Output is also invalid. + // Without rescaling, the same input is considered as valid + ut_settings settings; + settings.ignore_validity_on_invalid_input = false; + TEST_UNION_WITH(issue_690, 2, 0, -1, 25492.0505); + } +#endif + TEST_UNION(issue_838, 1, 0, -1, expectation_limits(1.3333, 1.33785)); TEST_UNION_REV(issue_838, 1, 0, -1, expectation_limits(1.3333, 1.33785)); @@ -597,7 +608,7 @@ int test_main(int, char* []) #endif #if defined(BOOST_GEOMETRY_TEST_FAILURES) - BoostGeometryWriteExpectedFailures(3, 1, 2, 0); + BoostGeometryWriteExpectedFailures(4, 1, 2, 0); #endif return 0; From f3fd231ff0be63696f7839c6974a37c21341200a Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 4 Aug 2021 15:17:21 +0200 Subject: [PATCH 24/30] [test] Remove BOOST_NO_AUTO_PTR definition from Jamfile to avoid redefinition warnings. --- test/Jamfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/Jamfile b/test/Jamfile index 023b53f06..492e41aa3 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -4,8 +4,8 @@ # Copyright (c) 2008-2012 Bruno Lalande, Paris, France. # Copyright (c) 2009-2018 Mateusz Loskot, London, UK. # -# This file was modified by Oracle on 2017, 2018, 2019. -# Modifications copyright (c) 2017-2019 Oracle and/or its affiliates. +# This file was modified by Oracle on 2017-2021. +# Modifications copyright (c) 2017-2021 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, @@ -24,7 +24,6 @@ project boost-geometry-test clang:-Wno-unneeded-internal-declaration # supress warning by Boost.None intel:BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE windows,intel:/bigobj - BOOST_NO_AUTO_PTR # disable the deprecated std::auto_ptr support in SmartPtr and Core ; # Run minimal testset From 68274399ce4c318b326a3deef181e8073817b37f Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 5 Aug 2021 00:15:10 +0200 Subject: [PATCH 25/30] [algorithms][io] Add workaround for gcc-5 name lookup. --- include/boost/geometry/algorithms/detail/visit.hpp | 5 +++-- include/boost/geometry/io/wkt/write.hpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/boost/geometry/algorithms/detail/visit.hpp b/include/boost/geometry/algorithms/detail/visit.hpp index 60958f4b4..bbc2f4e86 100644 --- a/include/boost/geometry/algorithms/detail/visit.hpp +++ b/include/boost/geometry/algorithms/detail/visit.hpp @@ -217,7 +217,8 @@ struct visit_breadth_first bool result = true; traits::iter_visit>::apply([&](auto && g) { - result = visit_or_enqueue(function, std::forward(g), queue, it); + result = visit_breadth_first::visit_or_enqueue( + function, std::forward(g), queue, it); }, it); if (! result) @@ -235,7 +236,7 @@ struct visit_breadth_first // so this call can be avoided. traits::iter_visit>::apply([&](auto && g) { - set_iterators(std::forward(g), it, end); + visit_breadth_first::set_iterators(std::forward(g), it, end); }, queue.front()); queue.pop_front(); } diff --git a/include/boost/geometry/io/wkt/write.hpp b/include/boost/geometry/io/wkt/write.hpp index aa52d072f..73b374c9e 100644 --- a/include/boost/geometry/io/wkt/write.hpp +++ b/include/boost/geometry/io/wkt/write.hpp @@ -478,9 +478,10 @@ struct wkt static inline void apply(OutputStream& os, Geometry const& geometry, bool force_closure) { - output_or_recursive_call(os, geometry, force_closure); + wkt::output_or_recursive_call(os, geometry, force_closure); } +private: template < typename OutputStream, typename Geom, @@ -501,7 +502,7 @@ struct wkt traits::iter_visit::apply([&](auto const& g) { - output_or_recursive_call(os, g, force_closure); + wkt::output_or_recursive_call(os, g, force_closure); }, it); } From 5110ec7daea0fef72ebdbd41c7f3392502c55945 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 13 Aug 2021 00:54:38 +0200 Subject: [PATCH 26/30] Add missing headers to satisfy Boost header policy. --- include/boost/geometry/algorithms/azimuth.hpp | 2 + .../index/detail/algorithms/bounds.hpp | 9 +++- .../comparable_distance_centroid.hpp | 7 +++ .../algorithms/comparable_distance_far.hpp | 7 +++ .../algorithms/comparable_distance_near.hpp | 7 +++ .../index/detail/algorithms/content.hpp | 9 +++- .../algorithms/intersection_content.hpp | 7 ++- .../index/detail/algorithms/is_valid.hpp | 5 ++- .../index/detail/algorithms/margin.hpp | 9 +++- .../detail/algorithms/path_intersection.hpp | 5 ++- .../algorithms/segment_intersection.hpp | 9 +++- .../index/detail/distance_predicates.hpp | 6 +-- .../geometry/index/detail/predicates.hpp | 21 +++++---- .../geometry/index/detail/rtree/adaptors.hpp | 8 +++- .../geometry/index/detail/rtree/iterators.hpp | 8 ++++ .../index/detail/rtree/kmeans/kmeans.hpp | 6 ++- .../index/detail/rtree/kmeans/split.hpp | 45 +++++++++++++------ .../index/detail/rtree/node/node_elements.hpp | 5 +++ .../detail/rtree/node/scoped_deallocator.hpp | 6 +++ .../detail/rtree/node/variant_dynamic.hpp | 13 +++++- .../detail/rtree/node/variant_static.hpp | 7 +++ .../index/detail/rtree/node/weak_dynamic.hpp | 35 ++++++++++++++- .../index/detail/rtree/node/weak_static.hpp | 7 +++ .../index/detail/rtree/node/weak_visitor.hpp | 6 +++ .../index/detail/rtree/pack_create.hpp | 11 +++-- .../index/detail/rtree/query_iterators.hpp | 8 +++- .../detail/rtree/rstar/choose_next_node.hpp | 6 ++- .../index/detail/rtree/rstar/insert.hpp | 5 +++ .../index/detail/rtree/utilities/gl_draw.hpp | 13 +++++- .../index/detail/rtree/utilities/print.hpp | 8 +++- .../detail/rtree/visitors/distance_query.hpp | 6 +++ .../index/detail/rtree/visitors/insert.hpp | 10 +++-- .../index/detail/rtree/visitors/iterator.hpp | 7 +++ .../index/detail/rtree/visitors/remove.hpp | 10 +++-- .../detail/rtree/visitors/spatial_query.hpp | 4 ++ .../geometry/index/detail/serialization.hpp | 22 ++++++++- .../geometry/index/detail/translator.hpp | 6 ++- include/boost/geometry/index/parameters.hpp | 6 +-- .../strategies/distance/comparable.hpp | 2 + .../geometry/strategies/distance/services.hpp | 2 + .../geographic/buffer_point_circle.hpp | 10 ++--- .../strategies/intersection_result.hpp | 6 +-- .../geometry/strategies/relate/geographic.hpp | 1 + .../strategies/simplify/spherical.hpp | 1 + 44 files changed, 314 insertions(+), 79 deletions(-) diff --git a/include/boost/geometry/algorithms/azimuth.hpp b/include/boost/geometry/algorithms/azimuth.hpp index 28e5491e7..26c9a5530 100644 --- a/include/boost/geometry/algorithms/azimuth.hpp +++ b/include/boost/geometry/algorithms/azimuth.hpp @@ -23,6 +23,8 @@ #include #include +#include + #include #include #include diff --git a/include/boost/geometry/index/detail/algorithms/bounds.hpp b/include/boost/geometry/index/detail/algorithms/bounds.hpp index 1828a2467..999246d9c 100644 --- a/include/boost/geometry/index/detail/algorithms/bounds.hpp +++ b/include/boost/geometry/index/detail/algorithms/bounds.hpp @@ -4,8 +4,8 @@ // // Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland. // -// This file was modified by Oracle on 2019-2020. -// Modifications copyright (c) 2019-2020 Oracle and/or its affiliates. +// This file was modified by Oracle on 2019-2021. +// Modifications copyright (c) 2019-2021 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, @@ -15,6 +15,11 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_BOUNDS_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_BOUNDS_HPP +#include +#include +#include +#include + #include namespace boost { namespace geometry { namespace index { namespace detail diff --git a/include/boost/geometry/index/detail/algorithms/comparable_distance_centroid.hpp b/include/boost/geometry/index/detail/algorithms/comparable_distance_centroid.hpp index c4e44cae1..6afe03eec 100644 --- a/include/boost/geometry/index/detail/algorithms/comparable_distance_centroid.hpp +++ b/include/boost/geometry/index/detail/algorithms/comparable_distance_centroid.hpp @@ -4,6 +4,10 @@ // // Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland. // +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021 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) @@ -11,6 +15,9 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP +#include +#include + #include #include diff --git a/include/boost/geometry/index/detail/algorithms/comparable_distance_far.hpp b/include/boost/geometry/index/detail/algorithms/comparable_distance_far.hpp index 214fbf6aa..102ac545e 100644 --- a/include/boost/geometry/index/detail/algorithms/comparable_distance_far.hpp +++ b/include/boost/geometry/index/detail/algorithms/comparable_distance_far.hpp @@ -4,6 +4,10 @@ // // Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland. // +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021 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) @@ -11,6 +15,9 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP +#include +#include + #include #include diff --git a/include/boost/geometry/index/detail/algorithms/comparable_distance_near.hpp b/include/boost/geometry/index/detail/algorithms/comparable_distance_near.hpp index 15368a7d2..4f2905f3a 100644 --- a/include/boost/geometry/index/detail/algorithms/comparable_distance_near.hpp +++ b/include/boost/geometry/index/detail/algorithms/comparable_distance_near.hpp @@ -4,6 +4,10 @@ // // Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland. // +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021 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) @@ -11,6 +15,9 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP +#include +#include + #include namespace boost { namespace geometry { namespace index { namespace detail { diff --git a/include/boost/geometry/index/detail/algorithms/content.hpp b/include/boost/geometry/index/detail/algorithms/content.hpp index 7833ae377..d698a3208 100644 --- a/include/boost/geometry/index/detail/algorithms/content.hpp +++ b/include/boost/geometry/index/detail/algorithms/content.hpp @@ -4,8 +4,8 @@ // // Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland. // -// This file was modified by Oracle on 2020. -// Modifications copyright (c) 2020 Oracle and/or its affiliates. +// This file was modified by Oracle on 2020-2021. +// Modifications copyright (c) 2020-2021 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, @@ -15,7 +15,12 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP +#include +#include #include +#include +#include +#include namespace boost { namespace geometry { namespace index { namespace detail { diff --git a/include/boost/geometry/index/detail/algorithms/intersection_content.hpp b/include/boost/geometry/index/detail/algorithms/intersection_content.hpp index 880540bc0..1a2cd28bc 100644 --- a/include/boost/geometry/index/detail/algorithms/intersection_content.hpp +++ b/include/boost/geometry/index/detail/algorithms/intersection_content.hpp @@ -4,8 +4,8 @@ // // Copyright (c) 2011-2018 Adam Wulkiewicz, Lodz, Poland. // -// This file was modified by Oracle on 2019-2020. -// Modifications copyright (c) 2019-2020 Oracle and/or its affiliates. +// This file was modified by Oracle on 2019-2021. +// Modifications copyright (c) 2019-2021 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, @@ -20,6 +20,9 @@ #include +#include +#include + namespace boost { namespace geometry { namespace index { namespace detail { // Util to distinguish between default and non-default index strategy diff --git a/include/boost/geometry/index/detail/algorithms/is_valid.hpp b/include/boost/geometry/index/detail/algorithms/is_valid.hpp index 0d57ed57e..5cd241c29 100644 --- a/include/boost/geometry/index/detail/algorithms/is_valid.hpp +++ b/include/boost/geometry/index/detail/algorithms/is_valid.hpp @@ -4,8 +4,8 @@ // // Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland. // -// This file was modified by Oracle on 2020. -// Modifications copyright (c) 2020 Oracle and/or its affiliates. +// This file was modified by Oracle on 2020-2021. +// Modifications copyright (c) 2020-2021 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, @@ -18,6 +18,7 @@ #include #include +#include #include namespace boost { namespace geometry { namespace index { namespace detail { diff --git a/include/boost/geometry/index/detail/algorithms/margin.hpp b/include/boost/geometry/index/detail/algorithms/margin.hpp index 2033f4a53..5a05d3c02 100644 --- a/include/boost/geometry/index/detail/algorithms/margin.hpp +++ b/include/boost/geometry/index/detail/algorithms/margin.hpp @@ -4,8 +4,8 @@ // // Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland. // -// This file was modified by Oracle on 2020. -// Modifications copyright (c) 2020 Oracle and/or its affiliates. +// This file was modified by Oracle on 2020-2021. +// Modifications copyright (c) 2020-2021 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, @@ -15,7 +15,12 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_MARGIN_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_MARGIN_HPP +#include +#include #include +#include +#include +#include // WARNING! comparable_margin() will work only if the same Geometries are compared // so it shouldn't be used in the case of Variants! diff --git a/include/boost/geometry/index/detail/algorithms/path_intersection.hpp b/include/boost/geometry/index/detail/algorithms/path_intersection.hpp index 4803f5914..ab0860349 100644 --- a/include/boost/geometry/index/detail/algorithms/path_intersection.hpp +++ b/include/boost/geometry/index/detail/algorithms/path_intersection.hpp @@ -4,8 +4,8 @@ // // Copyright (c) 2011-2017 Adam Wulkiewicz, Lodz, Poland. // -// This file was modified by Oracle on 2020. -// Modifications copyright (c) 2020 Oracle and/or its affiliates. +// This file was modified by Oracle on 2020-2021. +// Modifications copyright (c) 2020-2021 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, @@ -20,6 +20,7 @@ #include +#include #include diff --git a/include/boost/geometry/index/detail/algorithms/segment_intersection.hpp b/include/boost/geometry/index/detail/algorithms/segment_intersection.hpp index a2717d26e..674d9f5f8 100644 --- a/include/boost/geometry/index/detail/algorithms/segment_intersection.hpp +++ b/include/boost/geometry/index/detail/algorithms/segment_intersection.hpp @@ -4,8 +4,8 @@ // // Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland. // -// This file was modified by Oracle on 2020. -// Modifications copyright (c) 2020, Oracle and/or its affiliates. +// This file was modified by Oracle on 2020-2021. +// Modifications copyright (c) 2020-2021, 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, @@ -15,9 +15,14 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_SEGMENT_INTERSECTION_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_SEGMENT_INTERSECTION_HPP +#include #include +#include +#include #include +#include +#include namespace boost { namespace geometry { namespace index { namespace detail { diff --git a/include/boost/geometry/index/detail/distance_predicates.hpp b/include/boost/geometry/index/detail/distance_predicates.hpp index dcd8d1243..69ce45633 100644 --- a/include/boost/geometry/index/detail/distance_predicates.hpp +++ b/include/boost/geometry/index/detail/distance_predicates.hpp @@ -5,8 +5,8 @@ // // Copyright (c) 2011-2015 Adam Wulkiewicz, Lodz, Poland. // -// This file was modified by Oracle on 2019-2020. -// Modifications copyright (c) 2019-2020 Oracle and/or its affiliates. +// This file was modified by Oracle on 2019-2021. +// Modifications copyright (c) 2019-2021 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, @@ -22,7 +22,7 @@ #include #include #include - +#include #include namespace boost { namespace geometry { namespace index { namespace detail { diff --git a/include/boost/geometry/index/detail/predicates.hpp b/include/boost/geometry/index/detail/predicates.hpp index 0ae8defe8..c1a8b73c4 100644 --- a/include/boost/geometry/index/detail/predicates.hpp +++ b/include/boost/geometry/index/detail/predicates.hpp @@ -20,9 +20,13 @@ //#include #include +#include +#include #include +#include + namespace boost { namespace geometry { namespace index { namespace detail { namespace predicates { @@ -31,10 +35,10 @@ namespace predicates { // predicates // ------------------------------------------------------------------ // -template +template ::value> struct satisfies_impl { - satisfies_impl() : fun(NULL) {} + satisfies_impl() : fun(nullptr) {} satisfies_impl(Fun f) : fun(f) {} Fun * fun; }; @@ -42,20 +46,19 @@ struct satisfies_impl template struct satisfies_impl { - satisfies_impl() {} + satisfies_impl() = default; satisfies_impl(Fun const& f) : fun(f) {} Fun fun; }; template -struct satisfies - : satisfies_impl::value> +struct satisfies : satisfies_impl { - typedef satisfies_impl::value> base; + using base_t = satisfies_impl; - satisfies() {} - satisfies(Fun const& f) : base(f) {} - satisfies(base const& b) : base(b) {} + satisfies() = default; + satisfies(Fun const& f) : base_t(f) {} + satisfies(base_t const& b) : base_t(b) {} }; // ------------------------------------------------------------------ // diff --git a/include/boost/geometry/index/detail/rtree/adaptors.hpp b/include/boost/geometry/index/detail/rtree/adaptors.hpp index 4e0eb9ba0..4da3d7b94 100644 --- a/include/boost/geometry/index/detail/rtree/adaptors.hpp +++ b/include/boost/geometry/index/detail/rtree/adaptors.hpp @@ -4,6 +4,10 @@ // // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021 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) @@ -11,13 +15,13 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_ADAPTORS_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_ADAPTORS_HPP -#include -#include +#include #include namespace boost { namespace geometry { namespace index { +// Forward declaration template class rtree; diff --git a/include/boost/geometry/index/detail/rtree/iterators.hpp b/include/boost/geometry/index/detail/rtree/iterators.hpp index a47dd7ea4..1d5cd1a23 100644 --- a/include/boost/geometry/index/detail/rtree/iterators.hpp +++ b/include/boost/geometry/index/detail/rtree/iterators.hpp @@ -4,6 +4,10 @@ // // Copyright (c) 2011-2015 Adam Wulkiewicz, Lodz, Poland. // +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021 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) @@ -11,6 +15,10 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_ITERATORS_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_ITERATORS_HPP +#include + +#include + namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace iterators { template diff --git a/include/boost/geometry/index/detail/rtree/kmeans/kmeans.hpp b/include/boost/geometry/index/detail/rtree/kmeans/kmeans.hpp index 3f61482b2..34edcfa7c 100644 --- a/include/boost/geometry/index/detail/rtree/kmeans/kmeans.hpp +++ b/include/boost/geometry/index/detail/rtree/kmeans/kmeans.hpp @@ -4,6 +4,10 @@ // // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021 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) @@ -11,6 +15,6 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_KMEANS_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_KMEANS_HPP -#include +#include #endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_KMEANS_HPP diff --git a/include/boost/geometry/index/detail/rtree/kmeans/split.hpp b/include/boost/geometry/index/detail/rtree/kmeans/split.hpp index f19654972..aa9dfbba4 100644 --- a/include/boost/geometry/index/detail/rtree/kmeans/split.hpp +++ b/include/boost/geometry/index/detail/rtree/kmeans/split.hpp @@ -4,6 +4,10 @@ // // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021 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) @@ -11,13 +15,17 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_SPLIT_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_SPLIT_HPP -#include -#include +#include +#include namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { +// TODO: This should be defined in options.hpp +// For now it's defined here to satisfy Boost header policy +struct split_kmeans_tag {}; + namespace kmeans { // some details @@ -56,25 +64,34 @@ namespace kmeans { // 4. Pamietac o parametryzacji kontenera z nadmiarowymi elementami // PS. Z R* reinsertami moze byc masakra -template -class split +template +class split { protected: - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename MembersHolder::parameters_type parameters_type; + typedef typename MembersHolder::box_type box_type; + typedef typename MembersHolder::translator_type translator_type; + typedef typename MembersHolder::allocators_type allocators_type; + typedef typename MembersHolder::size_type size_type; - typedef typename Options::parameters_type parameters_type; + typedef typename MembersHolder::node node; + typedef typename MembersHolder::internal_node internal_node; + typedef typename MembersHolder::leaf leaf; public: + typedef index::detail::varray + < + typename rtree::elements_type::type::value_type, + 1 + > nodes_container_type; + template - static inline void apply(node* & root_node, - size_t & leafs_level, + static inline void apply(nodes_container_type & additional_nodes, Node & n, - internal_node *parent_node, - size_t current_child_index, - Translator const& tr, - Allocators & allocators) + box_type & n_box, + parameters_type const& parameters, + translator_type const& translator, + allocators_type & allocators) { } diff --git a/include/boost/geometry/index/detail/rtree/node/node_elements.hpp b/include/boost/geometry/index/detail/rtree/node/node_elements.hpp index 0e5848987..ca034a8d7 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_elements.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_elements.hpp @@ -4,6 +4,10 @@ // // Copyright (c) 2011-2015 Adam Wulkiewicz, Lodz, Poland. // +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021 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) @@ -15,6 +19,7 @@ #include #include #include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/index/detail/rtree/node/scoped_deallocator.hpp b/include/boost/geometry/index/detail/rtree/node/scoped_deallocator.hpp index 0062402d4..a63aad884 100644 --- a/include/boost/geometry/index/detail/rtree/node/scoped_deallocator.hpp +++ b/include/boost/geometry/index/detail/rtree/node/scoped_deallocator.hpp @@ -4,6 +4,10 @@ // // Copyright (c) 2011-2018 Adam Wulkiewicz, Lodz, Poland. // +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021 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) @@ -11,6 +15,8 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_SCOPED_DEALLOCATOR_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_SCOPED_DEALLOCATOR_HPP +#include + namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { diff --git a/include/boost/geometry/index/detail/rtree/node/variant_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/variant_dynamic.hpp index 52b253ccf..95c709616 100644 --- a/include/boost/geometry/index/detail/rtree/node/variant_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/variant_dynamic.hpp @@ -4,6 +4,10 @@ // // Copyright (c) 2011-2018 Adam Wulkiewicz, Lodz, Poland. // +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021 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) @@ -11,7 +15,14 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_DYNAMIC_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_DYNAMIC_HPP -#include +#include +#include +#include +#include + +#include +#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/index/detail/rtree/node/variant_static.hpp b/include/boost/geometry/index/detail/rtree/node/variant_static.hpp index c30998d68..624ce472e 100644 --- a/include/boost/geometry/index/detail/rtree/node/variant_static.hpp +++ b/include/boost/geometry/index/detail/rtree/node/variant_static.hpp @@ -4,6 +4,10 @@ // // Copyright (c) 2011-2018 Adam Wulkiewicz, Lodz, Poland. // +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021 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) @@ -11,6 +15,9 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_STATIC_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_STATIC_HPP +#include +#include + namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { diff --git a/include/boost/geometry/index/detail/rtree/node/weak_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/weak_dynamic.hpp index eadda62a9..1e96ed918 100644 --- a/include/boost/geometry/index/detail/rtree/node/weak_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/weak_dynamic.hpp @@ -4,6 +4,10 @@ // // Copyright (c) 2011-2018 Adam Wulkiewicz, Lodz, Poland. // +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021 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) @@ -11,10 +15,23 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_WEAK_DYNAMIC_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_WEAK_DYNAMIC_HPP +#include +#include + +#include +#include +#include +#include + namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { +// TODO: This should be defined in options.hpp +// For now it's defined here to satisfy Boost header policy +struct node_weak_dynamic_tag {}; +struct node_weak_static_tag {}; + template struct weak_internal_node : public weak_node @@ -87,7 +104,7 @@ struct visitor struct internal_node_alloc { - typedef typename internal_nod + typedef typename internal_node < Value, Parameters, Box, allocators, @@ -116,6 +133,22 @@ struct leaf_alloc >::template rebind_alloc type; }; +template +struct node_alloc +{ + typedef typename weak_node + < + Value, Parameters, Box, + allocators, + Tag + >::type node_type; + + typedef typename ::boost::container::allocator_traits + < + Allocator + >::template rebind_alloc type; +}; + template class allocators : public internal_node_alloc::type diff --git a/include/boost/geometry/index/detail/rtree/node/weak_static.hpp b/include/boost/geometry/index/detail/rtree/node/weak_static.hpp index ac9e69cec..65b80266d 100644 --- a/include/boost/geometry/index/detail/rtree/node/weak_static.hpp +++ b/include/boost/geometry/index/detail/rtree/node/weak_static.hpp @@ -4,6 +4,10 @@ // // Copyright (c) 2011-2018 Adam Wulkiewicz, Lodz, Poland. // +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021 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) @@ -11,6 +15,9 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_WEAK_STATIC_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_WEAK_STATIC_HPP +#include +#include + namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { diff --git a/include/boost/geometry/index/detail/rtree/node/weak_visitor.hpp b/include/boost/geometry/index/detail/rtree/node/weak_visitor.hpp index 08d84778e..a6beaf090 100644 --- a/include/boost/geometry/index/detail/rtree/node/weak_visitor.hpp +++ b/include/boost/geometry/index/detail/rtree/node/weak_visitor.hpp @@ -4,6 +4,10 @@ // // Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland. // +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021 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) @@ -11,6 +15,8 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_WEAK_VISITOR_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_WEAK_VISITOR_HPP +#include + namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { diff --git a/include/boost/geometry/index/detail/rtree/pack_create.hpp b/include/boost/geometry/index/detail/rtree/pack_create.hpp index 4cfd39669..6a8ffe6aa 100644 --- a/include/boost/geometry/index/detail/rtree/pack_create.hpp +++ b/include/boost/geometry/index/detail/rtree/pack_create.hpp @@ -5,8 +5,8 @@ // Copyright (c) 2011-2017 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2020 Caian Benedicto, Campinas, Brazil. // -// This file was modified by Oracle on 2019. -// Modifications copyright (c) 2019 Oracle and/or its affiliates. +// This file was modified by Oracle on 2019-2021. +// Modifications copyright (c) 2019-2021 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, @@ -18,12 +18,15 @@ #include +#include #include + +#include #include #include +#include #include - -#include +#include namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { diff --git a/include/boost/geometry/index/detail/rtree/query_iterators.hpp b/include/boost/geometry/index/detail/rtree/query_iterators.hpp index 8822bcf04..3ca0bafdf 100644 --- a/include/boost/geometry/index/detail/rtree/query_iterators.hpp +++ b/include/boost/geometry/index/detail/rtree/query_iterators.hpp @@ -4,8 +4,8 @@ // // Copyright (c) 2011-2015 Adam Wulkiewicz, Lodz, Poland. // -// This file was modified by Oracle on 2019. -// Modifications copyright (c) 2019 Oracle and/or its affiliates. +// This file was modified by Oracle on 2019-2021. +// Modifications copyright (c) 2019-2021 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, @@ -17,6 +17,10 @@ #include +#include +#include +#include + //#define BOOST_GEOMETRY_INDEX_DETAIL_QUERY_ITERATORS_USE_MOVE namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace iterators { diff --git a/include/boost/geometry/index/detail/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/index/detail/rtree/rstar/choose_next_node.hpp index 7ba5f0f99..4ea9060f8 100644 --- a/include/boost/geometry/index/detail/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/index/detail/rtree/rstar/choose_next_node.hpp @@ -4,8 +4,8 @@ // // Copyright (c) 2011-2019 Adam Wulkiewicz, Lodz, Poland. // -// This file was modified by Oracle on 2019. -// Modifications copyright (c) 2019 Oracle and/or its affiliates. +// This file was modified by Oracle on 2019-2021. +// Modifications copyright (c) 2019-2021 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, @@ -27,6 +27,8 @@ #include #include +#include +#include #include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/index/detail/rtree/rstar/insert.hpp b/include/boost/geometry/index/detail/rtree/rstar/insert.hpp index 8517b7f1b..ce830007a 100644 --- a/include/boost/geometry/index/detail/rtree/rstar/insert.hpp +++ b/include/boost/geometry/index/detail/rtree/rstar/insert.hpp @@ -19,7 +19,12 @@ #include +#include + #include +#include +#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/index/detail/rtree/utilities/gl_draw.hpp b/include/boost/geometry/index/detail/rtree/utilities/gl_draw.hpp index bdabebf22..44933dac4 100644 --- a/include/boost/geometry/index/detail/rtree/utilities/gl_draw.hpp +++ b/include/boost/geometry/index/detail/rtree/utilities/gl_draw.hpp @@ -4,8 +4,8 @@ // // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // -// This file was modified by Oracle on 2019-2020. -// Modifications copyright (c) 2019-2020 Oracle and/or its affiliates. +// This file was modified by Oracle on 2019-2021. +// Modifications copyright (c) 2019-2021 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, @@ -15,7 +15,16 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_UTILITIES_GL_DRAW_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_UTILITIES_GL_DRAW_HPP +#include + +#include +#include +#include #include +#include +#include + +#include namespace boost { namespace geometry { namespace index { namespace detail { diff --git a/include/boost/geometry/index/detail/rtree/utilities/print.hpp b/include/boost/geometry/index/detail/rtree/utilities/print.hpp index 2ed71a6b8..15d618eb6 100644 --- a/include/boost/geometry/index/detail/rtree/utilities/print.hpp +++ b/include/boost/geometry/index/detail/rtree/utilities/print.hpp @@ -4,8 +4,8 @@ // // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // -// This file was modified by Oracle on 2019-2020. -// Modifications copyright (c) 2019-2020 Oracle and/or its affiliates. +// This file was modified by Oracle on 2019-2021. +// Modifications copyright (c) 2019-2021 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, @@ -17,7 +17,11 @@ #include +#include +#include #include +#include +#include namespace boost { namespace geometry { namespace index { namespace detail { diff --git a/include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp b/include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp index a40dbfe84..ede7b346e 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp @@ -15,6 +15,12 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_DISTANCE_QUERY_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_DISTANCE_QUERY_HPP +#include +#include +#include +#include +#include + namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { diff --git a/include/boost/geometry/index/detail/rtree/visitors/insert.hpp b/include/boost/geometry/index/detail/rtree/visitors/insert.hpp index 8b32c8176..5d158bc7d 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/insert.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/insert.hpp @@ -4,8 +4,8 @@ // // Copyright (c) 2011-2015 Adam Wulkiewicz, Lodz, Poland. // -// This file was modified by Oracle on 2019-2020. -// Modifications copyright (c) 2019-2020 Oracle and/or its affiliates. +// This file was modified by Oracle on 2019-2021. +// Modifications copyright (c) 2019-2021 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, @@ -21,12 +21,14 @@ #include #include -#include #include #include - +#include #include +#include + +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/index/detail/rtree/visitors/iterator.hpp b/include/boost/geometry/index/detail/rtree/visitors/iterator.hpp index 621231ae9..71127dcbe 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/iterator.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/iterator.hpp @@ -4,6 +4,10 @@ // // Copyright (c) 2011-2015 Adam Wulkiewicz, Lodz, Poland. // +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021 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) @@ -11,6 +15,9 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_ITERATOR_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_ITERATOR_HPP +#include +#include + namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { diff --git a/include/boost/geometry/index/detail/rtree/visitors/remove.hpp b/include/boost/geometry/index/detail/rtree/visitors/remove.hpp index 59f486163..7cdbb0344 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/remove.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/remove.hpp @@ -4,8 +4,8 @@ // // Copyright (c) 2011-2017 Adam Wulkiewicz, Lodz, Poland. // -// This file was modified by Oracle on 2019. -// Modifications copyright (c) 2019 Oracle and/or its affiliates. +// This file was modified by Oracle on 2019-2021. +// Modifications copyright (c) 2019-2021 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, @@ -15,11 +15,13 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_REMOVE_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_REMOVE_HPP +#include + +#include +#include #include #include -#include - namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { diff --git a/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp b/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp index f0d30162c..5f2c07ea2 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp @@ -15,6 +15,10 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_SPATIAL_QUERY_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_SPATIAL_QUERY_HPP +#include +#include +#include + namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { diff --git a/include/boost/geometry/index/detail/serialization.hpp b/include/boost/geometry/index/detail/serialization.hpp index 71902d19f..909c38e3c 100644 --- a/include/boost/geometry/index/detail/serialization.hpp +++ b/include/boost/geometry/index/detail/serialization.hpp @@ -2,6 +2,10 @@ // // Copyright (c) 2011-2015 Adam Wulkiewicz, Lodz, Poland. // +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021 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) @@ -9,11 +13,21 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_SERIALIZATION_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_SERIALIZATION_HPP +#include +#include + //#include #include #include //#include +#include +#include + +#include +#include +#include + // TODO // how about using the unsigned type capable of storing Max in compile-time versions? @@ -26,7 +40,13 @@ // each geometry save without this info // TODO - move to index/detail/serialization.hpp -namespace boost { namespace geometry { namespace index { namespace detail { +namespace boost { namespace geometry { namespace index { + +// Forward declaration +template +class rtree; + +namespace detail { // TODO - use boost::move? template diff --git a/include/boost/geometry/index/detail/translator.hpp b/include/boost/geometry/index/detail/translator.hpp index 34960d226..900be6e73 100644 --- a/include/boost/geometry/index/detail/translator.hpp +++ b/include/boost/geometry/index/detail/translator.hpp @@ -2,8 +2,8 @@ // // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // -// This file was modified by Oracle on 2019-2020. -// Modifications copyright (c) 2019-2020 Oracle and/or its affiliates. +// This file was modified by Oracle on 2019-2021. +// Modifications copyright (c) 2019-2021 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, @@ -15,6 +15,8 @@ #include +#include + namespace boost { namespace geometry { namespace index { namespace detail { diff --git a/include/boost/geometry/index/parameters.hpp b/include/boost/geometry/index/parameters.hpp index fdaef9284..477518866 100644 --- a/include/boost/geometry/index/parameters.hpp +++ b/include/boost/geometry/index/parameters.hpp @@ -4,8 +4,8 @@ // // Copyright (c) 2011-2017 Adam Wulkiewicz, Lodz, Poland. // -// This file was modified by Oracle on 2019-2020. -// Modifications copyright (c) 2019-2020 Oracle and/or its affiliates. +// This file was modified by Oracle on 2019-2021. +// Modifications copyright (c) 2019-2021 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, @@ -15,13 +15,13 @@ #ifndef BOOST_GEOMETRY_INDEX_PARAMETERS_HPP #define BOOST_GEOMETRY_INDEX_PARAMETERS_HPP - #include #include #include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/strategies/distance/comparable.hpp b/include/boost/geometry/strategies/distance/comparable.hpp index 34a828cfe..3a6d8300b 100644 --- a/include/boost/geometry/strategies/distance/comparable.hpp +++ b/include/boost/geometry/strategies/distance/comparable.hpp @@ -14,6 +14,8 @@ #include #include +#include + namespace boost { namespace geometry { diff --git a/include/boost/geometry/strategies/distance/services.hpp b/include/boost/geometry/strategies/distance/services.hpp index 4ac35c6dd..5ce3cd98b 100644 --- a/include/boost/geometry/strategies/distance/services.hpp +++ b/include/boost/geometry/strategies/distance/services.hpp @@ -14,6 +14,8 @@ #include #include +#include + namespace boost { namespace geometry { diff --git a/include/boost/geometry/strategies/geographic/buffer_point_circle.hpp b/include/boost/geometry/strategies/geographic/buffer_point_circle.hpp index 8d6643d73..d9efba917 100644 --- a/include/boost/geometry/strategies/geographic/buffer_point_circle.hpp +++ b/include/boost/geometry/strategies/geographic/buffer_point_circle.hpp @@ -2,8 +2,8 @@ // Copyright (c) 2018-2019 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2020. -// Modifications copyright (c) 2020 Oracle and/or its affiliates. +// This file was modified by Oracle on 2020-2021. +// Modifications copyright (c) 2020-2021 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, @@ -17,12 +17,12 @@ #include +#include +#include +#include #include #include -#include - - namespace boost { namespace geometry { diff --git a/include/boost/geometry/strategies/intersection_result.hpp b/include/boost/geometry/strategies/intersection_result.hpp index 4b5aa1c46..94aae51d8 100644 --- a/include/boost/geometry/strategies/intersection_result.hpp +++ b/include/boost/geometry/strategies/intersection_result.hpp @@ -2,8 +2,8 @@ // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2015, 2016. -// Modifications copyright (c) 2015-2016 Oracle and/or its affiliates. +// This file was modified by Oracle on 2015-2021. +// Modifications copyright (c) 2015-2021 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, @@ -15,9 +15,9 @@ #include +#include #include - namespace boost { namespace geometry { diff --git a/include/boost/geometry/strategies/relate/geographic.hpp b/include/boost/geometry/strategies/relate/geographic.hpp index 60c6b9e58..4f556e953 100644 --- a/include/boost/geometry/strategies/relate/geographic.hpp +++ b/include/boost/geometry/strategies/relate/geographic.hpp @@ -13,6 +13,7 @@ // TEMP - move to strategy #include +#include #include #include #include diff --git a/include/boost/geometry/strategies/simplify/spherical.hpp b/include/boost/geometry/strategies/simplify/spherical.hpp index 0858087f3..4ff51b38c 100644 --- a/include/boost/geometry/strategies/simplify/spherical.hpp +++ b/include/boost/geometry/strategies/simplify/spherical.hpp @@ -12,6 +12,7 @@ #include +#include #include #include From 4bdfe1bf05b92d881e5ab3502ea82c179532ea61 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 13 Aug 2021 17:44:13 +0200 Subject: [PATCH 27/30] [test] Fix warnings. --- test/algorithms/line_interpolate.cpp | 43 ++++++++++++------------ test/geometries/boost_array_as_point.cpp | 32 ++++++++---------- test/strategies/envelope_segment.cpp | 7 ++-- test/util/algorithm.cpp | 18 +++++----- 4 files changed, 48 insertions(+), 52 deletions(-) diff --git a/test/algorithms/line_interpolate.cpp b/test/algorithms/line_interpolate.cpp index c3338c693..2b5c717e2 100644 --- a/test/algorithms/line_interpolate.cpp +++ b/test/algorithms/line_interpolate.cpp @@ -4,6 +4,7 @@ // Copyright (c) 2018, 2021, 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 // Licensed under the Boost Software License version 1.0. // http://www.boost.org/users/license.html @@ -204,13 +205,13 @@ void test_car() test(l1, 0, "MULTIPOINT((1 1))"); // The following type of test is not robust; // (1 3) could be missing due to floating point round off errors - //test(l1, 0.1, "MULTIPOINT((1.4 1)(1.8 1)(2 1.2)(2 1.6)(2 2)(1.6 2)\ - // (1.2 2)(1 2.2)(1 2.6)(1 3))"); + //test(l1, 0.1, "MULTIPOINT((1.4 1)(1.8 1)(2 1.2)(2 1.6)(2 2)(1.6 2)" + // "(1.2 2)(1 2.2)(1 2.6)(1 3))"); // Tests are more robust if you directly pass the distance - test_distance(l1, 0.4, "MULTIPOINT((1.4 1)(1.8 1)(2 1.2)(2 1.6)(2 2)(1.6 2)\ - (1.2 2)(1 2.2)(1 2.6)(1 3))"); - test(l1, 0.09, "MULTIPOINT((1.36 1)(1.72 1)(2 1.08)(2 1.44)(2 1.8)\ - (1.84 2)(1.48 2)(1.12 2)(1 2.24)(1 2.6)(1 2.96))"); + test_distance(l1, 0.4, "MULTIPOINT((1.4 1)(1.8 1)(2 1.2)(2 1.6)(2 2)(1.6 2)" + "(1.2 2)(1 2.2)(1 2.6)(1 3))"); + test(l1, 0.09, "MULTIPOINT((1.36 1)(1.72 1)(2 1.08)(2 1.44)(2 1.8)" + "(1.84 2)(1.48 2)(1.12 2)(1 2.24)(1 2.6)(1 2.96))"); test(l1, 0.21, "MULTIPOINT((1.84 1)(2 1.68)(1.48 2)(1 2.36))"); test(l1, 0.4, "MULTIPOINT((2 1.6)(1 2.2))"); test(l1, 0.6, "MULTIPOINT((1.6 2))"); @@ -241,18 +242,18 @@ void test_sph() test(l1, 1, "POINT(1 3)"); test(l1, 0, "MULTIPOINT((1 1))"); - test(l1, 0.09, "MULTIPOINT((1.35999 1.00004)(1.71997 1.00003)\ - (2 1.07995)(2 1.43988)(2 1.79981)(1.84016 2.00004)\ - (1.48001 2.00008)(1.11986 2.00003)(1 2.24014)\ - (1 2.60008)(1 2.96001))"); + test(l1, 0.09, "MULTIPOINT((1.35999 1.00004)(1.71997 1.00003)" + "(2 1.07995)(2 1.43988)(2 1.79981)(1.84016 2.00004)" + "(1.48001 2.00008)(1.11986 2.00003)(1 2.24014)" + "(1 2.60008)(1 2.96001))"); test(l1, 0.21, "MULTIPOINT((1.83997 1.00002)(2 1.67983)(1.48001 2.00008)(1 2.36012))"); test(l1, 0.4, "MULTIPOINT((2 1.5998477098527744)(1 2.2001522994279883))"); test(l1, 0.6, "MULTIPOINT((1.6000609543036084 2.0000730473928678))"); test(l1, 1, "MULTIPOINT((1 3))"); - test(l2, 0.3, "MULTIPOINT((5.3014893312120446 1.0006787676128222)\ - (11.600850053156366 1.0085030143490989)\ - (17.9002174825842 1.0041514208039872))"); + test(l2, 0.3, "MULTIPOINT((5.3014893312120446 1.0006787676128222)" + "(11.600850053156366 1.0085030143490989)" + "(17.9002174825842 1.0041514208039872))"); } template @@ -294,18 +295,18 @@ void test_geo(Strategy str) test(l1, 1, "POINT(1 3)", str); test(l1, 0, "MULTIPOINT((1 1))", str); - test(l1, 0.11, "MULTIPOINT((1.43851 1.00004)(1.87702 1.00002)(2 1.31761)\ - (2 1.75901)(1.80081 2.00005)(1.3621 2.00007)\ - (1 2.07708)(1 2.51847)(1 2.95986))", str); - test(l1, 0.21, "MULTIPOINT((1.83716 1.00002)(2 1.67875)(1.48176 2.00008)\ - (1 2.35796))", str); + test(l1, 0.11, "MULTIPOINT((1.43851 1.00004)(1.87702 1.00002)(2 1.31761)" + "(2 1.75901)(1.80081 2.00005)(1.3621 2.00007)" + "(1 2.07708)(1 2.51847)(1 2.95986))", str); + test(l1, 0.21, "MULTIPOINT((1.83716 1.00002)(2 1.67875)(1.48176 2.00008)" + "(1 2.35796))", str); test(l1, 0.4, "MULTIPOINT((2 1.598498298996567)(1 2.1974612279909937))", str); test(l1, 0.6, "MULTIPOINT((1.6013936980010324 2.0000734568388099))", str); test(l1, 1, "MULTIPOINT((1 3))", str); - test(l2, 0.3, "MULTIPOINT((5.306157814 1.0006937303)\ - (11.60351281 1.0085614548123072)\ - (17.90073492 1.004178475142552))", str); + test(l2, 0.3, "MULTIPOINT((5.306157814 1.0006937303)" + "(11.60351281 1.0085614548123072)" + "(17.90073492 1.004178475142552))", str); } template diff --git a/test/geometries/boost_array_as_point.cpp b/test/geometries/boost_array_as_point.cpp index 1cd49bf60..5a51357dc 100644 --- a/test/geometries/boost_array_as_point.cpp +++ b/test/geometries/boost_array_as_point.cpp @@ -4,27 +4,29 @@ // Copyright (c) 2010 Alfredo Correa // Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands. +// This file was modified by Oracle on 2021. +// Modifications copyright (c) 2021, 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) -#include +#include + #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) BOOST_GEOMETRY_REGISTER_BOOST_ARRAY_CS(cs::cartesian) BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) - -#ifndef BOOST_NO_CXX11_HDR_ARRAY -#include BOOST_GEOMETRY_REGISTER_STD_ARRAY_CS(cs::cartesian) -#endif //BOOST_NO_CXX11_HDR_ARRAY int test_main(int, char* []) { @@ -32,18 +34,12 @@ int test_main(int, char* []) double p2[3] = {4,5,6}; boost::tuple p3(7,8,9); boost::array p4 = {{10,11,12}}; + std::array p5 = {{13,14,15}}; + std::clog << bg::distance(p1, p2) << std::endl; std::clog << bg::distance(p2, p3) << std::endl; std::clog << bg::distance(p3, p4) << std::endl; - -#ifndef BOOST_NO_CXX11_HDR_ARRAY -#ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST - std::array p5 = {13,14,15}; -#else - std::array p5; p5[0] = 13; p5[1] = 14; p5[2] = 15; -#endif // BOOST_NO_CXX11_HDR_INITIALIZER_LIST std::clog << bg::distance(p4, p5) << std::endl; -#endif //BOOST_NO_CXX11_HDR_ARRAY return 0; } diff --git a/test/strategies/envelope_segment.cpp b/test/strategies/envelope_segment.cpp index 09610e3c0..77b66fbeb 100644 --- a/test/strategies/envelope_segment.cpp +++ b/test/strategies/envelope_segment.cpp @@ -1,7 +1,6 @@ // Boost.Geometry -// Copyright (c) 2016-2018 Oracle and/or its affiliates. - +// Copyright (c) 2016-2021 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 @@ -12,8 +11,8 @@ #include #include #include -#include -#include +#include +#include template < diff --git a/test/util/algorithm.cpp b/test/util/algorithm.cpp index dd3f35430..e99a80e4c 100644 --- a/test/util/algorithm.cpp +++ b/test/util/algorithm.cpp @@ -22,14 +22,14 @@ void test_dimension(bg::util::index_constant<0>) { bool called = false; - bg::detail::for_each_index<0>([&](auto index) { called = true; }); + bg::detail::for_each_index<0>([&](auto) { called = true; }); BOOST_CHECK(!called); - BOOST_CHECK(bg::detail::all_indexes_of<0>([&](auto index) { return true; }) == true); - BOOST_CHECK(bg::detail::all_indexes_of<0>([&](auto index) { return false; }) == true); - BOOST_CHECK(bg::detail::any_index_of<0>([&](auto index) { return true; }) == false); - BOOST_CHECK(bg::detail::any_index_of<0>([&](auto index) { return false; }) == false); - BOOST_CHECK(bg::detail::none_index_of<0>([&](auto index) { return true; }) == true); - BOOST_CHECK(bg::detail::none_index_of<0>([&](auto index) { return false; }) == true); + BOOST_CHECK(bg::detail::all_indexes_of<0>([&](auto) { return true; }) == true); + BOOST_CHECK(bg::detail::all_indexes_of<0>([&](auto) { return false; }) == true); + BOOST_CHECK(bg::detail::any_index_of<0>([&](auto) { return true; }) == false); + BOOST_CHECK(bg::detail::any_index_of<0>([&](auto) { return false; }) == false); + BOOST_CHECK(bg::detail::none_index_of<0>([&](auto) { return true; }) == true); + BOOST_CHECK(bg::detail::none_index_of<0>([&](auto) { return false; }) == true); } template @@ -60,7 +60,7 @@ void test_dimension(bg::util::index_constant) return bg::get(p) == 10; }) == false); BOOST_CHECK( - bg::detail::any_index_of<0>([&](auto index) + bg::detail::any_index_of<0>([&](auto) { return false; }) == false); @@ -70,7 +70,7 @@ void test_dimension(bg::util::index_constant) return bg::get(p) == double(I - 1); }) == true); BOOST_CHECK( - bg::detail::none_index_of<0>([&](auto index) + bg::detail::none_index_of<0>([&](auto) { return false; }) == true); From 3d8d40ee5cf122ae46dea7bbb59cc95ae5debc86 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 13 Aug 2021 19:03:37 +0200 Subject: [PATCH 28/30] [util] Add workaround for mismatched argument pack lengths error with gcc-11 c++20. --- include/boost/geometry/util/sequence.hpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/include/boost/geometry/util/sequence.hpp b/include/boost/geometry/util/sequence.hpp index 80e3b7b23..fad3d850e 100644 --- a/include/boost/geometry/util/sequence.hpp +++ b/include/boost/geometry/util/sequence.hpp @@ -1,6 +1,6 @@ // Boost.Geometry -// Copyright (c) 2020, Oracle and/or its affiliates. +// Copyright (c) 2020-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -187,13 +187,13 @@ struct combine; template struct combine, type_sequence> { - template - using type_sequence_t = type_sequence...>; + template + using type_sequence_t = type_sequence...>; - typedef typename merge + using type = typename merge < - type_sequence_t... - >::type type; + type_sequence_t... + >::type; }; // combine, integer_sequence>::type is @@ -202,13 +202,13 @@ struct combine, type_sequence> template struct combine, std::integer_sequence> { - template - using type_sequence_t = type_sequence...>; + template + using type_sequence_t = type_sequence...>; - typedef typename merge + using type = typename merge < - type_sequence_t... - >::type type; + type_sequence_t... + >::type; }; From 5f308236123de892d1bc838b6b26f596d95f91b2 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 13 Aug 2021 20:03:40 +0200 Subject: [PATCH 29/30] [util] Rename some of the sequence metafunctions. --- .../detail/select_geometry_type.hpp | 11 +- include/boost/geometry/util/sequence.hpp | 100 +++++++----------- 2 files changed, 48 insertions(+), 63 deletions(-) diff --git a/include/boost/geometry/algorithms/detail/select_geometry_type.hpp b/include/boost/geometry/algorithms/detail/select_geometry_type.hpp index 2e94ae73e..fe89ed5ad 100644 --- a/include/boost/geometry/algorithms/detail/select_geometry_type.hpp +++ b/include/boost/geometry/algorithms/detail/select_geometry_type.hpp @@ -39,7 +39,7 @@ template template class LessPred > struct select_geometry_type - : util::select_element + : util::sequence_min_element < typename traits::geometry_types>::type, LessPred @@ -89,10 +89,13 @@ template template class LessPred > struct select_geometry_types - : util::select_combination_element + : util::sequence_min_element < - typename geometry_types::type, - typename geometry_types::type, + typename util::sequence_combine + < + typename geometry_types::type, + typename geometry_types::type + >::type, LessPred > {}; diff --git a/include/boost/geometry/util/sequence.hpp b/include/boost/geometry/util/sequence.hpp index fad3d850e..d8f70d734 100644 --- a/include/boost/geometry/util/sequence.hpp +++ b/include/boost/geometry/util/sequence.hpp @@ -62,13 +62,13 @@ struct sequence_element {}; template struct sequence_element> { - typedef typename sequence_element>::type type; + using type = typename sequence_element>::type; }; template struct sequence_element<0, type_sequence> { - typedef T type; + using type = T; }; template @@ -112,6 +112,7 @@ struct sequence_empty {}; +// Defines type member for the first type in sequence that satisfies UnaryPred. template < typename Sequence, @@ -138,77 +139,71 @@ template