Merge branch 'develop' into bg-prepare

Conflicts:
	include/boost/geometry/extensions/algorithms/offset.hpp
	include/boost/geometry/extensions/gis/projections/impl/pj_init.hpp
	include/boost/geometry/extensions/iterators/section_iterators.hpp
	include/boost/geometry/extensions/nsphere/algorithms/disjoint.hpp
	include/boost/geometry/extensions/nsphere/algorithms/within.hpp
	include/boost/geometry/extensions/nsphere/nsphere.hpp
	include/boost/geometry/extensions/nsphere/strategies/cartesian/nsphere_in_box.hpp
	include/boost/geometry/extensions/nsphere/strategies/cartesian/point_in_nsphere.hpp
This commit is contained in:
Barend Gehrels
2015-10-28 10:11:24 +01:00
93 changed files with 1874 additions and 333 deletions

View File

@@ -93,6 +93,10 @@ static std::string const mysql_report_2015_06_11 = "LINESTRING("
"-162.7456296900030000 11.7183989853218000, 115.6208648232840000 "
"51.0941612539320000, -48.7772321835054000 50.4339743128205000)";
static std::string const mysql_report_2015_09_08a = "LINESTRING(1 1, 2 1, 1.765258e+308 4, -1 1, 10 4)";
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)";
template <bool Clockwise, typename P>
void test_all()
{
@@ -270,6 +274,12 @@ void test_all()
mysql_report_2015_06_11, join_round32, end_round32,
27862.733459829971,
5.9518403867035365);
#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS)
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);
#endif
}
template <bool Clockwise, typename P>

View File

@@ -32,6 +32,9 @@ static std::string const mikado4 = "MULTILINESTRING((-15 2,-15 -17,-6 11,-1.9358
static std::string const mysql_2015_04_10a = "MULTILINESTRING((-58 19, 61 88),(1.922421e+307 1.520384e+308, 15 42, 89 -93,-89 -22),(-63 -5, -262141 -536870908, -3 87, 77 -69))";
static std::string const mysql_2015_04_10b = "MULTILINESTRING((-58 19, 61 88), (-63 -5, -262141 -536870908, -3 87, 77 -69))";
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))";
template <bool Clockwise, typename P>
void test_all()
{
@@ -96,7 +99,7 @@ void test_all()
test_one<multi_linestring_type, polygon>("mikado1_small", mikado1, join_round32, end_round32, 1057.37, 10.0);
test_one<multi_linestring_type, polygon>("mikado1_small", mikado1, join_round32, end_flat, 874.590, 10.0);
test_one<multi_linestring_type, polygon>("mikado2_large", mikado2, join_round32, end_round32, 19878812253, 79610.0, same_distance, true, mikado_tolerance);
test_one<multi_linestring_type, polygon>("mikado2_large", mikado2, join_round32, end_round32, 19878812253, 79610.0, same_distance, true, 10 * mikado_tolerance);
test_one<multi_linestring_type, polygon>("mikado2_small", mikado2, join_round32, end_round32, 1082.470, 10.0);
test_one<multi_linestring_type, polygon>("mikado2_small", mikado2, join_round32, end_flat, 711.678, 10.0);
@@ -104,7 +107,7 @@ void test_all()
// msvc 29151950611
// clang/linux 29151950612
// mingw 29151950711
test_one<multi_linestring_type, polygon>("mikado3_large", mikado3, join_round32, end_round32, 29151950650, 96375.0, same_distance, true, 3 * mikado_tolerance);
test_one<multi_linestring_type, polygon>("mikado3_large", mikado3, join_round32, end_round32, 29151950650, 96375.0, same_distance, true, 10 * mikado_tolerance);
test_one<multi_linestring_type, polygon>("mikado3_small", mikado3, join_round32, end_round32, 2533.285, 10.0);
test_one<multi_linestring_type, polygon>("mikado3_small", mikado3, join_round32, end_flat, 2136.236, 10.0);
@@ -125,6 +128,17 @@ void test_all()
test_one<multi_linestring_type, polygon>("mysql_2015_04_10a", mysql_2015_04_10a, join_round32, end_round32, 1063005187.214, 0.98);
test_one<multi_linestring_type, polygon>("mysql_2015_04_10b", mysql_2015_04_10b, join_round32, end_round32, 1063005187.214, 0.98);
#endif
// Two other cases with inf for length calculation (tolerance quite high
// because the output area is quite high and varies between gcc/clang)
test_one<multi_linestring_type, polygon>("mysql_2015_09_08a",
mysql_2015_09_08a, join_round32, end_round32,
5.12436196736438764e+19, 4051744443.0,
same_distance, true, 1.0e12);
test_one<multi_linestring_type, polygon>("mysql_2015_09_08b",
mysql_2015_09_08b, join_round32, end_round32,
1.32832149026508268e+19, 2061380362.0,
same_distance, true, 1.0e12);
}

View File

@@ -570,7 +570,8 @@ void test_all()
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);
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,
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,
same_distance, false, high_tolerance);
@@ -578,7 +579,8 @@ void test_all()
join_round32, end_round32, 4.25405937213774089e+23, 1479986,
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,
same_distance, false, 10000.0);
}
}

View File

@@ -131,6 +131,8 @@ private :
color = 'b';
is_good = false;
break;
default:
; // to avoid "enumeration value not handled" warning
}
if (!it->selectable_start)
{

View File

@@ -226,6 +226,19 @@ void test_distance_multipoint_multilinestring(Strategy const& strategy)
tester::apply("multipoint(0 0,1 0,0 1,1 1)",
"multilinestring((4 4,5 5),(),(3 3))",
sqrt(8.0), 8, strategy);
// 21890717 - assertion failure in distance(Pt, Box)
{
multi_point_type mpt;
bg::read_wkt("multipoint(1 1,1 1,1 1,1 1,1 1,1 1,1 1,1 1,1 1)", mpt);
multi_linestring_type mls;
linestring_type ls;
point_type pt(std::numeric_limits<double>::quiet_NaN(), 1.0);
ls.push_back(pt);
ls.push_back(pt);
mls.push_back(ls);
bg::distance(mpt, mls);
}
}
//===========================================================================

View File

