]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Boost.Geometry |
2 | // Unit Test | |
3 | ||
4 | // Copyright (c) 2016, Oracle and/or its affiliates. | |
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_get_turns.hpp" | |
13 | #include <boost/geometry/geometries/geometries.hpp> | |
14 | ||
15 | ||
16 | template <typename T> | |
17 | void test_all() | |
18 | { | |
19 | typedef bg::model::point<T, 2, bg::cs::spherical_equatorial<bg::degree> > pt; | |
20 | typedef bg::model::linestring<pt> ls; | |
21 | typedef bg::model::multi_linestring<ls> mls; | |
22 | ||
23 | // NOTE: currently for the first endpoint of the Linestring on collinear segment | |
24 | // is_collinear flags are set to FALSE! | |
25 | // E.g. in the first test tii++, NOT tii== | |
26 | ||
27 | test_geometry<ls, ls>("LINESTRING(0 0,2 0)", "LINESTRING(0 0,2 0)", "tii++", "txx=="); | |
28 | test_geometry<ls, ls>("LINESTRING(0 0,2 0)", "LINESTRING(2 0,0 0)", "tix+=", "txi=+"); | |
29 | ||
30 | test_geometry<ls, ls>("LINESTRING(1 0,1 1)", "LINESTRING(0 0,1 0,2 0)", "tuu++"); | |
31 | test_geometry<ls, ls>("LINESTRING(1 0,0 0)", "LINESTRING(0 0,1 0,2 0)", "txi=+", "tiu+="); | |
32 | test_geometry<ls, ls>("LINESTRING(1 0,2 0)", "LINESTRING(0 0,1 0,2 0)", "tii++", "txx=="); | |
33 | test_geometry<ls, ls>("LINESTRING(1 1,1 0)", "LINESTRING(0 0,1 0,2 0)", "txu++"); | |
34 | test_geometry<ls, ls>("LINESTRING(0 0,1 0)", "LINESTRING(0 0,1 0,2 0)", "tii++", "txu=="); | |
35 | test_geometry<ls, ls>("LINESTRING(2 0,1 0)", "LINESTRING(0 0,1 0,2 0)", "txi=+", "tix+="); | |
36 | ||
37 | test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(1 0,1 1)", "tuu++"); | |
38 | test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(1 0,0 0)", "tix+=", "tui=+"); | |
39 | test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(1 0,2 0)", "tii++", "txx=="); | |
40 | test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(1 1,1 0)", "tux++"); | |
41 | test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(0 0,1 0)", "tii++", "tux=="); | |
42 | test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(2 0,1 0)", "tix+=", "txi=+"); | |
43 | ||
44 | test_geometry<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(1 1,1 0,3 0,3 1)", "mii++", "ccc==", "muu=="); | |
45 | test_geometry<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(1 -1,1 0,3 0,3 -1)", "mii++", "ccc==", "muu=="); | |
46 | test_geometry<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(3 1,3 0,1 0,1 1)", "miu+=", "mui=+"); | |
47 | test_geometry<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(3 -1,3 0,1 0,1 -1)", "miu+=", "mui=+"); | |
48 | test_geometry<ls, ls>("LINESTRING(0 0,2 0,3 0,4 0,6 0)", "LINESTRING(2 1,2 0,4 0,4 1)", "tii++", "ccc==", "tuu=="); | |
49 | test_geometry<ls, ls>("LINESTRING(0 0,2 0,3 0,4 0,6 0)", "LINESTRING(2 -1,2 0,4 0,4 -1)", "tii++", "ccc==", "tuu=="); | |
50 | test_geometry<ls, ls>("LINESTRING(0 0,2 0,3 0,4 0,6 0)", "LINESTRING(4 1,4 0,2 0,2 1)", "tiu+=", "tui=+"); | |
51 | test_geometry<ls, ls>("LINESTRING(0 0,2 0,3 0,4 0,6 0)", "LINESTRING(4 -1,4 0,2 0,2 -1)", "tiu+=", "tui=+"); | |
52 | ||
53 | test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 1,3 5,4 0)", "LINESTRING(1 0,2 1,3 5)", "tii++", "ecc==", "tux=="); | |
54 | test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 1,3 5,4 0)", "LINESTRING(3 5,2 1,1 0)", "tix+=", "ecc==", "tui=+"); | |
55 | test_geometry<ls, ls>("LINESTRING(1 0,2 1,3 5)", "LINESTRING(0 0,1 0,2 1,3 5,4 0)", "txu==", "ecc==", "tii++"); | |
56 | test_geometry<ls, ls>("LINESTRING(3 5,2 1,1 0)", "LINESTRING(0 0,1 0,2 1,3 5,4 0)", "tiu+=", "ecc==", "txi=+"); | |
57 | ||
58 | test_geometry<ls, ls>("LINESTRING(0 0,10 0)", "LINESTRING(-1 -1,1 0,10 0,20 -1)", "mii++", "txu=="); | |
59 | test_geometry<ls, ls>("LINESTRING(0 0,10 0)", "LINESTRING(20 -1,10 0,1 0,-1 -1)", "miu+=", "txi=+"); | |
60 | test_geometry<ls, ls>("LINESTRING(-1 -1,1 0,10 0,20 -1)", "LINESTRING(0 0,10 0)", "mii++", "tux=="); | |
61 | test_geometry<ls, ls>("LINESTRING(20 -1,10 0,1 0,-1 -1)", "LINESTRING(0 0,10 0)", "mui=+", "tix+="); | |
62 | ||
63 | test_geometry<ls, ls>("LINESTRING(-1 1,0 0,1 0,4 0,5 5,10 5,15 0,31 0)", | |
64 | "LINESTRING(-1 -1,0 0,1 0,2 0,2.5 1,3 0,30 0)", | |
65 | expected("tii++")("ecc==")("muu==")("mii++")("muu==")("mii++")("mux==")); | |
66 | test_geometry<ls, ls>("LINESTRING(-1 1,0 0,1 0,4 0,5 5,10 5,15 0,31 0)", | |
67 | "LINESTRING(30 0,3 0,2.5 1,2 0,1 0,0 0,-1 -1)", | |
68 | expected("tiu+=")("ecc==")("mui=+")("miu+=")("mui=+")("miu+=")("mui=+")); | |
69 | test_geometry<ls, ls>("LINESTRING(31 0,15 0,10 5,5 5,4 0,1 0,0 0,-1 1)", | |
70 | "LINESTRING(-1 -1,0 0,1 0,2 0,2.5 1,3 0,30 0)", | |
71 | expected("tui=+")("ecc==")("miu+=")("mui=+")("miu+=")("mui=+")("mix+=")); | |
72 | test_geometry<ls, ls>("LINESTRING(31 0,15 0,10 5,5 5,4 0,1 0,0 0,-1 1)", | |
73 | "LINESTRING(30 0,3 0,2.5 1,2 0,1 0,0 0,-1 -1)", | |
74 | expected("tuu==")("ecc==")("mii++")("muu==")("mii++")("muu==")("mii++")); | |
75 | ||
92f5a8d4 TL |
76 | if (BOOST_GEOMETRY_CONDITION((boost::is_same<T, double>::value))) |
77 | { | |
78 | test_geometry<ls, ls>("LINESTRING(-1 0,1 0,2 1.0004570537241201524198894179384922,3 2)", | |
79 | "LINESTRING(4 5,3 2,1 0,0 0)", | |
80 | "mix+=", "txi=+", "ecc=="); | |
81 | test_geometry<ls, ls>("LINESTRING(4 5,3 2,1 0,0 0)", | |
82 | "LINESTRING(-1 0,1 0,2 1.0004570537241201524198894179384922,3 2)", | |
83 | "mxi=+", "tix+=", "ecc=="); | |
84 | } | |
7c673cae FG |
85 | |
86 | test_geometry<ls, ls>("LINESTRING(30 0,20 0,1 1,-1 -1)", "LINESTRING(0 -1,0 0,1 -1,20 0,25 0)", "mix+=", "tui=+", "muu++"); | |
87 | test_geometry<ls, ls>("LINESTRING(0 -1,0 0,1 -1,20 0,25 0)", "LINESTRING(30 0,20 0,1 1,-1 -1)", "mxi=+", "tiu+=", "muu++"); | |
88 | ||
89 | test_geometry<ls, ls>("LINESTRING(0 0,30 0)", "LINESTRING(4 0,4 1,20 1,5 0,1 0)", "muu++", "mui=+", "mix+="); | |
90 | test_geometry<ls, ls>("LINESTRING(4 0,4 1,20 1,5 0,1 0)", "LINESTRING(0 0,30 0)", "muu++", "miu+=", "mxi=+"); | |
91 | ||
92 | test_geometry<ls, ls>("LINESTRING(30 0,0 0)", "LINESTRING(1 0,5 0,20 1,4 1,4 0,5 0)", | |
93 | expected("mui=+")("miu+=")("mui=+")("mix+=")); | |
94 | test_geometry<ls, ls>("LINESTRING(1 0,5 0,20 1,4 1,4 0,5 0)", "LINESTRING(30 0,0 0)", | |
95 | expected("miu+=")("mui=+")("miu+=")("mxi=+")); | |
96 | ||
97 | test_geometry<ls, ls>("LINESTRING(1 0,7 0,8 1)", "LINESTRING(0 0,10 0,10 10,4 -1)", | |
98 | expected("mii++")("iuu++")("muu==")); | |
99 | test_geometry<ls, ls>("LINESTRING(1 0,7 0,8 1)", "LINESTRING(0 0,10 0,10 10,5 0,4 1)", | |
100 | expected("mii++")("muu++")("muu==")); | |
101 | ||
102 | // non-collinear | |
103 | test_geometry<ls, ls>("LINESTRING(0 1,0 0)", "LINESTRING(0 0,1 0,2 0)", "txu++"); | |
104 | test_geometry<ls, ls>("LINESTRING(0 1,0 0,1 1)", "LINESTRING(0 0,1 0,2 0)", "tuu++"); | |
105 | test_geometry<ls, ls>("LINESTRING(0 1,1 0,2 1)", "LINESTRING(0 0,1 0,2 0)", "tuu++"); | |
106 | ||
107 | // SPIKE - NON-ENDPOINT - NON-OPPOSITE | |
108 | ||
109 | // spike - neq eq | |
110 | test_geometry<ls, ls>("LINESTRING(0 2,0 4,0 1)", "LINESTRING(0 0,0 4,6 3)", | |
111 | expected("mii++")("txu==")("tiu==")("mxi=+")); | |
112 | // spike - eq eq | |
113 | test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 1)", "LINESTRING(0 0,0 4,6 3)", | |
114 | expected("tii++")("txu==")("tiu==")("mxi=+")); | |
115 | // spike - eq neq | |
116 | test_geometry<ls, ls>("LINESTRING(0 0,0 3,0 1)", "LINESTRING(0 0,0 4,6 3)", | |
117 | expected("tii++")("mxu==")("miu==")("mxi=+")); | |
118 | // spike - neq neq | |
119 | test_geometry<ls, ls>("LINESTRING(0 1,0 3,0 2)", "LINESTRING(0 0,0 4,6 3)", | |
120 | expected("mii++")("mxu==")("miu==")("mxi=+")); | |
121 | // spike - out neq | |
122 | test_geometry<ls, ls>("LINESTRING(0 0,0 3,0 2)", "LINESTRING(0 1,0 4,6 3)", | |
123 | expected("mii++")("mxu==")("miu==")("mxi=+")); | |
124 | // spike - out eq | |
125 | test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 2)", "LINESTRING(0 1,0 4,6 3)", | |
126 | expected("mii++")("txu==")("tiu==")("mxi=+")); | |
127 | // spike - out out/eq | |
128 | test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 2)", "LINESTRING(1 0,0 4,6 3)", | |
129 | expected("tuu++")); | |
130 | test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 2)", "LINESTRING(-1 0,0 4,6 3)", | |
131 | expected("tuu++")); | |
132 | // spike - out out/neq | |
133 | test_geometry<ls, ls>("LINESTRING(0 -2,0 0,0 -1)", "LINESTRING(-1 0,1 0,6 3)", | |
134 | expected("muu++")); | |
135 | test_geometry<ls, ls>("LINESTRING(0 -2,0 0,0 -1)", "LINESTRING(-1 0,1 0,6 3)", | |
136 | expected("muu++")); | |
137 | ||
138 | // SPIKE - NON-ENDPOINT - OPPOSITE | |
139 | ||
140 | // opposite - eq eq | |
141 | test_geometry<ls, ls>("LINESTRING(0 6,0 4,0 0,0 2)", "LINESTRING(0 -1,0 0,0 4,6 3)", | |
142 | expected("tiu+=")("txi=+")("tii=+")("mxu==")); | |
143 | test_geometry<ls, ls>("LINESTRING(0 -1,0 0,0 4,6 3)", "LINESTRING(0 6,0 4,0 0,0 2)", | |
144 | expected("tui=+")("tix+=")("tii+=")("mux==")); | |
145 | // opposite - neq eq | |
146 | test_geometry<ls, ls>("LINESTRING(0 6,0 4,0 0,0 2)", "LINESTRING(0 -1,0 0,0 5,6 3)", | |
147 | expected("miu+=")("txi=+")("tii=+")("mxu==")); | |
148 | // opposite - eq neq | |
149 | test_geometry<ls, ls>("LINESTRING(0 6,0 4,0 0,0 2)", "LINESTRING(0 -2,0 -1,0 4,6 3)", | |
150 | expected("tiu+=")("mxi=+")("mii=+")("mxu==")); | |
151 | // opposite - neq neq | |
152 | test_geometry<ls, ls>("LINESTRING(0 6,0 4,0 0,0 2)", "LINESTRING(0 -2,0 -1,0 3,6 3)", | |
153 | expected("miu+=")("mxi=+")("mii=+")("mxu==")); | |
154 | // opposite - neq neq | |
155 | test_geometry<ls, ls>("LINESTRING(0 6,0 4,0 0,0 2)", "LINESTRING(0 -2,0 -1,0 3,0 5,6 3)", | |
156 | expected("miu+=")("mxi=+")("mii=+")("mxu==")); | |
157 | // opposite - neq eq | |
158 | test_geometry<ls, ls>("LINESTRING(6 3,0 3,0 0)", "LINESTRING(0 0,0 2,0 3,0 1)", | |
159 | expected("txi=+")("tix+=")("tii+=")("mux==")); | |
160 | ||
161 | // SPIKE - ENDPOINT - NON-OPPOSITE | |
162 | ||
163 | // spike - neq eq | |
164 | test_geometry<ls, ls>("LINESTRING(0 2,0 4,0 1)", "LINESTRING(0 0,0 4)", | |
165 | expected("mii++")("txx==")("tix==")("mxi=+")); | |
166 | test_geometry<ls, ls>("LINESTRING(0 2,0 4,0 1)", "LINESTRING(0 4,0 0)", | |
167 | expected("miu+=")("txi=+")("tii=+")("mxu==")); | |
168 | // spike - eq eq | |
169 | test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 1)", "LINESTRING(0 0,0 4)", | |
170 | expected("tii++")("txx==")("tix==")("mxi=+")); | |
171 | test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 1)", "LINESTRING(0 4,0 0)", | |
172 | expected("tix+=")("txi=+")("tii=+")("mxu==")); | |
173 | // spike - eq neq | |
174 | test_geometry<ls, ls>("LINESTRING(0 0,0 3,0 1)", "LINESTRING(0 0,0 4)", | |
175 | expected("tii++")("mxu==")("miu==")("mxi=+")); | |
176 | test_geometry<ls, ls>("LINESTRING(0 0,0 3,0 1)", "LINESTRING(0 4,0 0)", | |
177 | expected("tix+=")("mxi=+")("mii=+")("mxu==")); | |
178 | // spike - neq neq | |
179 | test_geometry<ls, ls>("LINESTRING(0 1,0 3,0 2)", "LINESTRING(0 0,0 4)", | |
180 | expected("mii++")("mxu==")("miu==")("mxi=+")); | |
181 | test_geometry<ls, ls>("LINESTRING(0 1,0 3,0 2)", "LINESTRING(0 4,0 0)", | |
182 | expected("miu+=")("mxi=+")("mii=+")("mxu==")); | |
183 | // spike - out neq | |
184 | test_geometry<ls, ls>("LINESTRING(0 0,0 3,0 2)", "LINESTRING(0 1,0 4)", | |
185 | expected("mii++")("mxu==")("miu==")("mxi=+")); | |
186 | test_geometry<ls, ls>("LINESTRING(0 0,0 3,0 2)", "LINESTRING(0 4,0 1)", | |
187 | expected("mix+=")("mxi=+")("mii=+")("mxu==")); | |
188 | // spike - out eq | |
189 | test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 2)", "LINESTRING(0 1,0 4)", | |
190 | expected("mii++")("txx==")("tix==")("mxi=+")); | |
191 | test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 2)", "LINESTRING(0 4,0 1)", | |
192 | expected("mix+=")("txi=+")("tii=+")("mxu==")); | |
193 | // spike - out out/eq | |
194 | test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 2)", "LINESTRING(1 0,0 4)", | |
195 | expected("tux++")); | |
196 | test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 2)", "LINESTRING(-1 0,0 4)", | |
197 | expected("tux++")); | |
198 | // spike - out out/neq | |
199 | test_geometry<ls, ls>("LINESTRING(0 -2,0 0,0 -1)", "LINESTRING(-1 0,1 0)", | |
200 | expected("muu++")); | |
201 | test_geometry<ls, ls>("LINESTRING(0 -2,0 0,0 -1)", "LINESTRING(1 0,-1 0)", | |
202 | expected("muu++")); | |
203 | ||
204 | ||
205 | test_geometry<ls, ls>("LINESTRING(3 0,0 0)", | |
206 | "LINESTRING(4 2,1 0,9 0)", | |
207 | expected("mui=+")("miu+=")); | |
208 | ||
209 | ||
210 | // 01.02.2015 | |
211 | test_geometry<ls, ls>("LINESTRING(6 0,0 0,5 0)", | |
212 | "LINESTRING(2 0,0 0,-10 0)", | |
213 | expected("mii++")("txu==")("tiu==")("mui=+")); | |
214 | // the reversal could be automatic... | |
215 | test_geometry<ls, ls>("LINESTRING(2 0,0 0,-10 0)", | |
216 | "LINESTRING(6 0,0 0,5 0)", | |
217 | expected("mii++")("tux==")("tui==")("miu+=")); | |
218 | // sanity check | |
219 | test_geometry<ls, ls>("LINESTRING(6 0,0 0)", | |
220 | "LINESTRING(2 0,0 0,-10 0)", | |
221 | expected("mii++")("txu==")); | |
222 | test_geometry<ls, ls>("LINESTRING(0 0,5 0)", | |
223 | "LINESTRING(2 0,0 0,-10 0)", | |
224 | expected("tiu+=")("mui=+")); | |
225 | ||
226 | if ( BOOST_GEOMETRY_CONDITION((boost::is_same<T, double>::value)) ) | |
227 | { | |
228 | test_geometry<ls, ls>("LINESTRING(0 -1, 10 -1, 20 1)", | |
229 | "LINESTRING(12 10, 12.5 -0.50051443471392, 15 0, 17.5 0.50051443471392)", | |
230 | expected("mii++")("ccc==")("mux==")); | |
231 | test_geometry<ls, ls>("LINESTRING(0 -1, 10 -1, 20 1)", | |
232 | "LINESTRING(17.5 0.50051443471392, 15 0, 12.5 -0.50051443471392, 12 10)", | |
233 | expected("miu+=")("mui=+")); | |
234 | test_geometry<ls, ls>("LINESTRING(20 1, 10 -1, 0 -1)", | |
235 | "LINESTRING(12 10, 12.5 -0.50051443471392, 15 0, 17.5 0.50051443471392)", | |
236 | expected("mui=+")("mix+=")); | |
237 | test_geometry<ls, ls>("LINESTRING(20 1, 10 -1, 0 0)", | |
238 | "LINESTRING(17.5 0.50051443471392, 15 0, 12.5 -0.50051443471392, 12 10)", | |
239 | expected("muu==")("ccc==")("mii++")); | |
240 | ||
241 | test_geometry<ls, ls>("LINESTRING(0 -1, 10 -1, 20 1)", | |
242 | "LINESTRING(12.5 -0.50051443471392, 15 0, 17.5 0.50051443471392)", | |
243 | expected("mii++")("ccc==")("mux==")); | |
244 | test_geometry<ls, ls>("LINESTRING(0 -1, 10 -1, 20 1)", | |
245 | "LINESTRING(17.5 0.50051443471392, 15 0, 12.5 -0.50051443471392)", | |
246 | expected("mix+=")("mui=+")); | |
247 | test_geometry<ls, ls>("LINESTRING(20 1, 10 -1, 0 -1)", | |
248 | "LINESTRING(12.5 -0.50051443471392, 15 0, 17.5 0.50051443471392)", | |
249 | expected("mui=+")("mix+=")); | |
250 | test_geometry<ls, ls>("LINESTRING(20 1, 10 -1, 0 -1)", | |
251 | "LINESTRING(17.5 0.50051443471392, 15 0, 12.5 -0.50051443471392)", | |
252 | expected("mux==")("ccc==")("mii++")); | |
253 | ||
254 | test_geometry<ls, ls>("LINESTRING(0 -1, 10 -1, 20 1)", | |
255 | "LINESTRING(12 10, 12.5 -0.50051443471392, 15 0)", | |
256 | expected("mii++")("mux==")); | |
257 | test_geometry<ls, ls>("LINESTRING(0 -1, 10 -1, 20 1)", | |
258 | "LINESTRING(15 0, 12.5 -0.50051443471392, 12 10)", | |
259 | expected("miu+=")("mui=+")); | |
260 | test_geometry<ls, ls>("LINESTRING(20 1, 10 -1, 0 -1)", | |
261 | "LINESTRING(12 10, 12.5 -0.50051443471392, 15 0)", | |
262 | expected("mui=+")("mix+=")); | |
263 | test_geometry<ls, ls>("LINESTRING(20 1, 10 -1, 0 -1)", | |
264 | "LINESTRING(15 0, 12.5 -0.50051443471392, 12 10)", | |
265 | expected("muu==")("mii++")); | |
266 | } | |
267 | ||
268 | // TODO: | |
269 | //test_geometry<ls, ls>("LINESTRING(0 0,2 0,1 0)", "LINESTRING(0 1,0 0,2 0)", "1FF00F102"); | |
270 | //test_geometry<ls, ls>("LINESTRING(2 0,0 0,1 0)", "LINESTRING(0 1,0 0,2 0)", "1FF00F102"); | |
271 | ||
272 | //test_geometry<ls, ls>("LINESTRING(0 0,3 3,1 1)", "LINESTRING(3 0,3 3,3 1)", "0F1FF0102"); | |
273 | //test_geometry<ls, ls>("LINESTRING(0 0,3 3,1 1)", "LINESTRING(2 0,2 3,2 1)", "0F1FF0102"); | |
274 | //test_geometry<ls, ls>("LINESTRING(0 0,3 3,1 1)", "LINESTRING(2 0,2 2,2 1)", "0F1FF0102"); | |
275 | ||
276 | //test_geometry<ls, ls>("LINESTRING(0 0,2 2,3 3,4 4)", "LINESTRING(0 0,1 1,4 4)", "1FFF0FFF2"); | |
277 | ||
278 | ||
279 | //if ( boost::is_same<T, double>::value ) | |
280 | //{ | |
281 | // to_svg<ls, ls>("LINESTRING(0 0,1 0,2 0,2.5 0,3 1)", "LINESTRING(0 0,2 0,2.5 0,3 1)", "test11.svg"); | |
282 | // to_svg<ls, ls>("LINESTRING(0 0,1 0,2 0,2.5 0,3 1)", "LINESTRING(3 1,2.5 0,2 0,0 0)", "test12.svg"); | |
283 | // to_svg<ls, ls>("LINESTRING(-1 1,0 0,1 0,4 0,5 5,10 5,15 0,20 0,30 0,31 1)", "LINESTRING(30 0,3 0,2.5 1,2 0,1 0,0 0,-1 -1)", "test21.svg"); | |
284 | // to_svg<ls, ls>("LINESTRING(-1 1,0 0,1 0,4 0,5 5,10 5,15 0,20 0,30 0,31 1)", "LINESTRING(-1 -1,0 0,1 0,2 0,2.5 1,3 0,30 0)", "test22.svg"); | |
285 | ||
286 | // to_svg<ls, ls>("LINESTRING(-1 1,0 0,1 0,4 0,5 5,10 5,15 0,31 0)", "LINESTRING(-1 -1,0 0,1 0,2 0,2.5 1,3 0,30 0)", "test31.svg"); | |
287 | // to_svg<ls, ls>("LINESTRING(-1 1,0 0,1 0,4 0,5 5,10 5,15 0,31 0)", "LINESTRING(30 0,3 0,2.5 1,2 0,1 0,0 0,-1 -1)", "test32.svg"); | |
288 | // to_svg<ls, ls>("LINESTRING(31 0,15 0,10 5,5 5,4 0,1 0,0 0,-1 1)", "LINESTRING(-1 -1,0 0,1 0,2 0,2.5 1,3 0,30 0)", "test33.svg"); | |
289 | // to_svg<ls, ls>("LINESTRING(31 0,15 0,10 5,5 5,4 0,1 0,0 0,-1 1)", "LINESTRING(30 0,3 0,2.5 1,2 0,1 0,0 0,-1 -1)", "test34.svg"); | |
290 | //} | |
291 | ||
292 | // duplicated | |
293 | test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0,30 0))", | |
294 | "MULTILINESTRING((0 10,5 0,20 0,20 0,30 0),(2 0,2 0),(3 0,3 0,3 0))", | |
295 | expected("mii++")("ccc==")("ccc==")("txx==")); | |
296 | ||
297 | // spike | |
298 | test_geometry<ls, ls>("LINESTRING(2 2,5 -1,15 2,18 0,20 0)", | |
299 | "LINESTRING(30 0,19 0,18 0,0 0)", | |
300 | expected("iuu++")("iuu++")("tiu+=")("mxi=+")); | |
301 | // spike | |
302 | test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0,5 0))", | |
303 | "MULTILINESTRING((1 0,8 0,4 0))", | |
304 | expected("mii++")("mix+=")("mux==")("mui==")("mix+=")("mii+=")("mxu==")("mxi=+")); | |
305 | ||
306 | /*test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0,5 0))", | |
307 | "MULTILINESTRING((1 0,8 0,4 0),(2 0,9 0,5 0))", | |
308 | expected("mii")("ccc")("ccc")("txx"));*/ | |
309 | ||
310 | // spike vs endpoint | |
311 | test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0))", | |
312 | "MULTILINESTRING((-1 0,0 0,-2 0),(11 0,10 0,12 0))", | |
313 | expected("tuu++")("txu++")); | |
314 | // internal turning R vs spike | |
315 | test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,2 1))", | |
316 | "MULTILINESTRING((0 1,1 1,0 1))", | |
317 | expected("tuu++")); | |
318 | test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,2 1))", | |
319 | "MULTILINESTRING((1 2,1 1,1 2))", | |
320 | expected("tuu++")); | |
321 | test_geometry<mls, mls>("MULTILINESTRING((0 0,1 0,0 0))", | |
322 | "MULTILINESTRING((2 0,1 0,2 0))", | |
323 | expected("tuu++")); | |
324 | test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,2 1))", | |
325 | "MULTILINESTRING((0 2,1 1,0 2))", | |
326 | expected("tuu++")); | |
327 | test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,2 1))", | |
328 | "MULTILINESTRING((2 0,1 1,2 0))", | |
329 | expected("tuu++")); | |
330 | test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,2 1))", | |
331 | "MULTILINESTRING((2 1,1 1,2 1))", | |
332 | expected("txi=+")("tix+=")("tii+=")("txx==")); | |
333 | // internal turning L vs spike | |
334 | test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,0 1))", | |
335 | "MULTILINESTRING((2 1,1 1,2 1))", | |
336 | expected("tuu++")); | |
337 | test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,0 1))", | |
338 | "MULTILINESTRING((1 2,1 1,1 2))", | |
339 | expected("tuu++")); | |
340 | test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,0 1))", | |
341 | "MULTILINESTRING((2 2,1 1,2 2))", | |
342 | expected("tuu++")); | |
343 | test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,0 1))", | |
344 | "MULTILINESTRING((0 0,1 1,0 0))", | |
345 | expected("tuu++")); | |
346 | test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,0 1))", | |
347 | "MULTILINESTRING((0 1,1 1,0 1))", | |
348 | expected("txi=+")("tix+=")("tii+=")("txx==")); | |
349 | // spike vs internal turning R | |
350 | test_geometry<mls, mls>("MULTILINESTRING((0 1,1 1,0 1))", | |
351 | "MULTILINESTRING((1 0,1 1,2 1))", | |
352 | expected("tuu++")); | |
353 | test_geometry<mls, mls>("MULTILINESTRING((1 2,1 1,1 2))", | |
354 | "MULTILINESTRING((1 0,1 1,2 1))", | |
355 | expected("tuu++")); | |
356 | test_geometry<mls, mls>("MULTILINESTRING((2 0,1 0,2 0))", | |
357 | "MULTILINESTRING((0 0,1 0,0 0))", | |
358 | expected("tuu++")); | |
359 | test_geometry<mls, mls>("MULTILINESTRING((0 2,1 1,0 2))", | |
360 | "MULTILINESTRING((1 0,1 1,2 1))", | |
361 | expected("tuu++")); | |
362 | test_geometry<mls, mls>("MULTILINESTRING((2 0,1 1,2 0))", | |
363 | "MULTILINESTRING((1 0,1 1,2 1))", | |
364 | expected("tuu++")); | |
365 | test_geometry<mls, mls>("MULTILINESTRING((2 1,1 1,2 1))", | |
366 | "MULTILINESTRING((1 0,1 1,2 1))", | |
367 | expected("tix+=")("txi=+")("tii=+")("txx==")); | |
368 | // spike vs internal turning L | |
369 | test_geometry<mls, mls>("MULTILINESTRING((2 1,1 1,2 1))", | |
370 | "MULTILINESTRING((1 0,1 1,0 1))", | |
371 | expected("tuu++")); | |
372 | test_geometry<mls, mls>("MULTILINESTRING((1 2,1 1,1 2))", | |
373 | "MULTILINESTRING((1 0,1 1,0 1))", | |
374 | expected("tuu++")); | |
375 | test_geometry<mls, mls>("MULTILINESTRING((2 2,1 1,2 2))", | |
376 | "MULTILINESTRING((1 0,1 1,0 1))", | |
377 | expected("tuu++")); | |
378 | test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))", | |
379 | "MULTILINESTRING((1 0,1 1,0 1))", | |
380 | expected("tuu++")); | |
381 | test_geometry<mls, mls>("MULTILINESTRING((0 1,1 1,0 1))", | |
382 | "MULTILINESTRING((1 0,1 1,0 1))", | |
383 | expected("tix+=")("txi=+")("tii=+")("txx==")); | |
384 | // spike vs internal collinear | |
385 | test_geometry<mls, mls>("MULTILINESTRING((0 1,1 1,0 1))", | |
386 | "MULTILINESTRING((2 1,1 1,0 1))", | |
387 | expected("tix+=")("txi=+")("tii=+")("txx==")); | |
388 | // internal collinear vs spike | |
389 | test_geometry<mls, mls>("MULTILINESTRING((2 1,1 1,0 1))", | |
390 | "MULTILINESTRING((0 1,1 1,0 1))", | |
391 | expected("txi=+")("tix+=")("tii+=")("txx==")); | |
392 | // spike vs spike | |
393 | test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))", | |
394 | "MULTILINESTRING((2 2,1 1,2 2))", | |
395 | expected("tuu++")); | |
396 | test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))", | |
397 | "MULTILINESTRING((2 0,1 1,2 0))", | |
398 | expected("tuu++")); | |
399 | test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))", | |
400 | "MULTILINESTRING((2 1,1 1,2 1))", | |
401 | expected("tuu++")); | |
402 | test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))", | |
403 | "MULTILINESTRING((0 1,1 1,0 1))", | |
404 | expected("tuu++")); | |
405 | // collinear spikes | |
406 | test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))", | |
407 | "MULTILINESTRING((0 0,1 1,0 0))", | |
408 | expected("tii++")("tix+=")("txi=+")("txx==") | |
409 | ("ecc==")); | |
410 | test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))", | |
411 | "MULTILINESTRING((1 1,0 0,1 1))", | |
412 | expected("tix+=")("tii+=")("txx==")("txi==") | |
413 | ("txi=+")("tii=+")("txx==")("tix==")); | |
414 | // non-spike similar | |
415 | test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0))", | |
416 | "MULTILINESTRING((-1 0,0 0,2 0))", | |
417 | expected("tii++")("mux==")); | |
418 | test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0))", | |
419 | "MULTILINESTRING((-1 -1,0 0,2 0))", | |
420 | expected("tii++")("mux==")); | |
421 | test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0))", | |
422 | "MULTILINESTRING((2 0,0 0,-1 0))", | |
423 | expected("tiu+=")("mui=+")); | |
424 | test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0))", | |
425 | "MULTILINESTRING((2 0,0 0,-1 -1))", | |
426 | expected("tiu+=")("mui=+")); | |
427 | } | |
428 | ||
429 | int test_main(int, char* []) | |
430 | { | |
431 | test_all<float>(); | |
432 | test_all<double>(); | |
433 | ||
434 | #if ! defined(_MSC_VER) | |
435 | test_all<long double>(); | |
436 | #endif | |
437 | ||
438 | #if defined(HAVE_TTMATH) | |
439 | test_all<ttmath_big>(); | |
440 | #endif | |
441 | return 0; | |
442 | } |