]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/test/algorithms/relate/relate_linear_areal_sph.cpp
bump version to 18.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / relate / relate_linear_areal_sph.cpp
CommitLineData
7c673cae
FG
1// Boost.Geometry
2// Unit Test
3
1e59de90 4// Copyright (c) 2016-2021, Oracle and/or its affiliates.
7c673cae
FG
5// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
6
7// Use, modification and distribution is subject to the Boost Software License,
8// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9// http://www.boost.org/LICENSE_1_0.txt)
10
11
12#include "test_relate.hpp"
13
14
15template <typename P>
16void test_linestring_polygon()
17{
18 typedef bg::model::linestring<P> ls;
19 typedef bg::model::polygon<P> poly;
20 typedef bg::model::ring<P> ring;
21
22 // LS disjoint
23 test_geometry<ls, poly>("LINESTRING(11 0,11 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "FF1FF0212");
24 test_geometry<ls, ring>("LINESTRING(11 0,11 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "FF1FF0212");
25
26 // II BB
27 test_geometry<ls, poly>("LINESTRING(0 0,10 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "1FFF0F212");
28 test_geometry<ls, poly>("LINESTRING(5 0,5 5,10 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "1FFF0F212");
29 test_geometry<ls, poly>("LINESTRING(5 1,5 5,9 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "1FF0FF212");
30
31 // IE
32 test_geometry<ls, poly>("LINESTRING(11 1,11 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "FF1FF0212");
33 // IE IB0
34 test_geometry<ls, poly>("LINESTRING(11 1,10 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "FF1F00212");
35 // IE IB1
36 test_geometry<ls, poly>("LINESTRING(11 1,10 5,10 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "F11F00212");
37 test_geometry<ls, poly>("LINESTRING(11 1,10 10,0 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "F11F00212");
38 test_geometry<ls, poly>("LINESTRING(11 1,10 0,0 0)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "F11F00212");
39 test_geometry<ls, poly>("LINESTRING(0 -1,1 0,2 0)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "F11F00212");
40 // IE IB0 II
41 test_geometry<ls, poly>("LINESTRING(11 1,10 5,5 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "1010F0212");
42 // IE IB0 lring
43 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");
44 // IE IB1 lring
45 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");
46
47 // IB1 II
48 test_geometry<ls, poly>("LINESTRING(0 0,5 0,5 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "11F00F212");
49 // BI0 II IB1
50 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");
51
52 // IB1 II IB1
53 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");
54 // IB1 IE IB1
55 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");
56
57 // II IB1
58 test_geometry<ls, poly>("LINESTRING(5 5,10 5,10 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "11F00F212");
59 // IB1 II
60 test_geometry<ls, poly>("LINESTRING(10 10,10 5,5 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "11F00F212");
61 // IE IB1
62 test_geometry<ls, poly>("LINESTRING(15 5,10 5,10 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "F11F00212");
63 // IB1 IE
64 test_geometry<ls, poly>("LINESTRING(10 10,10 5,15 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "F11F00212");
65
66 // duplicated points
67 {
68 // II IB0 IE
69 test_geometry<ls, poly>("LINESTRING(5 5,10 5,15 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "1010F0212");
70 test_geometry<ls, poly>("LINESTRING(5 5,5 5,5 5,10 5,10 5,10 5,15 10,15 10,15 10)",
71 "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))",
72 "1010F0212");
73 test_geometry<ls, poly>("LINESTRING(5 5,5 5,5 5,10 0,10 0,10 0,15 10,15 10,15 10)",
74 "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))",
75 "1010F0212");
76 // IE IB0 II
77 test_geometry<ls, poly>("LINESTRING(15 10,15 10,15 10,10 5,10 5,10 5,5 5,5 5,5 5)",
78 "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))",
79 "1010F0212");
80 test_geometry<ls, poly>("LINESTRING(15 10,15 10,15 10,10 0,10 0,10 0,5 5,5 5,5 5)",
81 "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))",
82 "1010F0212");
83
84 // TEST
85 //test_geometry<ls, poly>("LINESTRING(5 5,5 5,5 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "1010F0212");
86 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");
87 }
88
89 // non-simple polygon with hole
90 test_geometry<ls, poly>("LINESTRING(9 1,10 5,9 9)",
91 "POLYGON((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5))",
92 "10F0FF212");
93 test_geometry<ls, poly>("LINESTRING(10 1,10 5,10 9)",
94 "POLYGON((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5))",
95 "F1FF0F212");
96 test_geometry<ls, poly>("LINESTRING(2 8,10 5,2 2)",
97 "POLYGON((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5))",
98 "F1FF0F212");
99 test_geometry<ls, poly>("LINESTRING(10 1,10 5,2 2)",
100 "POLYGON((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5))",
101 "F1FF0F212");
102 test_geometry<ls, poly>("LINESTRING(10 1,10 5,2 8)",
103 "POLYGON((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5))",
104 "F1FF0F212");
105
106 // non-simple polygon with hole, linear ring
107 test_geometry<ls, poly>("LINESTRING(9 1,10 5,9 9,1 9,1 1,9 1)",
108 "POLYGON((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5))",
109 "10FFFF212");
110 test_geometry<ls, poly>("LINESTRING(10 5,10 9,11 5,10 1,10 5)",
111 "POLYGON((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5))",
112 "F11FFF212");
113 test_geometry<ls, poly>("LINESTRING(11 5,10 1,10 5,10 9,11 5)",
114 "POLYGON((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5))",
115 "F11FFF212");
116
117 // non-simple polygon with self-touching holes
118 test_geometry<ls, poly>("LINESTRING(7 1,8 5,7 9)",
119 "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))",
120 "10F0FF212");
121 test_geometry<ls, poly>("LINESTRING(8 2,8 5,8 8)",
122 "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))",
123 "F1FF0F212");
124 test_geometry<ls, poly>("LINESTRING(2 8,8 5,2 2)",
125 "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))",
126 "F1FF0F212");
127
128 // non-simple polygon self-touching
129 test_geometry<ls, poly>("LINESTRING(9 1,10 5,9 9)",
130 "POLYGON((0 0,0 10,10 10,10 5,2 8,2 2,10 5,10 0,0 0))",
131 "10F0FF212");
132 test_geometry<ls, poly>("LINESTRING(10 1,10 5,10 9)",
133 "POLYGON((0 0,0 10,10 10,10 5,2 8,2 2,10 5,10 0,0 0))",
134 "F1FF0F212");
135 test_geometry<ls, poly>("LINESTRING(2 8,10 5,2 2)",
136 "POLYGON((0 0,0 10,10 10,10 5,2 8,2 2,10 5,10 0,0 0))",
137 "F1FF0F212");
138
139 // non-simple polygon self-touching, linear ring
140 test_geometry<ls, poly>("LINESTRING(9 1,10 5,9 9,1 9,1 1,9 1)",
141 "POLYGON((0 0,0 10,10 10,10 5,2 8,2 2,10 5,10 0,0 0))",
142 "10FFFF212");
143 test_geometry<ls, poly>("LINESTRING(10 5,10 9,11 5,10 1,10 5)",
144 "POLYGON((0 0,0 10,10 10,10 5,2 8,2 2,10 5,10 0,0 0))",
145 "F11FFF212");
146 test_geometry<ls, poly>("LINESTRING(11 5,10 1,10 5,10 9,11 5)",
147 "POLYGON((0 0,0 10,10 10,10 5,2 8,2 2,10 5,10 0,0 0))",
148 "F11FFF212");
149
150 // polygons with some ring equal to the linestring
151 test_geometry<ls, poly>("LINESTRING(0 0,10 0,10 10,0 10,0 0)",
152 "POLYGON((0 0,0 10,10 10,10 0,0 0))",
153 "F1FFFF2F2");
154 test_geometry<ls, poly>("LINESTRING(0 0,10 0,10 10,0 10,0 0)",
155 "POLYGON((0 0,0 10,10 10,10 0,0 0),(2 2,5 5,2 8,2 2))",
156 "F1FFFF212");
157 test_geometry<ls, poly>("LINESTRING(2 2,5 5,2 8,2 2)",
158 "POLYGON((0 0,0 10,10 10,10 0,0 0),(2 2,5 5,2 8,2 2))",
159 "F1FFFF212");
160
161 // self-IP going on the boundary then into the exterior and to the boundary again
162 test_geometry<ls, poly>("LINESTRING(2 10.023946271183535,5 10.037423045910710,5 15,6 15,5 10.037423045910710,8 10.023946271183535)",
163 "POLYGON((0 0,0 10,10 10,10 0,0 0))",
164 "F11F0F212");
165 // self-IP going on the boundary then into the interior and to the boundary again
166 test_geometry<ls, poly>("LINESTRING(2 10.023946271183535,5 10.037423045910710,5 5,6 5,5 10.037423045910710,8 10.023946271183535)",
167 "POLYGON((0 0,0 10,10 10,10 0,0 0))",
168 "11FF0F212");
169
170 // self-IP with a hole -> B to I to B to E
171 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))",
172 "FF1F00212");
173}
174
175template <typename P>
176void test_linestring_multi_polygon()
177{
178 typedef bg::model::linestring<P> ls;
179 typedef bg::model::polygon<P> poly;
180 typedef bg::model::multi_polygon<poly> mpoly;
181
182 test_geometry<ls, mpoly>("LINESTRING(10 1,10 5,10 9)",
183 "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)))",
184 "F1FF0F212");
185 test_geometry<ls, mpoly>("LINESTRING(10 1,10 5,10 9)",
186 "MULTIPOLYGON(((0 20,0 30,10 30,10 20,0 20)),((0 0,0 10,10 10,10 0,0 0)))",
187 "F1FF0F212");
188
189 test_geometry<ls, mpoly>("LINESTRING(10 1,10 5,2 2)",
190 "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)))",
191 "F1FF0F212");
192 test_geometry<ls, mpoly>("LINESTRING(10 1,10 5,2 2)",
193 "MULTIPOLYGON(((0 20,0 30,10 30,10 20,0 20)),((0 0,0 10,10 10,10 0,0 0)))",
194 "11F00F212");
195
196 test_geometry<ls, mpoly>("LINESTRING(10 1,10 5,2 2)",
197 "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)))",
198 "F1FF0F212");
199 test_geometry<ls, mpoly>("LINESTRING(10 1,10 5,2 8)",
200 "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)))",
201 "F1FF0F212");
202 test_geometry<ls, mpoly>("LINESTRING(10 1,10 5,3 3)",
203 "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)))",
204 "F1FF0F212");
205 test_geometry<ls, mpoly>("LINESTRING(10 1,10 5,3 7)",
206 "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)))",
207 "F1FF0F212");
208 test_geometry<ls, mpoly>("LINESTRING(10 1,10 5,5 5)",
209 "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)))",
210 "11F00F212");
211
212 test_geometry<ls, mpoly>("LINESTRING(0 0,10 0,10 10,0 10,0 0)",
213 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((20 0,20 10,30 20,20 0)))",
214 "F1FFFF212");
215
216 // degenerated points
217 test_geometry<ls, mpoly>("LINESTRING(5 5,10 10,10 10,10 10,15 15)",
218 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((10 10,10 20,20 20,20 10,10 10)))",
219 "10F0FF212");
220
221 // 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
222 test_geometry<ls, mpoly>("LINESTRING(0 0,3 3)",
223 "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)))",
224 "FF1F00212");
225 // self-IP polygon with a hole and second polygon -> B to I to B to B to I
226 test_geometry<ls, mpoly>("LINESTRING(0 0,3 3)",
227 "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)))",
228 "1FF00F212");
229 test_geometry<ls, mpoly>("LINESTRING(0 0,3 3)",
230 "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)))",
231 "1FF00F212");
232
233 // MySQL report 18.12.2014 (https://svn.boost.org/trac/boost/ticket/10887)
234 test_geometry<ls, mpoly>("LINESTRING(5 -2,5 2)",
235 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
236 "10F0FF212");
237 test_geometry<ls, mpoly>("LINESTRING(5 -2,5 5.0190018174896416)",
238 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
239 "10F00F212");
240 test_geometry<ls, mpoly>("LINESTRING(5 -2,5 0)",
241 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
242 "1FF00F212");
243 // MySQL report 18.12.2014 - extended
244 test_geometry<ls, mpoly>("LINESTRING(5 -2,5 0)",
245 "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)))",
246 "1FF00F212");
247 test_geometry<ls, mpoly>("LINESTRING(0 0,5 0)",
248 "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)))",
249 "FF1F00212");
250
251 // 22.01.2015
252 test_geometry<ls, mpoly>("LINESTRING(5 5,0 0,10 0)",
253 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((0 0,0 -10,-10 -10,-10 0,0 0)))",
254 "11F00F212");
255 test_geometry<ls, mpoly>("LINESTRING(5 5,0 0,0 10)",
256 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((0 0,0 -10,-10 -10,-10 0,0 0)))",
257 "11F00F212");
258 // extended
259 test_geometry<ls, mpoly>("LINESTRING(5 5,0 0,2 1)",
260 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((0 0,0 -10,-10 -10,-10 0,0 0)))",
261 "10F0FF212");
262 test_geometry<ls, mpoly>("LINESTRING(5 5,0 0,5 -5)",
263 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((0 0,0 -10,-10 -10,-10 0,0 0)))",
264 "1010F0212");
265 test_geometry<ls, mpoly>("LINESTRING(5 5,0 0,5 -5,5 1)",
266 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((0 0,0 -10,-10 -10,-10 0,0 0)))",
267 "1010FF212");
268 test_geometry<ls, mpoly>("LINESTRING(-5 5,0 0,5 -5)",
269 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((0 0,0 -10,-10 -10,-10 0,0 0)))",
270 "F01FF0212");
271}
272
273template <typename P>
274void test_multi_linestring_polygon()
275{
276 typedef bg::model::linestring<P> ls;
277 typedef bg::model::multi_linestring<ls> mls;
278 typedef bg::model::polygon<P> poly;
279 typedef bg::model::ring<P> ring;
280 typedef typename bg::coordinate_type<P>::type coord_t;
281
282 test_geometry<mls, poly>("MULTILINESTRING((11 11, 20 20),(5 7, 4 1))",
283 "POLYGON((0 0,0 10,10 10,10 0,0 0),(2 2,4 2,4 4,2 4,2 2))",
284 "1F10F0212");
285 test_geometry<mls, poly>("MULTILINESTRING((10 0, 18 12),(2 2,2 1))",
286 "POLYGON((5 0,0 -5,-5 0,0 5,5 0))",
287 "1F10F0212");
288
1e59de90 289 if ( BOOST_GEOMETRY_CONDITION((std::is_same<coord_t, double>::value)) )
7c673cae
FG
290 {
291 // assertion failure in 1.57
292 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))",
293 "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))",
294 "*********");
295 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))",
296 "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))",
297 "*********");
298 }
299
300 // 21.01.2015
301 test_geometry<mls, poly>("MULTILINESTRING((6 6,15 15),(0 0, 7 7))",
302 "POLYGON((5 5,5 15,15 15,15 5,5 5))",
303 "101000212");
304 test_geometry<mls, poly>("MULTILINESTRING((15 15,6 6),(0 0, 7 7))",
305 "POLYGON((5 5,5 15,15 15,15 5,5 5))",
306 "101000212");
307
308 // extended
309 test_geometry<mls, ring>("MULTILINESTRING((15 15,6 6),(4 14,6 15.986412732589057))",
310 "POLYGON((5 5,5 15,15 15,15 5,5 5))",
311 "101000212");
312
313 // 23.01.2015
314 test_geometry<mls, poly>("MULTILINESTRING((4 10.035925377760330, 3 10.031432746397092, 10 6),(5 0, 7 5, 9 10.013467818052765))",
315 "POLYGON((0 0,0 10,10 10,10 0,5 5,0 0))",
316 "111F00212");
317
318 // 23.01.2015
319 test_geometry<mls, poly>("MULTILINESTRING((3 10.031432746397092, 1 5, 1 10.013467818052765, 3 4, 7 8, 6 10.035925377760330, 10 2))",
320 "POLYGON((0 0,0 10,10 10,10 0,0 0))",
321 "10FF0F212");
322}
323
324template <typename P>
325void test_multi_linestring_multi_polygon()
326{
327 typedef bg::model::linestring<P> ls;
328 typedef bg::model::polygon<P> poly;
329 typedef bg::model::multi_linestring<ls> mls;
330 typedef bg::model::multi_polygon<poly> mpoly;
331
332 // polygons with some ring equal to the linestrings
333 test_geometry<mls, mpoly>("MULTILINESTRING((0 0,10 0,10 10,0 10,0 0),(20 20,50 50,20 80,20 20))",
334 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
335 "F11FFF2F2");
336
337 test_geometry<mls, mpoly>("MULTILINESTRING((0 0,10 0,10 10,0 10,0 0),(2 2,5 5,2 8,2 2))",
338 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(2 2,5 5,2 8,2 2)))",
339 "F1FFFF2F2");
340
341
342 test_geometry<mls, mpoly>("MULTILINESTRING((0 0,10 0,10 10),(10 10,0 10,0 0))",
343 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
344 "F1FFFF2F2");
345 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))",
346 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
347 "F11FFF2F2");
348
349 // disjoint
350 test_geometry<mls, mpoly>("MULTILINESTRING((20 20,30 30),(30 30,40 40))",
351 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
352 "FF1FF0212");
353
354 test_geometry<mls, mpoly>("MULTILINESTRING((5 5,0 5),(5 5,5 0),(10 10,10 5,5 5,5 10,10 10))",
355 "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)))",
356 "F1FF0F212");
357 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))",
358 "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 "F1FFFF212");
360 test_geometry<mls, mpoly>("MULTILINESTRING((5 5,0 0),(5 5,5 0),(10 10,10 5,5 5,5 10,10 10))",
361 "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 "11FF0F212");
363
364 // MySQL report 18.12.2014 - extended
365 test_geometry<mls, mpoly>("MULTILINESTRING((5 -2,4 -2,5 0),(5 -2,6 -2,5 0))",
366 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
367 "10FFFF212");
368 test_geometry<mls, mpoly>("MULTILINESTRING((0 0,0 1,5 0),(0 0,0 -1,5 0))",
369 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
370 "F01FFF212");
371 test_geometry<mls, mpoly>("MULTILINESTRING((5 -2,4 -2,5 0),(6 -2,5 0))",
372 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
373 "10F0FF212");
374 test_geometry<mls, mpoly>("MULTILINESTRING((0 0,0 1,5 0),(0 -1,5 0))",
375 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
376 "F01FF0212");
377 test_geometry<mls, mpoly>("MULTILINESTRING((0 0,5 0),(5 -2,5 0))",
378 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
379 "1010F0212");
380 test_geometry<mls, mpoly>("MULTILINESTRING((5 -2,5 0),(0 0,5 0))",
381 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
382 "1010F0212");
383
384 // 22.01.2015 - extended
385 test_geometry<mls, mpoly>("MULTILINESTRING((10 10,0 10),(5 5,0 0,10 0))",
386 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((0 0,0 -10,-10 -10,-10 0,0 0)))",
387 "11F00F212");
388 test_geometry<mls, mpoly>("MULTILINESTRING((5 5,0 0,5 -5),(0 0,9 1))",
389 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((0 0,0 -10,-10 -10,-10 0,0 0)))",
390 "101000212");
391 test_geometry<mls, mpoly>("MULTILINESTRING((5 -5,0 0,5 5),(0 0,5 -1))",
392 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((0 0,0 -10,-10 -10,-10 0,0 0)))",
393 "101000212");
394}
395
396template <typename P>
397void test_all()
398{
399 test_linestring_polygon<P>();
400 test_linestring_multi_polygon<P>();
401 test_multi_linestring_polygon<P>();
402 test_multi_linestring_multi_polygon<P>();
403}
404
405int test_main( int , char* [] )
406{
407 typedef bg::cs::spherical_equatorial<bg::degree> cs_t;
408
409 test_all<bg::model::point<float, 2, cs_t> >();
410 test_all<bg::model::point<double, 2, cs_t> >();
411
7c673cae
FG
412 return 0;
413}