mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-11 13:34:10 +00:00
Merge branch 'develop' into feature/sph_seg_inters
Conflicts: test/algorithms/overlay/overlay_cases.hpp
This commit is contained in:
commit
8147014095
@ -8,7 +8,6 @@
|
||||
|
||||
This file was modified by Oracle on 2015, 2016.
|
||||
Modifications copyright (c) 2015-2016, 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
|
||||
|
||||
@ -19,6 +18,18 @@
|
||||
|
||||
[section:release_notes Release Notes]
|
||||
|
||||
[/=================]
|
||||
[heading Boost 1.62]
|
||||
[/=================]
|
||||
|
||||
[*Improvements]
|
||||
|
||||
* SVG: support boost::variant of geometries
|
||||
|
||||
[*Solved tickets]
|
||||
|
||||
* [@https://svn.boost.org/trac/boost/ticket/12189 12189] Relational operations not compiling when point types of inputs are different
|
||||
|
||||
[/=================]
|
||||
[heading Boost 1.61]
|
||||
[/=================]
|
||||
|
@ -49,7 +49,7 @@ struct azimuth<ReturnType, geographic_tag>
|
||||
template <typename P1, typename P2, typename Spheroid>
|
||||
static inline ReturnType apply(P1 const& p1, P2 const& p2, Spheroid const& spheroid)
|
||||
{
|
||||
return geometry::detail::vincenty_inverse<ReturnType, false, true>
|
||||
return geometry::detail::vincenty_inverse<ReturnType, false, true>().apply
|
||||
( get_as_radian<0>(p1), get_as_radian<1>(p1),
|
||||
get_as_radian<0>(p2), get_as_radian<1>(p2),
|
||||
spheroid ).azimuth;
|
||||
|
@ -3,6 +3,10 @@
|
||||
|
||||
// Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2016.
|
||||
// Modifications copyright (c) 2016, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -97,6 +101,8 @@ static std::string const mysql_report_2015_09_08a = "LINESTRING(1 1, 2 1, 1.7652
|
||||
static std::string const mysql_report_2015_09_08b = "LINESTRING(2199023255556 16777218, 32770 8194, 1.417733e+308 7.823620e+307, -8 -9, 2147483649 20)";
|
||||
static std::string const mysql_report_2015_09_08c = "LINESTRING(-5 -8, 2 8, 2.160023e+307 1.937208e+307, -4 -3, -5 -4, 8796093022208 281474976710653)";
|
||||
|
||||
static std::string const mysql_23023665 = "LINESTRING(0 0, 0 5, 5 5, 5 0, 0 0)";
|
||||
|
||||
template <bool Clockwise, typename P>
|
||||
void test_all()
|
||||
{
|
||||
@ -279,6 +285,9 @@ void test_all()
|
||||
test_one<linestring, polygon>("mysql_report_2015_09_08a", mysql_report_2015_09_08a, join_round32, end_round32, 0.0, 1.0);
|
||||
test_one<linestring, polygon>("mysql_report_2015_09_08b", mysql_report_2015_09_08b, join_round32, end_round32, 0.0, 1099511627778.0);
|
||||
test_one<linestring, polygon>("mysql_report_2015_09_08c", mysql_report_2015_09_08c, join_round32, end_round32, 0.0, 0xbe);
|
||||
|
||||
test_one<linestring, polygon>("mysql_23023665_1", mysql_23023665, join_round32, end_flat, 459.1051, 10);
|
||||
test_one<linestring, polygon>("mysql_23023665_2", mysql_23023665, join_round32, end_flat, 6877.6941, 50);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,10 @@
|
||||
|
||||
// Copyright (c) 2012-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2016.
|
||||
// Modifications copyright (c) 2016, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -35,6 +39,8 @@ static std::string const mysql_2015_04_10b = "MULTILINESTRING((-58 19, 61 88),
|
||||
static std::string const mysql_2015_09_08a = "MULTILINESTRING((7 -4, -3 -5), (72057594037927936 15, 72057594037927940 70368744177660, 32771 36028797018963964, 8589934589 2305843009213693953, 7 2, 9.300367e+307 9.649737e+307, -4092 -274877906946, 5 10, -3 4))";
|
||||
static std::string const mysql_2015_09_08b = "MULTILINESTRING((-9 -10, 0 -1, 5 -10, -6 7, -7 7, 5.041061e+307 9.926906e+307, 6.870356e+307 1.064454e+307, 35184372088830 288230376151711743, 183673728842483250000000000000000000000.000000 244323751784861950000000000000000000000.000000), (-23530 -7131, -6 1, 1 1, 2 -6, 32766 -4194302, -4 -6), (134217725 0, 50336782742294697000000000000000000000.000000 36696596077212901000000000000000000000.000000, 7434 16486, 3.025467e+307 8.926790e+307), (2147483646 67108868, 71328904281592545000000000000000000000.000000 225041650340452780000000000000000000000.000000, -7 4, 1.667154e+307 3.990414e+307))";
|
||||
|
||||
static std::string const mysql_23023665_1 = "MULTILINESTRING((-5 15, 7 15, 19 -10, -11 -2),(2 13, 2 -9))";
|
||||
|
||||
template <bool Clockwise, typename P>
|
||||
void test_all()
|
||||
{
|
||||
@ -139,6 +145,13 @@ void test_all()
|
||||
mysql_2015_09_08b, join_round32, end_round32,
|
||||
1.32832149026508268e+19, 2061380362.0,
|
||||
same_distance, true, 1.0e12);
|
||||
|
||||
#ifdef BOOST_GEOMETRY_TEST_INCLUDE_FAILING_TESTS
|
||||
test_one<multi_linestring_type, polygon>("mysql_23023665_1",
|
||||
mysql_23023665_1, join_round32, end_round32,
|
||||
1, 1, 186.55043107613727, 1.0,
|
||||
same_distance, true, 1.0e12);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,6 +3,10 @@
|
||||
|
||||
// Copyright (c) 2012-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2016.
|
||||
// Modifications copyright (c) 2016, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -342,25 +346,25 @@ void test_all()
|
||||
test_one<multi_polygon_type, polygon_type>("nested_10", nested, join_round, end_flat, 254.279, 1.0);
|
||||
test_one<multi_polygon_type, polygon_type>("nested_10", nested, join_round, end_flat, 1.721, -1.0);
|
||||
test_one<multi_polygon_type, polygon_type>("nested_25", nested, join_round, end_flat, 355.622, 2.5);
|
||||
test_one<multi_polygon_type, polygon_type>("nested_25", nested, join_round, end_flat, 0, -2.5);
|
||||
test_one<multi_polygon_type, polygon_type>("nested_25", nested, join_round, end_flat, 0.0, -2.5);
|
||||
// 3.0 is exactly touching (for the deflate case)
|
||||
test_one<multi_polygon_type, polygon_type>("nested_30", nested, join_round, end_flat, 392.256, 3.0);
|
||||
test_one<multi_polygon_type, polygon_type>("nested_30", nested, join_round, end_flat, 0, -3.0);
|
||||
test_one<multi_polygon_type, polygon_type>("nested_30", nested, join_round, end_flat, 0.0, -3.0);
|
||||
test_one<multi_polygon_type, polygon_type>("nested_29", nested, join_round, end_flat, 384.803, 2.9);
|
||||
test_one<multi_polygon_type, polygon_type>("nested_29", nested, join_round, end_flat, 0, -2.9);
|
||||
test_one<multi_polygon_type, polygon_type>("nested_29", nested, join_round, end_flat, 0.0, -2.9);
|
||||
test_one<multi_polygon_type, polygon_type>("nested_31", nested, join_round, end_flat, 399.771, 3.1);
|
||||
test_one<multi_polygon_type, polygon_type>("nested_31", nested, join_round, end_flat, 0, -3.1);
|
||||
test_one<multi_polygon_type, polygon_type>("nested_31", nested, join_round, end_flat, 0.0, -3.1);
|
||||
|
||||
test_one<multi_polygon_type, polygon_type>("degenerate0", degenerate0, join_round, end_flat, 0.0, 1.0);
|
||||
test_one<multi_polygon_type, polygon_type>("degenerate1", degenerate1, join_round, end_flat, 5.708, 1.0);
|
||||
test_one<multi_polygon_type, polygon_type>("degenerate2", degenerate2, join_round, end_flat, 133.0166, 0.75);
|
||||
|
||||
test_one<multi_polygon_type, polygon_type>("rt_a", rt_a, join_round, end_flat, 34.5381, 1.0);
|
||||
test_one<multi_polygon_type, polygon_type>("rt_a", rt_a, join_miter, end_flat, 36, 1.0);
|
||||
test_one<multi_polygon_type, polygon_type>("rt_a", rt_a, join_miter, end_flat, 36.0, 1.0);
|
||||
test_one<multi_polygon_type, polygon_type>("rt_b", rt_b, join_round, end_flat, 31.4186, 1.0);
|
||||
test_one<multi_polygon_type, polygon_type>("rt_b", rt_b, join_miter, end_flat, 34, 1.0);
|
||||
test_one<multi_polygon_type, polygon_type>("rt_b", rt_b, join_miter, end_flat, 34.0, 1.0);
|
||||
test_one<multi_polygon_type, polygon_type>("rt_c", rt_c, join_round, end_flat, 14.7093, 1.0);
|
||||
test_one<multi_polygon_type, polygon_type>("rt_c", rt_c, join_miter, end_flat, 16, 1.0);
|
||||
test_one<multi_polygon_type, polygon_type>("rt_c", rt_c, join_miter, end_flat, 16.0, 1.0);
|
||||
test_one<multi_polygon_type, polygon_type>("rt_d", rt_d, join_round, end_flat, 18.8726, 0.3);
|
||||
test_one<multi_polygon_type, polygon_type>("rt_e", rt_e, join_round, end_flat, 14.1866, 0.3);
|
||||
|
||||
@ -409,7 +413,7 @@ void test_all()
|
||||
test_one<multi_polygon_type, polygon_type>("rt_p4", rt_p4, join_miter, end_flat, 33.0563, 1.0);
|
||||
|
||||
#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
|
||||
test_one<multi_polygon_type, polygon_type>("rt_p5", rt_p5, join_miter, end_flat, 17, 1.0);
|
||||
test_one<multi_polygon_type, polygon_type>("rt_p5", rt_p5, join_miter, end_flat, 17.0, 1.0);
|
||||
#endif
|
||||
|
||||
test_one<multi_polygon_type, polygon_type>("rt_p6", rt_p6, join_miter, end_flat, 18.4853, 1.0);
|
||||
@ -484,24 +488,24 @@ void test_all()
|
||||
|
||||
test_one<multi_polygon_type, polygon_type>("neighbouring_small",
|
||||
neighbouring,
|
||||
join_round32, end_round32, 128, -1);
|
||||
join_round32, end_round32, 128.0, -1.0);
|
||||
test_one<multi_polygon_type, polygon_type>("neighbouring_with_holes_small",
|
||||
neighbouring_with_holes,
|
||||
join_round32, end_round32, 97.757, -1);
|
||||
join_round32, end_round32, 97.757, -1.0);
|
||||
test_one<multi_polygon_type, polygon_type>("neighbouring_large",
|
||||
neighbouring,
|
||||
join_round32, end_round32, 0, -10);
|
||||
join_round32, end_round32, 0.0, -10.0);
|
||||
test_one<multi_polygon_type, polygon_type>("neighbouring_with_holes_large",
|
||||
neighbouring_with_holes,
|
||||
join_round32, end_round32, 0, -10);
|
||||
join_round32, end_round32, 0.0, -10.0);
|
||||
|
||||
test_one<multi_polygon_type, polygon_type>("mysql_report_2015_07_05_1",
|
||||
mysql_report_2015_07_05_1,
|
||||
join_round32, end_round32, 6.04454566324708726e+23, 5526,
|
||||
join_round32, end_round32, 6.04454566324708726e+23, 5526.0,
|
||||
same_distance, false, 1e+020);
|
||||
test_one<multi_polygon_type, polygon_type>("mysql_report_2015_07_05_2",
|
||||
mysql_report_2015_07_05_2,
|
||||
join_round32, end_round32, 0, 948189399);
|
||||
join_round32, end_round32, 0.0, 948189399.0);
|
||||
}
|
||||
|
||||
int test_main(int, char* [])
|
||||
|
@ -3,6 +3,10 @@
|
||||
|
||||
// Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2016.
|
||||
// Modifications copyright (c) 2016, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -350,13 +354,13 @@ void test_all()
|
||||
test_one<polygon_type, polygon_type>("snake16", snake, join_miter, end_flat, 114.24, 1.6);
|
||||
#endif
|
||||
|
||||
test_one<polygon_type, polygon_type>("funnelgate2", funnelgate, join_miter, end_flat, 120.982, 2);
|
||||
test_one<polygon_type, polygon_type>("funnelgate3", funnelgate, join_miter, end_flat, 13*13, 3);
|
||||
test_one<polygon_type, polygon_type>("funnelgate4", funnelgate, join_miter, end_flat, 15*15, 4);
|
||||
test_one<polygon_type, polygon_type>("gammagate1", gammagate, join_miter, end_flat, 88, 1);
|
||||
test_one<polygon_type, polygon_type>("fork_a1", fork_a, join_miter, end_flat, 88, 1);
|
||||
test_one<polygon_type, polygon_type>("fork_b1", fork_b, join_miter, end_flat, 154, 1);
|
||||
test_one<polygon_type, polygon_type>("fork_c1", fork_c, join_miter, end_flat, 152, 1);
|
||||
test_one<polygon_type, polygon_type>("funnelgate2", funnelgate, join_miter, end_flat, 120.982, 2.0);
|
||||
test_one<polygon_type, polygon_type>("funnelgate3", funnelgate, join_miter, end_flat, 13.0*13.0, 3.0);
|
||||
test_one<polygon_type, polygon_type>("funnelgate4", funnelgate, join_miter, end_flat, 15.0*15.0, 4.0);
|
||||
test_one<polygon_type, polygon_type>("gammagate1", gammagate, join_miter, end_flat, 88.0, 1.0);
|
||||
test_one<polygon_type, polygon_type>("fork_a1", fork_a, join_miter, end_flat, 88.0, 1.0);
|
||||
test_one<polygon_type, polygon_type>("fork_b1", fork_b, join_miter, end_flat, 154.0, 1.0);
|
||||
test_one<polygon_type, polygon_type>("fork_c1", fork_c, join_miter, end_flat, 152.0, 1.0);
|
||||
test_one<polygon_type, polygon_type>("triangle", triangle, join_miter, end_flat, 14.6569, 1.0);
|
||||
|
||||
test_one<polygon_type, polygon_type>("degenerate0", degenerate0, join_round, end_round, 0.0, 1.0);
|
||||
@ -364,7 +368,7 @@ void test_all()
|
||||
test_one<polygon_type, polygon_type>("degenerate2", degenerate2, join_round, end_round, 3.1389, 1.0);
|
||||
test_one<polygon_type, polygon_type>("degenerate3", degenerate3, join_round, end_round, 143.1395, 1.0);
|
||||
|
||||
test_one<polygon_type, polygon_type>("gammagate2", gammagate, join_miter, end_flat, 130, 2);
|
||||
test_one<polygon_type, polygon_type>("gammagate2", gammagate, join_miter, end_flat, 130.0, 2.0);
|
||||
|
||||
test_one<polygon_type, polygon_type>("flower1", flower, join_miter, end_flat, 67.614, 0.1);
|
||||
test_one<polygon_type, polygon_type>("flower20", flower, join_miter, end_flat, 74.894, 0.20);
|
||||
@ -548,41 +552,41 @@ void test_all()
|
||||
join_round32, end_round32, 48.879, -1);
|
||||
test_one<polygon_type, polygon_type>("mysql_report_2015_02_17_1_d5",
|
||||
mysql_report_2015_02_17_1,
|
||||
join_round32, end_round32, 0, -5);
|
||||
join_round32, end_round32, 0.0, -5.0);
|
||||
test_one<polygon_type, polygon_type>("mysql_report_2015_02_17_1_d6",
|
||||
mysql_report_2015_02_17_1,
|
||||
join_round32, end_round32, 0, -6);
|
||||
join_round32, end_round32, 0.0, -6.0);
|
||||
test_one<polygon_type, polygon_type>("mysql_report_2015_02_17_1_d10",
|
||||
mysql_report_2015_02_17_1,
|
||||
join_round32, end_round32, 0, -10);
|
||||
join_round32, end_round32, 0.0, -10.0);
|
||||
|
||||
test_one<polygon_type, polygon_type>("mysql_report_2015_02_17_2_d1",
|
||||
mysql_report_2015_02_17_2,
|
||||
join_round32, end_round32, 64, -1);
|
||||
join_round32, end_round32, 64.0, -1.0);
|
||||
test_one<polygon_type, polygon_type>("mysql_report_2015_02_17_2_d10",
|
||||
mysql_report_2015_02_17_2,
|
||||
join_round32, end_round32, 0, -10);
|
||||
join_round32, end_round32, 0.0, -10.0);
|
||||
test_one<polygon_type, polygon_type>("mysql_report_2015_02_17_3_d1",
|
||||
mysql_report_2015_02_17_3,
|
||||
join_round32, end_round32, 64, -1);
|
||||
join_round32, end_round32, 64.0, -1.0);
|
||||
|
||||
{
|
||||
double high_tolerance = 1.0e+20;
|
||||
test_one<polygon_type, polygon_type>("mysql_report_2015_07_05_0", mysql_report_2015_07_05_0,
|
||||
join_round32, end_round32, 700643542.242915988, 6);
|
||||
join_round32, end_round32, 700643542.242915988, 6.0);
|
||||
test_one<polygon_type, polygon_type>("mysql_report_2015_07_05_1", mysql_report_2015_07_05_1,
|
||||
join_round32, end_round32, 2.07548405999982264e+19, 6);
|
||||
join_round32, end_round32, 2.07548405999982264e+19, 6.0);
|
||||
test_one<polygon_type, polygon_type>("mysql_report_2015_07_05_2", mysql_report_2015_07_05_2,
|
||||
join_round32, end_round32, 9.48681585720922691e+23, 549755813889,
|
||||
join_round32, end_round32, 9.48681585720922691e+23, 549755813889.0,
|
||||
same_distance, true, high_tolerance);
|
||||
test_one<polygon_type, polygon_type>("mysql_report_2015_07_05_3", mysql_report_2015_07_05_3,
|
||||
join_round32, end_round32, 6.10005339242509925e+22, 49316,
|
||||
join_round32, end_round32, 6.10005339242509925e+22, 49316.0,
|
||||
same_distance, false, high_tolerance);
|
||||
test_one<polygon_type, polygon_type>("mysql_report_2015_07_05_4", mysql_report_2015_07_05_4,
|
||||
join_round32, end_round32, 4.25405937213774089e+23, 1479986,
|
||||
join_round32, end_round32, 4.25405937213774089e+23, 1479986.0,
|
||||
same_distance, false, high_tolerance);
|
||||
test_one<polygon_type, polygon_type>("mysql_report_2015_07_05_5", mysql_report_2015_07_05_5,
|
||||
join_round32, end_round32, 644489321051.62439, 38141,
|
||||
join_round32, end_round32, 644489321051.62439, 38141.0,
|
||||
same_distance, false, 10000.0);
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,11 @@
|
||||
// Unit Test Helper
|
||||
|
||||
// Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2016.
|
||||
// Modifications copyright (c) 2016, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -30,6 +35,7 @@
|
||||
#include <boost/geometry/algorithms/intersects.hpp>
|
||||
#include <boost/geometry/algorithms/is_empty.hpp>
|
||||
#include <boost/geometry/algorithms/is_valid.hpp>
|
||||
#include <boost/geometry/algorithms/num_interior_rings.hpp>
|
||||
#include <boost/geometry/algorithms/union.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
|
||||
@ -128,7 +134,10 @@ void test_buffer(std::string const& caseid, Geometry const& geometry,
|
||||
DistanceStrategy const& distance_strategy,
|
||||
SideStrategy const& side_strategy,
|
||||
PointStrategy const& point_strategy,
|
||||
bool check_self_intersections, double expected_area,
|
||||
bool check_self_intersections,
|
||||
int expected_count,
|
||||
int expected_holes_count,
|
||||
double expected_area,
|
||||
double tolerance,
|
||||
std::size_t* self_ip_count)
|
||||
{
|
||||
@ -262,6 +271,29 @@ void test_buffer(std::string const& caseid, Geometry const& geometry,
|
||||
// std::cout << "OUTPUT env: " << bg::wkt(envelope_output) << std::endl;
|
||||
// std::cout << bg::wkt(buffered) << std::endl;
|
||||
|
||||
if (expected_count >= 0)
|
||||
{
|
||||
BOOST_CHECK_MESSAGE
|
||||
(
|
||||
int(buffered.size()) == expected_count,
|
||||
"#outputs not as expected."
|
||||
<< " Expected: " << expected_count
|
||||
<< " Detected: " << buffered.size()
|
||||
);
|
||||
}
|
||||
|
||||
if (expected_holes_count >= 0)
|
||||
{
|
||||
std::size_t nholes = bg::num_interior_rings(buffered);
|
||||
BOOST_CHECK_MESSAGE
|
||||
(
|
||||
int(nholes) == expected_holes_count,
|
||||
"#holes not as expected."
|
||||
<< " Expected: " << expected_holes_count
|
||||
<< " Detected: " << nholes
|
||||
);
|
||||
}
|
||||
|
||||
if (expected_area > -0.1)
|
||||
{
|
||||
double const difference = area - expected_area;
|
||||
@ -352,6 +384,31 @@ void test_buffer(std::string const& caseid, Geometry const& geometry,
|
||||
}
|
||||
}
|
||||
|
||||
template
|
||||
<
|
||||
typename GeometryOut,
|
||||
typename JoinStrategy,
|
||||
typename EndStrategy,
|
||||
typename DistanceStrategy,
|
||||
typename SideStrategy,
|
||||
typename PointStrategy,
|
||||
typename Geometry
|
||||
>
|
||||
void test_buffer(std::string const& caseid, Geometry const& geometry,
|
||||
JoinStrategy const& join_strategy,
|
||||
EndStrategy const& end_strategy,
|
||||
DistanceStrategy const& distance_strategy,
|
||||
SideStrategy const& side_strategy,
|
||||
PointStrategy const& point_strategy,
|
||||
bool check_self_intersections,
|
||||
double expected_area,
|
||||
double tolerance,
|
||||
std::size_t* self_ip_count)
|
||||
{
|
||||
test_buffer<GeometryOut>(caseid, geometry,
|
||||
join_strategy, end_strategy, distance_strategy, side_strategy, point_strategy,
|
||||
check_self_intersections, -1, -1, expected_area, tolerance, self_ip_count);
|
||||
}
|
||||
|
||||
#ifdef BOOST_GEOMETRY_CHECK_WITH_POSTGIS
|
||||
static int counter = 0;
|
||||
@ -366,7 +423,7 @@ template
|
||||
>
|
||||
void test_one(std::string const& caseid, std::string const& wkt,
|
||||
JoinStrategy const& join_strategy, EndStrategy const& end_strategy,
|
||||
double expected_area,
|
||||
int expected_count, int expected_holes_count, double expected_area,
|
||||
double distance_left, double distance_right = same_distance,
|
||||
bool check_self_intersections = true,
|
||||
double tolerance = 0.01)
|
||||
@ -404,7 +461,8 @@ void test_one(std::string const& caseid, std::string const& wkt,
|
||||
(caseid, g,
|
||||
join_strategy, end_strategy,
|
||||
distance_strategy, side_strategy, circle_strategy,
|
||||
check_self_intersections, expected_area,
|
||||
check_self_intersections,
|
||||
expected_count, expected_holes_count, expected_area,
|
||||
tolerance, NULL);
|
||||
|
||||
#if !defined(BOOST_GEOMETRY_COMPILER_MODE_DEBUG) && defined(BOOST_GEOMETRY_COMPILER_MODE_RELEASE)
|
||||
@ -422,13 +480,33 @@ void test_one(std::string const& caseid, std::string const& wkt,
|
||||
(caseid + "_sym", g,
|
||||
join_strategy, end_strategy,
|
||||
sym_distance_strategy, side_strategy, circle_strategy,
|
||||
check_self_intersections, expected_area,
|
||||
check_self_intersections,
|
||||
expected_count, expected_holes_count, expected_area,
|
||||
tolerance, NULL);
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template
|
||||
<
|
||||
typename Geometry,
|
||||
typename GeometryOut,
|
||||
typename JoinStrategy,
|
||||
typename EndStrategy
|
||||
>
|
||||
void test_one(std::string const& caseid, std::string const& wkt,
|
||||
JoinStrategy const& join_strategy, EndStrategy const& end_strategy,
|
||||
double expected_area,
|
||||
double distance_left, double distance_right = same_distance,
|
||||
bool check_self_intersections = true,
|
||||
double tolerance = 0.01)
|
||||
{
|
||||
test_one<Geometry, GeometryOut>(caseid, wkt, join_strategy, end_strategy,
|
||||
-1 ,-1, expected_area,
|
||||
distance_left, distance_right, check_self_intersections, tolerance);
|
||||
}
|
||||
|
||||
// Version (currently for the Aimes test) counting self-ip's instead of checking
|
||||
template
|
||||
<
|
||||
|
@ -2,6 +2,11 @@
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2016.
|
||||
// Modifications copyright (c) 2016, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -799,10 +804,32 @@ static std::string mysql_21965285_b[2] =
|
||||
"MULTIPOLYGON(((1 1, 3 0, 19 -8, -4 -3, 1 1)),((3 0, -2 7, -3 16, 1 19, 8 12, 3 0)))"
|
||||
};
|
||||
|
||||
static std::string mysql_1[2] =
|
||||
// formerly mysql_1
|
||||
static std::string mysql_23023665_7[2] =
|
||||
{
|
||||
"MULTIPOLYGON(((4 5,12 11,-12 -3,4 5)))",
|
||||
"MULTIPOLYGON(((5 4,-14 0,1 0,5 4)),((1 6,13 0,10 12,1 6)))"
|
||||
};
|
||||
|
||||
static std::string mysql_23023665_8[2] =
|
||||
{
|
||||
"MULTIPOLYGON(((0 0,0 40,40 40,40 0,0 0),(10 10,30 10,30 30,10 30,10 10)))",
|
||||
"MULTIPOLYGON(((10 10,10 20,20 10,10 10)),((20 10,30 20,30 10,20 10)),((10 20,10 30,20 20,10 20)),((20 20,30 30,30 20,20 20)))"
|
||||
};
|
||||
|
||||
static std::string mysql_23023665_9[2] =
|
||||
{
|
||||
"MULTIPOLYGON(((0 0, 0 40, 40 40, 40 0, 0 0),(10 10, 30 10, 30 30, 10 30, 10 10)))",
|
||||
"MULTIPOLYGON(((15 10, 10 15, 10 17, 15 10)),((15 10, 10 20, 10 22, 15 10)),"
|
||||
"((15 10, 10 25, 10 27, 15 10)),((25 10, 30 17, 30 15, 25 10)),"
|
||||
"((25 10, 30 22, 30 20, 25 10)),((25 10, 30 27, 30 25, 25 10)),"
|
||||
"((18 10, 20 30, 19 10, 18 10)),((21 10, 20 30, 22 10, 21 10)))"
|
||||
};
|
||||
|
||||
static std::string mysql_23023665_12[2] =
|
||||
{
|
||||
"MULTIPOLYGON(((6 7,18 14,-8 1,0 0,18 -8,6 7),(6 0,-4 3,5 3,6 0)))",
|
||||
"MULTIPOLYGON(((2 3,-3 5,-10 -1,2 3)))"
|
||||
};
|
||||
|
||||
#endif // BOOST_GEOMETRY_TEST_MULTI_OVERLAY_CASES_HPP
|
||||
|
@ -1087,5 +1087,58 @@ static std::string mysql_21965285_b_inv[2] =
|
||||
"POLYGON((-20 -20,-20 20,20 20,20 -20,-20 -20),(1 1, -4 -3, 19 -8, 3 0, 1 1),(3 0, 8 12, 1 19, -3 16, -2 7, 3 0))"
|
||||
};
|
||||
|
||||
static std::string mysql_23023665_1[2] =
|
||||
{
|
||||
"POLYGON((7 3,0 10,0 -6,9 -5,7 7,7 3),(0 8,2 3,2 -2,0 8))",
|
||||
"POLYGON((0 8,-8 14,-11 18,-19 11,-3 1,0 8))"
|
||||
};
|
||||
|
||||
static std::string mysql_23023665_2[2] =
|
||||
{
|
||||
"POLYGON((0 0,0 10,10 10,10 0,0 0),(0 8,4 4,4 6,0 8))",
|
||||
"POLYGON((0 8,-8 8,-10 4,0 8))"
|
||||
};
|
||||
|
||||
static std::string mysql_23023665_3[2] =
|
||||
{
|
||||
"POLYGON((5 0,15 18,-14 11,5 0),(0 3,-1 4,5 0,0 3))",
|
||||
"POLYGON((6 0,-5 0,-1 -12,6 0))"
|
||||
};
|
||||
|
||||
static std::string mysql_23023665_4[2] =
|
||||
{
|
||||
"POLYGON((7 0,10 -3,7 1,7 0))",
|
||||
"POLYGON((7 4,-14 10,7 -17,7 4),(7 1,0 3,-2 4,7 1))"
|
||||
};
|
||||
|
||||
static std::string mysql_23023665_5[2] =
|
||||
{
|
||||
"POLYGON((8 6,5 7,-1 4,-8 -7,0 -17,8 6),(3 6,5 5,0 -2,3 6))",
|
||||
"POLYGON((3 5,-17 11,-8 -3,3 5))"
|
||||
};
|
||||
|
||||
static std::string mysql_23023665_6[2] =
|
||||
{
|
||||
"POLYGON((6 7,18 14, -8 1, 0 0, 18 -8, 6 7), (6 0, -4 3, 5 3, 6 0))",
|
||||
"POLYGON((2 3,-3 5,-10 -1,2 3))"
|
||||
};
|
||||
|
||||
static std::string mysql_23023665_10[2] =
|
||||
{
|
||||
"POLYGON((0 5, -6 -17, 12 17, 0 5),(4 6, 5 5, 0 1, 4 6))",
|
||||
"POLYGON((3 9, -15 -5, 13 -11, 3 9))"
|
||||
};
|
||||
|
||||
static std::string mysql_23023665_11[2] =
|
||||
{
|
||||
"POLYGON((5 6,-15 -13,1 -8,5 6))",
|
||||
"POLYGON((0 8,-19 6,18 -17,20 8,11 17,0 8),(3 2,3 -1,1 0,3 2),(1 3,4 4,0 -1,1 3))"
|
||||
};
|
||||
|
||||
static std::string mysql_23023665_13[2] =
|
||||
{
|
||||
"POLYGON((6 7,18 14,-8 1,0 0,18 -8,6 7),(6 0,-4 3,5 3,6 0))",
|
||||
"POLYGON((0 7,-5 6,11 -13,0 7))"
|
||||
};
|
||||
|
||||
#endif // BOOST_GEOMETRY_TEST_OVERLAY_CASES_HPP
|
||||
|
@ -191,9 +191,6 @@ void test_point_polygon()
|
||||
template <typename P1, typename P2>
|
||||
void test_all()
|
||||
{
|
||||
typedef bg::model::polygon<P2> polygon;
|
||||
typedef bg::model::ring<P2> ring;
|
||||
|
||||
test_intersects_point_segment<P1, P2>();
|
||||
test_intersects_point_linestring<P1, P2>();
|
||||
test_intersects_polygon_polygon<P1, P2>();
|
||||
|
@ -3,9 +3,8 @@
|
||||
|
||||
// Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2015.
|
||||
// Modifications copyright (c) 2015, Oracle and/or its affiliates.
|
||||
|
||||
// This file was modified by Oracle on 2015, 2016.
|
||||
// Modifications copyright (c) 2015-2016, 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
|
||||
|
||||
@ -462,13 +461,50 @@ void test_all()
|
||||
test_one<polygon, polygon, polygon>("mysql_21977775",
|
||||
mysql_21977775[0], mysql_21977775[1],
|
||||
2, -1, 160.856568913, 2, -1, 92.3565689126);
|
||||
#endif
|
||||
|
||||
// also mysql_23023665
|
||||
test_one<polygon, polygon, polygon>("mysql_21965285",
|
||||
mysql_21965285[0], mysql_21965285[1],
|
||||
1, -1, 92.0,
|
||||
1, -1, 14.0,
|
||||
1, -1, 92.0 + 14.0);
|
||||
1, 2, -1, 92.0,
|
||||
1, 1, -1, 14.0,
|
||||
1, 2, -1, 92.0 + 14.0);
|
||||
|
||||
test_one<polygon, polygon, polygon>("mysql_23023665_1",
|
||||
mysql_23023665_1[0], mysql_23023665_1[1],
|
||||
1, 2, -1, 92.0,
|
||||
1, 1, -1, 142.5);
|
||||
|
||||
test_one<polygon, polygon, polygon>("mysql_23023665_2",
|
||||
mysql_23023665_2[0], mysql_23023665_2[1],
|
||||
1, 2, -1, 96.0,
|
||||
1, 1, -1, 16.0);
|
||||
|
||||
test_one<polygon, polygon, polygon>("mysql_23023665_3",
|
||||
mysql_23023665_3[0], mysql_23023665_3[1],
|
||||
1, 2, -1, 225.0,
|
||||
1, 1, -1, 66.0);
|
||||
|
||||
test_one<polygon, polygon, polygon>("mysql_23023665_4",
|
||||
mysql_23023665_4[0], mysql_23023665_4[1],
|
||||
1, 1, -1, 1.5,
|
||||
1, 2, -1, 219.0,
|
||||
1, 2, -1, 1.5 + 219.0);
|
||||
|
||||
test_one<polygon, polygon, polygon>("mysql_23023665_5",
|
||||
mysql_23023665_5[0], mysql_23023665_5[1],
|
||||
2, 2, -1, 165.23735,
|
||||
2, 2, -1, 105.73735);
|
||||
#endif
|
||||
test_one<polygon, polygon, polygon>("mysql_23023665_6",
|
||||
mysql_23023665_6[0], mysql_23023665_6[1],
|
||||
2, 2, -1, 105.68756,
|
||||
3, 3, -1, 10.18756);
|
||||
#ifdef BOOST_GEOMETRY_TEST_INCLUDE_FAILING_TESTS
|
||||
test_one<polygon, polygon, polygon>("mysql_23023665_13",
|
||||
mysql_23023665_13[0], mysql_23023665_13[1],
|
||||
3, 3, -1, 99.74526,
|
||||
3, 3, -1, 37.74526);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,6 +2,11 @@
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2016.
|
||||
// Modifications copyright (c) 2016, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -27,6 +32,7 @@
|
||||
#include <boost/geometry/algorithms/is_valid.hpp>
|
||||
#include <boost/geometry/algorithms/length.hpp>
|
||||
#include <boost/geometry/algorithms/num_points.hpp>
|
||||
#include <boost/geometry/algorithms/num_interior_rings.hpp>
|
||||
#include <boost/geometry/algorithms/remove_spikes.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/geometries.hpp>
|
||||
@ -117,7 +123,7 @@ void difference_output(std::string const& caseid, G1 const& g1, G2 const& g2, Ou
|
||||
|
||||
template <typename OutputType, typename G1, typename G2>
|
||||
std::string test_difference(std::string const& caseid, G1 const& g1, G2 const& g2,
|
||||
int expected_count, int expected_point_count,
|
||||
int expected_count, int expected_rings_count, int expected_point_count,
|
||||
double expected_area,
|
||||
bool sym,
|
||||
ut_settings const& settings)
|
||||
@ -214,6 +220,17 @@ std::string test_difference(std::string const& caseid, G1 const& g1, G2 const& g
|
||||
);
|
||||
}
|
||||
|
||||
if (expected_rings_count >= 0)
|
||||
{
|
||||
int nrings = expected_count + bg::num_interior_rings(result);
|
||||
BOOST_CHECK_MESSAGE(nrings == expected_rings_count,
|
||||
"difference: " << caseid
|
||||
<< " #rings expected: " << expected_rings_count
|
||||
<< " detected: " << nrings
|
||||
<< " type: " << (type_for_assert_message<G1, G2>())
|
||||
);
|
||||
}
|
||||
|
||||
BOOST_CHECK_CLOSE(area, expected_area, settings.percentage);
|
||||
#endif
|
||||
|
||||
@ -221,12 +238,97 @@ std::string test_difference(std::string const& caseid, G1 const& g1, G2 const& g
|
||||
return return_string.str();
|
||||
}
|
||||
|
||||
template <typename OutputType, typename G1, typename G2>
|
||||
std::string test_difference(std::string const& caseid, G1 const& g1, G2 const& g2,
|
||||
int expected_count, int expected_point_count,
|
||||
double expected_area,
|
||||
bool sym,
|
||||
ut_settings const& settings)
|
||||
{
|
||||
return test_difference<OutputType>(caseid, g1, g2,
|
||||
expected_count, -1, expected_point_count, expected_area,
|
||||
sym, settings);
|
||||
}
|
||||
|
||||
#ifdef BOOST_GEOMETRY_CHECK_WITH_POSTGIS
|
||||
static int counter = 0;
|
||||
#endif
|
||||
|
||||
|
||||
template <typename OutputType, typename G1, typename G2>
|
||||
std::string test_one(std::string const& caseid,
|
||||
std::string const& wkt1, std::string const& wkt2,
|
||||
int expected_count1,
|
||||
int expected_rings_count1,
|
||||
int expected_point_count1,
|
||||
double expected_area1,
|
||||
int expected_count2,
|
||||
int expected_rings_count2,
|
||||
int expected_point_count2,
|
||||
double expected_area2,
|
||||
int expected_count_s,
|
||||
int expected_rings_count_s,
|
||||
int expected_point_count_s,
|
||||
double expected_area_s,
|
||||
ut_settings const& settings = ut_settings())
|
||||
{
|
||||
G1 g1;
|
||||
bg::read_wkt(wkt1, g1);
|
||||
|
||||
G2 g2;
|
||||
bg::read_wkt(wkt2, g2);
|
||||
|
||||
bg::correct(g1);
|
||||
bg::correct(g2);
|
||||
|
||||
std::string result = test_difference<OutputType>(caseid + "_a", g1, g2,
|
||||
expected_count1, expected_rings_count1, expected_point_count1,
|
||||
expected_area1, false, settings);
|
||||
|
||||
#ifdef BOOST_GEOMETRY_DEBUG_ASSEMBLE
|
||||
return result;
|
||||
#endif
|
||||
|
||||
test_difference<OutputType>(caseid + "_b", g2, g1,
|
||||
expected_count2, expected_rings_count2, expected_point_count2,
|
||||
expected_area2, false, settings);
|
||||
|
||||
if (settings.sym_difference)
|
||||
{
|
||||
test_difference<OutputType>(caseid + "_s", g1, g2,
|
||||
expected_count_s,
|
||||
expected_rings_count_s,
|
||||
expected_point_count_s,
|
||||
expected_area_s,
|
||||
true, settings);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename OutputType, typename G1, typename G2>
|
||||
std::string test_one(std::string const& caseid,
|
||||
std::string const& wkt1, std::string const& wkt2,
|
||||
int expected_count1,
|
||||
int expected_rings_count1,
|
||||
int expected_point_count1,
|
||||
double expected_area1,
|
||||
int expected_count2,
|
||||
int expected_rings_count2,
|
||||
int expected_point_count2,
|
||||
double expected_area2,
|
||||
ut_settings const& settings = ut_settings())
|
||||
{
|
||||
return test_one<OutputType, G1, G2>(caseid, wkt1, wkt2,
|
||||
expected_count1, expected_rings_count1, expected_point_count1, expected_area1,
|
||||
expected_count2, expected_rings_count2, expected_point_count2, expected_area2,
|
||||
expected_count1 + expected_count2,
|
||||
expected_rings_count1 + expected_rings_count2,
|
||||
expected_point_count1 >= 0 && expected_point_count2 >= 0
|
||||
? (expected_point_count1 + expected_point_count2) : -1,
|
||||
expected_area1 + expected_area2,
|
||||
settings);
|
||||
}
|
||||
|
||||
template <typename OutputType, typename G1, typename G2>
|
||||
std::string test_one(std::string const& caseid,
|
||||
std::string const& wkt1, std::string const& wkt2,
|
||||
@ -241,36 +343,11 @@ std::string test_one(std::string const& caseid,
|
||||
double expected_area_s,
|
||||
ut_settings const& settings = ut_settings())
|
||||
{
|
||||
G1 g1;
|
||||
bg::read_wkt(wkt1, g1);
|
||||
|
||||
G2 g2;
|
||||
bg::read_wkt(wkt2, g2);
|
||||
|
||||
bg::correct(g1);
|
||||
bg::correct(g2);
|
||||
|
||||
std::string result = test_difference<OutputType>(caseid + "_a", g1, g2,
|
||||
expected_count1, expected_point_count1,
|
||||
expected_area1, false, settings);
|
||||
|
||||
#ifdef BOOST_GEOMETRY_DEBUG_ASSEMBLE
|
||||
return result;
|
||||
#endif
|
||||
|
||||
test_difference<OutputType>(caseid + "_b", g2, g1,
|
||||
expected_count2, expected_point_count2,
|
||||
expected_area2, false, settings);
|
||||
|
||||
if (settings.sym_difference)
|
||||
{
|
||||
test_difference<OutputType>(caseid + "_s", g1, g2,
|
||||
expected_count_s,
|
||||
expected_point_count_s,
|
||||
expected_area_s,
|
||||
true, settings);
|
||||
}
|
||||
return result;
|
||||
return test_one<OutputType, G1, G2>(caseid, wkt1, wkt2,
|
||||
expected_count1, -1, expected_point_count1, expected_area1,
|
||||
expected_count2, -1, expected_point_count2, expected_area2,
|
||||
expected_count_s, -1, expected_point_count_s, expected_area_s,
|
||||
settings);
|
||||
}
|
||||
|
||||
template <typename OutputType, typename G1, typename G2>
|
||||
|
@ -5,9 +5,8 @@
|
||||
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
|
||||
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
|
||||
|
||||
// This file was modified by Oracle on 2015.
|
||||
// Modifications copyright (c) 2015, Oracle and/or its affiliates.
|
||||
|
||||
// This file was modified by Oracle on 2015, 2016.
|
||||
// Modifications copyright (c) 2015-2016, 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
|
||||
|
||||
@ -147,7 +146,7 @@ void test_areal()
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("equal_holes_disjoint",
|
||||
equal_holes_disjoint[0], equal_holes_disjoint[1],
|
||||
1, 20, 81 - 2 * 3 * 3 - 3 * 7);
|
||||
1, 20, 81.0 - 2.0 * 3.0 * 3.0 - 3.0 * 7.0);
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("only_hole_intersections1",
|
||||
only_hole_intersections[0], only_hole_intersections[1],
|
||||
@ -158,7 +157,7 @@ void test_areal()
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("fitting",
|
||||
fitting[0], fitting[1],
|
||||
0, 0, 0);
|
||||
0, 0, 0.0);
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("crossed",
|
||||
crossed[0], crossed[1],
|
||||
@ -258,11 +257,11 @@ void test_areal()
|
||||
|
||||
#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
|
||||
test_one<Polygon, Polygon, Polygon>("ticket_8254", ticket_8254[0], ticket_8254[1],
|
||||
1, 4, 3.635930e-08, 0.01);
|
||||
1, 4, 3.635930e-08, ut_settings(0.01));
|
||||
#endif
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("ticket_6958", ticket_6958[0], ticket_6958[1],
|
||||
1, 4, 4.34355e-05, 0.01);
|
||||
1, 4, 4.34355e-05, ut_settings(0.01));
|
||||
|
||||
#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
|
||||
test_one<Polygon, Polygon, Polygon>("ticket_8652", ticket_8652[0], ticket_8652[1],
|
||||
@ -350,6 +349,20 @@ void test_areal()
|
||||
mysql_21965285_b_inv[1],
|
||||
2, -1, 183.71376870369406);
|
||||
|
||||
#ifdef BOOST_GEOMETRY_TEST_INCLUDE_FAILING_TESTS
|
||||
test_one<Polygon, Polygon, Polygon>("mysql_23023665_6",
|
||||
mysql_23023665_6[0], mysql_23023665_6[1],
|
||||
2, -1, 11.812440191387557);
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("mysql_23023665_10",
|
||||
mysql_23023665_10[0], mysql_23023665_10[1],
|
||||
1, 1, -1, 54.701340543162523);
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("mysql_23023665_11",
|
||||
mysql_23023665_11[0], mysql_23023665_11[1],
|
||||
1, 1, -1, 35.933385462482065);
|
||||
#endif
|
||||
|
||||
return;
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>(
|
||||
@ -658,23 +671,23 @@ void test_all()
|
||||
test_one<linestring, linestring, box>("llbi", "LINESTRING(3 3,7 7)", clip, 1, 2, sqrt(2.0 * 4.0 * 4.0));
|
||||
|
||||
// Completely outside
|
||||
test_one<linestring, linestring, box>("llbo", "LINESTRING(9 9,10 10)", clip, 0, 0, 0);
|
||||
test_one<linestring, linestring, box>("llbo", "LINESTRING(9 9,10 10)", clip, 0, 0, 0.0);
|
||||
|
||||
// Touching with point (-> output linestring with ONE point)
|
||||
//std::cout << "Note: the output line is degenerate! Might be removed!" << std::endl;
|
||||
test_one<linestring, linestring, box>("llb_touch", "LINESTRING(8 8,10 10)", clip, 1, 1, 0.0);
|
||||
|
||||
// Along border
|
||||
test_one<linestring, linestring, box>("llb_along", "LINESTRING(2 2,2 8)", clip, 1, 2, 6);
|
||||
test_one<linestring, linestring, box>("llb_along", "LINESTRING(2 2,2 8)", clip, 1, 2, 6.0);
|
||||
|
||||
// Outputting two lines (because of 3-4-5 constructions (0.3,0.4,0.5)
|
||||
// which occur 4 times, the length is expected to be 2.0)
|
||||
test_one<linestring, linestring, box>("llb_2", "LINESTRING(1.7 1.6,2.3 2.4,2.9 1.6,3.5 2.4,4.1 1.6)", clip, 2, 6, 4 * 0.5);
|
||||
test_one<linestring, linestring, box>("llb_2", "LINESTRING(1.7 1.6,2.3 2.4,2.9 1.6,3.5 2.4,4.1 1.6)", clip, 2, 6, 4.0 * 0.5);
|
||||
|
||||
// linear
|
||||
test_one<P, linestring, linestring>("llp1", "LINESTRING(0 0,1 1)", "LINESTRING(0 1,1 0)", 1, 1, 0);
|
||||
test_one<P, segment, segment>("ssp1", "LINESTRING(0 0,1 1)", "LINESTRING(0 1,1 0)", 1, 1, 0);
|
||||
test_one<P, linestring, linestring>("llp2", "LINESTRING(0 0,1 1)", "LINESTRING(0 0,2 2)", 2, 2, 0);
|
||||
test_one<P, linestring, linestring>("llp1", "LINESTRING(0 0,1 1)", "LINESTRING(0 1,1 0)", 1, 1, 0.0);
|
||||
test_one<P, segment, segment>("ssp1", "LINESTRING(0 0,1 1)", "LINESTRING(0 1,1 0)", 1, 1, 0.0);
|
||||
test_one<P, linestring, linestring>("llp2", "LINESTRING(0 0,1 1)", "LINESTRING(0 0,2 2)", 2, 2, 0.0);
|
||||
|
||||
// polygons outputing points
|
||||
//test_one<P, polygon, polygon>("ppp1", simplex_normal[0], simplex_normal[1], 1, 7, 5.47363293);
|
||||
|
@ -3,6 +3,10 @@
|
||||
|
||||
// Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2016.
|
||||
// Modifications copyright (c) 2016, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -104,10 +108,10 @@ 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);
|
||||
5, 33, 9.0);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_78_multi",
|
||||
case_78_multi[0], case_78_multi[1],
|
||||
1, 0, 22); // In "get_turns" using partitioning, #points went from 17 to 16
|
||||
1, 0, 22.0); // In "get_turns" using partitioning, #points went from 17 to 16
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_101_multi",
|
||||
case_101_multi[0], case_101_multi[1],
|
||||
4, 22, 4.75);
|
||||
@ -253,9 +257,15 @@ void test_areal()
|
||||
ticket_11018[0], ticket_11018[1],
|
||||
1, 4, 1.7791170511070893e-14);
|
||||
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("mysql_1",
|
||||
mysql_1[0], mysql_1[1],
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("mysql_23023665_7",
|
||||
mysql_23023665_7[0], mysql_23023665_7[1],
|
||||
2, 11, 9.80505786783);
|
||||
|
||||
#ifdef BOOST_GEOMETRY_TEST_INCLUDE_FAILING_TESTS
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("mysql_23023665_12",
|
||||
mysql_23023665_12[0], mysql_23023665_12[1],
|
||||
2, -1, 11.812440191387557);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename Polygon, typename MultiPolygon, typename Box>
|
||||
@ -274,24 +284,24 @@ void test_linear()
|
||||
typedef typename bg::point_type<MultiLineString>::type point;
|
||||
test_one<point, MultiLineString, MultiLineString>("case_multi_ml_ml_1",
|
||||
"MULTILINESTRING((0 0,1 1))", "MULTILINESTRING((0 1,1 0))",
|
||||
1, 1, 0);
|
||||
1, 1, 0.0);
|
||||
test_one<point, MultiLineString, MultiLineString>("case_multi_ml_ml_2",
|
||||
"MULTILINESTRING((0 0,1 1),(0.5 0,1.5 1))", "MULTILINESTRING((0 1,1 0),(0.5 1,1.5 0))",
|
||||
4, 4, 0);
|
||||
4, 4, 0.0);
|
||||
|
||||
test_one<point, LineString, MultiLineString>("case_multi_l_ml",
|
||||
"LINESTRING(0 0,1 1)", "MULTILINESTRING((0 1,1 0),(0.5 1,1.5 0))",
|
||||
2, 2, 0);
|
||||
2, 2, 0.0);
|
||||
test_one<point, MultiLineString, LineString>("case_multi_ml_l",
|
||||
"MULTILINESTRING((0 1,1 0),(0.5 1,1.5 0))", "LINESTRING(0 0,1 1)",
|
||||
2, 2, 0);
|
||||
2, 2, 0.0);
|
||||
|
||||
test_one<LineString, MultiLineString, Box>("case_multi_ml_b",
|
||||
"MULTILINESTRING((0 0,3 3)(1 0,4 3))", "POLYGON((1 1,3 2))",
|
||||
2, 4, 2 * std::sqrt(2.0));
|
||||
2, 4, 2.0 * std::sqrt(2.0));
|
||||
test_one<LineString, Box, MultiLineString>("case_multi_b_ml",
|
||||
"POLYGON((1 1,3 2))", "MULTILINESTRING((0 0,3 3)(1 0,4 3))",
|
||||
2, 4, 2 * std::sqrt(2.0));
|
||||
2, 4, 2.0 * std::sqrt(2.0));
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
|
@ -2,6 +2,11 @@
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2016.
|
||||
// Modifications copyright (c) 2016, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -21,6 +26,7 @@
|
||||
#include <boost/geometry/algorithms/is_valid.hpp>
|
||||
#include <boost/geometry/algorithms/length.hpp>
|
||||
#include <boost/geometry/algorithms/num_points.hpp>
|
||||
#include <boost/geometry/algorithms/num_interior_rings.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/geometries.hpp>
|
||||
|
||||
@ -41,7 +47,7 @@ struct ut_settings
|
||||
bool test_validity;
|
||||
bool debug;
|
||||
|
||||
ut_settings(double p = 0.0001)
|
||||
explicit ut_settings(double p = 0.0001)
|
||||
: percentage(p)
|
||||
, test_validity(false)
|
||||
, debug(false)
|
||||
@ -54,14 +60,15 @@ typename bg::default_area_result<G1>::type
|
||||
check_result(
|
||||
std::vector<OutputType> const& intersection_output,
|
||||
std::string const& caseid,
|
||||
std::size_t expected_count, int expected_point_count,
|
||||
double expected_length_or_area,
|
||||
std::size_t expected_count, std::size_t expected_holes_count,
|
||||
int expected_point_count, double expected_length_or_area,
|
||||
ut_settings const& settings)
|
||||
{
|
||||
bool const is_line = bg::geometry_id<OutputType>::type::value == 2;
|
||||
|
||||
typename bg::default_area_result<G1>::type length_or_area = 0;
|
||||
int n = 0;
|
||||
std::size_t nholes = 0;
|
||||
for (typename std::vector<OutputType>::const_iterator it = intersection_output.begin();
|
||||
it != intersection_output.end();
|
||||
++it)
|
||||
@ -73,6 +80,11 @@ check_result(
|
||||
n += static_cast<int>(bg::num_points(*it, true));
|
||||
}
|
||||
|
||||
if (expected_holes_count > 0)
|
||||
{
|
||||
nholes += bg::num_interior_rings(*it);
|
||||
}
|
||||
|
||||
// instead of specialization we check it run-time here
|
||||
length_or_area += is_line
|
||||
? bg::length(*it)
|
||||
@ -115,6 +127,17 @@ check_result(
|
||||
);
|
||||
}
|
||||
|
||||
if (expected_holes_count > 0)
|
||||
{
|
||||
|
||||
BOOST_CHECK_MESSAGE(nholes == expected_holes_count,
|
||||
"intersection: " << caseid
|
||||
<< " #holes expected: " << expected_holes_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)
|
||||
{
|
||||
@ -135,8 +158,8 @@ check_result(
|
||||
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,
|
||||
std::size_t expected_count = 0, std::size_t expected_holes_count = 0,
|
||||
int expected_point_count = 0, double expected_length_or_area = 0,
|
||||
ut_settings const& settings = ut_settings())
|
||||
{
|
||||
if (settings.debug)
|
||||
@ -168,27 +191,31 @@ typename bg::default_area_result<G1>::type test_intersection(std::string const&
|
||||
std::vector<OutputType> intersection_output;
|
||||
bg::intersection(g1, g2, intersection_output);
|
||||
|
||||
check_result<G1, G2>(intersection_output, caseid, expected_count, expected_point_count,
|
||||
expected_length_or_area, settings);
|
||||
check_result<G1, G2>(intersection_output, caseid, expected_count,
|
||||
expected_holes_count, expected_point_count, expected_length_or_area,
|
||||
settings);
|
||||
|
||||
// Check variant behaviour
|
||||
intersection_output.clear();
|
||||
bg::intersection(boost::variant<G1>(g1), g2, intersection_output);
|
||||
|
||||
check_result<G1, G2>(intersection_output, caseid, expected_count, expected_point_count,
|
||||
expected_length_or_area, settings);
|
||||
check_result<G1, G2>(intersection_output, caseid, expected_count,
|
||||
expected_holes_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>(intersection_output, caseid, expected_count, expected_point_count,
|
||||
expected_length_or_area, settings);
|
||||
check_result<G1, G2>(intersection_output, caseid, expected_count,
|
||||
expected_holes_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>(intersection_output, caseid, expected_count, expected_point_count,
|
||||
expected_length_or_area, settings);
|
||||
check_result<G1, G2>(intersection_output, caseid, expected_count,
|
||||
expected_holes_count, expected_point_count, expected_length_or_area,
|
||||
settings);
|
||||
|
||||
#if defined(TEST_WITH_SVG)
|
||||
{
|
||||
@ -246,11 +273,24 @@ typename bg::default_area_result<G1>::type test_intersection(std::string const&
|
||||
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, int expected_point_count = 0,
|
||||
double 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,
|
||||
expected_length_or_area, settings
|
||||
);
|
||||
}
|
||||
|
||||
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,
|
||||
std::size_t expected_count = 0, std::size_t expected_holes_count = 0,
|
||||
int expected_point_count = 0, double expected_length_or_area = 0,
|
||||
ut_settings const& settings = ut_settings())
|
||||
{
|
||||
G1 g1;
|
||||
@ -264,10 +304,23 @@ 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_point_count,
|
||||
expected_count, expected_holes_count, expected_point_count,
|
||||
expected_length_or_area, settings);
|
||||
}
|
||||
|
||||
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,
|
||||
ut_settings const& settings = ut_settings())
|
||||
{
|
||||
return test_one<OutputType, G1, G2>(caseid, wkt1, wkt2,
|
||||
expected_count, 0, expected_point_count,
|
||||
expected_length_or_area,
|
||||
settings);
|
||||
}
|
||||
|
||||
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,
|
||||
|
@ -5,6 +5,10 @@
|
||||
// Copyright (c) 2008-2016 Bruno Lalande, Paris, France.
|
||||
// Copyright (c) 2009-2016 Mateusz Loskot, London, UK.
|
||||
|
||||
// This file was modified by Oracle on 2016.
|
||||
// Modifications copyright (c) 2016, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
|
||||
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
|
||||
|
||||
@ -435,16 +439,29 @@ void test_areal()
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_mp2", buffer_mp2[0], buffer_mp2[1],
|
||||
1, 1, 217, 36.752837);
|
||||
|
||||
// #holes should be 1 (for the 3 cases below)
|
||||
#ifdef BOOST_GEOMETRY_TEST_INCLUDE_FAILING_TESTS
|
||||
test_one<Polygon, Polygon, Polygon>("mysql_21964079_1",
|
||||
mysql_21964079_1[0], mysql_21964079_1[1],
|
||||
2, 0, -1, 234.5);
|
||||
2, 1, -1, 234.5);
|
||||
test_one<Polygon, Polygon, Polygon>("mysql_21964079_2",
|
||||
mysql_21964079_2[0], mysql_21964079_2[1],
|
||||
2, 0, -1, 112.0);
|
||||
2, 1, -1, 112.0);
|
||||
test_one<Polygon, Polygon, Polygon>("mysql_21964049",
|
||||
mysql_21964049[0], mysql_21964049[1],
|
||||
1, 0, -1, 220.5);
|
||||
1, 1, -1, 220.5);
|
||||
test_one<Polygon, Polygon, Polygon>("mysql_23023665_1",
|
||||
mysql_23023665_1[0], mysql_23023665_1[1],
|
||||
2, 1, -1, 92.0 + 142.5);
|
||||
test_one<Polygon, Polygon, Polygon>("mysql_23023665_2",
|
||||
mysql_23023665_2[0], mysql_23023665_2[1],
|
||||
2, 1, -1, 96.0 + 16.0);
|
||||
test_one<Polygon, Polygon, Polygon>("mysql_23023665_3",
|
||||
mysql_23023665_3[0], mysql_23023665_3[1],
|
||||
2, 1, -1, 225.0 + 66.0);
|
||||
test_one<Polygon, Polygon, Polygon>("mysql_23023665_4",
|
||||
mysql_23023665_4[0], mysql_23023665_4[1],
|
||||
1, 1, -1, 1.5 + 219.0);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
|
@ -3,6 +3,10 @@
|
||||
|
||||
// Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2016.
|
||||
// Modifications copyright (c) 2016, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -278,9 +282,15 @@ void test_areal()
|
||||
1, 2, 134, 60071.08077);
|
||||
|
||||
#ifdef BOOST_GEOMETRY_ENABLE_FAILING_TESTS
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("mysql_1",
|
||||
mysql_1[0], mysql_1[1],
|
||||
1, 1, 19, 99.19494);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("mysql_23023665_7",
|
||||
mysql_23023665_7[0], mysql_23023665_7[1],
|
||||
1, 1, -1, 99.19494);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("mysql_23023665_8",
|
||||
mysql_23023665_8[0], mysql_23023665_8[1],
|
||||
1, 2, -1, 1400.0);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("mysql_23023665_9",
|
||||
mysql_23023665_9[0], mysql_23023665_9[1],
|
||||
1, 9, -1, 1250.0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user