Merge branch 'develop' of github.com:boostorg/geometry into develop

This commit is contained in:
Adam Wulkiewicz
2015-02-05 14:43:21 +01:00
18 changed files with 686 additions and 275 deletions

View File

@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
// Copyright (c) 2014, Oracle and/or its affiliates.
// Copyright (c) 2014-2015, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
@@ -174,7 +174,22 @@ BOOST_AUTO_TEST_CASE( test_is_simple_linestring )
test_simple(from_wkt<G>("LINESTRING(0 0,3 0,5 0,4 0,2 0)"), false);
test_simple(from_wkt<G>("LINESTRING(0 0,3 0,2 0,5 0)"), false);
test_simple(from_wkt<G>("LINESTRING(0 0,2 0,2 2,1 0,0 0)"), false);
test_simple(from_wkt<G>("LINESTRING(0 0,1 0,2 0,2 2,1 0,0 0)"), false);
test_simple(from_wkt<G>("LINESTRING(0 0,10 0,10 10,0 10,0 0,0 0)"), false);
test_simple(from_wkt<G>("LINESTRING(0 0,0 10,5 10,0 0,10 10,10 5,10 0,0 0)"), false);
test_simple(from_wkt<G>("LINESTRING(0 0,0 0,10 0,10 10,0 10,0 0,0 0)"),
false);
test_simple(from_wkt<G>("LINESTRING(0 0,0 0,0 0,10 0,10 10,0 10,0 0,0 0,0 0,0 0)"),
false);
test_simple(from_wkt<G>("LINESTRING(0 0,0 0,10 0,10 10,10 10,10 10,10 10,10 10,0 10,0 0,0 0)"),
false);
test_simple(from_wkt<G>("LINESTRING(0 0,1 0,2 0,2 2,1 0)"), false);
test_simple(from_wkt<G>("LINESTRING(1 0,2 2,2 0,1 0,0 0)"), false);
test_simple(from_wkt<G>("LINESTRING(0 0,1 0,2 0,2 2,1 0,1 4,0 0)"), false);
test_simple(from_wkt<G>("LINESTRING(4 1,10 8,4 6,4 1,10 5,10 3)"),
false);
test_simple(from_wkt<G>("LINESTRING(10 3,10 5,4 1,4 6,10 8,4 1)"),
false);
}
BOOST_AUTO_TEST_CASE( test_is_simple_multilinestring )
@@ -249,7 +264,12 @@ BOOST_AUTO_TEST_CASE( test_is_simple_multilinestring )
false);
test_simple(from_wkt<G>("MULTILINESTRING((0 0,1 0,1 1,0 1,0 0),(-1 -1,-1 0,0 0,0 -1,-1 -1))"),
false);
test_simple(from_wkt<G>("MULTILINESTRING((0 0,0 10,5 10,0 0,10 10,10 5,10 0,0 0))"), false);
test_simple(from_wkt<G>("MULTILINESTRING((0 0,0 10,5 10,0 0,10 10,10 5,10 0,0 0))"),
false);
test_simple(from_wkt<G>("MULTILINESTRING((4 1,10 8,4 6,4 1,10 5,10 3))"),
false);
test_simple(from_wkt<G>("MULTILINESTRING((10 3,10 5,4 1,4 6,10 8,4 1))"),
false);
}
BOOST_AUTO_TEST_CASE( test_is_simple_areal )

View File

