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