]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/set_operations/union/union_pl_pl.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / set_operations / union / union_pl_pl.cpp
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_union_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
37 BOOST_AUTO_TEST_CASE( test_union_point_point )
38 {
39 #ifdef BOOST_GEOMETRY_TEST_DEBUG
40 std::cout << std::endl << std::endl << std::endl;
41 std::cout << "*** POINT / POINT UNION ***" << 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_union
51 > tester;
52
53 tester::apply
54 ("ppu01",
55 from_wkt<P>("POINT(0 0)"),
56 from_wkt<P>("POINT(1 1)"),
57 from_wkt<MP>("MULTIPOINT(0 0,1 1)")
58 );
59
60 tester::apply
61 ("ppu02",
62 from_wkt<P>("POINT(0 0)"),
63 from_wkt<P>("POINT(0 0)"),
64 from_wkt<MP>("MULTIPOINT(0 0)")
65 );
66 }
67
68
69 BOOST_AUTO_TEST_CASE( test_union_multipoint_point )
70 {
71 #ifdef BOOST_GEOMETRY_TEST_DEBUG
72 std::cout << std::endl << std::endl << std::endl;
73 std::cout << "*** MULTIPOINT / POINT UNION ***" << std::endl;
74 std::cout << std::endl;
75 #endif
76
77 typedef point_type P;
78 typedef multi_point_type MP;
79
80 typedef test_set_op_of_pointlike_geometries
81 <
82 MP, P, MP, bg::overlay_union
83 > tester;
84
85 tester::apply
86 ("mppu01",
87 from_wkt<MP>("MULTIPOINT(0 0)"),
88 from_wkt<P>("POINT(1 1)"),
89 from_wkt<MP>("MULTIPOINT(0 0,1 1)")
90 );
91
92 tester::apply
93 ("mppu02",
94 from_wkt<MP>("MULTIPOINT(0 0)"),
95 from_wkt<P>("POINT(0 0)"),
96 from_wkt<MP>("MULTIPOINT(0 0)")
97 );
98
99 tester::apply
100 ("mppu03",
101 from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
102 from_wkt<P>("POINT(1 1)"),
103 from_wkt<MP>("MULTIPOINT(0 0,0 0,1 1)")
104 );
105
106 tester::apply
107 ("mppu04",
108 from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
109 from_wkt<P>("POINT(0 0)"),
110 from_wkt<MP>("MULTIPOINT(0 0)")
111 );
112
113 tester::apply
114 ("mppu05",
115 from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
116 from_wkt<P>("POINT(1 1)"),
117 from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0,1 1)")
118 );
119
120 tester::apply
121 ("mppu06",
122 from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
123 from_wkt<P>("POINT(1 0)"),
124 from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)")
125 );
126
127 tester::apply
128 ("mppu07",
129 from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
130 from_wkt<P>("POINT(0 0)"),
131 from_wkt<MP>("MULTIPOINT(0 0,1 0)")
132 );
133
134 tester::apply
135 ("mppu08",
136 from_wkt<MP>("MULTIPOINT()"),
137 from_wkt<P>("POINT(0 0)"),
138 from_wkt<MP>("MULTIPOINT(0 0)")
139 );
140 }
141
142
143 BOOST_AUTO_TEST_CASE( test_union_multipoint_multipoint )
144 {
145 #ifdef BOOST_GEOMETRY_TEST_DEBUG
146 std::cout << std::endl << std::endl << std::endl;
147 std::cout << "*** MULTIPOINT / MULTIPOINT UNION ***" << std::endl;
148 std::cout << std::endl;
149 #endif
150
151 typedef multi_point_type MP;
152
153 typedef test_set_op_of_pointlike_geometries
154 <
155 MP, MP, MP, bg::overlay_union
156 > tester;
157
158 tester::apply
159 ("mpmpu01",
160 from_wkt<MP>("MULTIPOINT(2 2,3 3,0 0,0 0,2 2,1 1,1 1,1 0,1 0)"),
161 from_wkt<MP>("MULTIPOINT(1 0,1 1,1 1,1 1)"),
162 from_wkt<MP>("MULTIPOINT(2 2,3 3,0 0,0 0,2 2,1 1,1 1,1 0,1 0)"),
163 from_wkt<MP>("MULTIPOINT(1 0,1 1,1 1,1 1,2 2,3 3,0 0,0 0,2 2)")
164 );
165
166 tester::apply
167 ("mpmpu02",
168 from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
169 from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)"),
170 from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
171 from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)")
172 );
173
174 tester::apply
175 ("mpmpu03",
176 from_wkt<MP>("MULTIPOINT()"),
177 from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)"),
178 from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)")
179 );
180
181 tester::apply
182 ("mpmpu04",
183 from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
184 from_wkt<MP>("MULTIPOINT()"),
185 from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)")
186 );
187
188 tester::apply
189 ("mpmpu05",
190 from_wkt<MP>("MULTIPOINT()"),
191 from_wkt<MP>("MULTIPOINT()"),
192 from_wkt<MP>("MULTIPOINT()")
193 );
194
195 tester::apply
196 ("mpmpu06",
197 from_wkt<MP>("MULTIPOINT(0 0,1 0,2 0,3 0,0 0,1 0,2 0)"),
198 from_wkt<MP>("MULTIPOINT(0 1,0 2,1 0,0 0,2 0)"),
199 from_wkt<MP>("MULTIPOINT(0 0,1 0,2 0,3 0,0 0,1 0,2 0,0 1,0 2)"),
200 from_wkt<MP>("MULTIPOINT(0 1,0 2,1 0,0 0,2 0,3 0)")
201 );
202 }