@@ -604,6 +604,52 @@ void test_open_polygons()
false);
test::apply(from_wkt<OG>("POLYGON((-10 -10,1 0,1 1,0 1),(-10 -10,-10 10,10 10,10 -10))"),
false);
test::apply
(from_wkt<OG>("POLYGON((-6 -10,-6.6923076923076925 -6.711538461538462,\
-9 -7,-8.824742268041238 -6.123711340206185,\
-10 -6,-8.583333333333332 -4.916666666666667,\
-8.094117647058823 -2.4705882352941173,-10 -3,\
-8.526315789473683 -0.05263157894736803,-10 1,\
-10 10,-7.764705882352941 8.509803921568627,\
-7.65090909090909 7.789090909090909,-10 10,\
-7.574468085106383 7.304964539007091,-7.4375 6.4375,\
-6.5 5.5,-6.4 6,-7.574468085106383 7.304964539007091,\
-7.65090909090909 7.789090909090909,\
-6.297029702970297 6.514851485148515,\
0 0,-6.297029702970297 6.514851485148515,\
-4.848484848484849 5.151515151515151,-4 6,\
-6.117647058823529 7.411764705882352,\
0 0,-6.11764705882353 7.411764705882353,\
-7.764705882352941 8.509803921568627,-8 10,\
-2.9473684210526314 7.052631578947368,-2 8,\
-0.17821782178217824 6.633663366336634,1 10,\
1.8095238095238098 5.142857142857142,\
3.2038834951456314 4.097087378640777,7 7,\
3.7142857142857144 3.7142857142857144,\
4.4 3.1999999999999997,8 2,\
6.540540540540541 1.5945945945945947,10 -1,\
7.454545454545455 -4.393939393939394,8 -5,\
7.320754716981132 -4.716981132075472,7 -6,\
6.062068965517241 -5.117241379310345,\
4.9504132231404965 -5.256198347107438,\
6.1506849315068495 -7.123287671232877,9 -8,\
6.548387096774194 -7.741935483870968,8 -10,\
5.906976744186046 -7.674418604651163,\
3.9107142857142856 -7.464285714285714,4 -8,\
2.8043478260869565 -7.3478260869565215,\
1.7829457364341086 -7.24031007751938,2 -8,\
1.0728476821192054 -7.1655629139072845,\
-4.3583617747440275 -6.593856655290103,-5 -9,\
-5.2020725388601035 -7.720207253886011,-6 -10),\
(5.127659574468085 -6.808510638297872,\
3.72972972972973 -6.378378378378379,\
3.571428571428571 -5.428571428571429,\
3.8539325842696632 -5.393258426966292,\
5.127659574468085 -6.808510638297872),\
(-5.5 4.5,-6.5 5.5,-6.4 6,\
-5.263157894736842 4.736842105263158,-5.5 4.5))"),
false);
}
template <typename Point>
@@ -718,6 +764,24 @@ void test_open_multipolygons()
// and the invalid case:
test::apply(from_wkt<OG>("MULTIPOLYGON(((0 0,100 0,100 100,0 100),(3 3,3 97,97 97,97 3)),((2 2,98 2,98 98,2 98),(1 1,1 99,99 99,99 1)))"),
false);
test::apply
(from_wkt<OG>("MULTIPOLYGON(((-1 4,8 -10,-10 10,7 -6,8 -2,\
-10 10,-10 1,-3 -4,4 1,-1 2,4 3,-8 10,-5 -9,-1 6,-5 0)),\
((-10 -3,-8 1,2 -8,-2 6,-4 0,8 -5,-1 5,8 2)),\
((-6 -10,1 10,4 -8,-7 -2,2 0,-4 3,-10 9)),\
((10 -1,-2 8,-7 3,-6 8,-9 -7,7 -5)),\
((7 7,-4 -4,9 -8,-10 -6)))"),
false);
test::apply
(from_wkt<OG>("MULTIPOLYGON(((-1 4,8 -10,-10 10,7 -6,8 -2,\
-10 10,-10 1,-3 -4,4 1,-1 2,4 3,-8 10,-5 -9,-1 6,-5 0)),\
((-10 -3,-8 1,2 -8,-2 6,-4 0,8 -5,-1 5,8 2)),\
((-6 -10,-10 9,-4 3,2 0,-7 -2,4 -8,1 10)),\
((10 -1,-2 8,-7 3,-6 8,-9 -7,7 -5)),\
((7 7,-10 -6,9 -8,-4 -4)))"),
false);
}
BOOST_AUTO_TEST_CASE( test_is_valid_multipolygon )