@@ -713,6 +713,67 @@ inline void test_open_polygons()
0.7808688094430304 -0.6246950475544243,\
0.7808688094430304 -0.6246950475544243))",
AllowDuplicates);
// MySQL report on Sep 30, 2015
test::apply
("pg077",
"POLYGON((72.8714768817168 -167.0048853643874,9274.40641550926 3433.5957427942167,-58.09039811390054 187.50989457746405,-81.09039811390053 179.50989457746405,-207.99999999999997 135.36742435621204,-208 1,-208 0,-208 -276.9111154485375,49.8714768817168 -176.0048853643874))",
true);
test::apply("pg077-simplified",
"POLYGON((-200 0,-207.99999999999997 135.36742435621204,-208 1,-208 0,-208 -276.9111154485375))",
true);
test::apply
("pg078",
"POLYGON((0 10,-10 0,0 0,10 0))",
true);
test::apply
("pg078spike1",
"POLYGON((0 10,-10 0,0 0,-10 0,10 0))",
false);
test::apply
("pg078spike2",
"POLYGON((0 10,-10 0,0 0,-8 0,10 0))",
false);
test::apply
("pg078spike3",
"POLYGON((0 10,-10 0,0 0,-11 0,10 0))",
false);
test::apply
("pg078reversed",
"POLYGON((0 10,10 0,0 0,-10 0))",
false);
test::apply
("pg079",
"POLYGON((10 0,0 10,0 0,0 -10))",
true);
test::apply
("pg079spike1",
"POLYGON((10 0,0 10,0 0,0 10,0 -10))",
false);
test::apply
("pg079spike2",
"POLYGON((10 0,0 10,0 0,0 8,0 -10))",
false);
test::apply
("pg079spike3",
"POLYGON((10 0,0 10,0 0,0 11,0 -10))",
false);
test::apply
("pg079reversed",
"POLYGON((10 0,0 -10,0 0,0 10))",
false);
}
template <typename Point>

View File

