MySQL 8.4.0
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, 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 covered_by functor interface.
30///
31/// The functor is not intended for use directly by MySQL code.
32
33#include <memory> // std::unique_ptr
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
42namespace gis {
43
44/// Covered_by 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 covered_by or other geographic functions. It should not be used
49/// directly by other MySQL code.
50class Covered_by : public Functor<bool> {
51 private:
52 /// Semi-major axis of ellipsoid.
54 /// Semi-minor axis of ellipsoid.
56
57 public:
58 /// Creates a new Covered_by functor.
59 ///
60 /// @param semi_major Semi-major axis of ellipsoid.
61 /// @param semi_minor Semi-minor axis of ellipsoid.
62 Covered_by(double semi_major, double semi_minor);
63 double semi_major() const { return m_semi_major; }
64 double semi_minor() const { return m_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 // covered_by(Box, Box)
72
73 bool eval(const Cartesian_box *b1, const Cartesian_box *b2) const;
74 bool eval(const Geographic_box *b1, const Geographic_box *b2) const;
75};
76
77} // namespace gis
78
79#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:41
A Cartesian 2d box.
Definition: box.h:70
Covered_by functor that calls Boost.Geometry with the correct parameter types.
Definition: covered_by_functor.h:50
bool operator()(const Geometry *g1, const Geometry *g2) const override
Definition: covered_by.cc:47
bool eval(const Geometry *g1, const Geometry *g2) const
Definition: covered_by.cc:66
Covered_by(double semi_major, double semi_minor)
Creates a new Covered_by functor.
Definition: covered_by.cc:44
double semi_minor() const
Definition: covered_by_functor.h:64
double m_semi_minor
Semi-minor axis of ellipsoid.
Definition: covered_by_functor.h:55
double semi_major() const
Definition: covered_by_functor.h:63
double m_semi_major
Semi-major axis of ellipsoid.
Definition: covered_by_functor.h:53
The base class of all functors that takes two geometry arguments.
Definition: functor.h:165
A Geographic 2d box.
Definition: box.h:103
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