View File

@@ -21,7 +21,7 @@
#include <boost/geometry/geometries/geometries.hpp>
//TEST
//#include <to_svg.hpp>
#include <to_svg.hpp>
template <typename T>
void test_all()
@@ -256,6 +256,26 @@ void test_all()
"LINESTRING(2 0,0 0,-10 0)",
expected("tiu+=")("mui=+"));
// 03.02.2015
test_geometry<ls, ls>("LINESTRING(-7 -8,3 0,4 -1,-7 10)",
"LINESTRING(-5 -4,3 0,4 -1,7 -4,2 -1)",
expected("tii++")("txu==")("tiu==")("mui=+"));
test_geometry<ls, ls>("LINESTRING(-7 -8,3 0,4 -1,-7 10)",
"LINESTRING(-5 -4,3 0,7 -4,2 -1)",
expected("tii++")("mxu==")("miu==")("mui=+"));
if ( boost::is_same<T, double>::value )
{
// FAILING
/*test_geometry<ls, ls>("LINESTRING(8 5,5 1,-2 3,1 10)",
"LINESTRING(1.9375 1.875, 1.7441860465116283 1.9302325581395348, -0.7692307692307692 2.6483516483516487, -2 3, -1.0071942446043165 5.316546762589928)",
expected(""));
test_geometry<ls, ls>("LINESTRING(8 5,5 1,-2 3,1 10)",
"LINESTRING(1.9375 1.875, 1.7441860465116283 1.9302325581395348, -0.7692307692307692 2.6483516483516487, -2 3, -0.5 6.5)",
expected(""));*/
}
// TODO:
//test_geometry<ls, ls>("LINESTRING(0 0,2 0,1 0)", "LINESTRING(0 1,0 0,2 0)", "1FF00F102");
//test_geometry<ls, ls>("LINESTRING(2 0,0 0,1 0)", "LINESTRING(0 1,0 0,2 0)", "1FF00F102");

View File