@@ -15,11 +15,11 @@
#include <boost/geometry/geometries/point_xy.hpp>
template <typename Geometry>
void test_geometry(std::string const& wkt, int expected)
void test_geometry(std::string const& wkt, std::size_t expected)
{
Geometry geometry;
bg::read_wkt(wkt, geometry);
int detected = bg::num_geometries(geometry);
std::size_t detected = bg::num_geometries(geometry);
BOOST_CHECK_MESSAGE(detected == expected,
"num_geometries: " << wkt
<< " -> Expected: " << expected

View File

@@ -15,11 +15,11 @@
#include <boost/geometry/geometries/point_xy.hpp>
template <typename Geometry>
void test_geometry(std::string const& wkt, int expected)
void test_geometry(std::string const& wkt, std::size_t expected)
{
Geometry geometry;
bg::read_wkt(wkt, geometry);
int detected = bg::num_interior_rings(geometry);
std::size_t detected = bg::num_interior_rings(geometry);
BOOST_CHECK_MESSAGE(detected == expected,
"num_interior_rings: " << wkt
<< " -> Expected: " << expected

View File

@@ -21,9 +21,9 @@
template <typename Geometry>
void check_geometry(Geometry const& geometry, std::string const& wkt, int expected)
void check_geometry(Geometry const& geometry, std::string const& wkt, std::size_t expected)
{
int detected = bg::num_points(geometry);
std::size_t detected = bg::num_points(geometry);
BOOST_CHECK_MESSAGE(detected == expected,
"num_points: " << wkt
<< " -> Expected: " << expected

View File

@@ -44,7 +44,7 @@
// To test that "get_turns" can be called using additional information
template <typename Point, typename SegmentRatio>
struct my_turn_op : public bg::detail::overlay::turn_operation<SegmentRatio>
struct my_turn_op : public bg::detail::overlay::turn_operation<Point, SegmentRatio>
{
};

View File

@@ -285,6 +285,10 @@ void test_all()
"LINESTRING(2 8,4 0.4,8 1,0 5)",
expected("iuu++")("mui=+")("tiu+="));
#if ! ( defined(BOOST_CLANG) && defined(BOOST_GEOMETRY_COMPILER_MODE_RELEASE) )
// In clang/release mode this testcase gives other results
// assertion failure in 1.57
// FAILING - no assertion failure but the result is not very good
test_geometry<ls, ls>("LINESTRING(-2305843009213693956 4611686018427387906, -33 -92, 78 83)",
@@ -293,6 +297,9 @@ void test_all()
test_geometry<ls, ls>("LINESTRING(31 -97, -46 57, -20 -4)",
"LINESTRING(-2305843009213693956 4611686018427387906, -33 -92, 78 83)",
expected("")(""));
#endif
}
// In 1.57 the results of those combinations was different for MinGW
@@ -511,6 +518,18 @@ void test_all()
test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0))",
"MULTILINESTRING((2 0,0 0,-1 -1))",
expected("tiu+=")("mui=+"));
// parts of boundaries taken from union A/A buffer_mp1
if ( BOOST_GEOMETRY_CONDITION((boost::is_same<T, double>::value)) )
{
test_geometry<ls, ls>("LINESTRING(6.95629520146761 5.415823381635526,6.989043790736545 5.209056926535316,7 5,6.989043790736547 4.790943073464693,6.956295201467611 4.584176618364482)",
"LINESTRING(7.415823381635519 5.043704798532389,7.209056926535308 5.010956209263453,7.000000000000001 5,6.790943073464693 5.010956209263453,6.584176618364483 5.043704798532389)",
expected("tuu++"));
// the above should give the same result as this:
test_geometry<ls, ls>("LINESTRING(6.95629520146761 5.415823381635526,6.989043790736545 5.209056926535316,7 5,6.989043790736547 4.790943073464693,6.956295201467611 4.584176618364482)",
"LINESTRING(7.415823381635519 5.043704798532389,7.209056926535308 5.010956209263453,7 5,6.790943073464693 5.010956209263453,6.584176618364483 5.043704798532389)",
expected("tuu++"));
}
}
int test_main(int, char* [])

View File

@@ -380,6 +380,13 @@ static std::string case_recursive_boxes_4[2] =
"MULTIPOLYGON(((1 0,2 1,2 0,1 0)),((7 9,7 10,8 10,7 9)),((1 0,0 0,0 3,1 3,2 2,2 3,1 3,1 4,2 4,2 5,1 4,0 4,0 8,1 7,1 6,2 7,1 7,1 9,0 9,0 10,7 10,6 9,6.5 8.5,7 9,8 9,9 8,8 8,9 7,9 6,10 7,10 5,9 5,9 4,10 5,10 0,7 0,8 1,7 1,6 0,3 0,3 1,1 1,1 0),(5 1,5.5 0.5,6 1,6 2,6.5 1.5,7 2,8 2,8 4,7 3,6 3,6 2,5 2,6 1,5 1),(4 4,5 4,5 5,4 4),(4 6,4 7,3 7,2 6,3 6,3 7,4 6),(6 5,6.5 4.5,7 5,6 5,7 6,7 7,6 7,6 5),(3.5 7.5,4 8,4 9,3 8,3.5 7.5)),((9 8,9 9,8 9,9 10,10 10,10 8,9 8)))"
};
static std::string case_recursive_boxes_5[2] =
{
// Occurs after refactoring uu / handle_touch (not yet integrated)
"MULTIPOLYGON(((0 9,0 10,1 10,1 9,0 9)),((9 0,9 1,10 1,10 0,9 0)),((5 6,5 7,6 7,6 6,7 6,7 4,6 4,6 5,5 5,5 6)),((5 3,7 3,7 2,4 2,4 3,5 3)),((5 8,5 9,7 9,7 8,5 8)),((4 0,1 0,1 1,5 1,5 0,4 0)),((3 5,3 4,4 4,4 3,2 3,2 2,1 2,1 3,0 3,0 4,2 4,2 5,1 5,1 6,4 6,4 5,3 5)),((0 2,1 2,1 1,0 1,0 2)),((4 10,4 7,1 7,1 6,0 6,0 8,1 8,1 9,2 9,2 10,4 10)),((9 4,9 3,8 3,8 5,9 5,9 4)),((7 2,8 2,8 0,7 0,7 2)),((8 7,10 7,10 6,7 6,7 8,8 8,8 7)))",
"MULTIPOLYGON(((2 3,2 4,3 4,3 3,2 3)),((1 5,1 6,2 6,2 5,1 5)),((2 1,2 2,3 2,3 1,2 1)),((8 1,9 1,9 0,8 0,8 1)),((9 7,10 7,10 6,9 6,9 7)),((1 4,1 3,0 3,0 5,1 5,1 4)),((7 6,7 7,8 7,8 6,7 6)),((7 1,7 2,8 2,8 1,7 1)),((6 2,6 3,7 3,7 2,6 2)),((6 8,6 9,7 9,7 8,6 8)),((5 0,3 0,3 1,4 1,4 2,6 2,6 1,7 1,7 0,5 0)),((5 5,5 6,6 6,6 5,8 5,8 6,9 6,9 4,8 4,8 3,7 3,7 4,6 4,6 3,5 3,5 4,3 4,3 6,2 6,2 8,3 8,3 7,5 7,5 6,4 6,4 5,5 5)),((1 1,2 1,2 0,1 0,1 1)),((1 3,2 3,2 2,1 2,1 3)),((3 10,4 10,4 9,2 9,2 8,0 8,0 10,3 10)),((10 3,10 1,9 1,9 2,8 2,8 3,9 3,9 4,10 4,10 3)),((9 9,10 9,10 8,9 8,9 7,8 7,8 10,9 10,9 9)))"
};
static std::string pie_21_7_21_0_3[2] =
{
"MULTIPOLYGON(((2500 2500,2500 3875,2855 3828,3187 3690,3472 3472,3690 3187,3828 2855,3875 2500,3828 2144,3690 1812,3472 1527,3187 1309,2855 1171,2499 1125,2144 1171,1812 1309,1527 1527,1309 1812,1171 2144,1125 2499,1171 2855,1309 3187,2500 2500)))",

View File

@@ -44,7 +44,7 @@
template <typename Geometry>
static void test_self_intersection_points(std::string const& case_id,
int expected_count,
std::size_t expected_count,
Geometry const& geometry,
bool check_has_intersections,
double /*precision*/ = 0.001)
@@ -84,7 +84,7 @@ static void test_self_intersection_points(std::string const& case_id,
x += bg::get<0>(turn.point);
y += bg::get<1>(turn.point);
}
int n = boost::size(turns);
std::size_t n = boost::size(turns);
if (n > 0)
{
x /= n;

View File

@@ -1,7 +1,12 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2015.
// Modifications copyright (c) 2015 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
@@ -145,6 +150,7 @@ int test_main( int , char* [] )
#if defined(HAVE_TTMATH)
test_all<bg::model::d2::point_xy<ttmath_big> >();
test_eps<bg::model::d2::point_xy<ttmath_big> >();
//test_spherical<bg::model::point<ttmath_big, 2, bg::cs::spherical_equatorial<bg::degree> > >();
#endif

View File

@@ -111,9 +111,11 @@ void test_3d()
}
int test_main(int, char* [])
{
test_all<bg::model::d2::point_xy<float> >();
test_all<bg::model::d2::point_xy<double> >();
#ifdef HAVE_TTMATH
@@ -121,7 +123,6 @@ int test_main(int, char* [])
#endif
test_3d<bg::model::point<double, 3, bg::cs::cartesian> >();
return 0;
}

View File

@@ -80,6 +80,30 @@ void test_additional()
"LINESTRING(1 2)",
"BOX(0 0,3 5)",
true);
// http://stackoverflow.com/questions/32457920/boost-rtree-of-box-gives-wrong-intersection-with-segment
// http://lists.boost.org/geometry/2015/09/3476.php
// For now disabled by default even though it works properly on MSVC14
// it's probable that the result depends on the compiler
#ifdef BOOST_GEOMETRY_ENABLE_FAILING_TESTS
test_geometry<bg::model::segment<P>, bg::model::box<P> >(
"SEGMENT(12 0,20 10)",
"BOX(0 0,10 10)",
false);
test_geometry<bg::model::segment<P>, bg::model::box<P> >(
"SEGMENT(2 0,8 6)",
"BOX(0 0,10 10)",
true);
test_geometry<bg::model::segment<P>, bg::model::box<P> >(
"SEGMENT(2 0,18 8)",
"BOX(0 0,10 10)",
true);
typedef bg::model::point<typename bg::coordinate_type<P>::type, 3, bg::cs::cartesian> point3d_t;
test_geometry<bg::model::segment<point3d_t>, bg::model::box<point3d_t> >(
"SEGMENT(2 1 0,2 1 10)",
"BOX(0 0 0,10 0 10)",
false);
#endif
}

View File

