diff --git a/test/algorithms/buffer/buffer_countries.cpp b/test/algorithms/buffer/buffer_countries.cpp index 8c7c18aea..56bdfb8bb 100644 --- a/test/algorithms/buffer/buffer_countries.cpp +++ b/test/algorithms/buffer/buffer_countries.cpp @@ -133,7 +133,6 @@ void test_one(std::string const& caseid, std::string const& wkt, double expected // Test with a high tolerance, even a difference of 1000 is only ~1.0e-6% settings.tolerance = 10000.0; - settings.test_self_intersections = false; #if defined(BOOST_GEOMETRY_NO_ROBUSTNESS) // in case robustness policies are changed, areas should be adapted diff --git a/test/algorithms/buffer/buffer_linestring.cpp b/test/algorithms/buffer/buffer_linestring.cpp index 4d5141e6a..efb3776cc 100644 --- a/test/algorithms/buffer/buffer_linestring.cpp +++ b/test/algorithms/buffer/buffer_linestring.cpp @@ -251,10 +251,9 @@ void test_all() #endif } - { - // Check on validity (not on self-intersections) with high precision because areas are all very small - ut_settings settings(1.0e-10, true, false); + // Check on validity, with high precision because areas are all very small + ut_settings settings(1.0e-10, true); test_one("aimes120", aimes120, join_miter, end_flat, 1.62669948622351512e-08, 0.000018, settings); test_one("aimes120", aimes120, join_round, end_round, 1.72842078427493107e-08, 0.000018, settings); diff --git a/test/algorithms/buffer/buffer_linestring_aimes.cpp b/test/algorithms/buffer/buffer_linestring_aimes.cpp index 7e76c6407..51dec91ad 100644 --- a/test/algorithms/buffer/buffer_linestring_aimes.cpp +++ b/test/algorithms/buffer/buffer_linestring_aimes.cpp @@ -468,10 +468,8 @@ void test_aimes() bg::strategy::buffer::end_flat end_flat; bg::strategy::buffer::end_round end_round(100); - ut_settings settings(1.0e-10, true, false); - // Aimes tested originally with 0.000018 degrees (around 2 m) - std::size_t self_ip_count = 0; + ut_settings settings(1.0e-10); int expectation_index = 0; for (int width = 18; width <= 36; width += 18, expectation_index += 2) @@ -483,17 +481,17 @@ void test_aimes() try { name << "aimes_" << i << "_" << width; - test_one_and_count_ips + test_one ( name.str(), testcases[i], join_miter, end_flat, expectations[i][expectation_index], - aimes_width, self_ip_count, settings + aimes_width, settings ); - test_one_and_count_ips + test_one ( name.str(), testcases[i], join_round, end_round, expectations[i][expectation_index + 1], - aimes_width, self_ip_count, settings + aimes_width, settings ); } catch(std::exception const& e) @@ -502,12 +500,6 @@ void test_aimes() } } } - - BOOST_CHECK_MESSAGE - ( - self_ip_count == 0, - "There are self-intersections: " << self_ip_count - ); } diff --git a/test/algorithms/buffer/buffer_multi_point.cpp b/test/algorithms/buffer/buffer_multi_point.cpp index 1a38dd874..1380151f3 100644 --- a/test/algorithms/buffer/buffer_multi_point.cpp +++ b/test/algorithms/buffer/buffer_multi_point.cpp @@ -91,7 +91,7 @@ void test_all() distance_strategy(1), side_strategy, bg::strategy::buffer::point_circle(36), - 1, 0, 3.12566719800474635, ut_settings(1.0), NULL); + 1, 0, 3.12566719800474635, ut_settings(1.0)); } } diff --git a/test/algorithms/buffer/buffer_polygon.cpp b/test/algorithms/buffer/buffer_polygon.cpp index 5eba7e6d1..544159d60 100644 --- a/test/algorithms/buffer/buffer_polygon.cpp +++ b/test/algorithms/buffer/buffer_polygon.cpp @@ -523,7 +523,6 @@ void test_all() { ut_settings settings; - settings.test_self_intersections = false; settings.test_validity = false; // Tickets diff --git a/test/algorithms/buffer/test_buffer.hpp b/test/algorithms/buffer/test_buffer.hpp index 3a361b3a2..0fd93545d 100644 --- a/test/algorithms/buffer/test_buffer.hpp +++ b/test/algorithms/buffer/test_buffer.hpp @@ -99,13 +99,11 @@ struct ut_settings { double tolerance; bool test_validity; - bool test_self_intersections; bool test_area; - explicit ut_settings(double tol = 0.01, bool val = true, bool self = true) + explicit ut_settings(double tol = 0.01, bool val = true) : tolerance(tol) , test_validity(val) - , test_self_intersections(self) , test_area(true) {} @@ -120,7 +118,6 @@ struct ut_settings { ut_settings result; result.test_validity = false; - result.test_self_intersections = false; result.test_area = false; return result; } @@ -128,29 +125,6 @@ struct ut_settings static inline double ignore_area() { return 9999.9; } }; -template -inline std::size_t count_self_ips(Geometry const& geometry, - Strategy const& strategy, - RescalePolicy const& rescale_policy) -{ - typedef typename bg::point_type::type point_type; - typedef bg::detail::overlay::turn_info - < - point_type, - typename bg::segment_ratio_type::type - > turn_info; - - std::vector turns; - - bg::detail::self_get_turn_points::no_interrupt_policy policy; - bg::self_turns - < - bg::detail::overlay::assign_null_policy - >(geometry, strategy, rescale_policy, turns, policy); - - return turns.size(); -} - template < typename GeometryOut, @@ -170,8 +144,7 @@ void test_buffer(std::string const& caseid, Geometry const& geometry, int expected_count, int expected_holes_count, double expected_area, - ut_settings const& settings, - std::size_t* self_ip_count) + ut_settings const& settings) { namespace bg = boost::geometry; @@ -301,9 +274,6 @@ void test_buffer(std::string const& caseid, Geometry const& geometry, bg::assign_values(envelope_output, 0, 0, 1, 1); bg::envelope(buffered, envelope_output); - rescale_policy_type rescale_policy_output - = bg::get_rescale_policy(envelope_output); - // std::cout << caseid << std::endl; // std::cout << "INPUT: " << bg::wkt(geometry) << std::endl; // std::cout << "OUTPUT: " << area << std::endl; @@ -351,32 +321,6 @@ void test_buffer(std::string const& caseid, Geometry const& geometry, ); } - if (settings.test_self_intersections) - { - // This test is basically replaced by check on validity, - // and might therefore be removed completely. - try - { - bool has_self_ips - = bg::detail::overlay::has_self_intersections(buffered, - strategy, rescale_policy_output, false); - // Be sure resulting polygon does not contain self-intersections - BOOST_CHECK_MESSAGE - ( - ! has_self_ips, - complete.str() << " output is self-intersecting. " - ); - } - catch(...) - { - BOOST_CHECK_MESSAGE - ( - false, - "Exception in checking self-intersections" - ); - } - } - if (settings.test_validity && ! bg::is_valid(buffered)) { BOOST_CHECK_MESSAGE(bg::is_valid(buffered), complete.str() << " is not valid"); @@ -399,26 +343,11 @@ void test_buffer(std::string const& caseid, Geometry const& geometry, // self_ips NYI here } #elif defined(TEST_WITH_SVG) + rescale_policy_type rescale_policy_output + = bg::get_rescale_policy(envelope_output); buffer_mapper.map_self_ips(mapper, buffered, strategy, rescale_policy_output); #endif - // Check for self-intersections - // See above for test_self_intersections, also this might be removed later. - if (self_ip_count != NULL) - { - std::size_t count = 0; - if (bg::detail::overlay::has_self_intersections(buffered, - strategy, rescale_policy_output, false)) - { - count = count_self_ips(buffered, strategy, rescale_policy_output); - } - - *self_ip_count += count; - if (count > 0) - { - std::cout << complete.str() << " " << count << std::endl; - } - } } template @@ -438,12 +367,11 @@ void test_buffer(std::string const& caseid, Geometry const& geometry, SideStrategy const& side_strategy, PointStrategy const& point_strategy, double expected_area, - ut_settings const& settings = ut_settings(), - std::size_t* self_ip_count = NULL) + ut_settings const& settings = ut_settings()) { test_buffer(caseid, geometry, join_strategy, end_strategy, distance_strategy, side_strategy, point_strategy, - -1, -1, expected_area, settings, self_ip_count); + -1, -1, expected_area, settings); } #ifdef BOOST_GEOMETRY_CHECK_WITH_POSTGIS @@ -497,7 +425,7 @@ void test_one(std::string const& caseid, std::string const& wkt, join_strategy, end_strategy, distance_strategy, side_strategy, circle_strategy, expected_count, expected_holes_count, expected_area, - settings, NULL); + settings); #if !defined(BOOST_GEOMETRY_COMPILER_MODE_DEBUG) && defined(BOOST_GEOMETRY_COMPILER_MODE_RELEASE) @@ -515,7 +443,7 @@ void test_one(std::string const& caseid, std::string const& wkt, join_strategy, end_strategy, sym_distance_strategy, side_strategy, circle_strategy, expected_count, expected_holes_count, expected_area, - settings, NULL); + settings); } #endif @@ -539,40 +467,6 @@ void test_one(std::string const& caseid, std::string const& wkt, distance_left, settings, distance_right); } -// Version (currently for the Aimes test) counting self-ip's instead of checking -template -< - typename Geometry, - typename GeometryOut, - typename JoinStrategy, - typename EndStrategy -> -void test_one_and_count_ips(std::string const& caseid, std::string const& wkt, - JoinStrategy const& join_strategy, EndStrategy const& end_strategy, - double expected_area, - double distance_left, - std::size_t& self_ip_count, - ut_settings const& settings) -{ - namespace bg = boost::geometry; - Geometry g; - bg::read_wkt(wkt, g); - bg::correct(g); - - bg::strategy::buffer::distance_asymmetric - < - typename bg::coordinate_type::type - > distance_strategy(distance_left, distance_left); - - bg::strategy::buffer::point_circle circle_strategy(88); - bg::strategy::buffer::side_straight side_strategy; - test_buffer(caseid, g, - join_strategy, end_strategy, - distance_strategy, side_strategy, circle_strategy, - expected_area, - settings, &self_ip_count); -} - template < typename Geometry, @@ -602,7 +496,7 @@ void test_with_custom_strategies(std::string const& caseid, (caseid, g, join_strategy, end_strategy, distance_strategy, side_strategy, point_strategy, - expected_area, settings, NULL); + expected_area, settings); } #endif