]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/test/algorithms/relate/relate_linear_areal_sph.cpp
import quincy beta 17.1.0
[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
4// Copyright (c) 2016, Oracle and/or its affiliates.
5
6// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
7
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)
11
12
13#include "test_relate.hpp"
14
15
16template <typename P>
17void test_linestring_polygon()
18{
19 typedef bg::model::linestring<P> ls;
20 typedef bg::model::polygon<P> poly;
21 typedef bg::model::ring<P> ring;
22
23 // LS disjoint
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");
26
27 // II BB
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");
31
32 // IE
33 test_geometry<ls, poly>("LINESTRING(11 1,11 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "FF1FF0212");
34 // IE IB0
35 test_geometry<ls, poly>("LINESTRING(11 1,10 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "FF1F00212");
36 // IE IB1
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");
41 // IE IB0 II
42 test_geometry<ls, poly>("LINESTRING(11 1,10 5,5 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "1010F0212");
43 // IE IB0 lring
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");
45 // IE IB1 lring
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");
47
48 // IB1 II
49 test_geometry<ls, poly>("LINESTRING(0 0,5 0,5 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "11F00F212");
50 // BI0 II IB1
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");
52
53 // IB1 II IB1
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");
55 // IB1 IE IB1
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");
57
58 // II IB1
59 test_geometry<ls, poly>("LINESTRING(5 5,10 5,10 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "11F00F212");
60 // IB1 II
61 test_geometry<ls, poly>("LINESTRING(10 10,10 5,5 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "11F00F212");
62 // IE IB1
63 test_geometry<ls, poly>("LINESTRING(15 5,10 5,10 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "F11F00212");
64 // IB1 IE
65 test_geometry<ls, poly>("LINESTRING(10 10,10 5,15 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", "F11F00212");
66
67 // duplicated points
68 {
69 // II IB0 IE
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))",
73 "1010F0212");
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))",
76 "1010F0212");
77 // IE IB0 II
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))",
80 "1010F0212");
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))",
83 "1010F0212");
84
85 // TEST
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");
88 }
89
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))",
93 "10F0FF212");
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))",
96 "F1FF0F212");
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))",
99 "F1FF0F212");
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))",
102 "F1FF0F212");
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))",
105 "F1FF0F212");
106
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))",
110 "10FFFF212");
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))",
113 "F11FFF212");
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))",
116 "F11FFF212");
117
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))",
121 "10F0FF212");
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))",
124 "F1FF0F212");
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))",
127 "F1FF0F212");
128
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))",
132 "10F0FF212");
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))",
135 "F1FF0F212");
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))",
138 "F1FF0F212");
139
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))",
143 "10FFFF212");
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))",
146 "F11FFF212");
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))",
149 "F11FFF212");
150
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))",
154 "F1FFFF2F2");
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))",
157 "F1FFFF212");
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))",
160 "F1FFFF212");
161
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))",
165 "F11F0F212");
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))",
169 "11FF0F212");
170
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))",
173 "FF1F00212");
174}
175
176template <typename P>
177void test_linestring_multi_polygon()
178{
179 typedef bg::model::linestring<P> ls;
180 typedef bg::model::polygon<P> poly;
181 typedef bg::model::multi_polygon<poly> mpoly;
182
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)))",
185 "F1FF0F212");
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)))",
188 "F1FF0F212");
189
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)))",
192 "F1FF0F212");
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)))",
195 "11F00F212");
196
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)))",
199 "F1FF0F212");
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)))",
202 "F1FF0F212");
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)))",
205 "F1FF0F212");
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)))",
208 "F1FF0F212");
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)))",
211 "11F00F212");
212
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)))",
215 "F1FFFF212");
216
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)))",
220 "10F0FF212");
221
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)))",
225 "FF1F00212");
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)))",
229 "1FF00F212");
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)))",
232 "1FF00F212");
233
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)))",
237 "10F0FF212");
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)))",
240 "10F00F212");
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)))",
243 "1FF00F212");
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)))",
247 "1FF00F212");
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)))",
250 "FF1F00212");
251
252 // 22.01.2015
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)))",
255 "11F00F212");
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)))",
258 "11F00F212");
259 // extended
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)))",
262 "10F0FF212");
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)))",
265 "1010F0212");
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)))",
268 "1010FF212");
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)))",
271 "F01FF0212");
272}
273
274template <typename P>
275void test_multi_linestring_polygon()
276{
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;
282
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))",
285 "1F10F0212");
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))",
288 "1F10F0212");
289
290 if ( BOOST_GEOMETRY_CONDITION((
291 boost::is_same<coord_t, double>::value )) )
292 {
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))",
296 "*********");
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))",
299 "*********");
300 }
301
302 // 21.01.2015
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))",
305 "101000212");
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))",
308 "101000212");
309
310 // extended
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))",
313 "101000212");
314
315 // 23.01.2015
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))",
318 "111F00212");
319
320 // 23.01.2015
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))",
323 "10FF0F212");
324}
325
326template <typename P>
327void test_multi_linestring_multi_polygon()
328{
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;
333
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)))",
337 "F11FFF2F2");
338
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)))",
341 "F1FFFF2F2");
342
343
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)))",
346 "F1FFFF2F2");
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)))",
349 "F11FFF2F2");
350
351 // disjoint
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)))",
354 "FF1FF0212");
355
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)))",
358 "F1FF0F212");
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)))",
361 "F1FFFF212");
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)))",
364 "11FF0F212");
365
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)))",
369 "10FFFF212");
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)))",
372 "F01FFF212");
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)))",
375 "10F0FF212");
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)))",
378 "F01FF0212");
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)))",
381 "1010F0212");
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)))",
384 "1010F0212");
385
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)))",
389 "11F00F212");
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)))",
392 "101000212");
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)))",
395 "101000212");
396}
397
398template <typename P>
399void test_all()
400{
401 test_linestring_polygon<P>();
402 test_linestring_multi_polygon<P>();
403 test_multi_linestring_polygon<P>();
404 test_multi_linestring_multi_polygon<P>();
405}
406
407int test_main( int , char* [] )
408{
409 typedef bg::cs::spherical_equatorial<bg::degree> cs_t;
410
411 test_all<bg::model::point<float, 2, cs_t> >();
412 test_all<bg::model::point<double, 2, cs_t> >();
413
7c673cae
FG
414 return 0;
415}