@@ -0,0 +1,130 @@
// Boost.Geometry
// Copyright (c) 2015 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <geometry_test_common.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/range/value_type.hpp>
#include <boost/type_traits/is_same.hpp>
template <typename Container>
struct pusher
: public Container
{
typedef typename Container::value_type value_type;
pusher(value_type const& val)
{
this->push_back(val);
}
pusher & operator()(value_type const& val)
{
this->push_back(val);
return *this;
}
};
template <typename Geometry,
typename Tag = typename bg::tag<Geometry>::type,
typename Coord = typename bg::coordinate_type<Geometry>::type>
struct nan_case_generator
{
static void apply(Geometry & , std::string & )
{}
};
template <typename Geometry>
struct nan_case_generator<Geometry, bg::multi_linestring_tag, double>
{
static void apply(Geometry & geometry, std::string & wkt)
{
typedef typename boost::range_value<Geometry>::type ls;
typedef typename bg::point_type<Geometry>::type P;
typedef typename bg::coordinate_type<Geometry>::type coord_t;
coord_t nan = std::numeric_limits<coord_t>::quiet_NaN();
wkt = "MULTILINESTRING((3.1e+307 1,-nan -nan),(3.1e+307 1,-nan -nan),(3.1e+307 1,5.1e+307 6e+307,nan nan),(-nan -nan,nan nan),(-nan -nan,-1 -3.97843,-1 3.28571,-1 47.6364),(3 78.5455,3 2),(nan nan,3 12.9689),(3 -2,-nan -nan),(3 2,3 12.9689,3 78.5455),(-1 4.29497e+09,-1 7,-nan -nan),(9 5,-nan -nan),(-nan -nan,9 60.8755,9 124.909),(nan nan,1 6.87195e+10,-nan -nan),(nan nan,4 86.2727,4 20.9533),(4 -5,-nan -nan),(4 -5,-nan -nan),(4 -5,-nan -nan),(4 -5,1.1e+308 2.1e+307,nan nan),(-nan -nan,-1 -8),(-nan -nan,-9 -4))";
typedef pusher<Geometry> ml;
typedef pusher<ls> l;
geometry = ml(l(P(3.1e+307, 1))(P(-nan, -nan)))
(l(P(3.1e+307, 1))(P(-nan, -nan)))
(l(P(3.1e+307, 1))(P(5.1e+307, 6e+307))(P(nan, nan)))
(l(P(-nan, -nan))(P(nan, nan)))
(l(P(-nan, -nan))(P(-1, -3.97843))(P(-1, 3.28571))(P(-1, 47.6364)))
(l(P(3, 78.5455))(P(3, 2)))
(l(P(nan, nan))(P(3, 12.9689)))
(l(P(3, -2))(P(-nan, -nan)))
(l(P(3, 2))(P(3, 12.9689))(P(3, 78.5455)))
(l(P(-1, 4.29497e+09))(P(-1, 7))(P(-nan, -nan)))
(l(P(9, 5))(P(-nan, -nan)))
(l(P(-nan, -nan))(P(9, 60.8755))(P(9, 124.909)))
(l(P(nan, nan))(P(1, 6.87195e+10))(P(-nan, -nan)))
(l(P(nan, nan))(P(4, 86.2727))(P(4, 20.9533)))
(l(P(4, -5))(P(-nan, -nan)))
(l(P(4, -5))(P(-nan, -nan)))
(l(P(4, -5))(P(-nan, -nan)))
(l(P(4, -5))(P(1.1e+308, 2.1e+307))(P(nan, nan)))
(l(P(-nan, -nan))(P(-1, -8)))
(l(P(-nan, -nan))(P(-9, -4)));
}
};
template <typename Geometry>
struct nan_case_generator<Geometry, bg::multi_point_tag, double>
{
static void apply(Geometry & geometry, std::string & wkt)
{
typedef typename bg::point_type<Geometry>::type P;
typedef typename bg::coordinate_type<Geometry>::type coord_t;
coord_t nan = std::numeric_limits<coord_t>::quiet_NaN();
wkt = "MULTIPOINT((3.1e+307 1),(-nan -nan),(3.1e+307 1),(-nan -nan),(3.1e+307 1),(5.1e+307 6e+307),(nan nan),(-nan -nan),(nan nan),(-nan -nan),(-1 -3.97843),(-1 3.28571),(-1 47.6364),(3 78.5455),(3 2),(nan nan),(3 12.9689),(3 -2),(-nan -nan),(3 2),(3 12.9689),(3 78.5455),(-1 4.29497e+09),(-1 7),(-nan -nan),(9 5),(-nan -nan),(-nan -nan),(9 60.8755),(9 124.909),(nan nan),(1 6.87195e+10),(-nan -nan),(nan nan),(4 86.2727),(4 20.9533),(4 -5),(-nan -nan),(4 -5),(-nan -nan),(4 -5),(-nan -nan),(4 -5),(1.1e+308 2.1e+307),(nan nan),(-nan -nan),(-1 -8),(-nan -nan),(-9 -4))";
typedef pusher<Geometry> mp;
geometry = mp(P(3.1e+307, 1))(P(-nan, -nan))
(P(3.1e+307, 1))(P(-nan, -nan))
(P(3.1e+307, 1))(P(5.1e+307, 6e+307))(P(nan, nan))
(P(-nan, -nan))(P(nan, nan))
(P(-nan, -nan))(P(-1, -3.97843))(P(-1, 3.28571))(P(-1, 47.6364))
(P(3, 78.5455))(P(3, 2))
(P(nan, nan))(P(3, 12.9689))
(P(3, -2))(P(-nan, -nan))
(P(3, 2))(P(3, 12.9689))(P(3, 78.5455))
(P(-1, 4.29497e+09))(P(-1, 7))(P(-nan, -nan))
(P(9, 5))(P(-nan, -nan))
(P(-nan, -nan))(P(9, 60.8755))(P(9, 124.909))
(P(nan, nan))(P(1, 6.87195e+10))(P(-nan, -nan))
(P(nan, nan))(P(4, 86.2727))(P(4, 20.9533))
(P(4, -5))(P(-nan, -nan))
(P(4, -5))(P(-nan, -nan))
(P(4, -5))(P(-nan, -nan))
(P(4, -5))(P(1.1e+308, 2.1e+307))(P(nan, nan))
(P(-nan, -nan))(P(-1, -8))
(P(-nan, -nan))(P(-9, -4));
}
};
template <typename Geometry>
void nan_case(Geometry & geometry, std::string & wkt)
{
nan_case_generator<Geometry>::apply(geometry, wkt);
}
template <typename Geometry>
struct is_nan_case_supported
{
typedef typename bg::coordinate_type<Geometry>::type coord_t;
static const bool value = boost::is_same<coord_t, double>::value
&& std::numeric_limits<coord_t>::has_quiet_NaN;
};

View File

@@ -44,6 +44,14 @@ void test_aa()
test_geometry<mpoly, poly>("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((0 0,0 -10,-10 -10,-10 0,0 0)))",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
false);
// mysql 21872795
test_geometry<poly, poly>("POLYGON((2 2,2 8,8 8,8 2,2 2))",
"POLYGON((0 0,0 10,10 10,10 0,0 0),(8 8,4 6,4 4,8 8))",
true);
test_geometry<poly, poly>("POLYGON((2 2,2 8,8 8,8 2,2 2))",
"POLYGON((0 0,0 10,10 10,10 0,0 0),(2 2,4 4,4 6,2 2))",
true);
}
template <typename P>

View File

