MySQL 9.1.0
Source Code Documentation
disjoint_functor.h
Go to the documentation of this file.
1#ifndef SQL_GIS_DISJOINT_FUNCTOR_H_INCLUDED
2#define SQL_GIS_DISJOINT_FUNCTOR_H_INCLUDED
3
4// Copyright (c) 2017, 2024, Oracle and/or its affiliates.
5//
6// This program is free software; you can redistribute it and/or modify
7// it under the terms of the GNU General Public License, version 2.0,
8// as published by the Free Software Foundation.
9//
10// This program is designed to work with certain software (including
11// but not limited to OpenSSL) that is licensed under separate terms,
12// as designated in a particular file or component or in included license
13// documentation. The authors of MySQL hereby grant you an additional
14// permission to link the program and your derivative works with the
15// separately licensed software that they have either included with
16// the program or referenced in the documentation.
17//
18// This program is distributed in the hope that it will be useful,
19// but WITHOUT ANY WARRANTY; without even the implied warranty of
20// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21// GNU General Public License, version 2.0, for more details.
22//
23// You should have received a copy of the GNU General Public License
24// along with this program; if not, write to the Free Software
25// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
26
27/// @file
28///
29/// This file declares the disjoint functor interface.
30///
31/// The functor is not intended for use directly by MySQL code. It should be
32/// used indirectly through the gis::disjoint() function.
33///
34/// @see gis::disjoint
35
36#include <boost/geometry.hpp>
37
38#include "sql/gis/box.h"
39#include "sql/gis/functor.h"
40#include "sql/gis/geometries.h"
42
43namespace gis {
44
45/// Disjoint functor that calls Boost.Geometry with the correct parameter
46/// types.
47///
48/// The functor throws exceptions and is therefore only intended used to
49/// implement disjoint or other geographic functions. It should not be used
50/// directly by other MySQL code.
51class Disjoint : public Functor<bool> {
52 private:
53 /// Strategy used for P/L and P/A.
54 boost::geometry::strategy::within::geographic_winding<Geographic_point>
56 /// Strategy used for L/L, L/A and A/A.
57 boost::geometry::strategy::intersection::geographic_segments<>
59
60 public:
61 /// Creates a new Disjoint functor.
62 ///
63 /// @param semi_major Semi-major axis of ellipsoid.
64 /// @param semi_minor Semi-minor axis of ellipsoid.
65 Disjoint(double semi_major, double semi_minor);
66 bool operator()(const Geometry *g1, const Geometry *g2) const override;
67 bool operator()(const Box *b1, const Box *b2) const;
68 bool eval(const Geometry *g1, const Geometry *g2) const;
69
70 //////////////////////////////////////////////////////////////////////////////
71
72 // disjoint(Cartesian_point, *)
73
74 bool eval(const Cartesian_point *g1, const Cartesian_point *g2) const;
75 bool eval(const Cartesian_point *g1, const Cartesian_linestring *g2) const;
76 bool eval(const Cartesian_point *g1, const Cartesian_polygon *g2) const;
77 bool eval(const Cartesian_point *g1,
78 const Cartesian_geometrycollection *g2) const;
79 bool eval(const Cartesian_point *g1, const Cartesian_multipoint *g2) const;
80 bool eval(const Cartesian_point *g1,
81 const Cartesian_multilinestring *g2) const;
82 bool eval(const Cartesian_point *g1, const Cartesian_multipolygon *g2) const;
83
84 //////////////////////////////////////////////////////////////////////////////
85
86 // disjoint(Cartesian_linestring, *)
87
88 bool eval(const Cartesian_linestring *g1, const Cartesian_point *g2) const;
89 bool eval(const Cartesian_linestring *g1,
90 const Cartesian_linestring *g2) const;
91 bool eval(const Cartesian_linestring *g1, const Cartesian_polygon *g2) const;
92 bool eval(const Cartesian_linestring *g1,
93 const Cartesian_geometrycollection *g2) const;
94 bool eval(const Cartesian_linestring *g1,
95 const Cartesian_multipoint *g2) const;
96 bool eval(const Cartesian_linestring *g1,
97 const Cartesian_multilinestring *g2) const;
98 bool eval(const Cartesian_linestring *g1,
99 const Cartesian_multipolygon *g2) const;
100
101 //////////////////////////////////////////////////////////////////////////////
102
103 // disjoint(Cartesian_polygon, *)
104
105 bool eval(const Cartesian_polygon *g1, const Cartesian_point *g2) const;
106 bool eval(const Cartesian_polygon *g1, const Cartesian_linestring *g2) const;
107 bool eval(const Cartesian_polygon *g1, const Cartesian_polygon *g2) const;
108 bool eval(const Cartesian_polygon *g1,
109 const Cartesian_geometrycollection *g2) const;
110 bool eval(const Cartesian_polygon *g1, const Cartesian_multipoint *g2) const;
111 bool eval(const Cartesian_polygon *g1,
112 const Cartesian_multilinestring *g2) const;
113 bool eval(const Cartesian_polygon *g1,
114 const Cartesian_multipolygon *g2) const;
115
116 //////////////////////////////////////////////////////////////////////////////
117
118 // disjoint(Cartesian_geometrycollection, *)
119
120 bool eval(const Cartesian_geometrycollection *g1, const Geometry *g2) const;
121
122 //////////////////////////////////////////////////////////////////////////////
123
124 // disjoint(Cartesian_multipoint, *)
125
126 bool eval(const Cartesian_multipoint *g1, const Cartesian_point *g2) const;
127 bool eval(const Cartesian_multipoint *g1,
128 const Cartesian_linestring *g2) const;
129 bool eval(const Cartesian_multipoint *g1, const Cartesian_polygon *g2) const;
130 bool eval(const Cartesian_multipoint *g1,
131 const Cartesian_geometrycollection *g2) const;
132 bool eval(const Cartesian_multipoint *g1,
133 const Cartesian_multipoint *g2) const;
134 bool eval(const Cartesian_multipoint *g1,
135 const Cartesian_multilinestring *g2) const;
136 bool eval(const Cartesian_multipoint *g1,
137 const Cartesian_multipolygon *g2) const;
138
139 //////////////////////////////////////////////////////////////////////////////
140
141 // disjoint(Cartesian_multilinestring, *)
142
143 bool eval(const Cartesian_multilinestring *g1,
144 const Cartesian_point *g2) const;
145 bool eval(const Cartesian_multilinestring *g1,
146 const Cartesian_linestring *g2) const;
147 bool eval(const Cartesian_multilinestring *g1,
148 const Cartesian_polygon *g2) const;
149 bool eval(const Cartesian_multilinestring *g1,
150 const Cartesian_geometrycollection *g2) const;
151 bool eval(const Cartesian_multilinestring *g1,
152 const Cartesian_multipoint *g2) const;
153 bool eval(const Cartesian_multilinestring *g1,
154 const Cartesian_multilinestring *g2) const;
155 bool eval(const Cartesian_multilinestring *g1,
156 const Cartesian_multipolygon *g2) const;
157
158 //////////////////////////////////////////////////////////////////////////////
159
160 // disjoint(Cartesian_multipolygon, *)
161
162 bool eval(const Cartesian_multipolygon *g1, const Cartesian_point *g2) const;
163 bool eval(const Cartesian_multipolygon *g1,
164 const Cartesian_linestring *g2) const;
165 bool eval(const Cartesian_multipolygon *g1,
166 const Cartesian_polygon *g2) const;
167 bool eval(const Cartesian_multipolygon *g1,
168 const Cartesian_geometrycollection *g2) const;
169 bool eval(const Cartesian_multipolygon *g1,
170 const Cartesian_multipoint *g2) const;
171 bool eval(const Cartesian_multipolygon *g1,
172 const Cartesian_multilinestring *g2) const;
173 bool eval(const Cartesian_multipolygon *g1,
174 const Cartesian_multipolygon *g2) const;
175
176 //////////////////////////////////////////////////////////////////////////////
177
178 // disjoint(Geographic_point, *)
179
180 bool eval(const Geographic_point *g1, const Geographic_point *g2) const;
181 bool eval(const Geographic_point *g1, const Geographic_linestring *g2) const;
182 bool eval(const Geographic_point *g1, const Geographic_polygon *g2) const;
183 bool eval(const Geographic_point *g1,
184 const Geographic_geometrycollection *g2) const;
185 bool eval(const Geographic_point *g1, const Geographic_multipoint *g2) const;
186 bool eval(const Geographic_point *g1,
187 const Geographic_multilinestring *g2) const;
188 bool eval(const Geographic_point *g1,
189 const Geographic_multipolygon *g2) const;
190
191 //////////////////////////////////////////////////////////////////////////////
192
193 // disjoint(Geographic_linestring, *)
194
195 bool eval(const Geographic_linestring *g1, const Geographic_point *g2) const;
196 bool eval(const Geographic_linestring *g1,
197 const Geographic_linestring *g2) const;
198 bool eval(const Geographic_linestring *g1,
199 const Geographic_polygon *g2) const;
200 bool eval(const Geographic_linestring *g1,
201 const Geographic_geometrycollection *g2) const;
202 bool eval(const Geographic_linestring *g1,
203 const Geographic_multipoint *g2) const;
204 bool eval(const Geographic_linestring *g1,
205 const Geographic_multilinestring *g2) const;
206 bool eval(const Geographic_linestring *g1,
207 const Geographic_multipolygon *g2) const;
208
209 //////////////////////////////////////////////////////////////////////////////
210
211 // disjoint(Geographic_polygon, *)
212
213 bool eval(const Geographic_polygon *g1, const Geographic_point *g2) const;
214 bool eval(const Geographic_polygon *g1,
215 const Geographic_linestring *g2) const;
216 bool eval(const Geographic_polygon *g1, const Geographic_polygon *g2) const;
217 bool eval(const Geographic_polygon *g1,
218 const Geographic_geometrycollection *g2) const;
219 bool eval(const Geographic_polygon *g1,
220 const Geographic_multipoint *g2) const;
221 bool eval(const Geographic_polygon *g1,
222 const Geographic_multilinestring *g2) const;
223 bool eval(const Geographic_polygon *g1,
224 const Geographic_multipolygon *g2) const;
225
226 //////////////////////////////////////////////////////////////////////////////
227
228 // disjoint(Geographic_geometrycollection, *)
229
230 bool eval(const Geographic_geometrycollection *g1, const Geometry *g2) const;
231
232 //////////////////////////////////////////////////////////////////////////////
233
234 // disjoint(Geographic_multipoint, *)
235
236 bool eval(const Geographic_multipoint *g1, const Geographic_point *g2) const;
237 bool eval(const Geographic_multipoint *g1,
238 const Geographic_linestring *g2) const;
239 bool eval(const Geographic_multipoint *g1,
240 const Geographic_polygon *g2) const;
241 bool eval(const Geographic_multipoint *g1,
242 const Geographic_geometrycollection *g2) const;
243 bool eval(const Geographic_multipoint *g1,
244 const Geographic_multipoint *g2) const;
245 bool eval(const Geographic_multipoint *g1,
246 const Geographic_multilinestring *g2) const;
247 bool eval(const Geographic_multipoint *g1,
248 const Geographic_multipolygon *g2) const;
249
250 //////////////////////////////////////////////////////////////////////////////
251
252 // disjoint(Geographic_multilinestring, *)
253
254 bool eval(const Geographic_multilinestring *g1,
255 const Geographic_point *g2) const;
256 bool eval(const Geographic_multilinestring *g1,
257 const Geographic_linestring *g2) const;
258 bool eval(const Geographic_multilinestring *g1,
259 const Geographic_polygon *g2) const;
260 bool eval(const Geographic_multilinestring *g1,
261 const Geographic_geometrycollection *g2) const;
262 bool eval(const Geographic_multilinestring *g1,
263 const Geographic_multipoint *g2) const;
264 bool eval(const Geographic_multilinestring *g1,
265 const Geographic_multilinestring *g2) const;
266 bool eval(const Geographic_multilinestring *g1,
267 const Geographic_multipolygon *g2) const;
268
269 //////////////////////////////////////////////////////////////////////////////
270
271 // disjoint(Geographic_multipolygon, *)
272
273 bool eval(const Geographic_multipolygon *g1,
274 const Geographic_point *g2) const;
275 bool eval(const Geographic_multipolygon *g1,
276 const Geographic_linestring *g2) const;
277 bool eval(const Geographic_multipolygon *g1,
278 const Geographic_polygon *g2) const;
279 bool eval(const Geographic_multipolygon *g1,
280 const Geographic_geometrycollection *g2) const;
281 bool eval(const Geographic_multipolygon *g1,
282 const Geographic_multipoint *g2) const;
283 bool eval(const Geographic_multipolygon *g1,
284 const Geographic_multilinestring *g2) const;
285 bool eval(const Geographic_multipolygon *g1,
286 const Geographic_multipolygon *g2) const;
287
288 //////////////////////////////////////////////////////////////////////////////
289
290 // disjoint(Box, Box)
291
292 bool eval(const Cartesian_box *b1, const Cartesian_box *b2) const;
293 bool eval(const Geographic_box *b1, const Geographic_box *b2) const;
294};
295
296} // namespace gis
297
298#endif // SQL_GIS_DISJOINT_FUNCTOR_H_INCLUDED
This file declares the Box class.
A 2d box with sides parallel to the coordinate system grid.
Definition: box.h:41
A Cartesian 2d box.
Definition: box.h:70
A Cartesian 2d geometry collection.
Definition: geometries_cs.h:375
A Cartesian 2d linestring.
Definition: geometries_cs.h:71
A Cartesian 2d multilinestring.
Definition: geometries_cs.h:602
A Cartesian 2d multipoint.
Definition: geometries_cs.h:501
A Cartesian 2d multipolygon.
Definition: geometries_cs.h:720
A Cartesian 2d point.
Definition: geometries_cs.h:47
A Cartesian 2d polygon.
Definition: geometries_cs.h:269
Disjoint functor that calls Boost.Geometry with the correct parameter types.
Definition: disjoint_functor.h:51
bool operator()(const Geometry *g1, const Geometry *g2) const override
Definition: disjoint.cc:83
boost::geometry::strategy::within::geographic_winding< Geographic_point > m_geographic_pl_pa_strategy
Strategy used for P/L and P/A.
Definition: disjoint_functor.h:55
bool eval(const Geometry *g1, const Geometry *g2) const
Definition: disjoint.cc:102
boost::geometry::strategy::intersection::geographic_segments m_geographic_ll_la_aa_strategy
Strategy used for L/L, L/A and A/A.
Definition: disjoint_functor.h:58
Disjoint(double semi_major, double semi_minor)
Creates a new Disjoint functor.
Definition: disjoint.cc:77
The base class of all functors that takes two geometry arguments.
Definition: functor.h:165
A Geographic 2d box.
Definition: box.h:103
A geographic (ellipsoidal) 2d geometry collection.
Definition: geometries_cs.h:438
A geographic (ellipsoidal) 2d linestring.
Definition: geometries_cs.h:125
A geographic (ellipsoidal) 2d multilinestring.
Definition: geometries_cs.h:661
A geographic (ellipsoidal) 2d multipoint.
Definition: geometries_cs.h:552
A geographic (ellipsoidal) 2d multipolygon.
Definition: geometries_cs.h:774
A geographic (ellipsoidal) 2d point.
Definition: geometries_cs.h:58
A geographic (ellipsoidal) 2d polygon.
Definition: geometries_cs.h:322
Abstract superclass for all geometric objects.
Definition: geometries.h:100
This file contains the superclasses for GIS functors.
This file declares the geometry class hierarchy used by the server as the internal representation of ...
This file contains Boost.Geometry type traits declarations for Cartesian and geographic geometries.
Definition: area.cc:47