]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/test/algorithms/touches/touches_sph.cpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / touches / touches_sph.cpp
CommitLineData
7c673cae
FG
1// Boost.Geometry
2
3// Copyright (c) 2016 Oracle and/or its affiliates.
4// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
5
6// Use, modification and distribution is subject to the Boost Software License,
7// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8// http://www.boost.org/LICENSE_1_0.txt)
9
10#include "test_touches.hpp"
11
12#include <algorithms/overlay/overlay_cases.hpp>
13#include <algorithms/overlay/multi_overlay_cases.hpp>
14
15#include <boost/geometry/geometries/geometries.hpp>
16
17
18template <typename P>
19void test_polygon_polygon()
20{
21 typedef bg::model::polygon<P> poly;
22 typedef bg::model::ring<P> ring;
23
24 test_geometry<ring, ring>(case_1[0], case_1[1],
25 false);
26 test_geometry<ring, poly>(case_1[0], case_1[1],
27 false);
28
29 test_geometry<poly, poly>(case_1[0], case_1[1],
30 false);
31 test_geometry<poly, poly>(case_2[0], case_2[1],
32 false);
33 test_geometry<poly, poly>(case_3_sph[0], case_3_sph[1],
34 false);
35 test_geometry<poly, poly>(case_3_2_sph[0], case_3_2_sph[1],
36 false);
37 test_geometry<poly, poly>(case_4[0], case_4[1],
38 false);
39 test_geometry<poly, poly>(case_5[0], case_5[1],
40 false);
41 test_geometry<poly, poly>(case_6_sph[0], case_6_sph[1],
42 false);
43
44 test_geometry<poly, poly>(case_7[0], case_7[1],
45 true);
46 test_geometry<poly, poly>(case_8_sph[0], case_8_sph[1],
47 true);
48 test_geometry<poly, poly>(case_9_sph[0], case_9_sph[1],
49 true);
50 test_geometry<poly, poly>(case_10_sph[0], case_10_sph[1],
51 true);
52 test_geometry<poly, poly>(case_11_sph[0], case_11_sph[1],
53 false);
54 test_geometry<poly, poly>(case_12[0], case_12[1],
55 false);
56
57 test_geometry<poly, poly>(case_13_sph[0], case_13_sph[1],
58 true);
59 test_geometry<poly, poly>(case_14_sph[0], case_14_sph[1],
60 true);
61 test_geometry<poly, poly>(case_15_sph[0], case_15_sph[1],
62 true);
63 test_geometry<poly, poly>(case_16_sph[0], case_16_sph[1],
64 true);
65 test_geometry<poly, poly>(case_17_sph[0], case_17_sph[1],
66 false);
67 test_geometry<poly, poly>(case_18_sph[0], case_18_sph[1],
68 false);
69}
70
71template <typename P>
72void test_polygon_multi_polygon()
73{
74 typedef bg::model::polygon<P> poly;
75 typedef bg::model::ring<P> ring;
76 typedef bg::model::multi_polygon<poly> mpoly;
77
78 test_geometry<ring, mpoly>(case_1[0], case_multi_2[0],
79 false);
80 test_geometry<poly, mpoly>(case_2[0], case_multi_2[0],
81 false);
82}
83
84template <typename P>
85void test_multi_polygon_multi_polygon()
86{
87 typedef bg::model::polygon<P> poly;
88 typedef bg::model::multi_polygon<poly> mpoly;
89
90 test_geometry<mpoly, mpoly>(case_multi_2[0], case_multi_2[1],
91 false);
92}
93
94template <typename P>
95void test_linestring_polygon()
96{
97 typedef bg::model::linestring<P> ls;
98 typedef bg::model::polygon<P> poly;
99 typedef bg::model::polygon<P> ring;
100
101 test_geometry<ls, poly>("LINESTRING(11 0,11 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", false);
102 test_geometry<ls, ring>("LINESTRING(11 0,11 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", false);
103 test_geometry<ls, poly>("LINESTRING(0 0,10 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", false);
104 test_geometry<ls, poly>("LINESTRING(5 0,5 5,10 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", false);
105 test_geometry<ls, poly>("LINESTRING(5 1,5 5,9 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", false);
106 test_geometry<ls, poly>("LINESTRING(11 1,11 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", false);
107
108 test_geometry<ls, poly>("LINESTRING(9 1,10 5,9 9)",
109 "POLYGON((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5))",
110 false);
111
112 test_geometry<ls, poly>("LINESTRING(9 1,10 5,9 9,1 9,1 1,9 1)",
113 "POLYGON((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5))",
114 false);
115
116 test_geometry<ls, poly>("LINESTRING(0 0,10 0,10 10,0 10,0 0)",
117 "POLYGON((0 0,0 10,10 10,10 0,0 0))",
118 true);
119}
120
121template <typename P>
122void test_linestring_multi_polygon()
123{
124 typedef bg::model::linestring<P> ls;
125 typedef bg::model::polygon<P> poly;
126 typedef bg::model::multi_polygon<poly> mpoly;
127
128 test_geometry<ls, mpoly>("LINESTRING(10 1,10 5,10 9)",
129 "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)))",
130 true);
131}
132
133template <typename P>
134void test_multi_linestring_polygon()
135{
136 typedef bg::model::linestring<P> ls;
137 typedef bg::model::polygon<P> poly;
138 typedef bg::model::ring<P> ring;
139 typedef bg::model::multi_linestring<ls> mls;
140
141 test_geometry<mls, poly>("MULTILINESTRING((11 11, 20 20),(5 7, 4 1))",
142 "POLYGON((0 0,0 10,10 10,10 0,0 0),(2 2,4 2,4 4,2 4,2 2))",
143 false);
144
145 test_geometry<mls, ring>("MULTILINESTRING((6 6,15 15),(0 0, 7 7))",
146 "POLYGON((5 5,5 15,15 15,15 5,5 5))",
147 false);
148
149 test_geometry<mls, poly>("MULTILINESTRING((3 10.031432746397092, 1 5, 1 10.013467818052765, 3 4, 7 8, 6 10.035925377760330, 10 2))",
150 "POLYGON((0 0,0 10,10 10,10 0,0 0))",
151 false);
152}
153
154template <typename P>
155void test_multi_linestring_multi_polygon()
156{
157 typedef bg::model::linestring<P> ls;
158 typedef bg::model::polygon<P> poly;
159 typedef bg::model::multi_linestring<ls> mls;
160 typedef bg::model::multi_polygon<poly> mpoly;
161
162 test_geometry<mls, mpoly>("MULTILINESTRING((0 0,10 0,10 10,0 10,0 0),(2 2,5 5,2 8,2 2))",
163 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(2 2,5 5,2 8,2 2)))",
164 true);
165
166 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))",
167 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
168 true);
169
170 test_geometry<mls, mpoly>("MULTILINESTRING((5 -2,4 -2,5 0),(5 -2,6 -2,5 0))",
171 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
172 false);
173}
174
175template <typename P>
176void test_linestring_linestring()
177{
178 typedef bg::model::linestring<P> ls;
179
180 test_geometry<ls, ls>("LINESTRING(0 0, 2 2, 3 2)", "LINESTRING(0 0, 2 2, 3 2)", false);
181
182 test_geometry<ls, ls>("LINESTRING(1 0,2 2,2 3)", "LINESTRING(0 0, 2 2, 3 2)", false);
183}
184
185template <typename P>
186void test_linestring_multi_linestring()
187{
188 typedef bg::model::linestring<P> ls;
189 typedef bg::model::multi_linestring<ls> mls;
190
191 test_geometry<ls, mls>("LINESTRING(0 0,10 0)",
192 "MULTILINESTRING((1 0,2 0),(1 1,2 1))",
193 false);
194
195 test_geometry<ls, mls>("LINESTRING(0 0,5 0,5 5,0 5,0 0)",
196 "MULTILINESTRING((5 5,0 5,0 0),(0 0,5 0,5 5))",
197 false);
198}
199
200template <typename P>
201void test_multi_linestring_multi_linestring()
202{
203 typedef bg::model::linestring<P> ls;
204 typedef bg::model::multi_linestring<ls> mls;
205
206 test_geometry<mls, mls>("MULTILINESTRING((0 0,0 0,18 0,18 0,19 0,19 0,19 0,30 0,30 0))",
207 "MULTILINESTRING((0 10,5 0,20 0,20 0,30 0))",
208 false);
209}
210
211
212template <typename P>
213void test_all()
214{
215 test_polygon_polygon<P>();
216 test_polygon_multi_polygon<P>();
217 test_multi_polygon_multi_polygon<P>();
218
219 test_linestring_polygon<P>();
220 test_linestring_multi_polygon<P>();
221 test_multi_linestring_polygon<P>();
222 test_multi_linestring_multi_polygon<P>();
223
224 test_linestring_linestring<P>();
225 test_linestring_multi_linestring<P>();
226 test_multi_linestring_multi_linestring<P>();
227}
228
229
230int test_main( int , char* [] )
231{
232 test_all<bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> > >();
233
7c673cae
FG
234 return 0;
235}