@@ -43,6 +43,7 @@ void test_3d()
test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1 1, 3 3 3)", "BOX(4 4 4,6 6 6)", false);
}
template <typename P>
void test_2d()
{

View File

@@ -2,6 +2,12 @@
// Unit Test
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2015.
// Modifications copyright (c) 2015 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)
@@ -22,15 +28,12 @@
template <typename Geometry1, typename Geometry2>
void test_geometry(std::string const& wkt1,
std::string const& wkt2, bool expected)
void test_geometry(Geometry1 const& geometry1,
Geometry2 const& geometry2,
std::string const& wkt1,
std::string const& wkt2,
bool expected)
{
Geometry1 geometry1;
Geometry2 geometry2;
bg::read_wkt(wkt1, geometry1);
bg::read_wkt(wkt2, geometry2);
bool detected = bg::overlaps(geometry1, geometry2);
BOOST_CHECK_MESSAGE(detected == expected,
@@ -48,5 +51,19 @@ void test_geometry(std::string const& wkt1,
<< " detected: " << detected);
}
template <typename Geometry1, typename Geometry2>
void test_geometry(std::string const& wkt1,
std::string const& wkt2,
bool expected)
{
Geometry1 geometry1;
Geometry2 geometry2;
bg::read_wkt(wkt1, geometry1);
bg::read_wkt(wkt2, geometry2);
test_geometry(geometry1, geometry2, wkt1, wkt2, expected);
}
#endif

View File

@@ -343,6 +343,25 @@ void test_polygon_polygon()
"POLYGON((1 1,1 2,2 2,2 1,1 1))",
"****F****");*/
}
// mysql 21872795 (overlaps)
test_geometry<poly, poly>("POLYGON((2 2,2 8,8 8,8 2,2 2))",
"POLYGON((0 0,0 10,10 10,10 0,0 0),(8 8,4 6,4 4,8 8))",
"21210F212");
test_geometry<poly, poly>("POLYGON((2 2,2 8,8 8,8 2,2 2))",
"POLYGON((0 0,0 10,10 10,10 0,0 0),(2 2,4 4,4 6,2 2))",
"21210F212");
// mysql 21873343 (touches)
test_geometry<poly, poly>("POLYGON((0 0,0 10,10 10,10 0,0 0), (0 8, 8 5, 8 8, 0 8))",
"POLYGON((0 8,-8 5,-8 8,0 8))",
"FF2F01212");
test_geometry<poly, poly>("POLYGON((0 0,0 10,10 10,10 0,0 0), (0 6, 6 3, 6 6, 0 6))",
"POLYGON((0 6,-6 3,-6 6,0 6))",
"FF2F01212");
// similar but touching from the inside of the hole
test_geometry<poly, poly>("POLYGON((0 0,0 10,10 10,10 0,0 0), (0 8, 8 5, 8 8, 0 8))",
"POLYGON((0 8,7 7, 7 6,0 8))",
"FF2F01212");
}
template <typename P>

View File

@@ -12,6 +12,7 @@
// http://www.boost.org/LICENSE_1_0.txt)
#include "test_relate.hpp"
#include "../nan_cases.hpp"
//TEST
//#include <to_svg.hpp>
@@ -381,6 +382,7 @@ void test_multi_linestring_polygon()
typedef bg::model::linestring<P> ls;
typedef bg::model::multi_linestring<ls> mls;
typedef bg::model::polygon<P> poly;
typedef typename bg::coordinate_type<P>::type coord_t;
test_geometry<mls, poly>("MULTILINESTRING((11 11, 20 20),(5 7, 4 1))",
"POLYGON((0 0,0 10,10 10,10 0,0 0),(2 2,4 2,4 4,2 4,2 2))",
@@ -390,7 +392,7 @@ void test_multi_linestring_polygon()
"1F10F0212");
if ( BOOST_GEOMETRY_CONDITION((
boost::is_same<typename bg::coordinate_type<P>::type, double>::value )) )
boost::is_same<coord_t, double>::value )) )
{
// assertion failure in 1.57
test_geometry<mls, poly>("MULTILINESTRING((-0.59322033898305082 -8.0508474576271194,-2.882352941176471 -7.7647058823529411,-2.8823529411764706 -7.7647058823529411,-3.7361111111111112 -6.5694444444444446,-3.4404145077720205 -5.766839378238342,-4.1864406779661012 -3.6779661016949152,-7.5252525252525251 -5.5858585858585865,-7.5862068965517242 -5.1896551724137936,-4.47887323943662 -2.859154929577465,-4.5789473684210531 -2.5789473684210527,-3 -1,-2.9310344827586206 -0.86206896551724144,-3.1764705882352944 -0.70588235294117663,-4.7401960784313726 -2.1274509803921577,-5.3255813953488369 -0.48837209302325502,-4.7872340425531918 0.31914893617021284,-5.8571428571428577 1.0000000000000007,-5.3255813953488369 -0.48837209302325502,-5.9473684210526319 -1.4210526315789465,-8 2,-7.7333333333333334 2.1939393939393939,-8.8294573643410867 2.891472868217055,-8.8556701030927822 3.061855670103093,-7.5999999999999996 3.6000000000000001,-7.7999999999999998 3.7999999999999998,-7.75 3.7916666666666665,-7.5471698113207548 3.6226415094339623,-7.3200000000000003 3.7200000000000002,-3.473684210526315 3.0789473684210527,-3.2549019607843133 3.2156862745098036,-2.9999999999999982 3.1428571428571423,-3.1733333333333325 3.2666666666666666,-2.9180327868852456 3.4262295081967209,-2.8723404255319145 3.1063829787234041,-2.1111111111111112 2.8888888888888888,-2.1428571428571428 2.8571428571428572,-1.8433734939759043 2.8072289156626509,-1.8396226415094346 2.8113207547169816,-1.6486486486486487 2.756756756756757,-1.76510067114094 2.8926174496644301,-0.53846153846153855 4.2307692307692308,1.8148148148148147 5.4074074074074074,1.588235294117647 2.2352941176470589,1.819672131147541 2.1967213114754101,2 4,2 2.1666666666666665,2.3538461538461544 2.1076923076923078,2 1.6875000000000004,2 -2,1.2173913043478262 -3.8260869565217392,1.7375886524822697 1.3758865248226959,1.5073170731707317 1.1024390243902444,1.1428571428571428 -4,-0.59322033898305082 -8.0508474576271194),(1.666666666666667 1.5999999999999988,1.5675675675675675 1.8378378378378377,1.4374999999999991 1.8750000000000002,1.0487804878048776 2.3414634146341466,0.46666666666666712 2.6060606060606055,0.086956521739131043 2.2608695652173911,1.4374999999999991 1.8750000000000002,1.666666666666667 1.5999999999999988))",
@@ -422,6 +424,21 @@ void test_multi_linestring_polygon()
test_geometry<mls, poly>("MULTILINESTRING((3 10, 1 5, 1 10, 3 4, 7 8, 6 10, 10 2))",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
"10FF0F212");
// mysql bug
// assertion failure in relate->boundary_checker->std::equal_range with msvc
if (BOOST_GEOMETRY_CONDITION(is_nan_case_supported<mls>::value))
{
mls g1;
std::string wkt1;
nan_case(g1, wkt1);
std::string wkt2 = "POLYGON((1.1e+308 1.2e+308,-1 -9,1 1e+12,1.1e+308 7.8e+307,1.1e+308 1.2e+308),(3 2,1 1,8e+307 1e+308,3 2),(258 2049,1 -3,1 1,-6 9,258 2049))";
poly g2;
bg::read_wkt(wkt2, g2);
check_geometry(g1, g2, wkt1, wkt2, "*********");
}
}
template <typename P>

View File

@@ -12,6 +12,7 @@
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
#include "test_relate.hpp"
#include "../nan_cases.hpp"
//TEST
//#include <to_svg.hpp>
@@ -47,6 +48,16 @@ void test_multipoint_multipoint()
//typedef bg::model::d2::point_xy<float> ptf;
//typedef bg::model::multi_point<ptf> mptf;
//test_geometry<mptf, mpt>("MULTIPOINT(0 0)", "MULTIPOINT(0 0)", "0FFFFFFF2");
// assertion failure in relate->boundary_checker->std::equal_range with msvc
if (BOOST_GEOMETRY_CONDITION(is_nan_case_supported<mpt>::value))
{
mpt g;
std::string wkt;
nan_case(g, wkt);
check_geometry(g, g, wkt, wkt, "*********");
}
}
template <typename P>
@@ -78,6 +89,27 @@ void test_point_multilinestring()
test_geometry<P, mls>("POINT(0 0)", "MULTILINESTRING((0 0,5 0),(0 0,0 5,5 0),(0 0,-5 0),(0 0,0 -5,-5 0))", "0FFFFF1F2");
test_geometry<P, mls>("POINT(5 0)", "MULTILINESTRING((0 0,5 0),(0 0,0 5,5 0),(0 0,-5 0),(0 0,0 -5,-5 0))", "0FFFFF1F2");
test_geometry<P, mls>("POINT(1 0)", "MULTILINESTRING((0 0,5 0),(0 0,0 5,5 0),(0 0,-5 0),(0 0,0 -5,-5 0))", "0FFFFF1F2");
// assertion failure in relate->boundary_checker->std::equal_range with msvc
if (BOOST_GEOMETRY_CONDITION(is_nan_case_supported<mls>::value))
{
// on the boundary
std::string wkt0 = "POINT(3.1e+307 1)";
P g0;
bg::read_wkt(wkt0, g0);
// disjoint
std::string wkt1 = "POINT(1.1e+308 1.2e+308)";
P g1;
bg::read_wkt(wkt1, g1);
mls g2;
std::string wkt2;
nan_case(g2, wkt2);
check_geometry(g0, g2, wkt0, wkt2, "*********");
check_geometry(g1, g2, wkt1, wkt2, "*********");
}
}
template <typename P>

