[test][intersects][relate] Add tests for MultiLinestring/Polygon.

This commit is contained in:
Adam Wulkiewicz
2015-01-20 19:51:10 +01:00
parent d5431d8bde
commit 49ee2f7230
2 changed files with 39 additions and 3 deletions

View File

@@ -133,6 +133,32 @@ void test_intersects_point_segment()
test_geometry<P, seg>("POINT(1 0)", "LINESTRING(0 0,2 2)", false);
}
template <typename P>
void test_multi_linestring_polygon()
{
typedef bg::model::linestring<P> ls;
typedef bg::model::multi_linestring<ls> mls;
typedef bg::model::polygon<P> poly;
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))",
true);
test_geometry<mls, poly>("MULTILINESTRING((10 0, 18 12),(2 2,2 1))",
"POLYGON((5 0,0 -5,-5 0,0 5,5 0))",
true);
}
template <typename P>
void test_multi_polygon_polygon()
{
typedef bg::model::polygon<P> poly;
typedef bg::model::multi_polygon<poly> mpoly;
test_geometry<mpoly, poly>("MULTIPOLYGON(((11 11,11 20,20 20,20 11,11 11)),((5 5,5 6,6 6,6 5,5 5)))",
"POLYGON((0 0,0 10,10 10,10 0,0 0),(2 2,4 2,4 4,2 4,2 2))",
true);
}
template <typename P>
void test_all()
{
@@ -164,6 +190,8 @@ void test_all()
test_intersects_linestring_segment<P>();
test_intersects_linestring_linestring<P>();
test_intersects_ring_polygon<P>();
test_multi_linestring_polygon<P>();
test_multi_polygon_polygon<P>();
// self-intersecting is not tested in disjoint, so that is done here.

View File

@@ -336,11 +336,19 @@ void test_linestring_multi_polygon()
template <typename P>
void test_multi_linestring_polygon()
{
typedef bg::model::linestring<P> ls;
typedef bg::model::multi_linestring<ls> mls;
typedef bg::model::polygon<P> poly;
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))",
"1F10F0212");
test_geometry<mls, poly>("MULTILINESTRING((10 0, 18 12),(2 2,2 1))",
"POLYGON((5 0,0 -5,-5 0,0 5,5 0))",
"1F10F0212");
if ( boost::is_same<typename bg::coordinate_type<P>::type, double>::value )
{
typedef bg::model::polygon<P> poly;
typedef bg::model::linestring<P> ls;
typedef bg::model::multi_linestring<ls> mls;
// 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))",
"POLYGON((-2.333333333333333 -8.6666666666666661,-4.3253012048192767 -8.168674698795181,-4.1194968553459113 -7.6100628930817606,-2.8823529411764706 -7.7647058823529411,-2.882352941176471 -7.7647058823529411,-2.263157894736842 -8.6315789473684212,-2.333333333333333 -8.6666666666666661))",