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