1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2014-2015, Oracle and/or its affiliates.
4
5 // Licensed under the Boost Software License version 1.0.
6 // http://www.boost.org/users/license.html
7
8 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
9
10 #include <iostream>
11
12 #ifndef BOOST_TEST_MODULE
13 #define BOOST_TEST_MODULE test_difference_pointlike_pointlike
14 #endif
15
16 #ifdef BOOST_GEOMETRY_TEST_DEBUG
17 #define BOOST_GEOMETRY_DEBUG_TURNS
18 #define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER
19 #endif
20
21 #include <boost/test/included/unit_test.hpp>
22
23 #include "../test_set_ops_pointlike.hpp"
24
25 #include <boost/geometry/geometries/multi_point.hpp>
26
27 typedef bg::model::point<double,2,bg::cs::cartesian> point_type;
28 typedef bg::model::multi_point<point_type> multi_point_type;
29
30
31
32 //===========================================================================
33 //===========================================================================
34 //===========================================================================
35
36
BOOST_AUTO_TEST_CASE(test_difference_point_point)37 BOOST_AUTO_TEST_CASE( test_difference_point_point )
38 {
39 #ifdef BOOST_GEOMETRY_TEST_DEBUG
40 std::cout << std::endl << std::endl << std::endl;
41 std::cout << "*** POINT / POINT DIFFERENCE ***" << std::endl;
42 std::cout << std::endl;
43 #endif
44
45 typedef point_type P;
46 typedef multi_point_type MP;
47
48 typedef test_set_op_of_pointlike_geometries
49 <
50 P, P, MP, bg::overlay_difference
51 > tester;
52
53 tester::apply
54 ("ppdf01",
55 from_wkt<P>("POINT(0 0)"),
56 from_wkt<P>("POINT(1 1)"),
57 from_wkt<MP>("MULTIPOINT(0 0)"),
58 from_wkt<MP>("MULTIPOINT(1 1)")
59 );
60
61 tester::apply
62 ("ppdf02",
63 from_wkt<P>("POINT(0 0)"),
64 from_wkt<P>("POINT(0 0)"),
65 from_wkt<MP>("MULTIPOINT()")
66 );
67 }
68
69
BOOST_AUTO_TEST_CASE(test_difference_multipoint_point)70 BOOST_AUTO_TEST_CASE( test_difference_multipoint_point )
71 {
72 #ifdef BOOST_GEOMETRY_TEST_DEBUG
73 std::cout << std::endl << std::endl << std::endl;
74 std::cout << "*** MULTIPOINT / POINT DIFFERENCE ***" << std::endl;
75 std::cout << std::endl;
76 #endif
77
78 typedef point_type P;
79 typedef multi_point_type MP;
80
81 typedef test_set_op_of_pointlike_geometries
82 <
83 MP, P, MP, bg::overlay_difference
84 > tester;
85
86 tester::apply
87 ("mppdf01",
88 from_wkt<MP>("MULTIPOINT(0 0)"),
89 from_wkt<P>("POINT(1 1)"),
90 from_wkt<MP>("MULTIPOINT(0 0)"),
91 from_wkt<MP>("MULTIPOINT(1 1)")
92 );
93
94 tester::apply
95 ("mppdf02",
96 from_wkt<MP>("MULTIPOINT(0 0)"),
97 from_wkt<P>("POINT(0 0)"),
98 from_wkt<MP>("MULTIPOINT()")
99 );
100
101 tester::apply
102 ("mppdf03",
103 from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
104 from_wkt<P>("POINT(1 1)"),
105 from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
106 from_wkt<MP>("MULTIPOINT(1 1)")
107 );
108
109 tester::apply
110 ("mppdf04",
111 from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
112 from_wkt<P>("POINT(0 0)"),
113 from_wkt<MP>("MULTIPOINT()")
114 );
115
116 tester::apply
117 ("mppdf05",
118 from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
119 from_wkt<P>("POINT(1 1)"),
120 from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
121 from_wkt<MP>("MULTIPOINT(1 1)")
122 );
123
124 tester::apply
125 ("mppdf06",
126 from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
127 from_wkt<P>("POINT(1 0)"),
128 from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
129 from_wkt<MP>("MULTIPOINT()")
130 );
131
132 tester::apply
133 ("mppdf07",
134 from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
135 from_wkt<P>("POINT(0 0)"),
136 from_wkt<MP>("MULTIPOINT(1 0)"),
137 from_wkt<MP>("MULTIPOINT()")
138 );
139
140 tester::apply
141 ("mppdf08",
142 from_wkt<MP>("MULTIPOINT()"),
143 from_wkt<P>("POINT(0 0)"),
144 from_wkt<MP>("MULTIPOINT()"),
145 from_wkt<MP>("MULTIPOINT(0 0)")
146 );
147 }
148
149
BOOST_AUTO_TEST_CASE(test_difference_point_multipoint)150 BOOST_AUTO_TEST_CASE( test_difference_point_multipoint )
151 {
152 #ifdef BOOST_GEOMETRY_TEST_DEBUG
153 std::cout << std::endl << std::endl << std::endl;
154 std::cout << "*** POINT / MULTIPOINT DIFFERENCE ***" << std::endl;
155 std::cout << std::endl;
156 #endif
157
158 typedef point_type P;
159 typedef multi_point_type MP;
160
161 typedef test_set_op_of_pointlike_geometries
162 <
163 P, MP, MP, bg::overlay_difference
164 > tester;
165
166 tester::apply
167 ("pmpdf01",
168 from_wkt<P>("POINT(0 0)"),
169 from_wkt<MP>("MULTIPOINT(1 0,1 1,1 1)"),
170 from_wkt<MP>("MULTIPOINT(0 0)"),
171 from_wkt<MP>("MULTIPOINT(1 0,1 1,1 1)")
172 );
173
174 tester::apply
175 ("pmpdf02",
176 from_wkt<P>("POINT(0 0)"),
177 from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)"),
178 from_wkt<MP>("MULTIPOINT()"),
179 from_wkt<MP>("MULTIPOINT(1 0,1 1)")
180 );
181
182 tester::apply
183 ("pmpdf03",
184 from_wkt<P>("POINT(0 0)"),
185 from_wkt<MP>("MULTIPOINT()"),
186 from_wkt<MP>("MULTIPOINT(0 0)"),
187 from_wkt<MP>("MULTIPOINT()")
188 );
189 }
190
191
BOOST_AUTO_TEST_CASE(test_difference_multipoint_multipoint)192 BOOST_AUTO_TEST_CASE( test_difference_multipoint_multipoint )
193 {
194 #ifdef BOOST_GEOMETRY_TEST_DEBUG
195 std::cout << std::endl << std::endl << std::endl;
196 std::cout << "*** MULTIPOINT / MULTIPOINT DIFFERENCE ***" << std::endl;
197 std::cout << std::endl;
198 #endif
199
200 typedef multi_point_type MP;
201
202 typedef test_set_op_of_pointlike_geometries
203 <
204 MP, MP, MP, bg::overlay_difference
205 > tester;
206
207 tester::apply
208 ("mpmpdf01",
209 from_wkt<MP>("MULTIPOINT(2 2,3 3,0 0,0 0,2 2,1 1,1 1,1 0,1 0)"),
210 from_wkt<MP>("MULTIPOINT(1 0,1 1,1 1,4 4)"),
211 from_wkt<MP>("MULTIPOINT(2 2,3 3,0 0,0 0,2 2)"),
212 from_wkt<MP>("MULTIPOINT(4 4)")
213 );
214
215 tester::apply
216 ("mpmpdf02",
217 from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
218 from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)"),
219 from_wkt<MP>("MULTIPOINT()")
220 );
221
222 tester::apply
223 ("mpmpdf03",
224 from_wkt<MP>("MULTIPOINT()"),
225 from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)"),
226 from_wkt<MP>("MULTIPOINT()"),
227 from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)")
228 );
229
230 tester::apply
231 ("mpmpdf04",
232 from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
233 from_wkt<MP>("MULTIPOINT()"),
234 from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
235 from_wkt<MP>("MULTIPOINT()")
236 );
237
238 tester::apply
239 ("mpmpdf05",
240 from_wkt<MP>("MULTIPOINT()"),
241 from_wkt<MP>("MULTIPOINT()"),
242 from_wkt<MP>("MULTIPOINT()")
243 );
244 }
245