@@ -416,6 +416,125 @@ BOOST_AUTO_TEST_CASE( test_difference_linestring_linestring )
from_wkt<ML>("MULTILINESTRING((1 1,2 1))"),
"lldf25"
);
tester::apply
(from_wkt<L>("LINESTRING(6 0,0 0,5 0)"),
from_wkt<L>("LINESTRING(2 0,-10 0)"),
from_wkt<ML>("MULTILINESTRING((6 0,2 0),(2 0,5 0))"),
"lldf27a"
);
tester::apply
(from_wkt<L>("LINESTRING(6 0,0 0,5 0)"),
from_wkt<L>("LINESTRING(2 0,-1 0,-10 0)"),
from_wkt<ML>("MULTILINESTRING((6 0,2 0),(2 0,5 0))"),
"lldf27b"
);
tester::apply
(from_wkt<L>("LINESTRING(6 0,0 0,5 0)"),
from_wkt<L>("LINESTRING(2 0,0 0,-10 0)"),
from_wkt<ML>("MULTILINESTRING((6 0,2 0),(2 0,5 0))"),
"lldf27c"
);
tester::apply
(from_wkt<L>("LINESTRING(2 0,0 0,-10 0)"),
from_wkt<L>("LINESTRING(6 0,0 0,5 0)"),
from_wkt<ML>("MULTILINESTRING((0 0,-10 0))"),
"lldf27d"
);
tester::apply
(from_wkt<L>("LINESTRING(-3 6,-3 0,-3 5)"),
from_wkt<L>("LINESTRING(-3 2,-3 0,-3 -10)"),
from_wkt<ML>("MULTILINESTRING((-3 6,-3 2),(-3 2,-3 5))"),
"lldf28a"
);
tester::apply
(from_wkt<L>("LINESTRING(-3 2,-3 0,-3 -10)"),
from_wkt<L>("LINESTRING(-3 6,-3 0,-3 5)"),
from_wkt<ML>("MULTILINESTRING((-3 0,-3 -10))"),
"lldf28b"
);
tester::apply
(from_wkt<L>("LINESTRING(-3 6,-3 0,-3 5)"),
from_wkt<L>("LINESTRING(-3 2,-3 0,-3 -10)"),
from_wkt<ML>("MULTILINESTRING((-3 6,-3 2),(-3 2,-3 5))"),
"lldf28c"
);
tester::apply
(from_wkt<L>("LINESTRING(-7 -8,3 0,4 -1)"),
from_wkt<L>("LINESTRING(-5 -4,3 0,4 -1,7 -4)"),
from_wkt<ML>("MULTILINESTRING((-7 -8,3 0))"),
"lldf29a"
);
tester::apply
(from_wkt<L>("LINESTRING(-7 -8,3 0,4 -1,-7 10)"),
from_wkt<L>("LINESTRING(-5 -4,3 0,4 -1,2 -1)"),
from_wkt<ML>("MULTILINESTRING((-7 -8,3 0),(3 0,-7 10))"),
"lldf29b"
);
tester::apply
(from_wkt<L>("LINESTRING(-7 -8,3 0,4 -1,-7 10)"),
from_wkt<L>("LINESTRING(-5 -4,3 0,4 -1,7 -4,2 -1)"),
from_wkt<ML>("MULTILINESTRING((-7 -8,3 0),(3 0,-7 10))"),
"lldf29c"
);
tester::apply
(from_wkt<L>("LINESTRING(-5 -4,3 0,4 -1,7 -4,2 -1)"),
from_wkt<L>("LINESTRING(-7 -8,3 0,4 -1,-7 10)"),
from_wkt<ML>("MULTILINESTRING((-5 -4,3 0),(4 -1,7 -4,2 -1))"),
"lldf29c-r"
);
tester::apply
(from_wkt<L>("LINESTRING(-2 -2,-4 0,1 -8,-2 6,8 5,-7 -8,\
3 0,4 -1,-7 10,-4 10)"),
from_wkt<L>("LINESTRING(-5 -4,3 0,4 -1,7 -4,2 -1,-4 -1,-2 6)"),
from_wkt<ML>("MULTILINESTRING((-2 -2,-4 0,1 -8,-2 6,8 5,-7 -8,\
3 0),(3 0,-7 10,-4 10))"),
"lldf29d"
);
#ifdef GEOMETRY_TEST_INCLUDE_FAILING_TESTS
tester::apply
(from_wkt<L>("LINESTRING(8 5,5 1,-2 3,1 10)"),
from_wkt<L>("LINESTRING(1.9375 1.875,\
1.7441860465116283 1.9302325581395348,\
-0.7692307692307692 2.6483516483516487,\
-2 3,-1.0071942446043165 5.316546762589928)"),
from_wkt<ML>("MULTILINESTRING()"),
"lldf30a"
);
tester::apply
(from_wkt<L>("LINESTRING(1.9375 1.875,\
1.7441860465116283 1.9302325581395348,\
-0.7692307692307692 2.6483516483516487,\
-2 3,-1.0071942446043165 5.316546762589928)"),
from_wkt<L>("LINESTRING(8 5,5 1,-2 3,1 10)"),
from_wkt<ML>("MULTILINESTRING()"),
"lldf30b"
);
tester::apply
(from_wkt<L>("LINESTRING(5 -8,-7 -6,-3 6,-3 1,-5 4,-1 0,8 5,\
5 1,-2 3,1 10,8 5,6 2,7 4)"),
from_wkt<L>("LINESTRING(1.9375 1.875,\
1.7441860465116283 1.9302325581395348,\
-0.7692307692307692 2.6483516483516487,\
-2 3,-1.0071942446043165 5.316546762589928)"),
from_wkt<ML>("MULTILINESTRING()"),
"lldf30c"
);
#endif
}
@@ -696,6 +815,31 @@ BOOST_AUTO_TEST_CASE( test_difference_multilinestring_linestring )
from_wkt<ML>("MULTILINESTRING((-1 0,-1 10),(0 0,1 0),(19 0,20 0),(25 0,30 0))"),
"mlldf05"
);
tester::apply
(from_wkt<ML>("MULTILINESTRING((-3 2,-3 0,-3 -10))"),
from_wkt<L>("LINESTRING(-3 6,-3 0,-3 5)"),
from_wkt<ML>("MULTILINESTRING((-3 0,-3 -10))"),
"mlldf06a"
);
tester::apply
(from_wkt<ML>("MULTILINESTRING((6 6,-3 2,-3 0,-3 -10,9 -2))"),
from_wkt<L>("LINESTRING(-3 6,-3 0,-3 5,2 -3,-6 10,5 0,2 8,\
-6 1,10 -6)"),
from_wkt<ML>("MULTILINESTRING((6 6,-3 2),(-3 0,-3 -10,9 -2))"),
"mlldf06b"
);
tester::apply
(from_wkt<ML>("MULTILINESTRING((0 -3,5 4,6 6,-3 2,-3 0,-3 -10,\
9 -2,9 5,5 -5,-4 -8,9 0))"),
from_wkt<L>("LINESTRING(-3 6,-3 0,-3 5,2 -3,-6 10,5 0,2 8,\
-6 1,10 -6)"),
from_wkt<ML>("MULTILINESTRING((0 -3,5 4,6 6,-3 2),\
(-3 0,-3 -10,9 -2,9 5,5 -5,-4 -8,9 0))"),
"mlldf06c"
);
}

