4 // Copyright (c) 2016, Oracle and/or its affiliates.
6 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
8 // Use, modification and distribution is subject to the Boost Software License,
9 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
10 // http://www.boost.org/LICENSE_1_0.txt)
13 #include "test_relate.hpp"
17 void test_linestring_polygon()
19 typedef bg::model::linestring
<P
> ls
;
20 typedef bg::model::polygon
<P
> poly
;
21 typedef bg::model::ring
<P
> ring
;
24 test_geometry
<ls
, poly
>("LINESTRING(11 0,11 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "FF1FF0212");
25 test_geometry
<ls
, ring
>("LINESTRING(11 0,11 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "FF1FF0212");
28 test_geometry
<ls
, poly
>("LINESTRING(0 0,10 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "1FFF0F212");
29 test_geometry
<ls
, poly
>("LINESTRING(5 0,5 5,10 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "1FFF0F212");
30 test_geometry
<ls
, poly
>("LINESTRING(5 1,5 5,9 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "1FF0FF212");
33 test_geometry
<ls
, poly
>("LINESTRING(11 1,11 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "FF1FF0212");
35 test_geometry
<ls
, poly
>("LINESTRING(11 1,10 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "FF1F00212");
37 test_geometry
<ls
, poly
>("LINESTRING(11 1,10 5,10 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "F11F00212");
38 test_geometry
<ls
, poly
>("LINESTRING(11 1,10 10,0 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "F11F00212");
39 test_geometry
<ls
, poly
>("LINESTRING(11 1,10 0,0 0)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "F11F00212");
40 test_geometry
<ls
, poly
>("LINESTRING(0 -1,1 0,2 0)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "F11F00212");
42 test_geometry
<ls
, poly
>("LINESTRING(11 1,10 5,5 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "1010F0212");
44 test_geometry
<ls
, poly
>("LINESTRING(11 1,10 5,11 5,11 1)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "F01FFF212");
46 test_geometry
<ls
, poly
>("LINESTRING(11 1,10 5,10 10,11 5,11 1)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "F11FFF212");
49 test_geometry
<ls
, poly
>("LINESTRING(0 0,5 0,5 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "11F00F212");
51 test_geometry
<ls
, poly
>("LINESTRING(5 0,5 5,10 5,10 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "11FF0F212");
54 test_geometry
<ls
, poly
>("LINESTRING(1 0,2 0,3 1,4 0,5 0)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "11FF0F212");
56 test_geometry
<ls
, poly
>("LINESTRING(1 0,2 0,3 -1,4 0,5 0)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "F11F0F212");
59 test_geometry
<ls
, poly
>("LINESTRING(5 5,10 5,10 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "11F00F212");
61 test_geometry
<ls
, poly
>("LINESTRING(10 10,10 5,5 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "11F00F212");
63 test_geometry
<ls
, poly
>("LINESTRING(15 5,10 5,10 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "F11F00212");
65 test_geometry
<ls
, poly
>("LINESTRING(10 10,10 5,15 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "F11F00212");
70 test_geometry
<ls
, poly
>("LINESTRING(5 5,10 5,15 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "1010F0212");
71 test_geometry
<ls
, poly
>("LINESTRING(5 5,5 5,5 5,10 5,10 5,10 5,15 10,15 10,15 10)",
72 "POLYGON((0 0,0 0,0 0,0 10,0 10,0 10,10 10,10 10,10 10,10 0,10 0,10 0,0 0,0 0,0 0))",
74 test_geometry
<ls
, poly
>("LINESTRING(5 5,5 5,5 5,10 0,10 0,10 0,15 10,15 10,15 10)",
75 "POLYGON((0 0,0 0,0 0,0 10,0 10,0 10,10 10,10 10,10 10,10 0,10 0,10 0,0 0,0 0,0 0))",
78 test_geometry
<ls
, poly
>("LINESTRING(15 10,15 10,15 10,10 5,10 5,10 5,5 5,5 5,5 5)",
79 "POLYGON((0 0,0 0,0 0,0 10,0 10,0 10,10 10,10 10,10 10,10 0,10 0,10 0,0 0,0 0,0 0))",
81 test_geometry
<ls
, poly
>("LINESTRING(15 10,15 10,15 10,10 0,10 0,10 0,5 5,5 5,5 5)",
82 "POLYGON((0 0,0 0,0 0,0 10,0 10,0 10,10 10,10 10,10 10,10 0,10 0,10 0,0 0,0 0,0 0))",
86 //test_geometry<ls, poly>("LINESTRING(5 5,5 5,5 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "1010F0212");
87 test_geometry
<ls
, poly
>("LINESTRING(5 5,5 5,5 5,15 5,15 5,15 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "1010F0212");
90 // non-simple polygon with hole
91 test_geometry
<ls
, poly
>("LINESTRING(9 1,10 5,9 9)",
92 "POLYGON((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5))",
94 test_geometry
<ls
, poly
>("LINESTRING(10 1,10 5,10 9)",
95 "POLYGON((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5))",
97 test_geometry
<ls
, poly
>("LINESTRING(2 8,10 5,2 2)",
98 "POLYGON((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5))",
100 test_geometry
<ls
, poly
>("LINESTRING(10 1,10 5,2 2)",
101 "POLYGON((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5))",
103 test_geometry
<ls
, poly
>("LINESTRING(10 1,10 5,2 8)",
104 "POLYGON((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5))",
107 // non-simple polygon with hole, linear ring
108 test_geometry
<ls
, poly
>("LINESTRING(9 1,10 5,9 9,1 9,1 1,9 1)",
109 "POLYGON((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5))",
111 test_geometry
<ls
, poly
>("LINESTRING(10 5,10 9,11 5,10 1,10 5)",
112 "POLYGON((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5))",
114 test_geometry
<ls
, poly
>("LINESTRING(11 5,10 1,10 5,10 9,11 5)",
115 "POLYGON((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5))",
118 // non-simple polygon with self-touching holes
119 test_geometry
<ls
, poly
>("LINESTRING(7 1,8 5,7 9)",
120 "POLYGON((0 0,0 10,10 10,10 0,0 0),(8 1,9 1,9 9,8 9,8 1),(2 2,8 5,2 8,2 2))",
122 test_geometry
<ls
, poly
>("LINESTRING(8 2,8 5,8 8)",
123 "POLYGON((0 0,0 10,10 10,10 0,0 0),(8 1,9 1,9 9,8 9,8 1),(2 2,8 5,2 8,2 2))",
125 test_geometry
<ls
, poly
>("LINESTRING(2 8,8 5,2 2)",
126 "POLYGON((0 0,0 10,10 10,10 0,0 0),(8 1,9 1,9 9,8 9,8 1),(2 2,8 5,2 8,2 2))",
129 // non-simple polygon self-touching
130 test_geometry
<ls
, poly
>("LINESTRING(9 1,10 5,9 9)",
131 "POLYGON((0 0,0 10,10 10,10 5,2 8,2 2,10 5,10 0,0 0))",
133 test_geometry
<ls
, poly
>("LINESTRING(10 1,10 5,10 9)",
134 "POLYGON((0 0,0 10,10 10,10 5,2 8,2 2,10 5,10 0,0 0))",
136 test_geometry
<ls
, poly
>("LINESTRING(2 8,10 5,2 2)",
137 "POLYGON((0 0,0 10,10 10,10 5,2 8,2 2,10 5,10 0,0 0))",
140 // non-simple polygon self-touching, linear ring
141 test_geometry
<ls
, poly
>("LINESTRING(9 1,10 5,9 9,1 9,1 1,9 1)",
142 "POLYGON((0 0,0 10,10 10,10 5,2 8,2 2,10 5,10 0,0 0))",
144 test_geometry
<ls
, poly
>("LINESTRING(10 5,10 9,11 5,10 1,10 5)",
145 "POLYGON((0 0,0 10,10 10,10 5,2 8,2 2,10 5,10 0,0 0))",
147 test_geometry
<ls
, poly
>("LINESTRING(11 5,10 1,10 5,10 9,11 5)",
148 "POLYGON((0 0,0 10,10 10,10 5,2 8,2 2,10 5,10 0,0 0))",
151 // polygons with some ring equal to the linestring
152 test_geometry
<ls
, poly
>("LINESTRING(0 0,10 0,10 10,0 10,0 0)",
153 "POLYGON((0 0,0 10,10 10,10 0,0 0))",
155 test_geometry
<ls
, poly
>("LINESTRING(0 0,10 0,10 10,0 10,0 0)",
156 "POLYGON((0 0,0 10,10 10,10 0,0 0),(2 2,5 5,2 8,2 2))",
158 test_geometry
<ls
, poly
>("LINESTRING(2 2,5 5,2 8,2 2)",
159 "POLYGON((0 0,0 10,10 10,10 0,0 0),(2 2,5 5,2 8,2 2))",
162 // self-IP going on the boundary then into the exterior and to the boundary again
163 test_geometry
<ls
, poly
>("LINESTRING(2 10.023946271183535,5 10.037423045910710,5 15,6 15,5 10.037423045910710,8 10.023946271183535)",
164 "POLYGON((0 0,0 10,10 10,10 0,0 0))",
166 // self-IP going on the boundary then into the interior and to the boundary again
167 test_geometry
<ls
, poly
>("LINESTRING(2 10.023946271183535,5 10.037423045910710,5 5,6 5,5 10.037423045910710,8 10.023946271183535)",
168 "POLYGON((0 0,0 10,10 10,10 0,0 0))",
171 // self-IP with a hole -> B to I to B to E
172 test_geometry
<ls
, poly
>("LINESTRING(0 0,3 3)", "POLYGON((0 0,0 10,10 10,10 0,0 0),(0 0,9 1,9 9,1 9,0 0))",
176 template <typename P
>
177 void test_linestring_multi_polygon()
179 typedef bg::model::linestring
<P
> ls
;
180 typedef bg::model::polygon
<P
> poly
;
181 typedef bg::model::multi_polygon
<poly
> mpoly
;
183 test_geometry
<ls
, mpoly
>("LINESTRING(10 1,10 5,10 9)",
184 "MULTIPOLYGON(((0 20,0 30,10 30,10 20,0 20)),((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5)))",
186 test_geometry
<ls
, mpoly
>("LINESTRING(10 1,10 5,10 9)",
187 "MULTIPOLYGON(((0 20,0 30,10 30,10 20,0 20)),((0 0,0 10,10 10,10 0,0 0)))",
190 test_geometry
<ls
, mpoly
>("LINESTRING(10 1,10 5,2 2)",
191 "MULTIPOLYGON(((0 20,0 30,10 30,10 20,0 20)),((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5)))",
193 test_geometry
<ls
, mpoly
>("LINESTRING(10 1,10 5,2 2)",
194 "MULTIPOLYGON(((0 20,0 30,10 30,10 20,0 20)),((0 0,0 10,10 10,10 0,0 0)))",
197 test_geometry
<ls
, mpoly
>("LINESTRING(10 1,10 5,2 2)",
198 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5)),((10 5,3 3,3 7,10 5)))",
200 test_geometry
<ls
, mpoly
>("LINESTRING(10 1,10 5,2 8)",
201 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5)),((10 5,3 3,3 7,10 5)))",
203 test_geometry
<ls
, mpoly
>("LINESTRING(10 1,10 5,3 3)",
204 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5)),((10 5,3 3,3 7,10 5)))",
206 test_geometry
<ls
, mpoly
>("LINESTRING(10 1,10 5,3 7)",
207 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5)),((10 5,3 3,3 7,10 5)))",
209 test_geometry
<ls
, mpoly
>("LINESTRING(10 1,10 5,5 5)",
210 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5)),((10 5,3 3,3 7,10 5)))",
213 test_geometry
<ls
, mpoly
>("LINESTRING(0 0,10 0,10 10,0 10,0 0)",
214 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((20 0,20 10,30 20,20 0)))",
217 // degenerated points
218 test_geometry
<ls
, mpoly
>("LINESTRING(5 5,10 10,10 10,10 10,15 15)",
219 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((10 10,10 20,20 20,20 10,10 10)))",
222 // self-IP polygon with a hole and second polygon with a hole -> B to I to B to B to I to B to E
223 test_geometry
<ls
, mpoly
>("LINESTRING(0 0,3 3)",
224 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(0 0,9 1,9 9,1 9,0 0)),((0 0,2 8,8 8,8 2,0 0),(0 0,7 3,7 7,3 7,0 0)))",
226 // self-IP polygon with a hole and second polygon -> B to I to B to B to I
227 test_geometry
<ls
, mpoly
>("LINESTRING(0 0,3 3)",
228 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(0 0,9 1,9 9,1 9,0 0)),((0 0,2 8,8 8,8 2,0 0)))",
230 test_geometry
<ls
, mpoly
>("LINESTRING(0 0,3 3)",
231 "MULTIPOLYGON(((0 0,2 8,8 8,8 2,0 0)),((0 0,0 10,10 10,10 0,0 0),(0 0,9 1,9 9,1 9,0 0)))",
234 // MySQL report 18.12.2014 (https://svn.boost.org/trac/boost/ticket/10887)
235 test_geometry
<ls
, mpoly
>("LINESTRING(5 -2,5 2)",
236 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
238 test_geometry
<ls
, mpoly
>("LINESTRING(5 -2,5 5.0190018174896416)",
239 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
241 test_geometry
<ls
, mpoly
>("LINESTRING(5 -2,5 0)",
242 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
244 // MySQL report 18.12.2014 - extended
245 test_geometry
<ls
, mpoly
>("LINESTRING(5 -2,5 0)",
246 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)),((5 0,7 1,7 -1,5 0)))",
248 test_geometry
<ls
, mpoly
>("LINESTRING(0 0,5 0)",
249 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)),((5 0,7 1,7 -1,5 0)))",
253 test_geometry
<ls
, mpoly
>("LINESTRING(5 5,0 0,10 0)",
254 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((0 0,0 -10,-10 -10,-10 0,0 0)))",
256 test_geometry
<ls
, mpoly
>("LINESTRING(5 5,0 0,0 10)",
257 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((0 0,0 -10,-10 -10,-10 0,0 0)))",
260 test_geometry
<ls
, mpoly
>("LINESTRING(5 5,0 0,2 1)",
261 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((0 0,0 -10,-10 -10,-10 0,0 0)))",
263 test_geometry
<ls
, mpoly
>("LINESTRING(5 5,0 0,5 -5)",
264 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((0 0,0 -10,-10 -10,-10 0,0 0)))",
266 test_geometry
<ls
, mpoly
>("LINESTRING(5 5,0 0,5 -5,5 1)",
267 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((0 0,0 -10,-10 -10,-10 0,0 0)))",
269 test_geometry
<ls
, mpoly
>("LINESTRING(-5 5,0 0,5 -5)",
270 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((0 0,0 -10,-10 -10,-10 0,0 0)))",
274 template <typename P
>
275 void test_multi_linestring_polygon()
277 typedef bg::model::linestring
<P
> ls
;
278 typedef bg::model::multi_linestring
<ls
> mls
;
279 typedef bg::model::polygon
<P
> poly
;
280 typedef bg::model::ring
<P
> ring
;
281 typedef typename
bg::coordinate_type
<P
>::type coord_t
;
283 test_geometry
<mls
, poly
>("MULTILINESTRING((11 11, 20 20),(5 7, 4 1))",
284 "POLYGON((0 0,0 10,10 10,10 0,0 0),(2 2,4 2,4 4,2 4,2 2))",
286 test_geometry
<mls
, poly
>("MULTILINESTRING((10 0, 18 12),(2 2,2 1))",
287 "POLYGON((5 0,0 -5,-5 0,0 5,5 0))",
290 if ( BOOST_GEOMETRY_CONDITION((
291 boost::is_same
<coord_t
, double>::value
)) )
293 // assertion failure in 1.57
294 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))",
295 "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))",
297 test_geometry
<mls
, poly
>("MULTILINESTRING((-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))",
298 "POLYGON((-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))",
303 test_geometry
<mls
, poly
>("MULTILINESTRING((6 6,15 15),(0 0, 7 7))",
304 "POLYGON((5 5,5 15,15 15,15 5,5 5))",
306 test_geometry
<mls
, poly
>("MULTILINESTRING((15 15,6 6),(0 0, 7 7))",
307 "POLYGON((5 5,5 15,15 15,15 5,5 5))",
311 test_geometry
<mls
, ring
>("MULTILINESTRING((15 15,6 6),(4 14,6 15.986412732589057))",
312 "POLYGON((5 5,5 15,15 15,15 5,5 5))",
316 test_geometry
<mls
, poly
>("MULTILINESTRING((4 10.035925377760330, 3 10.031432746397092, 10 6),(5 0, 7 5, 9 10.013467818052765))",
317 "POLYGON((0 0,0 10,10 10,10 0,5 5,0 0))",
321 test_geometry
<mls
, poly
>("MULTILINESTRING((3 10.031432746397092, 1 5, 1 10.013467818052765, 3 4, 7 8, 6 10.035925377760330, 10 2))",
322 "POLYGON((0 0,0 10,10 10,10 0,0 0))",
326 template <typename P
>
327 void test_multi_linestring_multi_polygon()
329 typedef bg::model::linestring
<P
> ls
;
330 typedef bg::model::polygon
<P
> poly
;
331 typedef bg::model::multi_linestring
<ls
> mls
;
332 typedef bg::model::multi_polygon
<poly
> mpoly
;
334 // polygons with some ring equal to the linestrings
335 test_geometry
<mls
, mpoly
>("MULTILINESTRING((0 0,10 0,10 10,0 10,0 0),(20 20,50 50,20 80,20 20))",
336 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
339 test_geometry
<mls
, mpoly
>("MULTILINESTRING((0 0,10 0,10 10,0 10,0 0),(2 2,5 5,2 8,2 2))",
340 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(2 2,5 5,2 8,2 2)))",
344 test_geometry
<mls
, mpoly
>("MULTILINESTRING((0 0,10 0,10 10),(10 10,0 10,0 0))",
345 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
347 test_geometry
<mls
, mpoly
>("MULTILINESTRING((0 0,10 0,10 10),(10 10,0 10,0 0),(20 20,50 50,20 80,20 20))",
348 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
352 test_geometry
<mls
, mpoly
>("MULTILINESTRING((20 20,30 30),(30 30,40 40))",
353 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
356 test_geometry
<mls
, mpoly
>("MULTILINESTRING((5 5,0 5),(5 5,5 0),(10 10,10 5,5 5,5 10,10 10))",
357 "MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5)),((5 5,10 1,10 0,5 5)))",
359 test_geometry
<mls
, mpoly
>("MULTILINESTRING((5 5,0 5),(5 5,5 0),(0 5,0 0,5 0),(10 10,10 5,5 5,5 10,10 10))",
360 "MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5)),((5 5,10 1,10 0,5 5)))",
362 test_geometry
<mls
, mpoly
>("MULTILINESTRING((5 5,0 0),(5 5,5 0),(10 10,10 5,5 5,5 10,10 10))",
363 "MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5)),((5 5,10 1,10 0,5 5)))",
366 // MySQL report 18.12.2014 - extended
367 test_geometry
<mls
, mpoly
>("MULTILINESTRING((5 -2,4 -2,5 0),(5 -2,6 -2,5 0))",
368 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
370 test_geometry
<mls
, mpoly
>("MULTILINESTRING((0 0,0 1,5 0),(0 0,0 -1,5 0))",
371 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
373 test_geometry
<mls
, mpoly
>("MULTILINESTRING((5 -2,4 -2,5 0),(6 -2,5 0))",
374 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
376 test_geometry
<mls
, mpoly
>("MULTILINESTRING((0 0,0 1,5 0),(0 -1,5 0))",
377 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
379 test_geometry
<mls
, mpoly
>("MULTILINESTRING((0 0,5 0),(5 -2,5 0))",
380 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
382 test_geometry
<mls
, mpoly
>("MULTILINESTRING((5 -2,5 0),(0 0,5 0))",
383 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
386 // 22.01.2015 - extended
387 test_geometry
<mls
, mpoly
>("MULTILINESTRING((10 10,0 10),(5 5,0 0,10 0))",
388 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((0 0,0 -10,-10 -10,-10 0,0 0)))",
390 test_geometry
<mls
, mpoly
>("MULTILINESTRING((5 5,0 0,5 -5),(0 0,9 1))",
391 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((0 0,0 -10,-10 -10,-10 0,0 0)))",
393 test_geometry
<mls
, mpoly
>("MULTILINESTRING((5 -5,0 0,5 5),(0 0,5 -1))",
394 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((0 0,0 -10,-10 -10,-10 0,0 0)))",
398 template <typename P
>
401 test_linestring_polygon
<P
>();
402 test_linestring_multi_polygon
<P
>();
403 test_multi_linestring_polygon
<P
>();
404 test_multi_linestring_multi_polygon
<P
>();
407 int test_main( int , char* [] )
409 typedef bg::cs::spherical_equatorial
<bg::degree
> cs_t
;
411 test_all
<bg::model::point
<float, 2, cs_t
> >();
412 test_all
<bg::model::point
<double, 2, cs_t
> >();
414 #if defined(HAVE_TTMATH)
415 test_all
<bg::model::point
<ttmath_big
, 2, cs_t
> >();