MySQL  8.0.28
Source Code Documentation
covered_by_functor.h
Go to the documentation of this file.
1 #ifndef SQL_GIS_COVERED_BY_FUNCTOR_H_INCLUDED
2 #define SQL_GIS_COVERED_BY_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 covered_by functor interface.
29 ///
30 /// The functor is not intended for use directly by MySQL code.
31 
32 #include <memory> // std::unique_ptr
33 
34 #include <boost/geometry.hpp>
35 
36 #include "sql/gis/box.h"
37 #include "sql/gis/functor.h"
38 #include "sql/gis/geometries.h"
40 
41 namespace gis {
42 
43 /// Covered_by 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 covered_by or other geographic functions. It should not be used
48 /// directly by other MySQL code.
49 class Covered_by : 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 
56  public:
57  /// Creates a new Covered_by functor.
58  ///
59  /// @param semi_major Semi-major axis of ellipsoid.
60  /// @param semi_minor Semi-minor axis of ellipsoid.
61  Covered_by(double semi_major, double semi_minor);
62  double semi_major() const { return m_semi_major; }
63  double semi_minor() const { return m_semi_minor; }
64  bool operator()(const Geometry *g1, const Geometry *g2) const override;
65  bool operator()(const Box *b1, const Box *b2) const;
66  bool eval(const Geometry *g1, const Geometry *g2) const;
67 
68  //////////////////////////////////////////////////////////////////////////////
69 
70  // covered_by(Box, Box)
71 
72  bool eval(const Cartesian_box *b1, const Cartesian_box *b2) const;
73  bool eval(const Geographic_box *b1, const Geographic_box *b2) const;
74 };
75 
76 } // namespace gis
77 
78 #endif // SQL_GIS_COVERED_BY_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
Covered_by functor that calls Boost.Geometry with the correct parameter types.
Definition: covered_by_functor.h:49
bool operator()(const Geometry *g1, const Geometry *g2) const override
Definition: covered_by.cc:46
bool eval(const Geometry *g1, const Geometry *g2) const
Definition: covered_by.cc:65
Covered_by(double semi_major, double semi_minor)
Creates a new Covered_by functor.
Definition: covered_by.cc:43
double semi_minor() const
Definition: covered_by_functor.h:63
double m_semi_minor
Semi-minor axis of ellipsoid.
Definition: covered_by_functor.h:54
double semi_major() const
Definition: covered_by_functor.h:62
double m_semi_major
Semi-major axis of ellipsoid.
Definition: covered_by_functor.h:52
The base class of all functors that takes two geometry arguments.
Definition: functor.h:164
A Geographic 2d box.
Definition: box.h:102
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