View File

@@ -376,6 +376,17 @@ BOOST_AUTO_TEST_CASE( test_sym_difference_linestring_linestring )
(2 2,5 -1,15 2,18 0))"),
"llsdf21"
);
tester::apply
(from_wkt<L>("LINESTRING(0 -3,5 4,6 6,-3 2,-3 0,-3 -10,9 -2,\
9 5,5 -5,-4 -8,9 0)"),
from_wkt<L>("LINESTRING(-3 6,-3 0,-3 5,2 -3,-6 10,5 0,\
2 8,-6 1,10 -6)"),
from_wkt<ML>("MULTILINESTRING((0 -3,5 4,6 6,-3 2),\
(-3 0,-3 -10,9 -2,9 5,5 -5,-4 -8,9 0),(-3 6,-3 2),\
(-3 2,-3 5,2 -3,-6 10,5 0,2 8,-6 1,10 -6))"),
"llsdf22"
);
}
@@ -617,6 +628,30 @@ BOOST_AUTO_TEST_CASE( test_sym_difference_linestring_multilinestring )
(0 1,1 0),(19 0,20 1),(2 2,5 -1,15 2,25 0))"),
"lmlsdf18d"
);
#ifdef GEOMETRY_TEST_INCLUDE_FAILING_TESTS
tester::apply
(from_wkt<L>("LINESTRING(1 5,4 2,1 -1.1,1 6,1 189.7654,2 5,-0.7654 3)"),
from_wkt<ML>("MULTILINESTRING((2 5,-0.7654 2),\
(-1032.34324 4,1 5,9 7,3 9,0.2 5,1 -0.3),\
(1 0.9,1 6,1 -0.6,2.232432 -0.7654,0.9 3,1 5,\
-0.7654 9,3 0.1,9 0,-6 8,-0.7 8,0 1,-1032.34324 0))"),
/*
from_wkt<ML>("MULTILINESTRING((-0.7654 2,2 5),\
(1 -0.3,0.2 5,3 9,9 7,1 5,-1032.34 4),\
(-1032.34 0,0 1,-0.7 8,-6 8,9 0,3 0.1,\
-0.7654 9,1 5,0.9 3,2.23243 -0.7654,1 -0.6),\
(-0.7654 3,2 5,1 189.765,1 6),\
(1 -0.6,1 -1.1,4 2,1 5))"),
*/
from_wkt<ML>("MULTILINESTRING((1 5,4 2,1 -1.1,1 -0.6),\
(1 6,1 189.7654,2 5,-0.7654 3),(2 5,-0.7654 2),\
(-1032.34324 4,1 5,9 7,3 9,0.2 5,1 -0.3),\
(1 -0.6,2.232432 -0.7654,0.9 3,1 5,-0.7654 9,\
3 0.1,9 0,-6 8,-0.7 8,0 1,-1032.34324 0))"),
"lmlsdf19"
);
#endif
}
@@ -669,6 +704,25 @@ BOOST_AUTO_TEST_CASE( test_sym_difference_multilinestring_linestring )
(17 0,18 1,17 1,16 0),(4 0,3 1))"),
"mllsdf04"
);
tester::apply
(from_wkt<ML>("MULTILINESTRING((0 -3,5 4,6 6,-3 2,-3 0,\
-3 -10,9 -2,9 5,5 -5,-4 -8,9 0),\
(-7 9,-4 -9,-5 -10,5 3),\
(-8 -3,-6 6,-9 0,-4 -3,-1 -10),\
(0 1,7 -1,-2 3,-7 1),\
(-5 -9,-4 -10,7 -10,0 -6,1 6,2 -1,1 5,-5 -5))"),
from_wkt<L>("LINESTRING(-3 6,-3 0,-3 5,2 -3,-6 10,5 0,2 8,\
-6 1,10 -6)"),
from_wkt<ML>("MULTILINESTRING((0 -3,5 4,6 6,-3 2),\
(-3 0,-3 -10,9 -2,9 5,5 -5,-4 -8,9 0),\
(-7 9,-4 -9,-5 -10,5 3),\
(-8 -3,-6 6,-9 0,-4 -3,-1 -10),\
(0 1,7 -1,-2 3,-7 1),\
(-5 -9,-4 -10,7 -10,0 -6,1 6,2 -1,1 5,-5 -5),\
(-3 6,-3 2),(-3 2,-3 5,2 -3,-6 10,5 0,2 8,-6 1,10 -6))"),
"mllsdf05"
);
}