View File

@@ -1,10 +1,12 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2013.
// Modifications copyright (c) 2013, Oracle and/or its affiliates.
// This file was modified by Oracle on 2013, 2015.
// Modifications copyright (c) 2013, 2015 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
@@ -43,8 +45,8 @@ void check_touches(Geometry1 const& geometry1,
detected = bg::touches(geometry2, geometry1);
BOOST_CHECK_MESSAGE(detected == expected,
"touches: " << wkt2
<< " with " << wkt1
"touches: " << wkt1
<< " with " << wkt2
<< " -> Expected: " << expected
<< " detected: " << detected);
}

View File

@@ -118,6 +118,20 @@ void test_all()
true
);
// mysql 21873343
test_touches<polygon, polygon>
(
"POLYGON((0 0,0 10,10 10,10 0,0 0), (0 8, 8 5, 8 8, 0 8))",
"POLYGON((0 8,-8 5,-8 8,0 8))",
true
);
test_touches<polygon, polygon>
(
"POLYGON((0 0,0 10,10 10,10 0,0 0), (0 6, 6 3, 6 6, 0 6))",
"POLYGON((0 6,-6 3,-6 6,0 6))",
true
);
// Point-Polygon
test_touches<P, ring>("POINT(40 50)", "POLYGON((40 40,40 60,60 60,60 40,40 40))", true);
test_touches<P, polygon>("POINT(40 50)", "POLYGON((40 40,40 60,60 60,60 40,40 40))", true);

View File

