From 3b3ead537eaf34b9d5129ffa4695888cc3483812 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 10 Mar 2016 04:55:17 +0100 Subject: [PATCH 01/20] [test][rtree] Add test for non-cartesian CSes. --- index/test/rtree/Jamfile.v2 | 3 +- index/test/rtree/rtree_non_cartesian.cpp | 99 ++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 index/test/rtree/rtree_non_cartesian.cpp diff --git a/index/test/rtree/Jamfile.v2 b/index/test/rtree/Jamfile.v2 index 6eb676a45..f5052de37 100644 --- a/index/test/rtree/Jamfile.v2 +++ b/index/test/rtree/Jamfile.v2 @@ -1,6 +1,6 @@ # Boost.Geometry Index # -# Copyright (c) 2011-2015 Adam Wulkiewicz, Lodz, Poland. +# Copyright (c) 2011-2016 Adam Wulkiewicz, Lodz, Poland. # # Use, modification and distribution is subject to the Boost Software License, # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,7 @@ test-suite boost-geometry-index-rtree [ run rtree_epsilon.cpp ] [ run rtree_insert_remove.cpp ] [ run rtree_move_pack.cpp ] + [ run rtree_non_cartesian.cpp ] [ run rtree_values.cpp ] [ compile-fail rtree_values_invalid.cpp ] ; diff --git a/index/test/rtree/rtree_non_cartesian.cpp b/index/test/rtree/rtree_non_cartesian.cpp new file mode 100644 index 000000000..0854fbb35 --- /dev/null +++ b/index/test/rtree/rtree_non_cartesian.cpp @@ -0,0 +1,99 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2016 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +template +inline void fill(Point & pt, double x, double y) +{ + bg::set<0>(pt, x); + bg::set<1>(pt, y); +} + +template +inline void fill(bg::model::box & box, double x, double y) +{ + bg::set<0, 0>(box, x); + bg::set<0, 1>(box, y); + bg::set<1, 0>(box, x + 20); + bg::set<1, 1>(box, y + 20); +} + +template +void test_rtree() +{ + typedef typename Rtree::value_type value_t; + + Rtree rtree; + value_t v; + + // This is not fully valid because both point's longitude and box's min + // longitude should be in range [-180, 180]. So if this stopped passing + // in the future it wouldn't be that bad. Still it works as it is now. + + size_t n = 0; + for (double x = -170; x < 400; x += 30, ++n) + { + //double lon = x <= 180 ? x : x - 360; + double lon = x; + double lat = x <= 180 ? 0 : 30; + + fill(v, lon, lat); + rtree.insert(v); + BOOST_CHECK_EQUAL(rtree.size(), n + 1); + size_t vcount = 1; // x < 180 ? 1 : 2; + BOOST_CHECK_EQUAL(rtree.count(v), vcount); + std::vector res; + rtree.query(bgi::intersects(v), std::back_inserter(res)); + BOOST_CHECK_EQUAL(res.size(), vcount); + } + + for (double x = -170; x < 400; x += 30, --n) + { + //double lon = x <= 180 ? x : x - 360; + double lon = x; + double lat = x <= 180 ? 0 : 30; + + fill(v, lon, lat); + rtree.remove(v); + BOOST_CHECK_EQUAL(rtree.size(), n - 1); + size_t vcount = 0; // x < 180 ? 1 : 0; + BOOST_CHECK_EQUAL(rtree.count(v), vcount); + std::vector res; + rtree.query(bgi::intersects(v), std::back_inserter(res)); + BOOST_CHECK_EQUAL(res.size(), vcount); + } +} + +template +void test_value() +{ + test_rtree > >(); + test_rtree > >(); + test_rtree > >(); +} + +template +void test_cs() +{ + test_value(); + test_value >(); +} + +int test_main(int, char* []) +{ + //test_cs >(); + test_cs > >(); + test_cs > >(); + + return 0; +} From 1142490f4778dc9b696046a7a2643d7fa6e6e2fa Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 10 Mar 2016 05:26:35 +0100 Subject: [PATCH 02/20] [doc] Update 1.61 release notes (addition, ticket, bugfixes). --- doc/release_notes.qbk | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/release_notes.qbk b/doc/release_notes.qbk index 685438ea3..f45352cd4 100644 --- a/doc/release_notes.qbk +++ b/doc/release_notes.qbk @@ -23,6 +23,10 @@ [heading Boost 1.61] [/=================] +[*Additional functionality] + +* Support within and covered_by for Box/Box in spherical and geographic coordinate systems. + [*Improvements] * Overlay: handle_tangencies replaced by clusters, fixing many cases with colocated turns @@ -34,12 +38,15 @@ * [@https://svn.boost.org/trac/boost/ticket/11928 11928] Improvement of the accuracy of surveyor area strategy. * [@https://svn.boost.org/trac/boost/ticket/11966 11966] Compilation error in svg() for box and non-int coordinate type. * [@https://svn.boost.org/trac/boost/ticket/11789 11789] Assertion failure or invalid result of set operations for spherical_equatorial coordinate system. +* [@https://svn.boost.org/trac/boost/ticket/11987 11987] rtree::remove() not compiling for geographic CS. * [@https://svn.boost.org/trac/boost/ticket/12000 12000] Uninitialized reference in (unused) constructor of relate's mask_handler. [*Bugfixes] -* Fix wrong result of intersects/disjoints for Segment and Box when Segment is parallel to Box's face. -* Fix relation operations of Point/Areal in edge cases for non-cartesian coordinate systems. +* Fix intersects and disjoints for Segment/Box in cartesian coordinate system when Segment is parallel to Box's face. +* Fix relation operations for Point/Areal in spherical and geographic coordinate systems for edge cases. +* Fix intersect and disjoint for Point/Box and Box/Box in spherical and geographic coordinate systems for some cases. +* Fix within and covered_by for Point/Box in spherical and geographic coordinate systems for some cases. [/=================] [heading Boost 1.60] From 8bdc2104b3e3a7650230dc6020d0a5db714c637a Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 10 Mar 2016 18:19:52 +0100 Subject: [PATCH 03/20] [test][overlay] Suppress unused typedef warning. --- test/algorithms/overlay/overlay.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/algorithms/overlay/overlay.cpp b/test/algorithms/overlay/overlay.cpp index b35f38b83..3ebc162a4 100644 --- a/test/algorithms/overlay/overlay.cpp +++ b/test/algorithms/overlay/overlay.cpp @@ -398,10 +398,7 @@ void test_all() { typedef bg::model::point point_type; typedef bg::model::polygon polygon; - typedef bg::model::multi_polygon - < - bg::model::polygon - > multi_polygon; + typedef bg::model::multi_polygon multi_polygon; test_overlay ( From e79b50c60d924b4f71843dc398da7caf23df3f48 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 16 Mar 2016 01:15:21 +0100 Subject: [PATCH 04/20] [util] Cleanup includes (type_traits, range). --- include/boost/geometry/util/calculation_type.hpp | 4 +++- include/boost/geometry/util/combine_if.hpp | 2 -- include/boost/geometry/util/parameter_type_of.hpp | 2 +- include/boost/geometry/util/promote_floating_point.hpp | 2 +- include/boost/geometry/util/range.hpp | 5 +++++ include/boost/geometry/util/select_calculation_type.hpp | 2 +- include/boost/geometry/util/select_most_precise.hpp | 3 ++- 7 files changed, 13 insertions(+), 7 deletions(-) diff --git a/include/boost/geometry/util/calculation_type.hpp b/include/boost/geometry/util/calculation_type.hpp index 2ac0de87d..18eac4fbb 100644 --- a/include/boost/geometry/util/calculation_type.hpp +++ b/include/boost/geometry/util/calculation_type.hpp @@ -13,7 +13,9 @@ #include #include -#include +#include +#include +#include #include #include diff --git a/include/boost/geometry/util/combine_if.hpp b/include/boost/geometry/util/combine_if.hpp index cfc344926..5d94c3446 100644 --- a/include/boost/geometry/util/combine_if.hpp +++ b/include/boost/geometry/util/combine_if.hpp @@ -24,8 +24,6 @@ #include #include -#include - namespace boost { namespace geometry { diff --git a/include/boost/geometry/util/parameter_type_of.hpp b/include/boost/geometry/util/parameter_type_of.hpp index 3ed09ab9b..731fb55a5 100644 --- a/include/boost/geometry/util/parameter_type_of.hpp +++ b/include/boost/geometry/util/parameter_type_of.hpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include namespace boost { namespace geometry diff --git a/include/boost/geometry/util/promote_floating_point.hpp b/include/boost/geometry/util/promote_floating_point.hpp index 0c74cb8d6..b84069db1 100644 --- a/include/boost/geometry/util/promote_floating_point.hpp +++ b/include/boost/geometry/util/promote_floating_point.hpp @@ -16,7 +16,7 @@ #include -#include +#include namespace boost { namespace geometry diff --git a/include/boost/geometry/util/range.hpp b/include/boost/geometry/util/range.hpp index 64dee862e..67f373359 100644 --- a/include/boost/geometry/util/range.hpp +++ b/include/boost/geometry/util/range.hpp @@ -19,11 +19,16 @@ #include #include +#include #include #include #include #include +#include +#include +#include #include +#include #include #include diff --git a/include/boost/geometry/util/select_calculation_type.hpp b/include/boost/geometry/util/select_calculation_type.hpp index 0e3faf229..b6405831e 100644 --- a/include/boost/geometry/util/select_calculation_type.hpp +++ b/include/boost/geometry/util/select_calculation_type.hpp @@ -21,7 +21,7 @@ #include -#include +#include #include diff --git a/include/boost/geometry/util/select_most_precise.hpp b/include/boost/geometry/util/select_most_precise.hpp index b5b1388cf..3169f5fa1 100644 --- a/include/boost/geometry/util/select_most_precise.hpp +++ b/include/boost/geometry/util/select_most_precise.hpp @@ -20,7 +20,8 @@ #define BOOST_GEOMETRY_UTIL_SELECT_MOST_PRECISE_HPP #include -#include +#include +#include namespace boost { namespace geometry From b791e1eede7f2d2cdc794070f92879e86c4c5f24 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 16 Mar 2016 01:16:16 +0100 Subject: [PATCH 05/20] [algorithms] Cleanup includes (type_traits, range). --- include/boost/geometry/algorithms/assign.hpp | 1 - include/boost/geometry/algorithms/detail/as_range.hpp | 2 -- .../boost/geometry/algorithms/detail/assign_values.hpp | 1 - include/boost/geometry/algorithms/detail/recalculate.hpp | 6 ++++-- include/boost/geometry/algorithms/length.hpp | 8 ++++---- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/include/boost/geometry/algorithms/assign.hpp b/include/boost/geometry/algorithms/assign.hpp index b17e305f2..e3d664de3 100644 --- a/include/boost/geometry/algorithms/assign.hpp +++ b/include/boost/geometry/algorithms/assign.hpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include diff --git a/include/boost/geometry/algorithms/detail/as_range.hpp b/include/boost/geometry/algorithms/detail/as_range.hpp index d0dfb07e4..fef5156ee 100644 --- a/include/boost/geometry/algorithms/detail/as_range.hpp +++ b/include/boost/geometry/algorithms/detail/as_range.hpp @@ -15,8 +15,6 @@ #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_AS_RANGE_HPP -#include - #include #include #include diff --git a/include/boost/geometry/algorithms/detail/assign_values.hpp b/include/boost/geometry/algorithms/detail/assign_values.hpp index 5e4a1795b..ef5691e97 100644 --- a/include/boost/geometry/algorithms/detail/assign_values.hpp +++ b/include/boost/geometry/algorithms/detail/assign_values.hpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include diff --git a/include/boost/geometry/algorithms/detail/recalculate.hpp b/include/boost/geometry/algorithms/detail/recalculate.hpp index 056f7c6e1..fd3ed6b8d 100644 --- a/include/boost/geometry/algorithms/detail/recalculate.hpp +++ b/include/boost/geometry/algorithms/detail/recalculate.hpp @@ -21,8 +21,10 @@ #include #include #include -#include -#include +#include +#include +#include +#include #include #include diff --git a/include/boost/geometry/algorithms/length.hpp b/include/boost/geometry/algorithms/length.hpp index 58324bcc8..cf5234da1 100644 --- a/include/boost/geometry/algorithms/length.hpp +++ b/include/boost/geometry/algorithms/length.hpp @@ -24,8 +24,6 @@ #include #include -#include - #include #include #include @@ -34,8 +32,10 @@ #include #include #include -#include - +#include +#include +#include +#include #include #include #include From ad916f108d2399d29098a6d19dc2ec4606b91253 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 16 Mar 2016 01:17:02 +0100 Subject: [PATCH 06/20] [strategies] Cleanup includes (type_traits, mpl). --- .../strategies/cartesian/centroid_bashein_detmer.hpp | 2 +- .../strategies/cartesian/distance_projected_point.hpp | 2 +- .../strategies/cartesian/distance_projected_point_ax.hpp | 2 -- .../geometry/strategies/cartesian/distance_pythagoras.hpp | 5 ----- .../boost/geometry/strategies/cartesian/side_by_triangle.hpp | 3 ++- include/boost/geometry/strategies/spherical/ssf.hpp | 2 -- 6 files changed, 4 insertions(+), 12 deletions(-) diff --git a/include/boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp b/include/boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp index 47763a9f3..d081173a3 100644 --- a/include/boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp +++ b/include/boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include diff --git a/include/boost/geometry/strategies/cartesian/distance_projected_point.hpp b/include/boost/geometry/strategies/cartesian/distance_projected_point.hpp index dff4a77f6..b7127c834 100644 --- a/include/boost/geometry/strategies/cartesian/distance_projected_point.hpp +++ b/include/boost/geometry/strategies/cartesian/distance_projected_point.hpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include diff --git a/include/boost/geometry/strategies/cartesian/distance_projected_point_ax.hpp b/include/boost/geometry/strategies/cartesian/distance_projected_point_ax.hpp index c4090044f..7ff86c7cf 100644 --- a/include/boost/geometry/strategies/cartesian/distance_projected_point_ax.hpp +++ b/include/boost/geometry/strategies/cartesian/distance_projected_point_ax.hpp @@ -24,8 +24,6 @@ #include #include -#include -#include #include #include diff --git a/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp b/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp index 77bdc966a..665426ecb 100644 --- a/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp +++ b/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp @@ -15,9 +15,6 @@ #define BOOST_GEOMETRY_STRATEGIES_CARTESIAN_DISTANCE_PYTHAGORAS_HPP -#include -#include - #include #include @@ -26,8 +23,6 @@ #include - - namespace boost { namespace geometry { diff --git a/include/boost/geometry/strategies/cartesian/side_by_triangle.hpp b/include/boost/geometry/strategies/cartesian/side_by_triangle.hpp index 77443d46a..ba7749ba7 100644 --- a/include/boost/geometry/strategies/cartesian/side_by_triangle.hpp +++ b/include/boost/geometry/strategies/cartesian/side_by_triangle.hpp @@ -20,7 +20,8 @@ #define BOOST_GEOMETRY_STRATEGIES_CARTESIAN_SIDE_BY_TRIANGLE_HPP #include -#include +#include +#include #include #include diff --git a/include/boost/geometry/strategies/spherical/ssf.hpp b/include/boost/geometry/strategies/spherical/ssf.hpp index 1d9e7b60a..c99e5835e 100644 --- a/include/boost/geometry/strategies/spherical/ssf.hpp +++ b/include/boost/geometry/strategies/spherical/ssf.hpp @@ -13,8 +13,6 @@ #ifndef BOOST_GEOMETRY_STRATEGIES_SPHERICAL_SSF_HPP #define BOOST_GEOMETRY_STRATEGIES_SPHERICAL_SSF_HPP -#include -#include #include #include From 6208fd9556c4af7892dfadbeaea8d0dd1eedb46a Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 16 Mar 2016 01:18:00 +0100 Subject: [PATCH 07/20] [core] Cleanup includes (type_traits, mpl). --- include/boost/geometry/core/reverse_dispatch.hpp | 3 +-- include/boost/geometry/core/tag_cast.hpp | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/boost/geometry/core/reverse_dispatch.hpp b/include/boost/geometry/core/reverse_dispatch.hpp index 2e4fb8005..c95182a34 100644 --- a/include/boost/geometry/core/reverse_dispatch.hpp +++ b/include/boost/geometry/core/reverse_dispatch.hpp @@ -18,9 +18,8 @@ #include -#include #include -#include +#include #include diff --git a/include/boost/geometry/core/tag_cast.hpp b/include/boost/geometry/core/tag_cast.hpp index cafd13cba..e03d841f4 100644 --- a/include/boost/geometry/core/tag_cast.hpp +++ b/include/boost/geometry/core/tag_cast.hpp @@ -16,7 +16,7 @@ #include -#include +#include namespace boost { namespace geometry { From fbf5bcd3f307c92a159c7bb34440bd07252efaef Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 16 Mar 2016 01:18:40 +0100 Subject: [PATCH 08/20] [policies] Cleanup includes (type_traits). --- .../boost/geometry/policies/robustness/get_rescale_policy.hpp | 3 ++- include/boost/geometry/policies/robustness/rescale_policy.hpp | 2 -- include/boost/geometry/policies/robustness/robust_type.hpp | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/boost/geometry/policies/robustness/get_rescale_policy.hpp b/include/boost/geometry/policies/robustness/get_rescale_policy.hpp index 7a66d572f..daf32d305 100644 --- a/include/boost/geometry/policies/robustness/get_rescale_policy.hpp +++ b/include/boost/geometry/policies/robustness/get_rescale_policy.hpp @@ -20,8 +20,9 @@ #include -#include #include +#include +#include #include #include diff --git a/include/boost/geometry/policies/robustness/rescale_policy.hpp b/include/boost/geometry/policies/robustness/rescale_policy.hpp index 8f34bf3de..b92f6e1ec 100644 --- a/include/boost/geometry/policies/robustness/rescale_policy.hpp +++ b/include/boost/geometry/policies/robustness/rescale_policy.hpp @@ -18,8 +18,6 @@ #include -#include - #include #include #include diff --git a/include/boost/geometry/policies/robustness/robust_type.hpp b/include/boost/geometry/policies/robustness/robust_type.hpp index 4cfb2c4d9..7342f905b 100644 --- a/include/boost/geometry/policies/robustness/robust_type.hpp +++ b/include/boost/geometry/policies/robustness/robust_type.hpp @@ -13,8 +13,8 @@ #define BOOST_GEOMETRY_POLICIES_ROBUSTNESS_ROBUST_TYPE_HPP -#include #include +#include namespace boost { namespace geometry From 3a688340dd6ae0f02f43374ee3199987042cd220 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 16 Mar 2016 01:19:13 +0100 Subject: [PATCH 09/20] [io] Cleanup includes (type_traits, range). --- include/boost/geometry/io/wkt/read.hpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/boost/geometry/io/wkt/read.hpp b/include/boost/geometry/io/wkt/read.hpp index a39c8f89d..7924b7028 100644 --- a/include/boost/geometry/io/wkt/read.hpp +++ b/include/boost/geometry/io/wkt/read.hpp @@ -27,9 +27,12 @@ #include #include -#include - -#include +#include +#include +#include +#include +#include +#include #include #include From 54fcaf82732e7a4b561a75eb2b36738dae56f4d1 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 16 Mar 2016 01:19:39 +0100 Subject: [PATCH 10/20] [extensions] Cleanup include (type_traits). --- .../gis/geographic/strategies/distance_cross_track.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/geometry/extensions/gis/geographic/strategies/distance_cross_track.hpp b/include/boost/geometry/extensions/gis/geographic/strategies/distance_cross_track.hpp index 4e00c4b74..f6349327b 100644 --- a/include/boost/geometry/extensions/gis/geographic/strategies/distance_cross_track.hpp +++ b/include/boost/geometry/extensions/gis/geographic/strategies/distance_cross_track.hpp @@ -12,7 +12,7 @@ #include #include -#include +#include #include From 2f1f29acb637e510cf129063802765044523622e Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 16 Mar 2016 04:26:54 +0100 Subject: [PATCH 11/20] [core] Add missing include (type_traits). --- include/boost/geometry/core/radius.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/boost/geometry/core/radius.hpp b/include/boost/geometry/core/radius.hpp index ee6d5d246..6cbf6ac8f 100644 --- a/include/boost/geometry/core/radius.hpp +++ b/include/boost/geometry/core/radius.hpp @@ -24,6 +24,7 @@ #include #include +#include #include #include From c96bc1d878dee74f22802e2d8c95b6bfbda0f243 Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Wed, 16 Mar 2016 11:58:54 +0100 Subject: [PATCH 12/20] [test] add now necessary include --- test/robustness/overlay/areal_areal/test_overlay_p_q.hpp | 1 + 1 file changed, 1 insertion(+) 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 6fbd38b3e..eda9bb6bf 100644 --- a/test/robustness/overlay/areal_areal/test_overlay_p_q.hpp +++ b/test/robustness/overlay/areal_areal/test_overlay_p_q.hpp @@ -10,6 +10,7 @@ #define BOOST_GEOMETRY_TEST_OVERLAY_P_Q_HPP #include +#include #include //#define BOOST_GEOMETRY_ROBUSTNESS_USE_DIFFERENCE From b468a369e800818a5f904566b1fcd38134ca3d74 Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Wed, 16 Mar 2016 12:07:35 +0100 Subject: [PATCH 13/20] [traverse] remove unintentionally committed extra debug info --- .../boost/geometry/algorithms/detail/overlay/traverse.hpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/include/boost/geometry/algorithms/detail/overlay/traverse.hpp b/include/boost/geometry/algorithms/detail/overlay/traverse.hpp index a44616b87..655cfd20b 100644 --- a/include/boost/geometry/algorithms/detail/overlay/traverse.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/traverse.hpp @@ -333,14 +333,6 @@ struct traversal turn_type const& turn = m_turns[turn_index]; BOOST_ASSERT(turn.cluster_id >= 0); -#ifdef BOOST_GEOMETRY_DEBUG_TRAVERSE_BUFFER - std::cout << "Select Cluster " - << turn.cluster_id - << " from " << turn_index - << "[" << op_index << "]" - << std::boolalpha << std::endl; -#endif - typename Clusters::const_iterator mit = m_clusters.find(turn.cluster_id); BOOST_ASSERT(mit != m_clusters.end()); From c9b9c6950f12141330bb072fd0b486d65dbf747c Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Wed, 16 Mar 2016 12:08:13 +0100 Subject: [PATCH 14/20] [traverse] merge method calls --- .../boost/geometry/algorithms/detail/overlay/traverse.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/boost/geometry/algorithms/detail/overlay/traverse.hpp b/include/boost/geometry/algorithms/detail/overlay/traverse.hpp index 655cfd20b..19c72079a 100644 --- a/include/boost/geometry/algorithms/detail/overlay/traverse.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/traverse.hpp @@ -407,13 +407,14 @@ struct traversal } } + bool allow = false; if (open_count > 1) { sbs.reverse(); - return select_from_cluster(turn_index, op_index, start_turn_index, sbs, true); + allow = true; } - return select_from_cluster(turn_index, op_index, start_turn_index, sbs, false); + return select_from_cluster(turn_index, op_index, start_turn_index, sbs, allow); } inline void change_index_for_self_turn(signed_size_type& to_vertex_index, From 7d3d0dd69f6bf1b7d8ca0e4356697432240af17c Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Wed, 16 Mar 2016 14:46:05 +0100 Subject: [PATCH 15/20] [traverse] revise last weeks fix, make it more general. It should just skip finalized arcs. This fixes the robustness test almost completely --- .../algorithms/detail/overlay/traverse.hpp | 33 ++++++------------- .../overlay/multi_overlay_cases.hpp | 16 ++++++++- .../intersection/intersection_multi.cpp | 6 ++++ .../set_operations/union/union_multi.cpp | 9 +++++ 4 files changed, 40 insertions(+), 24 deletions(-) diff --git a/include/boost/geometry/algorithms/detail/overlay/traverse.hpp b/include/boost/geometry/algorithms/detail/overlay/traverse.hpp index 19c72079a..a2f3a553a 100644 --- a/include/boost/geometry/algorithms/detail/overlay/traverse.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/traverse.hpp @@ -263,6 +263,7 @@ struct traversal bool const is_intersection = OperationType == operation_intersection; std::size_t selected_rank = 0; + std::size_t min_rank = 0; bool result = false; for (std::size_t i = 0; i < sbs.m_ranked_points.size(); i++) { @@ -282,8 +283,15 @@ struct traversal return false; } + if (! is_union && ranked_op.visited.finalized()) + { + // Skip this one, go to next + min_rank = ranked_point.main_rank; + continue; + } + if (ranked_point.index == sort_by_side::index_to - && (ranked_point.main_rank > 0 + && (ranked_point.main_rank > min_rank || ranked_turn.both(operation_continue))) { if ((is_union @@ -325,7 +333,6 @@ struct traversal inline bool select_turn_from_cluster(signed_size_type& turn_index, int& op_index, signed_size_type start_turn_index, - int start_op_index, bool is_start, point_type const& point) { bool const is_union = OperationType == operation_union; @@ -341,9 +348,6 @@ struct traversal sbs_type sbs; sbs.set_origin(point); - bool at_start = false; - bool has_finished = false; - for (typename std::set::const_iterator sit = ids.begin(); sit != ids.end(); ++sit) { @@ -355,30 +359,13 @@ struct traversal continue; } - if (! is_start && ! is_union && cluster_turn_index == start_turn_index) - { - at_start = true; - } - for (int i = 0; i < 2; i++) { sbs.add(cluster_turn.operations[i], cluster_turn_index, i, m_geometry1, m_geometry2, false); - - if (cluster_turn.operations[i].visited.finished()) - { - has_finished = true; - } } } - if (at_start && has_finished) - { - turn_index = start_turn_index; - op_index = start_op_index; - return true; - } - sbs.apply(turn.point); int open_count = 0; @@ -530,7 +517,7 @@ struct traversal { if (! select_turn_from_cluster(turn_index, op_index, - start_turn_index, start_op_index, is_start, current_ring.back())) + start_turn_index, current_ring.back())) { return is_start ? traverse_error_no_next_ip_at_start diff --git a/test/algorithms/overlay/multi_overlay_cases.hpp b/test/algorithms/overlay/multi_overlay_cases.hpp index 18465fb3e..4f063d364 100644 --- a/test/algorithms/overlay/multi_overlay_cases.hpp +++ b/test/algorithms/overlay/multi_overlay_cases.hpp @@ -636,11 +636,25 @@ static std::string case_recursive_boxes_33[2] = static std::string case_recursive_boxes_34[2] = { - // Requires detecting start turn at cluster and use that to finish it + // Requires detecting finished arcs during cluster traversal "MULTIPOLYGON(((2 0,0 0,0 5,2 5,2 4,3 5,5 5,5 0,2 0)))", "MULTIPOLYGON(((3 3,2 3,2 2,3 2,3 1,2 0,1 0,2 1,1 1,1 0,0 0,0 5,1 4,1 5,4 5,3 4,3.5 3.5,4 4,4 5,5 4,5 1,4 1,4 3,3 3)),((3 1,4 1,3 0,3 1)))" }; +static std::string case_recursive_boxes_35[2] = +{ + // Requires detecting finished arcs during cluster traversal + "MULTIPOLYGON(((3 1,2 1,3 0,0 0,0 2,1 2,1 3,0 2,0 5,4 5,4 4,5 4,5 1,4 1,5 0,3 0,3 1),(2.5 1.5,3 2,2 2,2.5 1.5),(2 4,1 4,2 3,2 4)))", + "MULTIPOLYGON(((2 2,1.5 1.5,2 1,1 1,1 0,0 0,0 5,3 5,2.5 4.5,3 4,3 5,5 5,5 0,1 0,2 1,2 2),(3 2,3 3,2.5 2.5,3 2),(2 3,2 4,1 4,1 3,2 3)))" +}; + +static std::string case_recursive_boxes_36[2] = +{ + // Requires increasing target rank while skipping finished arcs to avoid duplicate output + "MULTIPOLYGON(((5 3,4 3,4 4,5 3)),((5 2,4 2,5 3,5 2)),((5 2,5 1,4 1,5 2)))", + "MULTIPOLYGON(((4 2,4 3,5 3,5 2,4 2)),((4 2,4 1,3 1,3 2,4 2)))" +}; + static std::string pie_21_7_21_0_3[2] = { "MULTIPOLYGON(((2500 2500,2500 3875,2855 3828,3187 3690,3472 3472,3690 3187,3828 2855,3875 2500,3828 2144,3690 1812,3472 1527,3187 1309,2855 1171,2499 1125,2144 1171,1812 1309,1527 1527,1309 1812,1171 2144,1125 2499,1171 2855,1309 3187,2500 2500)))", diff --git a/test/algorithms/set_operations/intersection/intersection_multi.cpp b/test/algorithms/set_operations/intersection/intersection_multi.cpp index ad597364d..027846040 100644 --- a/test/algorithms/set_operations/intersection/intersection_multi.cpp +++ b/test/algorithms/set_operations/intersection/intersection_multi.cpp @@ -228,6 +228,12 @@ void test_areal() test_one("case_recursive_boxes_34", case_recursive_boxes_34[0], case_recursive_boxes_34[1], 2, 0, 17.25); + test_one("case_recursive_boxes_35", + case_recursive_boxes_35[0], case_recursive_boxes_35[1], + 2, 0, 20.0); + test_one("case_recursive_boxes_36", + case_recursive_boxes_36[0], case_recursive_boxes_36[1], + 1, 0, 0.5); test_one("ggl_list_20120915_h2_a", ggl_list_20120915_h2[0], ggl_list_20120915_h2[1], diff --git a/test/algorithms/set_operations/union/union_multi.cpp b/test/algorithms/set_operations/union/union_multi.cpp index adde818b3..6753ee193 100644 --- a/test/algorithms/set_operations/union/union_multi.cpp +++ b/test/algorithms/set_operations/union/union_multi.cpp @@ -218,6 +218,15 @@ void test_areal() test_one("case_recursive_boxes_33", case_recursive_boxes_33[0], case_recursive_boxes_33[1], 1, 0, -1, 11.0); + test_one("case_recursive_boxes_34", + case_recursive_boxes_34[0], case_recursive_boxes_34[1], + 1, 0, -1, 25.0); + test_one("case_recursive_boxes_35", + case_recursive_boxes_35[0], case_recursive_boxes_35[1], + 1, 1, -1, 24.5); + test_one("case_recursive_boxes_36", + case_recursive_boxes_36[0], case_recursive_boxes_36[1], + 3, 0, -1, 3.0); test_one("ggl_list_20120915_h2_a", ggl_list_20120915_h2[0], ggl_list_20120915_h2[1], From 75ad78a21c14e34c646b1aa8e9c22d54a2720f36 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 16 Mar 2016 16:09:02 +0100 Subject: [PATCH 16/20] [core] Refactor the includes, remove unneeded dependencies. --- include/boost/geometry/core/access.hpp | 11 ++++++----- include/boost/geometry/core/closure.hpp | 2 +- include/boost/geometry/core/coordinate_dimension.hpp | 9 +-------- include/boost/geometry/core/coordinate_type.hpp | 2 +- include/boost/geometry/core/exterior_ring.hpp | 1 + include/boost/geometry/core/interior_type.hpp | 3 +++ include/boost/geometry/core/mutable_range.hpp | 2 +- include/boost/geometry/core/point_order.hpp | 2 +- include/boost/geometry/core/tag.hpp | 1 - 9 files changed, 15 insertions(+), 18 deletions(-) diff --git a/include/boost/geometry/core/access.hpp b/include/boost/geometry/core/access.hpp index 57f925763..866fb19a4 100644 --- a/include/boost/geometry/core/access.hpp +++ b/include/boost/geometry/core/access.hpp @@ -17,9 +17,10 @@ #include +#include #include -#include #include +#include #include #include @@ -271,7 +272,7 @@ inline typename coordinate_type::type get(Geometry const& geometry #endif ) { - boost::ignore_unused_variable_warning(dummy); + boost::ignore_unused(dummy); typedef core_dispatch::access < @@ -306,7 +307,7 @@ inline void set(Geometry& geometry #endif ) { - boost::ignore_unused_variable_warning(dummy); + boost::ignore_unused(dummy); typedef core_dispatch::access < @@ -341,7 +342,7 @@ inline typename coordinate_type::type get(Geometry const& geometry #endif ) { - boost::ignore_unused_variable_warning(dummy); + boost::ignore_unused(dummy); typedef core_dispatch::indexed_access < @@ -378,7 +379,7 @@ inline void set(Geometry& geometry #endif ) { - boost::ignore_unused_variable_warning(dummy); + boost::ignore_unused(dummy); typedef core_dispatch::indexed_access < diff --git a/include/boost/geometry/core/closure.hpp b/include/boost/geometry/core/closure.hpp index b69dcda14..405a5a5f3 100644 --- a/include/boost/geometry/core/closure.hpp +++ b/include/boost/geometry/core/closure.hpp @@ -22,11 +22,11 @@ #include #include #include -#include #include #include #include +#include namespace boost { namespace geometry { diff --git a/include/boost/geometry/core/coordinate_dimension.hpp b/include/boost/geometry/core/coordinate_dimension.hpp index 85da6b424..19022f2fd 100644 --- a/include/boost/geometry/core/coordinate_dimension.hpp +++ b/include/boost/geometry/core/coordinate_dimension.hpp @@ -18,7 +18,6 @@ #include #include -#include #include #include @@ -94,13 +93,7 @@ struct dimension template inline void assert_dimension() { - BOOST_STATIC_ASSERT(( - boost::mpl::equal_to - < - boost::mpl::int_::value>, - boost::mpl::int_ - >::type::value - )); + BOOST_STATIC_ASSERT(( static_cast(dimension::value) == Dimensions )); } /*! diff --git a/include/boost/geometry/core/coordinate_type.hpp b/include/boost/geometry/core/coordinate_type.hpp index f138d59c8..47c028fec 100644 --- a/include/boost/geometry/core/coordinate_type.hpp +++ b/include/boost/geometry/core/coordinate_type.hpp @@ -17,8 +17,8 @@ #include -#include #include +#include #include #include diff --git a/include/boost/geometry/core/exterior_ring.hpp b/include/boost/geometry/core/exterior_ring.hpp index e5c97dd30..fa5a0a2b9 100644 --- a/include/boost/geometry/core/exterior_ring.hpp +++ b/include/boost/geometry/core/exterior_ring.hpp @@ -17,6 +17,7 @@ #include +#include #include diff --git a/include/boost/geometry/core/interior_type.hpp b/include/boost/geometry/core/interior_type.hpp index e6c4537e4..66544b79a 100644 --- a/include/boost/geometry/core/interior_type.hpp +++ b/include/boost/geometry/core/interior_type.hpp @@ -17,7 +17,10 @@ #include +#include +#include #include +#include #include #include diff --git a/include/boost/geometry/core/mutable_range.hpp b/include/boost/geometry/core/mutable_range.hpp index 9b53e4057..7cb513783 100644 --- a/include/boost/geometry/core/mutable_range.hpp +++ b/include/boost/geometry/core/mutable_range.hpp @@ -17,8 +17,8 @@ #include +#include #include -#include namespace boost { namespace geometry diff --git a/include/boost/geometry/core/point_order.hpp b/include/boost/geometry/core/point_order.hpp index d43adbd03..df6d4bbff 100644 --- a/include/boost/geometry/core/point_order.hpp +++ b/include/boost/geometry/core/point_order.hpp @@ -22,11 +22,11 @@ #include #include -#include #include #include #include +#include namespace boost { namespace geometry { diff --git a/include/boost/geometry/core/tag.hpp b/include/boost/geometry/core/tag.hpp index 6bffcb932..14a224270 100644 --- a/include/boost/geometry/core/tag.hpp +++ b/include/boost/geometry/core/tag.hpp @@ -14,7 +14,6 @@ #ifndef BOOST_GEOMETRY_CORE_TAG_HPP #define BOOST_GEOMETRY_CORE_TAG_HPP -#include #include #include From 0e83cbce5d9b0d148eaa6b9f2b8f1e5f676bfa74 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 16 Mar 2016 16:22:53 +0100 Subject: [PATCH 17/20] [util] Add missing include (range_reference). --- include/boost/geometry/util/range.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/boost/geometry/util/range.hpp b/include/boost/geometry/util/range.hpp index 67f373359..b10a00805 100644 --- a/include/boost/geometry/util/range.hpp +++ b/include/boost/geometry/util/range.hpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include From 588d102b1900e0a14f8f024d755076d698d55b61 Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Wed, 16 Mar 2016 17:54:03 +0100 Subject: [PATCH 18/20] [union] same solution as for intersection should be applied for union, but not in case of uu or similar --- .../boost/geometry/algorithms/detail/overlay/traverse.hpp | 2 +- test/algorithms/overlay/multi_overlay_cases.hpp | 7 +++++++ .../set_operations/intersection/intersection_multi.cpp | 3 +++ test/algorithms/set_operations/union/union_multi.cpp | 3 +++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/boost/geometry/algorithms/detail/overlay/traverse.hpp b/include/boost/geometry/algorithms/detail/overlay/traverse.hpp index a2f3a553a..ebf74c5ef 100644 --- a/include/boost/geometry/algorithms/detail/overlay/traverse.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/traverse.hpp @@ -283,7 +283,7 @@ struct traversal return false; } - if (! is_union && ranked_op.visited.finalized()) + if (! allow_pass_rank && ranked_op.visited.finalized()) { // Skip this one, go to next min_rank = ranked_point.main_rank; diff --git a/test/algorithms/overlay/multi_overlay_cases.hpp b/test/algorithms/overlay/multi_overlay_cases.hpp index 4f063d364..c4ee6be4b 100644 --- a/test/algorithms/overlay/multi_overlay_cases.hpp +++ b/test/algorithms/overlay/multi_overlay_cases.hpp @@ -655,6 +655,13 @@ static std::string case_recursive_boxes_36[2] = "MULTIPOLYGON(((4 2,4 3,5 3,5 2,4 2)),((4 2,4 1,3 1,3 2,4 2)))" }; +static std::string case_recursive_boxes_37[2] = +{ + // Requires skipping arc for union too, to avoid duplicate hole + "MULTIPOLYGON(((4 0,5 1,5 0,4 0)),((2 0,3 1,3 0,2 0)),((2 3,2 2,1 2,1 3,2 3)),((2 1,2 2,4 2,3 1,2 1)))", + "MULTIPOLYGON(((2 3,1 2,1 3,2 3)),((3 1,3.5 0.5,4 1,3 1,4 2,4 3,5 3,5 0,3 0,3 1)),((3 1,2 0,2 1,3 1)))" +}; + static std::string pie_21_7_21_0_3[2] = { "MULTIPOLYGON(((2500 2500,2500 3875,2855 3828,3187 3690,3472 3472,3690 3187,3828 2855,3875 2500,3828 2144,3690 1812,3472 1527,3187 1309,2855 1171,2499 1125,2144 1171,1812 1309,1527 1527,1309 1812,1171 2144,1125 2499,1171 2855,1309 3187,2500 2500)))", diff --git a/test/algorithms/set_operations/intersection/intersection_multi.cpp b/test/algorithms/set_operations/intersection/intersection_multi.cpp index 027846040..ca49a8496 100644 --- a/test/algorithms/set_operations/intersection/intersection_multi.cpp +++ b/test/algorithms/set_operations/intersection/intersection_multi.cpp @@ -234,6 +234,9 @@ void test_areal() test_one("case_recursive_boxes_36", case_recursive_boxes_36[0], case_recursive_boxes_36[1], 1, 0, 0.5); + test_one("case_recursive_boxes_37", + case_recursive_boxes_37[0], case_recursive_boxes_37[1], + 2, 0, 1.0); test_one("ggl_list_20120915_h2_a", ggl_list_20120915_h2[0], ggl_list_20120915_h2[1], diff --git a/test/algorithms/set_operations/union/union_multi.cpp b/test/algorithms/set_operations/union/union_multi.cpp index 6753ee193..bdb0e3683 100644 --- a/test/algorithms/set_operations/union/union_multi.cpp +++ b/test/algorithms/set_operations/union/union_multi.cpp @@ -227,6 +227,9 @@ void test_areal() test_one("case_recursive_boxes_36", case_recursive_boxes_36[0], case_recursive_boxes_36[1], 3, 0, -1, 3.0); + test_one("case_recursive_boxes_37", + case_recursive_boxes_37[0], case_recursive_boxes_37[1], + 2, 1, -1, 7.75); test_one("ggl_list_20120915_h2_a", ggl_list_20120915_h2[0], ggl_list_20120915_h2[1], From 8597ed9fd283d0921341b29f61b6be277fde23c8 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 16 Mar 2016 18:27:22 +0100 Subject: [PATCH 19/20] [test][util][range] Add missing include. --- test/util/range.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/util/range.cpp b/test/util/range.cpp index f48789a9b..56cfdfb11 100644 --- a/test/util/range.cpp +++ b/test/util/range.cpp @@ -14,6 +14,9 @@ #include #include + +#include + #include namespace bgt { From 9b61648d9953f2927a826b979de0dd8c9f88bf08 Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Thu, 24 Mar 2016 21:35:31 +0100 Subject: [PATCH 20/20] [doc] update release notes --- doc/release_notes.qbk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/release_notes.qbk b/doc/release_notes.qbk index f45352cd4..f7b0ed28e 100644 --- a/doc/release_notes.qbk +++ b/doc/release_notes.qbk @@ -33,6 +33,8 @@ [*Solved tickets] +* [@https://svn.boost.org/trac/boost/ticket/10866 10866] union_ doesn't work in 1.56 and 1.57. +* [@https://svn.boost.org/trac/boost/ticket/11576 11576] Intersection gives wrong results. * [@https://svn.boost.org/trac/boost/ticket/11637 11637] Unused parameter warning. * [@https://svn.boost.org/trac/boost/ticket/11917 11917] Andoyer distance strategy returns 0 for antipodal points (default geographic distance). * [@https://svn.boost.org/trac/boost/ticket/11928 11928] Improvement of the accuracy of surveyor area strategy.