1 // Boost.Geometry (aka GGL, Generic Geometry Library)
4 // Copyright (c) 2018, Oracle and/or its affiliates.
6 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
8 // Licensed under the Boost Software License version 1.0.
9 // http://www.boost.org/users/license.html
12 #ifndef BOOST_GEOMETRY_TEST_EMPTY_GEOMETRY_HPP
13 #define BOOST_GEOMETRY_TEST_EMPTY_GEOMETRY_HPP
15 template <typename Point, typename Strategy>
16 void test_more_empty_input_pointlike_pointlike(Strategy const& strategy)
18 #ifdef BOOST_GEOMETRY_TEST_DEBUG
19 std::cout << std::endl;
20 std::cout << "testing on empty inputs... " << std::flush;
22 bg::model::multi_point<Point> multipoint_empty;
24 Point point = from_wkt<Point>("point(0 0)");
26 // 1st geometry is empty
27 test_empty_input(multipoint_empty, point, strategy);
29 // 2nd geometry is empty
30 test_empty_input(point, multipoint_empty, strategy);
32 // both geometries are empty
33 test_empty_input(multipoint_empty, multipoint_empty, strategy);
35 #ifdef BOOST_GEOMETRY_TEST_DEBUG
36 std::cout << "done!" << std::endl;
41 template <typename Point, typename Strategy>
42 void test_more_empty_input_pointlike_linear(Strategy const& strategy)
44 #ifdef BOOST_GEOMETRY_TEST_DEBUG
45 std::cout << std::endl;
46 std::cout << "testing on empty inputs... " << std::flush;
48 bg::model::linestring<Point> line_empty;
49 bg::model::multi_point<Point> multipoint_empty;
50 bg::model::multi_linestring<bg::model::linestring<Point> > multiline_empty;
52 Point point = from_wkt<Point>("POINT(0 0)");
53 bg::model::linestring<Point> line =
54 from_wkt<bg::model::linestring<Point> >("LINESTRING(0 0,1 1,2 2)");
56 // 1st geometry is empty
57 test_empty_input(multipoint_empty, line, strategy);
59 // 2nd geometry is empty
60 test_empty_input(line, multipoint_empty, strategy);
61 test_empty_input(point, line_empty, strategy);
62 test_empty_input(point, multiline_empty, strategy);
64 // both geometries are empty
65 test_empty_input(multipoint_empty, line_empty, strategy);
66 test_empty_input(multipoint_empty, multiline_empty, strategy);
68 #ifdef BOOST_GEOMETRY_TEST_DEBUG
69 std::cout << "done!" << std::endl;
74 template <typename Point, typename Strategy>
75 void test_more_empty_input_pointlike_areal(Strategy const& strategy)
77 #ifdef BOOST_GEOMETRY_TEST_DEBUG
78 std::cout << std::endl;
79 std::cout << "testing on empty inputs... " << std::flush;
81 bg::model::multi_point<Point> multipoint_empty;
83 bg::model::polygon<Point> polygon_empty;
84 bg::model::multi_polygon<bg::model::polygon<Point> > multipolygon_empty;
86 Point point = from_wkt<Point>("POINT(0 0)");
87 bg::model::polygon<Point> polygon =
88 from_wkt<bg::model::polygon<Point> >("POLYGON((0 0,1 0,1 1,0 1,0 0))");
90 // 1st geometry is empty
91 test_empty_input(multipoint_empty, polygon, strategy);
92 test_empty_input(polygon_empty, point, strategy);
93 test_empty_input(multipolygon_empty, point, strategy);
95 // 2nd geometry is empty
96 test_empty_input(point, polygon_empty, strategy);
97 test_empty_input(point, multipolygon_empty, strategy);
98 test_empty_input(polygon, multipoint_empty, strategy);
100 // both geometries are empty
101 test_empty_input(multipoint_empty, polygon_empty, strategy);
102 test_empty_input(multipoint_empty, multipolygon_empty, strategy);
104 #ifdef BOOST_GEOMETRY_TEST_DEBUG
105 std::cout << "done!" << std::endl;
110 template <typename Point, typename Strategy>
111 void test_more_empty_input_linear_linear(Strategy const& strategy)
113 #ifdef BOOST_GEOMETRY_TEST_DEBUG
114 std::cout << std::endl;
115 std::cout << "testing on empty inputs... " << std::flush;
117 bg::model::linestring<Point> line_empty;
118 bg::model::multi_linestring<bg::model::linestring<Point> > multiline_empty;
120 bg::model::linestring<Point> line =
121 from_wkt<bg::model::linestring<Point> >("LINESTRING(0 0,1 1)");
123 // 1st geometry is empty
124 test_empty_input(line_empty, line, strategy);
125 test_empty_input(multiline_empty, line, strategy);
127 // 2nd geometry is empty
128 test_empty_input(line, line_empty, strategy);
129 test_empty_input(line, multiline_empty, strategy);
131 // both geometries are empty
132 test_empty_input(line_empty, line_empty, strategy);
133 test_empty_input(multiline_empty, line_empty, strategy);
134 test_empty_input(multiline_empty, multiline_empty, strategy);
136 #ifdef BOOST_GEOMETRY_TEST_DEBUG
137 std::cout << "done!" << std::endl;
142 template <typename Point, typename Strategy>
143 void test_more_empty_input_linear_areal(Strategy const& strategy)
145 #ifdef BOOST_GEOMETRY_TEST_DEBUG
146 std::cout << std::endl;
147 std::cout << "testing on empty inputs... " << std::flush;
149 bg::model::linestring<Point> line_empty;
150 bg::model::multi_linestring<bg::model::linestring<Point> > multiline_empty;
152 bg::model::polygon<Point> polygon_empty;
153 bg::model::multi_polygon<bg::model::polygon<Point> > multipolygon_empty;
155 bg::model::linestring<Point> line =
156 from_wkt<bg::model::linestring<Point> >("LINESTRING(0 0,1 1)");
157 bg::model::polygon<Point> polygon =
158 from_wkt<bg::model::polygon<Point> >("POLYGON((0 0,1 0,1 1,0 1,0 0))");
160 // 1st geometry is empty
161 test_empty_input(line_empty, polygon, strategy);
162 test_empty_input(multiline_empty, polygon, strategy);
163 test_empty_input(polygon_empty, line, strategy);
164 test_empty_input(multipolygon_empty, line, strategy);
166 // 2nd geometry is empty
167 test_empty_input(line, polygon_empty, strategy);
168 test_empty_input(line, multipolygon_empty, strategy);
169 test_empty_input(polygon, line_empty, strategy);
170 test_empty_input(polygon, multiline_empty, strategy);
172 // both geometries are empty
173 test_empty_input(line_empty, polygon_empty, strategy);
174 test_empty_input(line_empty, multipolygon_empty, strategy);
175 test_empty_input(multiline_empty, polygon_empty, strategy);
176 test_empty_input(multiline_empty, multipolygon_empty, strategy);
178 #ifdef BOOST_GEOMETRY_TEST_DEBUG
179 std::cout << "done!" << std::endl;
184 template <typename Point, typename Strategy>
185 void test_more_empty_input_areal_areal(Strategy const& strategy)
187 #ifdef BOOST_GEOMETRY_TEST_DEBUG
188 std::cout << std::endl;
189 std::cout << "testing on empty inputs... " << std::flush;
191 bg::model::polygon<Point> polygon_empty;
192 bg::model::multi_polygon<bg::model::polygon<Point> > multipolygon_empty;
194 bg::model::polygon<Point> polygon =
195 from_wkt<bg::model::polygon<Point> >("POLYGON((0 0,1 0,1 1,0 1,0 0))");
197 // 1st geometry is empty
198 test_empty_input(polygon_empty, polygon, strategy);
199 test_empty_input(multipolygon_empty, polygon, strategy);
201 // 2nd geometry is empty
202 test_empty_input(polygon, polygon_empty, strategy);
203 test_empty_input(polygon, multipolygon_empty, strategy);
205 // both geometries are empty
206 test_empty_input(polygon_empty, multipolygon_empty, strategy);
208 #ifdef BOOST_GEOMETRY_TEST_DEBUG
209 std::cout << "done!" << std::endl;
213 #endif // BOOST_GEOMETRY_TEST_EMPTY_GEOMETRY_HPP