@@ -2,7 +2,7 @@
//
// Copyright (c) 2012-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2013, 2014. 2015.
// This file was modified by Oracle on 2013, 2014, 2015.
// Modifications copyright (c) 2013-2015, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -42,6 +42,7 @@ void test_box_3d()
true);
}
int test_main( int , char* [] )
{
test_all<bg::model::d2::point_xy<double> >();

View File

@@ -6,12 +6,12 @@
// This file was modified by Oracle on 2014, 2015.
// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
#include "test_within.hpp"

View File

@@ -7,6 +7,7 @@
// Modifications copyright (c) 2015, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -86,6 +87,81 @@ void test_areal_linear()
test_one_lp<LineString, LineString, Polygon>("case25", "LINESTRING(4 0,4 5,7 5)", poly_9, 2, 5, 5.0);
test_one_lp<LineString, LineString, Polygon>("case26", "LINESTRING(4 0,4 3,4 5,7 5)", poly_9, 2, 5, 5.0);
test_one_lp<LineString, LineString, Polygon>("case27", "LINESTRING(4 4,4 5,5 5)", poly_9, 1, 3, 2.0);
test_one_lp<LineString, LineString, Polygon>("case28",
"LINESTRING(-1.3 0,-15 0,-1.3 0)",
"POLYGON((2 3,-9 -7,12 -13,2 3))",
1, 3, 27.4);
test_one_lp<LineString, LineString, Polygon>("case29",
"LINESTRING(5 5,-10 5,5 5)",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
1, 3, 20);
test_one_lp<LineString, LineString, Polygon>("case29a",
"LINESTRING(1 1,5 5,-10 5,5 5,6 6)",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
1, 3, 20);
test_one_lp<LineString, LineString, Polygon>("case30",
"LINESTRING(-10 5,5 5,-10 5)",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
2, 4, 20);
test_one_lp<LineString, LineString, Polygon>("case30a",
"LINESTRING(-20 10,-10 5,5 5,-10 5,-20 -10)",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
2, 6, 49.208096);
test_one_lp<LineString, LineString, Polygon>("case31",
"LINESTRING(0 5,5 5,0 5)",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
0, 0, 0);
test_one_lp<LineString, LineString, Polygon>("case31",
"LINESTRING(0 5,5 5,1 1,9 1,5 5,0 5)",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
0, 0, 0);
test_one_lp<LineString, LineString, Polygon>("case32",
"LINESTRING(5 5,0 5,5 5)",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
0, 0, 0);
test_one_lp<LineString, LineString, Polygon>("case32a",
"LINESTRING(-10 10,5 5,0 5,5 5,20 10)",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
2, 4, 21.081851);
test_one_lp<LineString, LineString, Polygon>("case33",
"LINESTRING(-5 5,0 5,-5 5)",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
1, 3, 10);
test_one_lp<LineString, LineString, Polygon>("case33a",
"LINESTRING(-10 10,-5 5,0 5,-5 5,-10 -10)",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
1, 5, 32.882456);
test_one_lp<LineString, LineString, Polygon>("case33b",
"LINESTRING(0 5,-5 5,0 5)",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
1, 3, 10);
test_one_lp<LineString, LineString, Polygon>("case34",
"LINESTRING(5 5,0 5,5 5,5 4,0 4,5 4)",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
0, 0, 0);
test_one_lp<LineString, LineString, Polygon>("case35",
"LINESTRING(5 5,0 5,5 5,5 4,0 4,5 3)",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
0, 0, 0);
test_one_lp<LineString, LineString, Polygon>("case36",
"LINESTRING(-1 -1,10 10)",
"POLYGON((5 5,15 15,15 5,5 5))",
1, 2, 6 * std::sqrt(2.0));
}
template <typename CoordinateType>
@@ -599,6 +675,21 @@ void test_all()
5, 22, 1.1901714,
5, 27, 1.6701714);
***/
#ifdef BOOST_GEOMETRY_TEST_ENABLE_FAILING
test_one<polygon, polygon, polygon>("ticket_11725_2",
"POLYGON((0 0,0 3,3 3,3 0,0 0))",
"POLYGON((3 1,1 1,1 2,2 2,3 1))",
2, -1, 7.5, 0, -1, 0.0);
test_one<polygon, polygon, polygon>("mysql_21977775",
"POLYGON((8 6,5 7,-1 4,-8 -7, 0 -17, 8 6), (3 6, 5 5, 0 -2, 3 6))",
"POLYGON((3 3,-17 11,-8 -3, 3 3))",
2, -1, 160.856568913, 2, -1, 92.3565689126);
test_one<polygon, polygon, polygon>("mysql_21965285",
"POLYGON((7 3,0 10,0 -6, 9 -5, 7 7, 7 3), (0 8, 2 3, 2 -2, 0 8))",
"POLYGON((0 6,0 8,-14 13,0 6))",
0, -1, 0.0, 0, -1, 0.0);
#endif
}
/*******

View File

@@ -553,7 +553,7 @@ BOOST_AUTO_TEST_CASE( test_difference_linestring_linestring )
from_wkt<L>("LINESTRING(0 -.2, 8 1)"),
from_wkt<ML>("MULTILINESTRING((4 .4,2 8))"),
"lldf31x",
4.0 * std::numeric_limits<double>::epsilon()
1e-10
);
tester::apply
@@ -561,7 +561,7 @@ BOOST_AUTO_TEST_CASE( test_difference_linestring_linestring )
from_wkt<L>("LINESTRING(0 -.2, 8 1)"),
from_wkt<ML>("MULTILINESTRING((2 8,4 .4))"),
"lldf31x-r",
4.0 * std::numeric_limits<double>::epsilon()
1e-10
);
tester::apply

View File

@@ -64,6 +64,7 @@ private:
<< ", difference L/L: " << bg::wkt(geometry1)
<< " " << bg::wkt(geometry2)
<< " -> Expected: " << bg::wkt(mls_diff)
<< std::setprecision(20)
<< " computed: " << bg::wkt(mls_output) );
set_operation_output("difference", case_id,

View File

@@ -9,6 +9,7 @@
// Modifications copyright (c) 2015, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@@ -323,14 +324,20 @@ void test_areal()
test_one<Polygon, Polygon, Polygon>("buffer_mp2", buffer_mp2[0], buffer_mp2[1],
1, 29, 0.457126);
#ifdef BOOST_GEOMETRY_TEST_ENABLE_FAILING
test_one<Polygon, Polygon, Polygon>("mysql_21964465",
"POLYGON((0 0,0 10,10 10,10 0, 0 0), (0 8, 4 4, 4 6, 0 8))",
"POLYGON((0 8,-8 8,-2 2,0 8))",
0, -1, 0.0);
#endif
return;
test_one<Polygon, Polygon, Polygon>(
"polygon_pseudo_line",
"Polygon((0 0,0 4,4 4,4 0,0 0))",
"Polygon((2 -2,2 -1,2 6,2 -2))",
5, 22, 1.1901714);
"polygon_pseudo_line",
"Polygon((0 0,0 4,4 4,4 0,0 0))",
"Polygon((2 -2,2 -1,2 6,2 -2))",
5, 22, 1.1901714);
}
template <typename Polygon, typename Box>
@@ -446,6 +453,86 @@ void test_areal_linear()
test_one_lp<LineString, Polygon, LineString>("case19", poly_9, "LINESTRING(1 2,1 3,0 3)", 1, 2, 1.0);
test_one_lp<LineString, Polygon, LineString>("case20", poly_9, "LINESTRING(1 2,1 3,2 3)", 1, 3, 2.0);
test_one_lp<LineString, Polygon, LineString>("case21",
"POLYGON((2 3,-9 -7,12 -13,2 3))",
"LINESTRING(-1.3 0,-15 0,-1.3 0)",
0, 0, 0);
test_one_lp<LineString, Polygon, LineString>("case22",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
"LINESTRING(5 5,-10 5,5 5)",
2, 4, 10);
test_one_lp<LineString, Polygon, LineString>("case22a",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
"LINESTRING(1 1,5 5,-10 5,5 5,6 6)",
2, 6, 17.071068);
test_one_lp<LineString, Polygon, LineString>("case23",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
"LINESTRING(-10 5,5 5,-10 5)",
1, 3, 10);
test_one_lp<LineString, Polygon, LineString>("case23a",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
"LINESTRING(-20 10,-10 5,5 5,-10 5,-20 -10)",
1, 3, 10);
test_one_lp<LineString, Polygon, LineString>("case24",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
"LINESTRING(0 5,5 5,0 5)",
1, 3, 10);
test_one_lp<LineString, Polygon, LineString>("case24",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
"LINESTRING(0 5,5 5,1 1,9 1,5 5,0 5)",
1, 6, 29.313708);
test_one_lp<LineString, Polygon, LineString>("case25",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
"LINESTRING(5 5,0 5,5 5)",
1, 3, 10);
test_one_lp<LineString, Polygon, LineString>("case25a",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
"LINESTRING(-10 10,5 5,0 5,5 5,20 10)",
1, 4, 20.540925);
test_one_lp<LineString, Polygon, LineString>("case25b",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
"LINESTRING(-10 10,5 5,1 5,5 5,20 10)",
1, 4, 18.540925);
test_one_lp<LineString, Polygon, LineString>("case25c",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
"LINESTRING(-10 10,5 5,-1 5,5 5,20 10)",
2, 6, 20.540925);
test_one_lp<LineString, Polygon, LineString>("case26",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
"LINESTRING(-5 5,0 5,-5 5)",
0, 0, 0);
test_one_lp<LineString, Polygon, LineString>("case26a",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
"LINESTRING(-10 10,-5 5,0 5,-5 5,-10 -10)",
0, 0, 0);
test_one_lp<LineString, Polygon, LineString>("case27",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
"LINESTRING(5 5,0 5,5 5,5 4,0 4,5 4)",
1, 6, 21.0);
test_one_lp<LineString, Polygon, LineString>("case28",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
"LINESTRING(5 5,0 5,5 5,5 4,0 4,5 3)",
1, 6, 21.099019);
test_one_lp<LineString, Polygon, LineString>("case29",
"POLYGON((5 5,15 15,15 5,5 5))",
"LINESTRING(0 0,10 10)",
1, 2, 5 * std::sqrt(2.0));
// PROPERTIES CHANGED BY switch_to_integer
// TODO test_one_lp<LineString, Polygon, LineString>("case21", poly_9, "LINESTRING(1 2,1 4,4 4,4 1,2 1,2 2)", 1, 6, 11.0);
@@ -681,6 +768,7 @@ void test_boxes_nd()
test_boxes_per_d(p3(0,0,0), p3(5,5,5), p3(3,3,3), p3(6,6,6), true);
}
template <typename CoordinateType>
void test_ticket_10868(std::string const& wkt_out)
{

View File

@@ -257,6 +257,9 @@ void test_one_lp(std::string const& caseid,
double percentage = 0.0001,
bool debug1 = false, bool debug2 = false)
{
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << caseid << " -- start" << std::endl;
#endif
Areal areal;
bg::read_wkt(wkt_areal, areal);
bg::correct(areal);
@@ -274,6 +277,9 @@ void test_one_lp(std::string const& caseid,
test_intersection<OutputType, void>(caseid + "_rev", areal, linear,
expected_count, expected_point_count,
expected_length, percentage, debug2);
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << caseid << " -- end" << std::endl;
#endif
}
template <typename Geometry1, typename Geometry2>

View File

@@ -7,6 +7,7 @@
// Modifications copyright (c) 2015 Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -51,6 +52,7 @@ void test_union(std::string const& caseid, G1 const& g1, G2 const& g2,
{
typedef typename bg::coordinate_type<G1>::type coordinate_type;
boost::ignore_unused<coordinate_type>();
boost::ignore_unused(expected_point_count);
std::vector<OutputType> clip;

View File

@@ -1,9 +1,9 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@@ -248,7 +248,7 @@ void test_areal()
1,
0,
-1,
313.36036462, 0.01);
313.36036462, 0.1);
// SQL Server gives: 313.360374193241
// PostGIS gives: 313.360364623393
@@ -319,10 +319,8 @@ void test_areal()
1, 0, if_typed<ct, double>(18, 23), 4.60853);
#endif
#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<Polygon, Polygon, Polygon>("buffer_rt_g", buffer_rt_g[0], buffer_rt_g[1],
1, 0, if_typed<ct, float>(18, 17), 16.571);
#endif
test_one<Polygon, Polygon, Polygon>("buffer_rt_g_rev", buffer_rt_g[1], buffer_rt_g[0],
1, 0, if_typed<ct, float>(18, 17), 16.571);
@@ -355,10 +353,8 @@ void test_areal()
test_one<Polygon, Polygon, Polygon>("buffer_rt_m2_rev", buffer_rt_m2[1], buffer_rt_m2[0],
1, 0, if_typed_tt<ct>(20, 19), 21.4853);
#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<Polygon, Polygon, Polygon>("buffer_rt_q", buffer_rt_q[0], buffer_rt_q[1],
1, 0, 18, 18.5710);
#endif
test_one<Polygon, Polygon, Polygon>("buffer_rt_q_rev", buffer_rt_q[1], buffer_rt_q[0],
1, 0, 18, 18.5710);
@@ -376,13 +372,30 @@ void test_areal()
1, 0, if_typed_tt<ct>(16, if_typed<ct, float>(15, 14)), 15.6569);
#endif
#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
test_one<Polygon, Polygon, Polygon>("buffer_mp1", buffer_mp1[0], buffer_mp1[1],
1, 0, if_typed_tt<ct>(93, 91), 22.815);
#endif
test_one<Polygon, Polygon, Polygon>("buffer_mp2", buffer_mp2[0], buffer_mp2[1],
1, 0, 217, 36.752837);
#ifdef BOOST_GEOMETRY_TEST_ENABLE_FAILING
test_one<Polygon, Polygon, Polygon>("ticket_11725",
"POLYGON((0 0, 0 1, 3 1, 3 0, 0 0))",
"POLYGON((0 1, 0 3, 3 3, 3 1, 2 2, 1 2 , 1 1, 0 1))",
1, 1, -1, 7.5);
test_one<Polygon, Polygon, Polygon>("mysql_21964079_1",
"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))",
2, 1, -1, 234.5);
test_one<Polygon, Polygon, Polygon>("mysql_21964079_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))",
2, 1, -1, 112.0);
test_one<Polygon, Polygon, Polygon>("mysql_21964049",
"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))",
1, 1, -1, 220.5);
#endif
}
template <typename P>

View File

@@ -113,6 +113,13 @@ void test_areal()
case_recursive_boxes_3[0], case_recursive_boxes_3[1],
17, 0, 159, 56.5); // Area from SQL Server
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_4",
case_recursive_boxes_4[0], case_recursive_boxes_4[1],
1, 1, 42, 96.75);
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_5",
case_recursive_boxes_5[0], case_recursive_boxes_5[1],
3, 2, 110, 70.0);
test_one<Polygon, MultiPolygon, MultiPolygon>("ggl_list_20120915_h2_a",
ggl_list_20120915_h2[0], ggl_list_20120915_h2[1],
1, 0, 12, 23.0); // Area from SQL Server