View File

@@ -14,6 +14,8 @@
#include <boost/geometry/algorithms/reverse.hpp>
#include <boost/geometry/algorithms/detail/signed_index_type.hpp>
#include <boost/geometry/algorithms/detail/relate/turns.hpp>
#include <boost/geometry/algorithms/detail/turns/compare_turns.hpp>
@@ -44,11 +46,10 @@ private:
typename Info,
typename Point1,
typename Point2,
typename IntersectionInfo,
typename DirInfo
typename IntersectionInfo
>
static inline void apply(Info& , Point1 const& , Point2 const& ,
IntersectionInfo const& , DirInfo const& )
IntersectionInfo const&)
{
}
};

View File

@@ -461,6 +461,19 @@ BOOST_AUTO_TEST_CASE( test_union_linestring_linestring )
(2 2,5 -1,15 2,18 0))"),
"llu21a"
);
tester::apply
(from_wkt<L>("LINESTRING(-2 -2,-4 0,1 -8,-2 6,8 5,-7 -8,3 0,\
4 -1,-7 10,-4 10)"),
from_wkt<L>("LINESTRING(-5 -4,3 0,4 -1,7 -4,2 -1,-4 -1,-2 6)"),
from_wkt<ML>("MULTILINESTRING((-2 -2,-4 0,1 -8,-2 6,8 5,-7 -8,3 0,\
4 -1,-7 10,-4 10),(-5 -4,3 0),\
(4 -1,7 -4,2 -1,-4 -1,-2 6))"),
from_wkt<ML>("MULTILINESTRING((-5 -4,3 0,4 -1,7 -4,2 -1,-4 -1,-2 6),\
(-2 -2,-4 0,1 -8,-2 6,8 5,-7 -8,3 0),\
(3 0,-7 10,-4 10))"),
"llu22"
);
}