MySQL 8.0.40
Source Code Documentation
crosses_functor.h
Go to the documentation of this file.
1#ifndef SQL_GIS_CROSSES_FUNCTOR_H_INCLUDED
2#define SQL_GIS_CROSSES_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 crosses functor interface.
30///
31/// The functor is not intended for use directly by MySQL code. It should be
32/// used indirectly through the gis::crosses() function.
33///
34/// @see gis::crosses
35
36#include <boost/geometry.hpp>
37
38#include "sql/gis/functor.h"
39#include "sql/gis/geometries.h"
41
42namespace gis {
43
44/// Crosses 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 crosses or other geographic functions. It should not be used
49/// directly by other MySQL code.
50class Crosses : public Functor<bool> {
51 private:
52 /// Semi-major axis of ellipsoid.
54 /// Semi-minor axis of ellipsoid.
56 /// Strategy used for P/L and P/A.
57 boost::geometry::strategy::within::geographic_winding<Geographic_point>
59 /// Strategy used for L/L, L/A and A/A.
60 boost::geometry::strategy::intersection::geographic_segments<>
62
63 public:
64 /// Creates a new Crosses functor.
65 ///
66 /// @param semi_major Semi-major axis of ellipsoid.
67 /// @param semi_minor Semi-minor axis of ellipsoid.
68 Crosses(double semi_major, double semi_minor);
69 double semi_major() const { return m_semi_major; }
70 double semi_minor() const { return m_semi_minor; }
71 bool operator()(const Geometry *g1, const Geometry *g2) const override;
72 bool eval(const Geometry *g1, const Geometry *g2) const;
73
74 //////////////////////////////////////////////////////////////////////////////
75
76 // crosses(Cartesian_point, *)
77
78 bool eval(const Cartesian_point *g1, const Cartesian_point *g2) const;
79 bool eval(const Cartesian_point *g1, const Cartesian_linestring *g2) const;
80 bool eval(const Cartesian_point *g1, const Cartesian_polygon *g2) const;
81 bool eval(const Cartesian_point *g1,
82 const Cartesian_geometrycollection *g2) const;
83 bool eval(const Cartesian_point *g1, const Cartesian_multipoint *g2) const;
84 bool eval(const Cartesian_point *g1,
85 const Cartesian_multilinestring *g2) const;
86 bool eval(const Cartesian_point *g1, const Cartesian_multipolygon *g2) const;
87
88 //////////////////////////////////////////////////////////////////////////////
89
90 // crosses(Cartesian_linestring, *)
91
92 bool eval(const Cartesian_linestring *g1, const Cartesian_point *g2) const;
93 bool eval(const Cartesian_linestring *g1,
94 const Cartesian_linestring *g2) const;
95 bool eval(const Cartesian_linestring *g1, const Cartesian_polygon *g2) const;
96 bool eval(const Cartesian_linestring *g1,
97 const Cartesian_geometrycollection *g2) const;
98 bool eval(const Cartesian_linestring *g1,
99 const Cartesian_multipoint *g2) const;
100 bool eval(const Cartesian_linestring *g1,
101 const Cartesian_multilinestring *g2) const;
102 bool eval(const Cartesian_linestring *g1,
103 const Cartesian_multipolygon *g2) const;
104
105 //////////////////////////////////////////////////////////////////////////////
106
107 // crosses(Cartesian_polygon, *)
108
109 bool eval(const Cartesian_polygon *g1, const Geometry *g2) const;
110
111 //////////////////////////////////////////////////////////////////////////////
112
113 // crosses(Cartesian_geometrycollection, *)
114
115 bool eval(const Cartesian_geometrycollection *g1, const Geometry *g2) const;
116
117 //////////////////////////////////////////////////////////////////////////////
118
119 // crosses(Cartesian_multipoint, *)
120
121 bool eval(const Cartesian_multipoint *g1, const Cartesian_point *g2) const;
122 bool eval(const Cartesian_multipoint *g1,
123 const Cartesian_linestring *g2) const;
124 bool eval(const Cartesian_multipoint *g1, const Cartesian_polygon *g2) const;
125 bool eval(const Cartesian_multipoint *g1,
126 const Cartesian_geometrycollection *g2) const;
127 bool eval(const Cartesian_multipoint *g1,
128 const Cartesian_multipoint *g2) const;
129 bool eval(const Cartesian_multipoint *g1,
130 const Cartesian_multilinestring *g2) const;
131 bool eval(const Cartesian_multipoint *g1,
132 const Cartesian_multipolygon *g2) const;
133
134 //////////////////////////////////////////////////////////////////////////////
135
136 // crosses(Cartesian_multilinestring, *)
137
138 bool eval(const Cartesian_multilinestring *g1,
139 const Cartesian_point *g2) const;
140 bool eval(const Cartesian_multilinestring *g1,
141 const Cartesian_linestring *g2) const;
142 bool eval(const Cartesian_multilinestring *g1,
143 const Cartesian_polygon *g2) const;
144 bool eval(const Cartesian_multilinestring *g1,
145 const Cartesian_geometrycollection *g2) const;
146 bool eval(const Cartesian_multilinestring *g1,
147 const Cartesian_multipoint *g2) const;
148 bool eval(const Cartesian_multilinestring *g1,
149 const Cartesian_multilinestring *g2) const;
150 bool eval(const Cartesian_multilinestring *g1,
151 const Cartesian_multipolygon *g2) const;
152
153 //////////////////////////////////////////////////////////////////////////////
154
155 // crosses(Cartesian_multipolygon, *)
156
157 bool eval(const Cartesian_multipolygon *g1, const Geometry *g2) const;
158
159 //////////////////////////////////////////////////////////////////////////////
160
161 // crosses(Geographic_point, *)
162
163 bool eval(const Geographic_point *g1, const Geographic_point *g2) const;
164 bool eval(const Geographic_point *g1, const Geographic_linestring *g2) const;
165 bool eval(const Geographic_point *g1, const Geographic_polygon *g2) const;
166 bool eval(const Geographic_point *g1,
167 const Geographic_geometrycollection *g2) const;
168 bool eval(const Geographic_point *g1, const Geographic_multipoint *g2) const;
169 bool eval(const Geographic_point *g1,
170 const Geographic_multilinestring *g2) const;
171 bool eval(const Geographic_point *g1,
172 const Geographic_multipolygon *g2) const;
173
174 //////////////////////////////////////////////////////////////////////////////
175
176 // crosses(Geographic_linestring, *)
177
178 bool eval(const Geographic_linestring *g1, const Geographic_point *g2) const;
179 bool eval(const Geographic_linestring *g1,
180 const Geographic_linestring *g2) const;
181 bool eval(const Geographic_linestring *g1,
182 const Geographic_polygon *g2) const;
183 bool eval(const Geographic_linestring *g1,
184 const Geographic_geometrycollection *g2) const;
185 bool eval(const Geographic_linestring *g1,
186 const Geographic_multipoint *g2) const;
187 bool eval(const Geographic_linestring *g1,
188 const Geographic_multilinestring *g2) const;
189 bool eval(const Geographic_linestring *g1,
190 const Geographic_multipolygon *g2) const;
191
192 //////////////////////////////////////////////////////////////////////////////
193
194 // crosses(Geographic_polygon, *)
195
196 bool eval(const Geographic_polygon *g1, const Geometry *g2) const;
197
198 //////////////////////////////////////////////////////////////////////////////
199
200 // crosses(Geographic_geometrycollection, *)
201
202 bool eval(const Geographic_geometrycollection *g1, const Geometry *g2) const;
203
204 //////////////////////////////////////////////////////////////////////////////
205
206 // crosses(Geographic_multipoint, *)
207
208 bool eval(const Geographic_multipoint *g1, const Geographic_point *g2) const;
209 bool eval(const Geographic_multipoint *g1,
210 const Geographic_linestring *g2) const;
211 bool eval(const Geographic_multipoint *g1,
212 const Geographic_polygon *g2) const;
213 bool eval(const Geographic_multipoint *g1,
214 const Geographic_geometrycollection *g2) const;
215 bool eval(const Geographic_multipoint *g1,
216 const Geographic_multipoint *g2) const;
217 bool eval(const Geographic_multipoint *g1,
218 const Geographic_multilinestring *g2) const;
219 bool eval(const Geographic_multipoint *g1,
220 const Geographic_multipolygon *g2) const;
221
222 //////////////////////////////////////////////////////////////////////////////
223
224 // crosses(Geographic_multilinestring, *)
225
226 bool eval(const Geographic_multilinestring *g1,
227 const Geographic_point *g2) const;
228 bool eval(const Geographic_multilinestring *g1,
229 const Geographic_linestring *g2) const;
230 bool eval(const Geographic_multilinestring *g1,
231 const Geographic_polygon *g2) const;
232 bool eval(const Geographic_multilinestring *g1,
233 const Geographic_geometrycollection *g2) const;
234 bool eval(const Geographic_multilinestring *g1,
235 const Geographic_multipoint *g2) const;
236 bool eval(const Geographic_multilinestring *g1,
237 const Geographic_multilinestring *g2) const;
238 bool eval(const Geographic_multilinestring *g1,
239 const Geographic_multipolygon *g2) const;
240
241 //////////////////////////////////////////////////////////////////////////////
242
243 // crosses(Geographic_multipolygon, *)
244
245 bool eval(const Geographic_multipolygon *g1, const Geometry *g2) const;
246};
247
248} // namespace gis
249
250#endif // SQL_GIS_CROSSES_FUNCTOR_H_INCLUDED
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
Crosses functor that calls Boost.Geometry with the correct parameter types.
Definition: crosses_functor.h:50
boost::geometry::strategy::intersection::geographic_segments m_geographic_ll_la_aa_strategy
Strategy used for L/L, L/A and A/A.
Definition: crosses_functor.h:61
boost::geometry::strategy::within::geographic_winding< Geographic_point > m_geographic_pl_pa_strategy
Strategy used for P/L and P/A.
Definition: crosses_functor.h:58
Crosses(double semi_major, double semi_minor)
Creates a new Crosses functor.
Definition: crosses.cc:291
double semi_major() const
Definition: crosses_functor.h:69
double m_semi_minor
Semi-minor axis of ellipsoid.
Definition: crosses_functor.h:55
bool eval(const Geometry *g1, const Geometry *g2) const
Definition: crosses.cc:303
double semi_minor() const
Definition: crosses_functor.h:70
double m_semi_major
Semi-major axis of ellipsoid.
Definition: crosses_functor.h:53
bool operator()(const Geometry *g1, const Geometry *g2) const override
Definition: crosses.cc:299
The base class of all functors that takes two geometry arguments.
Definition: functor.h:165
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