[DEV] add v1.76.0

This commit is contained in:
2021-10-05 21:37:46 +02:00
parent a97e9ae7d4
commit d0115b733d
45133 changed files with 4744437 additions and 1026325 deletions

View File

@@ -4,8 +4,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, 2015, 2020.
# Modifications copyright (c) 2014-2020, 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,6 +22,8 @@ test-suite boost-geometry-algorithms-intersection
[ run intersection_linear_linear.cpp : : : : algorithms_intersection_linear_linear ]
[ run intersection_multi.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
: algorithms_intersection_multi ]
[ run intersection_pl_a.cpp : : : : algorithms_intersection_pl_a ]
[ run intersection_pl_l.cpp : : : : algorithms_intersection_pl_l ]
[ run intersection_pl_pl.cpp : : : : algorithms_intersection_pl_pl ]
[ run intersection_tupled.cpp : : : : algorithms_intersection_tupled ]
;

View File

@@ -46,20 +46,24 @@ BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector)
(test_one<Polygon, Polygon, Polygon>) \
( #caseid, caseid[0], caseid[1], clips, points, area)
#if ! defined(BOOST_GEOMETRY_INCLUDE_SELF_TURNS)
#define TEST_INTERSECTION_IGNORE(caseid, clips, points, area) \
{ ut_settings ignore_validity; ignore_validity.test_validity = false; \
(test_one<Polygon, Polygon, Polygon>) \
( #caseid, caseid[0], caseid[1], clips, points, area, ignore_validity); }
#endif
#define TEST_INTERSECTION_REV(caseid, clips, points, area) \
(test_one<Polygon, Polygon, Polygon>) \
( #caseid "_rev", caseid[1], caseid[0], clips, points, area)
#define TEST_INTERSECTION_IGNORE(caseid, clips, points, area) \
{ ut_settings ignore_validity; ignore_validity.set_test_validity(false); \
(test_one<Polygon, Polygon, Polygon>) \
( #caseid, caseid[0], caseid[1], clips, points, area, ignore_validity); }
#define TEST_INTERSECTION_WITH(caseid, index1, index2, \
clips, points, area, settings) \
(test_one<Polygon, Polygon, Polygon>) \
( #caseid "_" #index1 "_" #index2, caseid[index1], caseid[index2], \
clips, points, area, settings)
template <typename Polygon>
void test_areal()
{
typedef typename bg::coordinate_type<Polygon>::type ct;
bool const ccw = bg::point_order<Polygon>::value == bg::counterclockwise;
bool const open = bg::closure<Polygon>::value == bg::open;
test_one<Polygon, Polygon, Polygon>("simplex_with_empty_1",
simplex_normal[0], polygon_empty,
0, 0, 0.0);
@@ -148,7 +152,7 @@ void test_areal()
test_one<Polygon, Polygon, Polygon>("distance_zero",
distance_zero[0], distance_zero[1],
1, 0 /* f: 4, other: 5 */, 0.29516139, ut_settings(0.01));
1, 0, 0.29516139);
test_one<Polygon, Polygon, Polygon>("equal_holes_disjoint",
equal_holes_disjoint[0], equal_holes_disjoint[1],
@@ -173,76 +177,31 @@ void test_areal()
pie_2_3_23_0[0], pie_2_3_23_0[1],
1, 4, 163292.679042133, ut_settings(0.1));
{
ut_settings settings(if_typed_tt<ct>(0.01, 0.1));
TEST_INTERSECTION(isovist, 1, 19, expectation_limits(88.19202, 88.19206));
#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
settings.test_validity = false;
#endif
TEST_INTERSECTION_IGNORE(geos_1, 1, -1, expectation_limits(3454, 3462));
// SQL Server gives: 88.1920416352664
// PostGIS gives: 88.19203677911
test_one<Polygon, Polygon, Polygon>("isovist",
isovist1[0], isovist1[1],
1, 19, 88.192037,
settings);
}
test_one<Polygon, Polygon, Polygon>("geos_1",
geos_1[0], geos_1[1],
1, -1, 3461.0214843, // MSVC 14 reports 3461.025390625
ut_settings(0.005, false));
// Expectations:
// In most cases: 0 (no intersection)
// Can, in some cases, create small slivers
// In some cases: 1.430511474609375e-05 (clang/gcc on Xubuntu using b2)
// In some cases: 5.6022983000000002e-05 (powerpc64le-gcc-6-0)
test_one<Polygon, Polygon, Polygon>("geos_2",
geos_2[0], geos_2[1],
0, 0, 6.0e-5, ut_settings(-1.0)); // -1 denotes: compare with <=
TEST_INTERSECTION(geos_2, count_set(0, 1, 2), 0, optional_sliver(6.0e-5));
#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<Polygon, Polygon, Polygon>("geos_3",
geos_3[0], geos_3[1],
0, 0, 0.0);
#endif
test_one<Polygon, Polygon, Polygon>("geos_4",
geos_4[0], geos_4[1],
1, -1, 0.08368849);
TEST_INTERSECTION(geos_3, optional(), 0, optional_sliver(3.0e-7));
TEST_INTERSECTION(geos_4, 1, -1, expectation_limits(0.08368, 0.08370));
if ( BOOST_GEOMETRY_CONDITION(! ccw && open) )
{
// Pointcount for ttmath/double (both 5) or float (4)
// double returns 5 (since method append_no_dups_or_spikes)
// but not for ccw/open. Those cases has to be adapted once, anyway,
// because for open always one point too much is generated...
test_one<Polygon, Polygon, Polygon>("ggl_list_20110306_javier",
ggl_list_20110306_javier[0], ggl_list_20110306_javier[1],
1, if_typed<ct, float>(4, 5),
0.6649875,
ut_settings(if_typed<ct, float>(1.0, 0.01)));
}
TEST_INTERSECTION(ggl_list_20110306_javier, 1, -1, expectation_limits(0.6649, 0.6670));
// SQL Server reports: 0.400390625
// PostGIS reports 0.4
// BG did report 0.4 but is changed to 0.397
// BG did report 0.4 but with rescaling 0.397
// when selecting other IP closer at endpoint or if segment B is smaller than A
test_one<Polygon, Polygon, Polygon>("ggl_list_20110307_javier",
ggl_list_20110307_javier[0], ggl_list_20110307_javier[1],
1, 4,
#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
0.40
#else
0.397162651, ut_settings(0.01)
#endif
);
1, 4, {0.397162651, 0.40});
#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<Polygon, Polygon, Polygon>("ggl_list_20110627_phillip",
ggl_list_20110627_phillip[0], ggl_list_20110627_phillip[1],
1, if_typed_tt<ct>(6, 5), 11151.6618);
#endif
1, -1, 11151.6618);
test_one<Polygon, Polygon, Polygon>("ggl_list_20110716_enrico",
ggl_list_20110716_enrico[0], ggl_list_20110716_enrico[1],
@@ -250,38 +209,40 @@ void test_areal()
test_one<Polygon, Polygon, Polygon>("ggl_list_20131119_james",
ggl_list_20131119_james[0], ggl_list_20131119_james[1],
1, 4, 6.6125873045, ut_settings(0.1));
1, 4, 6.6125873045);
test_one<Polygon, Polygon, Polygon>("ggl_list_20140223_shalabuda",
ggl_list_20140223_shalabuda[0], ggl_list_20140223_shalabuda[1],
1, 4, 3.77106, ut_settings(0.001));
1, 4, {3.771058, 3.771066});
// Mailed to the Boost.Geometry list on 2014/03/21 by 7415963@gmail.com
test_one<Polygon, Polygon, Polygon>("ggl_list_20140321_7415963",
ggl_list_20140321_7415963[0], ggl_list_20140321_7415963[1],
0, 0, 0, ut_settings(0.1));
0, 0, 0);
#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
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<Polygon, Polygon, Polygon>("buffer_rt_f", buffer_rt_f[0], buffer_rt_f[1],
1, 4, 0.00029437899183903937, ut_settings(0.01));
1, 4, expectation_limits(0.00029437, 0.000294380));
#endif
test_one<Polygon, Polygon, Polygon>("buffer_rt_g", buffer_rt_g[0], buffer_rt_g[1],
1, 0, 2.914213562373);
#endif
test_one<Polygon, Polygon, Polygon>("ticket_8254", ticket_8254[0], ticket_8254[1],
1, 4, 3.635930e-08, ut_settings(0.01));
optional(), -1, optional_sliver(1e-07));
test_one<Polygon, Polygon, Polygon>("ticket_6958", ticket_6958[0], ticket_6958[1],
1, 4, 4.34355e-05, ut_settings(0.01));
optional(), -1, optional_sliver());
test_one<Polygon, Polygon, Polygon>("ticket_8652", ticket_8652[0], ticket_8652[1],
1, 4, 0.0003);
test_one<Polygon, Polygon, Polygon>("ticket_8310a", ticket_8310a[0], ticket_8310a[1],
1, 5, 0.3843747);
test_one<Polygon, Polygon, Polygon>("ticket_8310b", ticket_8310b[0], ticket_8310b[1],
1, 5, 0.3734379);
test_one<Polygon, Polygon, Polygon>("ticket_8310c", ticket_8310c[0], ticket_8310c[1],
1, 5, 0.4689541);
TEST_INTERSECTION(ticket_8310a, 1, 5, 0.3843747);
TEST_INTERSECTION(ticket_8310b, 1, 5, 0.3734379);
TEST_INTERSECTION(ticket_8310c, 1, 5, 0.4689541);
TEST_INTERSECTION_REV(ticket_8310a, 1, 5, 0.3843747);
TEST_INTERSECTION_REV(ticket_8310b, 1, 5, 0.3734379);
TEST_INTERSECTION_REV(ticket_8310c, 1, 5, 0.4689541);
test_one<Polygon, Polygon, Polygon>("ticket_9081_15",
ticket_9081_15[0], ticket_9081_15[1],
@@ -291,13 +252,11 @@ void test_areal()
ticket_10108_a[0], ticket_10108_a[1],
0, 0, 0.0);
#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
// msvc 5.6023011e-5
// mingw 5.6022954e-5
test_one<Polygon, Polygon, Polygon>("ticket_10108_b",
ticket_10108_b[0], ticket_10108_b[1],
0, 0, 5.6022983e-5);
#endif
optional(), 0, optional_sliver(1.0e-4));
test_one<Polygon, Polygon, Polygon>("ticket_10747_a",
ticket_10747_a[0], ticket_10747_a[1],
@@ -311,16 +270,31 @@ void test_areal()
test_one<Polygon, Polygon, Polygon>("ticket_10747_d",
ticket_10747_d[0], ticket_10747_d[1],
1, 4, 703687777321.0);
// Delivers very small triangle < 1.0e-13, or zero
test_one<Polygon, Polygon, Polygon>("ticket_10747_e",
ticket_10747_e[0], ticket_10747_e[1],
1, 4, 7.0368748575710959e-15);
optional(), -1, optional_sliver(1.0e-13));
test_one<Polygon, Polygon, Polygon>("ticket_11576",
ticket_11576[0], ticket_11576[1],
1, 0, 5.585617332907136e-07);
1, -1, expectation_limits(5.5856173e-07, 5.5856175e-07));
test_one<Polygon, Polygon, Polygon>("ticket_9563", ticket_9563[0], ticket_9563[1],
1, 8, 129.90381);
{
// Not yet valid when rescaling is turned off
ut_settings settings;
settings.set_test_validity(BG_IF_RESCALED(true, false));
test_one<Polygon, Polygon, Polygon>("ticket_9563", ticket_9563[0], ticket_9563[1],
1, 8, 129.90381, settings);
}
#if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES)
// With rescaling the output is empty
TEST_INTERSECTION(issue_548, 1, -1, expectation_limits(1958821942, 1958824416));
#endif
TEST_INTERSECTION(issue_566_a, 1, -1, 70.7107);
TEST_INTERSECTION(issue_566_b, 1, -1, 70.7107);
test_one<Polygon, Polygon, Polygon>("buffer_mp1", buffer_mp1[0], buffer_mp1[1],
1, 31, 2.271707796);
@@ -333,18 +307,18 @@ void test_areal()
test_one<Polygon, Polygon, Polygon>("case_80",
case_80[0], case_80[1],
0, -1, 0.0);
0, 0, 0.0);
test_one<Polygon, Polygon, Polygon>("case_81",
case_81[0], case_81[1],
0, -1, 0.0);
0, 0, 0.0);
test_one<Polygon, Polygon, Polygon>("case_101",
case_101[0], case_101[1],
0, -1, 6.25);
1, -1, 6.25);
test_one<Polygon, Polygon, Polygon>("case_102",
case_102[0], case_102[1],
0, -1, 3.1875);
count_set(1, 2), -1, 3.1875);
test_one<Polygon, Polygon, Polygon>("case_103",
case_103[0], case_103[1],
@@ -354,15 +328,62 @@ void test_areal()
0, -1, 0.0);
TEST_INTERSECTION(case_105, 1, 34, 76.0);
#ifdef BOOST_GEOMETRY_INCLUDE_SELF_TURNS
TEST_INTERSECTION(case_106, 2, -1, 3.5);
TEST_INTERSECTION(case_107, 3, -1, 3.0);
#else
TEST_INTERSECTION_IGNORE(case_106, 0, -1, 3.5);
TEST_INTERSECTION_IGNORE(case_107, 0, -1, 3.0);
#endif
TEST_INTERSECTION(case_precision_1, optional(), 0, optional_sliver(1.0e-4));
TEST_INTERSECTION(case_precision_2, optional(), 0, optional_sliver(1.0e-5));
TEST_INTERSECTION(case_precision_3, optional(), 0, optional_sliver(1.0e-7));
TEST_INTERSECTION(case_precision_4, 0, 0, 0.0);
TEST_INTERSECTION(case_precision_5, optional(), 0, optional_sliver(1.0e-6));
TEST_INTERSECTION(case_precision_6, 1, -1, 14.0);
TEST_INTERSECTION(case_precision_7, 0, -1, 0.0);
TEST_INTERSECTION(case_precision_8, 1, -1, 14.0);
TEST_INTERSECTION(case_precision_9, 1, -1, 14.0);
TEST_INTERSECTION(case_precision_10, 1, -1, 14.0);
TEST_INTERSECTION(case_precision_11, 1, -1, 14.0);
TEST_INTERSECTION(case_precision_12, 1, -1, 2.0);
TEST_INTERSECTION(case_precision_13, 1, -1, 1.99998);
TEST_INTERSECTION(case_precision_14, 0, -1, 0.0);
TEST_INTERSECTION(case_precision_15, 1, -1, 14.0);
TEST_INTERSECTION(case_precision_16, 1, -1, 14.0);
TEST_INTERSECTION(case_precision_17, 1, -1, 14.0);
TEST_INTERSECTION(case_precision_18, 1, -1, 14.0);
TEST_INTERSECTION(case_precision_19, 1, -1, 14.0);
TEST_INTERSECTION(case_precision_20, 0, 0, 0.0);
TEST_INTERSECTION(case_precision_21, 0, 0, 0.0);
TEST_INTERSECTION(case_precision_22, 1, -1, 14.0);
TEST_INTERSECTION(case_precision_23, 1, -1, 14.0);
TEST_INTERSECTION(case_precision_24, 0, 0, 0.0);
TEST_INTERSECTION(case_precision_25, 0, 0, 0.0);
TEST_INTERSECTION(case_precision_26, 1, -1, 14.0);
TEST_INTERSECTION_REV(case_precision_1, optional(), 0, optional_sliver(1.0e-4));
TEST_INTERSECTION_REV(case_precision_2, optional(), 0, optional_sliver(1.0e-5));
TEST_INTERSECTION_REV(case_precision_3, optional(), 0, optional_sliver(1.0e-7));
TEST_INTERSECTION_REV(case_precision_4, 0, 0, 0.0);
TEST_INTERSECTION_REV(case_precision_5, optional(), 0, optional_sliver(1.0e-6));
TEST_INTERSECTION_REV(case_precision_6, 1, -1, 14.0);
TEST_INTERSECTION_REV(case_precision_7, 0, -1, 0.0);
TEST_INTERSECTION_REV(case_precision_8, 1, -1, 14.0);
TEST_INTERSECTION_REV(case_precision_9, 1, -1, 14.0);
TEST_INTERSECTION_REV(case_precision_10, 1, -1, 14.0);
TEST_INTERSECTION_REV(case_precision_11, 1, -1, 14.0);
TEST_INTERSECTION_REV(case_precision_12, 1, -1, 2.0);
TEST_INTERSECTION_REV(case_precision_13, 1, -1, 1.99998);
TEST_INTERSECTION_REV(case_precision_14, 0, -1, 0.0);
TEST_INTERSECTION_REV(case_precision_15, 1, -1, 14.0);
TEST_INTERSECTION_REV(case_precision_16, 1, -1, 14.0);
TEST_INTERSECTION_REV(case_precision_17, 1, -1, 14.0);
TEST_INTERSECTION_REV(case_precision_18, 1, -1, 14.0);
TEST_INTERSECTION_REV(case_precision_19, 1, -1, 14.0);
TEST_INTERSECTION_REV(case_precision_20, 0, 0, 0.0);
TEST_INTERSECTION_REV(case_precision_21, 0, 0, 0.0);
TEST_INTERSECTION_REV(case_precision_22, 1, -1, 14.0);
TEST_INTERSECTION_REV(case_precision_23, 1, -1, 14.0);
TEST_INTERSECTION_REV(case_precision_24, 0, 0, 0.0);
TEST_INTERSECTION_REV(case_precision_25, 0, 0, 0.0);
TEST_INTERSECTION_REV(case_precision_26, 1, -1, 14.0);
test_one<Polygon, Polygon, Polygon>("mysql_21964049",
mysql_21964049[0], mysql_21964049[1],
@@ -377,20 +398,17 @@ void test_areal()
mysql_21965285_b_inv[1],
2, -1, 183.71376870369406);
// Needs self-intersections to solve validity
#ifdef BOOST_GEOMETRY_INCLUDE_SELF_TURNS
TEST_INTERSECTION(mysql_23023665_6, 2, 0, 11.812440191387557);
#else
TEST_INTERSECTION_IGNORE(mysql_23023665_6, 1, -1, 11.812440191387557);
#endif
// Formation of an interior ring is optional
test_one<Polygon, Polygon, Polygon>("mysql_23023665_10",
mysql_23023665_10[0], mysql_23023665_10[1],
1, 0, -1, 54.701340543162523);
1, optional(), -1, 54.701340543162523);
// Formation of an interior ring is optional
test_one<Polygon, Polygon, Polygon>("mysql_23023665_11",
mysql_23023665_11[0], mysql_23023665_11[1],
1, 0, -1, 35.933385462482065);
1, optional(), -1, 35.933385462482065);
// test_one<Polygon, Polygon, Polygon>(
// "polygon_pseudo_line",
@@ -670,9 +688,6 @@ void test_all()
typedef bg::model::polygon<P, false, false> polygon_ccw_open;
boost::ignore_unused<polygon_ccw, polygon_open, polygon_ccw_open>();
ut_settings ignore_validity;
ignore_validity.test_validity = false;
std::string clip = "box(2 2,8 8)";
test_areal_linear<polygon, linestring>();
@@ -725,7 +740,8 @@ void test_all()
test_one<linestring, linestring, box>("llbo", "LINESTRING(9 9,10 10)", clip, 0, 0, 0.0);
// Touching with point (-> output linestring with ONE point)
test_one<linestring, linestring, box>("llb_touch", "LINESTRING(8 8,10 10)", clip, 1, 1, 0.0, ignore_validity);
test_one<linestring, linestring, box>("llb_touch", "LINESTRING(8 8,10 10)", clip, 1, 1, 0.0,
ut_settings(0.0001, false));
// Along border
test_one<linestring, linestring, box>("llb_along", "LINESTRING(2 2,2 8)", clip, 1, 2, 6.0);
@@ -880,18 +896,12 @@ void test_ticket_10868(std::string const& wkt_out)
int test_main(int, char* [])
{
test_all<bg::model::d2::point_xy<double> >();
BoostGeometryWriteTestConfiguration();
test_all<bg::model::d2::point_xy<default_test_type> >();
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
test_all<bg::model::d2::point_xy<float> >();
#if defined(HAVE_TTMATH)
std::cout << "Testing TTMATH" << std::endl;
test_all<bg::model::d2::point_xy<ttmath_big> >();
#endif
#endif
// Commented, because exception is now disabled:
// test_exception<bg::model::d2::point_xy<double> >();
@@ -902,11 +912,11 @@ int test_main(int, char* [])
test_boxes_nd<double>();
#ifdef BOOST_GEOMETRY_TEST_INCLUDE_FAILING_TESTS
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
// ticket #10868 still fails for 32-bit integers
test_ticket_10868<int32_t>("MULTIPOLYGON(((33520458 6878575,33480192 14931538,31446819 18947953,30772384 19615678,30101303 19612322,30114725 16928001,33520458 6878575)))");
#if !defined(BOOST_NO_INT64) || defined(BOOST_HAS_INT64_T) || defined(BOOST_HAS_MS_INT64)
#if !defined(BOOST_NO_INT64_T) || defined(BOOST_HAS_MS_INT64)
test_ticket_10868<int64_t>("MULTIPOLYGON(((33520458 6878575,33480192 14931538,31446819 18947953,30772384 19615678,30101303 19612322,30114725 16928001,33520458 6878575)))");
#endif
@@ -918,6 +928,13 @@ int test_main(int, char* [])
#if defined(BOOST_HAS_LONG_LONG)
test_ticket_10868<boost::long_long_type>("MULTIPOLYGON(((33520458 6878575,33480192 14931538,31446819 18947953,30772384 19615678,30101303 19612322,30114725 16928001,33520458 6878575)))");
#endif
#endif
#endif
#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(4, 2, 3, 1);
#endif
return 0;

View File

@@ -1,13 +1,14 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit test
// Copyright (c) 2015, Oracle and/or its affiliates.
// Copyright (c) 2015-2020, 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
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
#ifndef BOOST_TEST_MODULE
#define BOOST_TEST_MODULE test_intersection_linear_linear_areal
#endif
@@ -19,8 +20,6 @@
#include <boost/test/included/unit_test.hpp>
#include <boost/range.hpp>
#include <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometries/multi_linestring.hpp>
#include <boost/geometry/geometries/ring.hpp>

View File

@@ -32,8 +32,12 @@
(test_one<Polygon, MultiPolygon, MultiPolygon>) \
( #caseid, caseid[0], caseid[1], clips, points, area)
#define TEST_INTERSECTION_REV(caseid, clips, points, area) \
(test_one<Polygon, MultiPolygon, MultiPolygon>) \
( #caseid "_rev", caseid[1], caseid[0], clips, points, area)
#define TEST_INTERSECTION_IGNORE(caseid, clips, points, area) \
{ ut_settings ignore_validity; ignore_validity.test_validity = false; \
{ ut_settings ignore_validity; ignore_validity.set_test_validity(false); \
(test_one<Polygon, MultiPolygon, MultiPolygon>) \
( #caseid, caseid[0], caseid[1], clips, points, area, ignore_validity); }
@@ -111,7 +115,7 @@ void test_areal()
3, 16, 6.15);
test_one<Polygon, MultiPolygon, MultiPolygon>("case_77_multi",
case_77_multi[0], case_77_multi[1],
5, 33, 9.0);
5, 27, 9.0);
test_one<Polygon, MultiPolygon, MultiPolygon>("case_78_multi",
case_78_multi[0], case_78_multi[1],
1, 16, 22.0);
@@ -131,26 +135,19 @@ void test_areal()
case_107_multi[1], case_107_multi[2],
3, 13, 3.0);
#ifdef BOOST_GEOMETRY_TEST_INCLUDE_FAILING_TESTS
#if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES)
{
ut_settings ignore_validity; ignore_validity.test_validity = false;
// One intersection is missing (by rescaling)
// Rescaling misses one intersection
test_one<Polygon, MultiPolygon, MultiPolygon>("case_108_multi",
case_108_multi[0], case_108_multi[1],
5, 33, 7.5,
ignore_validity);
7, -1, 7.5);
}
#endif
TEST_INTERSECTION(case_123_multi, 3, 13, 1.875);
TEST_INTERSECTION(case_124_multi, 2, 13, 2.0625);
TEST_INTERSECTION(case_125_multi, 3, 17, 2.1);
#ifdef BOOST_GEOMETRY_INCLUDE_SELF_TURNS
TEST_INTERSECTION(case_126_multi, 5, 27, 9.0);
#else
TEST_INTERSECTION_IGNORE(case_126_multi, 3, 23, 9.0);
#endif
TEST_INTERSECTION(case_127_multi, 3, 19, 24.0);
TEST_INTERSECTION(case_128_multi, 2, 26, 75.5);
TEST_INTERSECTION(case_129_multi, 1, 20, 20.5);
@@ -158,42 +155,31 @@ void test_areal()
TEST_INTERSECTION(case_133_multi, 2, 23, 40.625);
TEST_INTERSECTION(case_134_multi, 1, 23, 42.0);
TEST_INTERSECTION(case_135_multi, 1, 17, 7.0);
TEST_INTERSECTION(case_136_multi, 1, 17, 6.5);
TEST_INTERSECTION(case_137_multi, 1, 17, 6.5);
TEST_INTERSECTION(case_135_multi, 1, 12, 7.0);
TEST_INTERSECTION(case_136_multi, 1, 12, 6.5);
TEST_INTERSECTION(case_137_multi, 1, 12, 6.5);
TEST_INTERSECTION(case_138_multi, 2, 23, 40.4);
TEST_INTERSECTION(case_139_multi, 2, 23, 40.546875);
TEST_INTERSECTION(case_140_multi, 2, 23, 40.546875);
TEST_INTERSECTION(case_141_multi, 3, -1, 74.5);
// TODO: isolated region with multiple connection should be handled
// differently
TEST_INTERSECTION_IGNORE(case_141_multi, 2, -1, 74.5);
#ifdef BOOST_GEOMETRY_INCLUDE_SELF_TURNS
TEST_INTERSECTION(case_recursive_boxes_1, 10, 97, 47.0);
#else
TEST_INTERSECTION_IGNORE(case_recursive_boxes_1, 8, 97, 47.0);
#endif
TEST_INTERSECTION(case_recursive_boxes_1, 10, 89, 47.0);
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_2",
case_recursive_boxes_2[0], case_recursive_boxes_2[1],
1, 50, 90.0); // Area from SQL Server
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_3",
case_recursive_boxes_3[0], case_recursive_boxes_3[1],
19, 87, 12.5); // Area from SQL Server
19, 84, 12.5); // Area from SQL Server
#ifdef BOOST_GEOMETRY_INCLUDE_SELF_TURNS
TEST_INTERSECTION_IGNORE(case_recursive_boxes_4, 13, 169, 67.0);
#else
TEST_INTERSECTION_IGNORE(case_recursive_boxes_4, 8, 178, 67.0);
#endif
TEST_INTERSECTION_IGNORE(case_recursive_boxes_4, 13, 158, 67.0);
// Fixed by replacing handle_tangencies in less_by_segment_ratio sort order
// Should contain 6 output polygons
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_6",
case_recursive_boxes_6[0], case_recursive_boxes_6[1],
6, 47, 19.0);
6, 42, 19.0);
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_7",
case_recursive_boxes_7[0], case_recursive_boxes_7[1],
@@ -302,8 +288,8 @@ void test_areal()
TEST_INTERSECTION(case_recursive_boxes_47, 1, 5, 1.0);
TEST_INTERSECTION(case_recursive_boxes_48, 1, 5, 1.0);
TEST_INTERSECTION(case_recursive_boxes_49, 7, 57, 20.0);
TEST_INTERSECTION(case_recursive_boxes_50, 9, 71, 26.0);
TEST_INTERSECTION(case_recursive_boxes_51, 14, 79, 19.0);
TEST_INTERSECTION(case_recursive_boxes_50, 9, 62, 26.0);
TEST_INTERSECTION(case_recursive_boxes_51, 14, 74, 19.0);
TEST_INTERSECTION(case_recursive_boxes_52, 8, -1, 22.0);
TEST_INTERSECTION(case_recursive_boxes_53, 1, -1, 19.75);
TEST_INTERSECTION(case_recursive_boxes_54, 3, -1, 10.0);
@@ -315,46 +301,45 @@ void test_areal()
TEST_INTERSECTION(case_recursive_boxes_60, 8, -1, 10.0);
TEST_INTERSECTION(case_recursive_boxes_61, 2, -1, 20.0);
TEST_INTERSECTION(case_recursive_boxes_62, 9, -1, 10.5);
TEST_INTERSECTION(case_recursive_boxes_63, 11, -1, 5.75);
#ifdef BOOST_GEOMETRY_INCLUDE_SELF_TURNS
TEST_INTERSECTION(case_recursive_boxes_64, 5, -1, 17.25);
#else
TEST_INTERSECTION_IGNORE(case_recursive_boxes_64, 4, -1, 17.25);
#endif
TEST_INTERSECTION(case_recursive_boxes_65, 3, -1, 17.25);
#ifdef BOOST_GEOMETRY_INCLUDE_SELF_TURNS
TEST_INTERSECTION(case_recursive_boxes_66, 4, -1, 16.0);
#else
TEST_INTERSECTION_IGNORE(case_recursive_boxes_66, 2, -1, 16.0);
#endif
TEST_INTERSECTION(case_recursive_boxes_67, 5, -1, 2.5);
TEST_INTERSECTION(case_recursive_boxes_68, 8, -1, 9.5);
TEST_INTERSECTION(case_recursive_boxes_69, 6, -1, 3.25);
#ifdef BOOST_GEOMETRY_INCLUDE_SELF_TURNS
TEST_INTERSECTION(case_recursive_boxes_70, 6, -1, 18.5);
#else
// Misses a necessary self-turn and therefore a ring
TEST_INTERSECTION_IGNORE(case_recursive_boxes_70, 3, -1, 18.0);
#endif
TEST_INTERSECTION(case_recursive_boxes_71, 3, -1, 1.75);
TEST_INTERSECTION(case_recursive_boxes_72, 8, -1, 4.5);
TEST_INTERSECTION(case_recursive_boxes_73, 3, -1, 18.5);
#ifdef BOOST_GEOMETRY_INCLUDE_SELF_TURNS
TEST_INTERSECTION(case_recursive_boxes_74, 3, -1, 20.25);
#else
TEST_INTERSECTION_IGNORE(case_recursive_boxes_74, 2, -1, 20.25);
#endif
TEST_INTERSECTION(case_recursive_boxes_75, 5, -1, 16.75);
TEST_INTERSECTION(case_recursive_boxes_76, 2, -1, 18.25);
TEST_INTERSECTION(case_recursive_boxes_77, 5, -1, 3.5);
TEST_INTERSECTION(case_recursive_boxes_78, 9, -1, 8.0);
TEST_INTERSECTION(case_recursive_boxes_79, 5, -1, 9.0);
TEST_INTERSECTION(case_recursive_boxes_80, 1, -1, 0.25);
TEST_INTERSECTION(case_recursive_boxes_81, 5, -1, 3.75);
TEST_INTERSECTION(case_recursive_boxes_82, 5, -1, 8.5);
TEST_INTERSECTION(case_recursive_boxes_83, 5, -1, 10.25);
TEST_INTERSECTION(case_recursive_boxes_84, 1, -1, 0.5);
#if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES)
TEST_INTERSECTION(case_recursive_boxes_85, 1, -1, 0.25);
#endif
TEST_INTERSECTION(case_recursive_boxes_86, 0, -1, 0.0);
TEST_INTERSECTION(case_recursive_boxes_87, 0, -1, 0.0);
TEST_INTERSECTION(case_recursive_boxes_88, 4, -1, 3.5);
#if ! defined(BOOST_GEOMETRY_USE_RESCALING)
TEST_INTERSECTION(case_precision_m1, 1, -1, 14.0);
TEST_INTERSECTION(case_precision_m2, 2, -1, 15.25);
TEST_INTERSECTION_REV(case_precision_m1, 1, -1, 14.0);
TEST_INTERSECTION_REV(case_precision_m2, 2, -1, 15.25);
#else
// Validity: false positives (very small triangles looking like a line)
TEST_INTERSECTION_IGNORE(case_precision_m1, 1, -1, 14.0);
TEST_INTERSECTION_IGNORE(case_precision_m2, 2, -1, 15.25);
#endif
test_one<Polygon, MultiPolygon, MultiPolygon>("ggl_list_20120915_h2_a",
ggl_list_20120915_h2[0], ggl_list_20120915_h2[1],
@@ -365,32 +350,39 @@ void test_areal()
test_one<Polygon, MultiPolygon, MultiPolygon>("ticket_9081",
ticket_9081[0], ticket_9081[1],
2, 10, 0.0019812556);
count_set(2, 4), 10, 0.0019812556);
// qcc-arm reports 1.7791215549400884e-14
test_one<Polygon, MultiPolygon, MultiPolygon>("ticket_11018",
ticket_11018[0], ticket_11018[1],
1, 4,
#ifdef BOOST_GEOMETRY_NO_ROBUSTNESS
9.896437631745599e-09
#else
1.7791170511070893e-14, ut_settings(0.001)
#endif
// Should generate output, even for <float>
// For long double two small extra slivers are generated
test_one<Polygon, MultiPolygon, MultiPolygon>("mail_2019_01_21_johan",
mail_2019_01_21_johan[2], mail_2019_01_21_johan[3],
count_set(2, 4), -1, 0.0005889587);
);
// Might generate a very small triangle, which is acceptable
TEST_INTERSECTION(ticket_11018, count_set(0, 1), 0, expectation_limits(0.0, 4.0e-7));
TEST_INTERSECTION(ticket_12503, 2, 13, 17.375);
#if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES)
// 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_643, 1, -1, 3.4615);
#endif
test_one<Polygon, MultiPolygon, MultiPolygon>("mysql_23023665_7",
mysql_23023665_7[0], mysql_23023665_7[1],
2, 11, 9.80505786783);
#ifdef BOOST_GEOMETRY_INCLUDE_SELF_TURNS
TEST_INTERSECTION(mysql_23023665_12, 2, 0, 11.812440191387557);
#else
TEST_INTERSECTION_IGNORE(mysql_23023665_12, 1, -1, 11.812440191387557);
#endif
TEST_INTERSECTION(mysql_regression_1_65_2017_08_31, 2, -1, 29.9022122);
}
@@ -494,23 +486,20 @@ void test_all()
#endif
test_point_output<P>();
// linear
}
int test_main(int, char* [])
{
test_all<bg::model::d2::point_xy<double> >();
BoostGeometryWriteTestConfiguration();
test_all<bg::model::d2::point_xy<default_test_type> >();
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
test_all<bg::model::d2::point_xy<float> >();
#if defined(HAVE_TTMATH)
std::cout << "Testing TTMATH" << std::endl;
test_all<bg::model::d2::point_xy<ttmath_big> >();
#endif
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
BoostGeometryWriteExpectedFailures(9, 1, 2, 1);
#endif
return 0;

View File

@@ -0,0 +1,190 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2020, 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
#ifndef BOOST_TEST_MODULE
#define BOOST_TEST_MODULE test_intersection_pointlike_areal
#endif
#include <iostream>
#include <algorithm>
#include <boost/test/included/unit_test.hpp>
#include "../test_set_ops_pointlike.hpp"
#include <boost/geometry/geometries/multi_point.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/ring.hpp>
typedef bg::model::point<double, 2, bg::cs::cartesian> Pt;
typedef bg::model::polygon<Pt> Po;
typedef bg::model::ring<Pt> R;
typedef bg::model::multi_point<Pt> MPt;
typedef bg::model::multi_polygon<Po> MPo;
BOOST_AUTO_TEST_CASE( test_intersection_point_ring )
{
typedef test_set_op_of_pointlike_geometries
<
Pt, R, MPt, bg::overlay_intersection
> tester;
tester::apply(
"pt-r-01",
from_wkt<Pt>("POINT(0 0)"),
from_wkt<R>("POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))"),
from_wkt<MPt>("MULTIPOINT(0 0)")
);
tester::apply(
"pt-r-02",
from_wkt<Pt>("POINT(1 1)"),
from_wkt<R>("POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))"),
from_wkt<MPt>("MULTIPOINT(1 1)")
);
tester::apply(
"pt-r-03",
from_wkt<Pt>("POINT(6 6)"),
from_wkt<R>("POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))"),
from_wkt<MPt>("MULTIPOINT()")
);
}
BOOST_AUTO_TEST_CASE( test_intersection_point_polygon )
{
typedef test_set_op_of_pointlike_geometries
<
Pt, Po, MPt, bg::overlay_intersection
> tester;
tester::apply(
"pt-po-01",
from_wkt<Pt>("POINT(0 0)"),
from_wkt<Po>("POLYGON((0 0, 0 5, 5 5, 5 0, 0 0),(0 0, 3 1, 3 3, 1 3, 0 0))"),
from_wkt<MPt>("MULTIPOINT(0 0)")
);
tester::apply(
"pt-po-02",
from_wkt<Pt>("POINT(1 1)"),
from_wkt<Po>("POLYGON((0 0, 0 5, 5 5, 5 0, 0 0),(0 0, 3 1, 3 3, 1 3, 0 0))"),
from_wkt<MPt>("MULTIPOINT()")
);
tester::apply(
"pt-po-03",
from_wkt<Pt>("POINT(3 3)"),
from_wkt<Po>("POLYGON((0 0, 0 5, 5 5, 5 0, 0 0),(0 0, 3 1, 3 3, 1 3, 0 0))"),
from_wkt<MPt>("MULTIPOINT(3 3)")
);
tester::apply(
"pt-po-04",
from_wkt<Pt>("POINT(4 4)"),
from_wkt<Po>("POLYGON((0 0, 0 5, 5 5, 5 0, 0 0),(0 0, 3 1, 3 3, 1 3, 0 0))"),
from_wkt<MPt>("MULTIPOINT(4 4)")
);
tester::apply(
"pt-po-05",
from_wkt<Pt>("POINT(6 6)"),
from_wkt<Po>("POLYGON((0 0, 0 5, 5 5, 5 0, 0 0),(0 0, 3 1, 3 3, 1 3, 0 0))"),
from_wkt<MPt>("MULTIPOINT()")
);
}
BOOST_AUTO_TEST_CASE( test_intersection_point_multipolygon )
{
typedef test_set_op_of_pointlike_geometries
<
Pt, MPo, MPt, bg::overlay_intersection
> tester;
tester::apply(
"pt-mpo-01",
from_wkt<Pt>("POINT(0 0)"),
from_wkt<MPo>("MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0),(0 0, 4 1, 4 4, 1 4, 0 0)),((0 0, 1 2, 2 2, 2 1, 0 0)))"),
from_wkt<MPt>("MULTIPOINT(0 0)")
);
tester::apply(
"pt-mpo-02",
from_wkt<Pt>("POINT(1 1)"),
from_wkt<MPo>("MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0),(0 0, 4 1, 4 4, 1 4, 0 0)),((0 0, 1 2, 2 2, 2 1, 0 0)))"),
from_wkt<MPt>("MULTIPOINT(1 1)")
);
tester::apply(
"pt-mpo-03",
from_wkt<Pt>("POINT(2 2)"),
from_wkt<MPo>("MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0),(0 0, 4 1, 4 4, 1 4, 0 0)),((0 0, 1 2, 2 2, 2 1, 0 0)))"),
from_wkt<MPt>("MULTIPOINT(2 2)")
);
tester::apply(
"pt-mpo-04",
from_wkt<Pt>("POINT(3 3)"),
from_wkt<MPo>("MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0),(0 0, 4 1, 4 4, 1 4, 0 0)),((0 0, 1 2, 2 2, 2 1, 0 0)))"),
from_wkt<MPt>("MULTIPOINT()")
);
}
BOOST_AUTO_TEST_CASE( test_intersection_multipoint_ring )
{
typedef test_set_op_of_pointlike_geometries
<
MPt, R, MPt, bg::overlay_intersection
> tester;
tester::apply(
"mpt-r-01",
from_wkt<MPt>("MULTIPOINT(0 0, 1 1, 6 6)"),
from_wkt<R>("POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))"),
from_wkt<MPt>("MULTIPOINT(0 0, 1 1)")
);
}
BOOST_AUTO_TEST_CASE( test_intersection_multipoint_polygon )
{
typedef test_set_op_of_pointlike_geometries
<
MPt, Po, MPt, bg::overlay_intersection
> tester;
tester::apply(
"mpt-po-01",
from_wkt<MPt>("MULTIPOINT(0 0, 1 1, 3 3, 4 4, 6 6)"),
from_wkt<Po>("POLYGON((0 0, 0 5, 5 5, 5 0, 0 0),(0 0, 3 1, 3 3, 1 3, 0 0))"),
from_wkt<MPt>("MULTIPOINT(0 0, 3 3, 4 4)")
);
}
BOOST_AUTO_TEST_CASE( test_intersection_multipoint_multipolygon )
{
typedef test_set_op_of_pointlike_geometries
<
MPt, MPo, MPt, bg::overlay_intersection
> tester;
tester::apply(
"mpt-mpo-01",
from_wkt<MPt>("MULTIPOINT(0 0, 1 1, 2 2, 3 3, 4 4, 5 5, 6 6)"),
from_wkt<MPo>("MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0),(0 0, 4 1, 4 4, 1 4, 0 0)),((0 0, 1 2, 2 2, 2 1, 0 0)))"),
// NOTE: This is caused by the fact that intersection(MPt, MPt)
// used internally does not filter duplicates out.
from_wkt<MPt>("MULTIPOINT(0 0, 0 0, 1 1, 2 2, 4 4, 5 5)")
);
}

View File

@@ -0,0 +1,370 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2020, 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 <geometry_test_common.hpp>
#include <boost/geometry/algorithms/correct.hpp>
#include <boost/geometry/algorithms/equals.hpp>
#include <boost/geometry/algorithms/intersection.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/strategies/cartesian/intersection.hpp>
#include <boost/geometry/strategies/cartesian/point_in_poly_winding.hpp>
#include <boost/geometry/strategies/cartesian/point_in_point.hpp>
#include <boost/tuple/tuple.hpp>
// TEMP
#include <boost/geometry/strategies/cartesian.hpp>
#include <boost/geometry/strategies/geographic.hpp>
#include <boost/geometry/strategies/spherical.hpp>
typedef bg::model::point<double, 2, bg::cs::cartesian> Pt;
typedef bg::model::linestring<Pt> Ls;
typedef bg::model::polygon<Pt> Po;
typedef bg::model::ring<Pt> R;
typedef bg::model::multi_point<Pt> MPt;
typedef bg::model::multi_linestring<Ls> MLs;
typedef bg::model::multi_polygon<Po> MPo;
#ifdef BOOST_GEOMETRY_CXX11_TUPLE
#include <tuple>
#endif
template <typename G>
inline void check(std::string const& wkt1,
std::string const& wkt2,
G const& g,
std::string const& expected)
{
G expect;
bg::read_wkt(expected, expect);
bg::correct(expect);
if (! boost::empty(g) || ! boost::empty(expect))
{
BOOST_CHECK_MESSAGE(
// Commented out becasue the output in reversed case may be slightly different
// e.g. different number of duplicated points in MultiPoint
//boost::size(g) == boost::size(expect) &&
bg::equals(g, expect),
wkt1 << " x " << wkt2 << " -> " << bg::wkt(g)
<< " different than expected: " << expected
);
}
}
inline void check(std::string const& wkt1,
std::string const& wkt2,
boost::tuple<MPt, MLs, MPo> const& tup,
std::string const& out_p_str,
std::string const& out_l_str,
std::string const& out_a_str)
{
check(wkt1, wkt2, boost::get<0>(tup), out_p_str);
check(wkt1, wkt2, boost::get<1>(tup), out_l_str);
check(wkt1, wkt2, boost::get<2>(tup), out_a_str);
}
inline void check(std::string const& wkt1,
std::string const& wkt2,
std::pair<MPt, MLs> const& pair,
std::string const& out_p_str,
std::string const& out_l_str,
std::string const& )
{
check(wkt1, wkt2, pair.first, out_p_str);
check(wkt1, wkt2, pair.second, out_l_str);
}
#ifdef BOOST_GEOMETRY_CXX11_TUPLE
inline void check(std::string const& wkt1,
std::string const& wkt2,
std::tuple<MPt, MLs, MPo> const& tup,
std::string const& out_p_str,
std::string const& out_l_str,
std::string const& out_a_str)
{
check(wkt1, wkt2, std::get<0>(tup), out_p_str);
check(wkt1, wkt2, std::get<1>(tup), out_l_str);
check(wkt1, wkt2, std::get<2>(tup), out_a_str);
}
#endif
template <typename In1, typename In2, typename Tup>
inline void test_one(std::string const& in1_str,
std::string const& in2_str,
std::string const& out_p_str = "MULTIPOINT()",
std::string const& out_l_str = "MULTILINESTRING()",
std::string const& out_a_str = "MULTIPOLYGON()")
{
In1 in1;
bg::read_wkt(in1_str, in1);
bg::correct(in1);
In2 in2;
bg::read_wkt(in2_str, in2);
bg::correct(in2);
{
Tup result;
bg::intersection(in1, in2, result);
check(in1_str, in2_str, result, out_p_str, out_l_str, out_a_str);
}
{
Tup result;
bg::intersection(in2, in1, result);
check(in1_str, in2_str, result, out_p_str, out_l_str, out_a_str);
}
}
template <typename Tup>
inline void test_pp()
{
test_one<Pt, Pt, Tup>(
"POINT(0 0)",
"POINT(0 0)",
"MULTIPOINT(0 0)");
test_one<Pt, MPt, Tup>(
"POINT(0 0)",
"MULTIPOINT(0 0, 1 1)",
"MULTIPOINT(0 0)");
test_one<MPt, MPt, Tup>(
"MULTIPOINT(0 0, 1 1, 2 2)",
"MULTIPOINT(1 1, 2 2, 3 3)",
"MULTIPOINT(1 1, 2 2)");
}
template <typename Tup>
inline void test_pl()
{
test_one<Pt, Ls, Tup>(
"POINT(0 0)",
"LINESTRING(0 0, 1 1)",
"MULTIPOINT(0 0)");
test_one<Pt, MLs, Tup>(
"POINT(1 1)",
"MULTILINESTRING((0 0, 1 1),(1 1, 2 2),(4 4, 5 5))",
"MULTIPOINT(1 1)");
test_one<MPt, Ls, Tup>(
"MULTIPOINT(0 0, 1 1, 2 2, 3 3)",
"LINESTRING(0 0, 1 1)",
"MULTIPOINT(0 0, 1 1)");
test_one<MPt, MLs, Tup>(
"MULTIPOINT(0 0, 1 1, 2 2, 3 3)",
"MULTILINESTRING((0 0, 1 1),(1 1, 2 2),(4 4, 5 5))",
"MULTIPOINT(0 0, 1 1, 2 2)");
}
template <typename Tup>
inline void test_pa()
{
test_one<Pt, R, Tup>(
"POINT(0 0)",
"POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))",
"MULTIPOINT(0 0)");
test_one<Pt, Po, Tup>(
"POINT(0 0)",
"POLYGON((0 0, 0 5, 5 5, 5 0, 0 0),(0 0, 4 1, 4 4, 1 4, 0 0))",
"MULTIPOINT(0 0)");
test_one<Pt, MPo, Tup>(
"POINT(0 0)",
"MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0),(0 0, 4 1, 4 4, 1 4, 0 0)),((0 0, 1 2, 2 2, 2 1, 0 0)))",
"MULTIPOINT(0 0)");
test_one<MPt, R, Tup>(
"MULTIPOINT(0 0, 1 1, 2 2, 3 3, 4 4, 5 5, 6 6)",
"POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))",
"MULTIPOINT(0 0, 1 1, 2 2, 3 3, 4 4, 5 5)");
test_one<MPt, Po, Tup>(
"MULTIPOINT(0 0, 1 1, 2 2, 3 3, 4 4, 5 5, 6 6)",
"POLYGON((0 0, 0 5, 5 5, 5 0, 0 0),(0 0, 4 1, 4 4, 1 4, 0 0))",
"MULTIPOINT(0 0, 4 4, 5 5)");
test_one<MPt, MPo, Tup>(
"MULTIPOINT(0 0, 0 0, 1 1, 2 2, 3 3, 4 4, 5 5, 6 6)",
"MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0),(0 0, 4 1, 4 4, 1 4, 0 0)),((0 0, 1 2, 2 2, 2 1, 0 0)))",
"MULTIPOINT(0 0, 0 0, 1 1, 2 2, 4 4, 5 5)"); // one (0 0) could be filtered out
}
template <typename Tup>
inline void test_ll()
{
test_one<Ls, Ls, Tup>(
"LINESTRING(0 0, 1 0, 2 1, 3 0)",
"LINESTRING(0 0, 1 0, 3 0, 4 0)",
"MULTIPOINT(3 0)",
"MULTILINESTRING((0 0, 1 0))");
test_one<Ls, MLs, Tup>(
"LINESTRING(0 0, 1 0, 2 1, 3 0)",
"MULTILINESTRING((0 0, 1 0, 3 0),(2 1, 2 2))",
"MULTIPOINT(3 0, 2 1)",
"MULTILINESTRING((0 0, 1 0))");
test_one<MLs, MLs, Tup>(
"MULTILINESTRING((0 0, 1 0, 2 1),(2 1, 3 0))",
"MULTILINESTRING((0 0, 1 0, 3 0),(2 1, 2 2))",
"MULTIPOINT(3 0, 2 1, 2 1)", // (2 1) could be filtered out
"MULTILINESTRING((0 0, 1 0))");
test_one<Ls, Ls, Tup>(
"LINESTRING(0 0, 0 5, 5 5, 5 0, 0 0)",
"LINESTRING(0 0, 0 1, 6 1, 5 2, 5 5, 5 6, 4 5, 4 7, 7 7, 7 0, 0 0)",
"MULTIPOINT(4 5, 5 1, 0 0)", // (0 0) could be filtered out
"MULTILINESTRING((0 0, 0 1), (5 5, 5 2), (5 0, 0 0))");
test_one<MLs, MLs, Tup>(
"MULTILINESTRING((0 0, 0 5, 5 5, 5 0, 0 0),(0 0, 4 1, 4 4, 1 4, 0 0))",
"MULTILINESTRING((0 0, 1 4, 5 4, 5 1, 4 1, 0 0),(0 0, 2 1, 2 2, 1 2, 0 0))",
// all (0 0) could be filtered out
"MULTIPOINT(0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0)",
"MULTILINESTRING((5 4,5 1),(0 0,4 1),(4 4,1 4,0 0))");
}
template <typename Tup>
inline void test_la()
{
test_one<Ls, R, Tup>(
"LINESTRING(0 2, -4 1, 0 0, 5 0, 9 1, 5 2, 9 3, 5 5, 4 9, 4 5, 3 3, 2 5, 2 9, 0 5)",
"POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))",
"MULTIPOINT(0 2, 5 2, 5 5, 0 5)",
"MULTILINESTRING((0 0, 5 0),(4 5, 3 3, 2 5))");
test_one<Ls, Po, Tup>(
"LINESTRING(1 4, -4 1, 0 0, 5 0, 9 1, 5 2, 9 3, 5 5, 4 9, 4 5, 3 3, 2 5, 2 9, 0 5)",
"POLYGON((0 0, 0 5, 5 5, 5 0, 0 0),(0 0, 4 1, 4 4, 1 4, 0 0))",
"MULTIPOINT(5 2, 5 5, 0 5)",
"MULTILINESTRING((1 4, 0 3.4)(0 0, 5 0),(4 5, 3.5 4),(2.5 4, 2 5))");
test_one<MLs, R, Tup>(
"MULTILINESTRING((0 2, -4 1, 0 0, 5 0, 9 1, 5 2, 9 3, 5 5, 4 9), (4 9, 4 5, 3 3, 2 5, 2 9, 0 5))",
"POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))",
"MULTIPOINT(0 2, 5 2, 5 5, 0 5)",
"MULTILINESTRING((0 0, 5 0),(4 5, 3 3, 2 5))");
test_one<MLs, Po, Tup>(
"MULTILINESTRING((1 4, -4 1, 0 0, 5 0, 9 1, 5 2, 9 3, 5 5, 4 9), (4 9, 4 5, 3 3, 2 5, 2 9, 0 5))",
"POLYGON((0 0, 0 5, 5 5, 5 0, 0 0),(0 0, 4 1, 4 4, 1 4, 0 0))",
"MULTIPOINT(5 2, 5 5, 0 5)",
"MULTILINESTRING((1 4, 0 3.4)(0 0, 5 0),(4 5, 3.5 4),(2.5 4, 2 5))");
test_one<MLs, MPo, Tup>(
"MULTILINESTRING((1 4, -4 1, 0 0, 5 0, 9 1, 5 2, 9 3, 5 5, 4 9), (4 9, 4 5, 4 4, 2 2, 2 5, 1 9, 0 5))",
"MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0),(0 0, 4 1, 4 4, 1 4, 0 0)),((0 0, 1 2, 2 2, 2 1, 0 0)))",
"MULTIPOINT(5 2, 5 5, 2 2, 0 5)",
"MULTILINESTRING((1 4, 0 3.4)(0 0, 5 0),(4 5, 4 4),(2 4, 2 5))");
test_one<Ls, R, Tup>(
"LINESTRING(0 0, 0 5, 5 5, 5 0, 0 0)",
"POLYGON((0 0, 0 1, 6 1, 5 2, 5 5, 5 6, 4 5, 4 7, 7 7, 7 0, 0 0))",
"MULTIPOINT(4 5)",
"MULTILINESTRING((0 0, 0 1), (5 5, 5 2), (5 1, 5 0, 0 0))");
test_one<MLs, Po, Tup>(
"MULTILINESTRING((0 0, 0 5, 5 5, 5 0, 0 0),(0 0, 4 1, 4 4, 1 4, 0 0))",
"POLYGON((0 0, 1 4, 5 4, 5 1, 4 1, 0 0),(0 0, 2 1, 2 2, 1 2, 0 0))",
"MULTIPOINT(0 0)", // (0 0) could be filtered out
"MULTILINESTRING((5 4, 5 1),(0 0, 4 1, 4 4, 1 4, 0 0))");
}
template <typename Tup>
inline void test_aa()
{
test_one<R, R, Tup>(
"POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))",
"POLYGON((0 0, 0 1, 6 1, 5 2, 5 5, 5 6, 4 5, 4 7, 7 7, 7 0, 0 0))",
"MULTIPOINT(4 5)",
"MULTILINESTRING((5 2, 5 5))",
"MULTIPOLYGON(((0 0, 0 1, 5 1, 5 0, 0 0)))");
test_one<R, MPo, Tup>(
"POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))",
"MULTIPOLYGON(((0 0, 0 1, 6 1, 6 0, 0 0)),"
"((6 1, 5 2, 5 5, 5 6, 4 5, 4 7, 7 7, 7 1, 6 1)))",
"MULTIPOINT(4 5)",
"MULTILINESTRING((5 2, 5 5))",
"MULTIPOLYGON(((0 0, 0 1, 5 1, 5 0, 0 0)))");
test_one<Po, Po, Tup>(
"POLYGON((0 0, 0 5, 5 5, 5 0, 0 0),(0 0, 4 1, 4 4, 1 4, 0 0))",
"POLYGON((0 0, 1 4, 5 4, 5 1, 4 1, 0 0),(0 0, 2 1, 2 2, 1 2, 0 0))",
// all (0 0) could be filtered out
"MULTIPOINT(0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0)",
"MULTILINESTRING((0 0, 1 4, 4 4),(0 0, 4 1))",
"MULTIPOLYGON(((4 1, 4 4, 5 4, 5 1, 4 1)))");
test_one<Po, MPo, Tup>(
"POLYGON((0 0, 0 5, 5 5, 5 0, 0 0),(0 0, 4 1, 4 4, 1 4, 0 0))",
"MULTIPOLYGON(((0 0, 1 4, 5 4, 5 1, 4 1, 0 0),(0 0, 2 1, 2 2, 1 2, 0 0)),"
"((5 0, 5 1, 6 1, 6 4, 5 4, 3 6, 2 5, 2 7, 7 7, 7 0 5 0)))",
// all (0 0) and (5 0) could be filtered out
"MULTIPOINT(2 5, 5 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0)",
"MULTILINESTRING((0 0, 1 4, 4 4),(0 0, 4 1),(5 1, 5 0))",
"MULTIPOLYGON(((4 1, 4 4, 5 4, 5 1, 4 1)),((5 4, 4 5, 5 5, 5 4)))");
test_one<MPo, MPo, Tup>(
"MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0),(0 0, 4 1, 4 4, 1 4, 0 0)),"
"((2 6, 2 8, 8 8, 8 5, 7 5, 7 6, 2 6)))",
"MULTIPOLYGON(((0 0, 1 4, 5 4, 5 1, 4 1, 0 0),(0 0, 2 1, 2 2, 1 2, 0 0)),"
"((5 0, 5 1, 6 1, 6 4, 5 4, 3 6, 2 5, 2 7, 7 7, 7 0 5 0)))",
// all (0 0) and (5 0) could be filtered out
"MULTIPOINT(2 5, 5 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0)",
"MULTILINESTRING((0 0, 1 4, 4 4),(0 0, 4 1),(5 1, 5 0),(7 5, 7 6))",
"MULTIPOLYGON(((4 1, 4 4, 5 4, 5 1, 4 1)),"
"((5 4, 4 5, 5 5, 5 4)),"
"((2 6, 2 7, 7 7, 7 6, 2 6)))");
}
template <typename Tup>
inline void test_pair()
{
test_pp<Tup>();
test_pl<Tup>();
test_pa<Tup>();
test_ll<Tup>();
test_la<Tup>();
}
template <typename Tup>
inline void test_tuple()
{
test_pp<Tup>();
test_pl<Tup>();
test_pa<Tup>();
test_ll<Tup>();
test_la<Tup>();
test_aa<Tup>();
}
int test_main(int, char* [])
{
test_pair<std::pair<MPt, MLs> >();
test_tuple<boost::tuple<MPt, MLs, MPo> >();
#ifdef BOOST_GEOMETRY_CXX11_TUPLE
test_tuple<std::tuple<MPt, MLs, MPo> >();
#endif
return 0;
}

View File

@@ -3,8 +3,8 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// 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-2020.
// Modifications copyright (c) 2016-2020, 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 <iomanip>
#include <boost/foreach.hpp>
#include <boost/range/value_type.hpp>
#include <boost/variant/variant.hpp>
#include <boost/geometry/algorithms/intersection.hpp>
@@ -40,36 +41,30 @@
#endif
#include <geometry_test_common.hpp>
#include <count_set.hpp>
#include <expectation_limits.hpp>
#include <algorithms/check_validity.hpp>
#include "../setop_output_type.hpp"
#include "../check_validity.hpp"
struct ut_settings
struct ut_settings : ut_base_settings
{
double percentage;
bool test_validity;
bool debug;
explicit ut_settings(double p = 0.0001, bool tv = true)
: percentage(p)
, test_validity(tv)
: ut_base_settings(tv)
, percentage(p)
, debug(false)
{}
};
template
<
typename G1,
typename G2,
typename ResultType,
typename IntersectionOutput
>
typename bg::default_area_result<G1>::type
check_result(
IntersectionOutput const& intersection_output,
template<typename IntersectionOutput, typename G1, typename G2>
void check_result(IntersectionOutput const& intersection_output,
std::string const& caseid,
std::size_t expected_count, std::size_t expected_holes_count,
int expected_point_count, double expected_length_or_area,
G1 const& g1, G2 const& g2,
const count_set& expected_count, const count_set& expected_hole_count,
int expected_point_count, expectation_limits const& expected_length_or_area,
ut_settings const& settings)
{
typedef typename boost::range_value<IntersectionOutput>::type OutputType;
@@ -82,14 +77,14 @@ check_result(
it != intersection_output.end();
++it)
{
if (expected_point_count > 0)
if (! expected_count.empty())
{
// here n should rather be of type std::size_t, but expected_point_count
// is set to -1 in some test cases so type int was left for now
n += static_cast<int>(bg::num_points(*it, true));
}
if (expected_holes_count > 0)
if (! expected_hole_count.empty())
{
nholes += bg::num_interior_rings(*it);
}
@@ -105,17 +100,20 @@ check_result(
}
}
if (settings.test_validity)
if (settings.test_validity())
{
std::string message;
bool const valid = check_validity<ResultType>::apply(intersection_output, message);
bool const valid = check_validity<IntersectionOutput>
::apply(intersection_output, caseid, g1, g2, message);
BOOST_CHECK_MESSAGE(valid,
"intersection: " << caseid << " not valid: " << message
<< " type: " << (type_for_assert_message<G1, G2>()));
}
#if ! defined(BOOST_GEOMETRY_NO_BOOST_TEST)
#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
#if defined(BOOST_GEOMETRY_USE_RESCALING)
// Without rescaling, point count might easily differ (which is no problem)
if (expected_point_count > 0)
{
BOOST_CHECK_MESSAGE(bg::math::abs(n - expected_point_count) < 3,
@@ -127,49 +125,42 @@ check_result(
}
#endif
if (expected_count > 0)
if (! expected_count.empty())
{
BOOST_CHECK_MESSAGE(intersection_output.size() == expected_count,
"intersection: " << caseid
<< " #outputs expected: " << expected_count
<< " detected: " << intersection_output.size()
<< " type: " << (type_for_assert_message<G1, G2>())
);
BOOST_CHECK_MESSAGE(expected_count.has(intersection_output.size()),
"intersection: " << caseid
<< " #outputs expected: " << expected_count
<< " detected: " << intersection_output.size()
<< " type: " << (type_for_assert_message<G1, G2>())
);
}
if (expected_holes_count > 0)
if (! expected_hole_count.empty())
{
BOOST_CHECK_MESSAGE(nholes == expected_holes_count,
BOOST_CHECK_MESSAGE(expected_hole_count.has(nholes),
"intersection: " << caseid
<< " #holes expected: " << expected_holes_count
<< " #holes expected: " << expected_hole_count
<< " detected: " << nholes
<< " type: " << (type_for_assert_message<G1, G2>())
);
}
double const detected_length_or_area = boost::numeric_cast<double>(length_or_area);
if (settings.percentage > 0.0)
{
BOOST_CHECK_CLOSE(detected_length_or_area, expected_length_or_area, settings.percentage);
}
else
{
// In some cases (geos_2) the intersection is either 0, or a tiny rectangle,
// depending on compiler/settings. That cannot be tested by CLOSE
BOOST_CHECK_LE(detected_length_or_area, expected_length_or_area);
}
BOOST_CHECK_MESSAGE(expected_length_or_area.contains(length_or_area, settings.percentage),
"intersection: " << caseid << std::setprecision(20)
<< " #area expected: " << expected_length_or_area
<< " detected: " << length_or_area
<< " type: " << (type_for_assert_message<G1, G2>()));
#endif
return length_or_area;
}
template <typename OutputType, typename CalculationType, typename G1, typename G2>
typename bg::default_area_result<G1>::type test_intersection(std::string const& caseid,
G1 const& g1, G2 const& g2,
std::size_t expected_count = 0, std::size_t expected_holes_count = 0,
int expected_point_count = 0, double expected_length_or_area = 0,
const count_set& expected_count = count_set(),
const count_set& expected_hole_count = count_set(),
int expected_point_count = 0, expectation_limits const& expected_length_or_area = 0,
ut_settings const& settings = ut_settings())
{
if (settings.debug)
@@ -201,8 +192,8 @@ typename bg::default_area_result<G1>::type test_intersection(std::string const&
result_type intersection_output;
bg::intersection(g1, g2, intersection_output);
check_result<G1, G2, result_type>(intersection_output, caseid, expected_count,
expected_holes_count, expected_point_count, expected_length_or_area,
check_result(intersection_output, caseid, g1, g2, expected_count,
expected_hole_count, expected_point_count, expected_length_or_area,
settings);
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
@@ -210,22 +201,22 @@ typename bg::default_area_result<G1>::type test_intersection(std::string const&
intersection_output.clear();
bg::intersection(boost::variant<G1>(g1), g2, intersection_output);
check_result<G1, G2, result_type>(intersection_output, caseid, expected_count,
expected_holes_count, expected_point_count, expected_length_or_area,
check_result(intersection_output, caseid, g1, g2, expected_count,
expected_hole_count, expected_point_count, expected_length_or_area,
settings);
intersection_output.clear();
bg::intersection(g1, boost::variant<G2>(g2), intersection_output);
check_result<G1, G2, result_type>(intersection_output, caseid, expected_count,
expected_holes_count, expected_point_count, expected_length_or_area,
check_result(intersection_output, caseid, g1, g2, expected_count,
expected_hole_count, expected_point_count, expected_length_or_area,
settings);
intersection_output.clear();
bg::intersection(boost::variant<G1>(g1), boost::variant<G2>(g2), intersection_output);
check_result<G1, G2, result_type>(intersection_output, caseid, expected_count,
expected_holes_count, expected_point_count, expected_length_or_area,
check_result(intersection_output, caseid, g1, g2, expected_count,
expected_hole_count, expected_point_count, expected_length_or_area,
settings);
#endif
@@ -248,11 +239,8 @@ typename bg::default_area_result<G1>::type test_intersection(std::string const&
<< string_from_type<CalculationType>::name()
<< (ccw ? "_ccw" : "")
<< (open ? "_open" : "")
#if defined(BOOST_GEOMETRY_INCLUDE_SELF_TURNS)
<< "_self"
#endif
#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
<< "_no_rob"
#if defined(BOOST_GEOMETRY_USE_RESCALING)
<< "_rescaled"
#endif
<< ".svg";
@@ -291,21 +279,24 @@ typename bg::default_area_result<G1>::type test_intersection(std::string const&
template <typename OutputType, typename CalculationType, typename G1, typename G2>
typename bg::default_area_result<G1>::type test_intersection(std::string const& caseid,
G1 const& g1, G2 const& g2,
std::size_t expected_count = 0, int expected_point_count = 0,
double expected_length_or_area = 0,
const count_set& expected_count = count_set(), int expected_point_count = 0,
expectation_limits const& expected_length_or_area = 0,
ut_settings const& settings = ut_settings())
{
return test_intersection<OutputType, CalculationType>(
caseid, g1, g2, expected_count, 0, expected_point_count,
caseid, g1, g2, expected_count, count_set(), expected_point_count,
expected_length_or_area, settings
);
}
// Version with expected hole count
template <typename OutputType, typename G1, typename G2>
typename bg::default_area_result<G1>::type test_one(std::string const& caseid,
std::string const& wkt1, std::string const& wkt2,
std::size_t expected_count = 0, std::size_t expected_holes_count = 0,
int expected_point_count = 0, double expected_length_or_area = 0,
const count_set& expected_count,
const count_set& expected_hole_count,
int expected_point_count,
expectation_limits const& expected_length_or_area,
ut_settings const& settings = ut_settings())
{
G1 g1;
@@ -319,19 +310,21 @@ typename bg::default_area_result<G1>::type test_one(std::string const& caseid,
bg::correct(g2);
return test_intersection<OutputType, void>(caseid, g1, g2,
expected_count, expected_holes_count, expected_point_count,
expected_count, expected_hole_count, expected_point_count,
expected_length_or_area, settings);
}
// Version without expected hole count
template <typename OutputType, typename G1, typename G2>
typename bg::default_area_result<G1>::type test_one(std::string const& caseid,
std::string const& wkt1, std::string const& wkt2,
std::size_t expected_count = 0, int expected_point_count = 0,
double expected_length_or_area = 0,
const count_set& expected_count,
int expected_point_count,
expectation_limits const& expected_length_or_area,
ut_settings const& settings = ut_settings())
{
return test_one<OutputType, G1, G2>(caseid, wkt1, wkt2,
expected_count, 0, expected_point_count,
expected_count, count_set(), expected_point_count,
expected_length_or_area,
settings);
}
@@ -339,8 +332,8 @@ typename bg::default_area_result<G1>::type test_one(std::string const& caseid,
template <typename OutputType, typename Areal, typename Linear>
void test_one_lp(std::string const& caseid,
std::string const& wkt_areal, std::string const& wkt_linear,
std::size_t expected_count = 0, int expected_point_count = 0,
double expected_length = 0,
const count_set& expected_count = count_set(), int expected_point_count = 0,
expectation_limits const& expected_length = 0,
ut_settings const& settings = ut_settings())
{
#ifdef BOOST_GEOMETRY_TEST_DEBUG

View File

@@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2014-2017, Oracle and/or its affiliates.
// Copyright (c) 2014-2020, 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
@@ -13,6 +13,7 @@
#include <limits>
#include <boost/range/value_type.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/geometry/geometry.hpp>