MySQL 8.0.39
Source Code Documentation
area_functor.h
Go to the documentation of this file.
1// Copyright (c) 2018, 2024, Oracle and/or its affiliates.
2//
3// This program is free software; you can redistribute it and/or modify
4// it under the terms of the GNU General Public License, version 2.0,
5// as published by the Free Software Foundation.
6//
7// This program is designed to work with certain software (including
8// but not limited to OpenSSL) that is licensed under separate terms,
9// as designated in a particular file or component or in included license
10// documentation. The authors of MySQL hereby grant you an additional
11// permission to link the program and your derivative works with the
12// separately licensed software that they have either included with
13// the program or referenced in the documentation.
14//
15// This program is distributed in the hope that it will be useful,
16// but WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License, version 2.0, for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with this program; if not, write to the Free Software
22// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
24/// @file
25///
26/// Declares the area functor interface.
27///
28/// The functor is not intended for use directly by MySQL code. It should be
29/// used indirectly through the gis::area() function.
30///
31/// @see gis::area
32
33#ifndef SQL_GIS_AREA_FUNCTOR_H_INCLUDED
34#define SQL_GIS_AREA_FUNCTOR_H_INCLUDED
35
36#include <boost/geometry.hpp> // boost::geometry
37
38#include "sql/gis/functor.h" // gis::Unary_functor
39#include "sql/gis/geometries.h" // gis::Geometry
40#include "sql/gis/geometries_cs.h" // gis::{Cartesian_*,Geographic_*}
41
42namespace gis {
43
44/// Area functor that calls boost::geometry::area with the correct parameter
45/// types.
46///
47/// The functor may throw exceptions. It is intended for implementing geographic
48/// functions. It should not be used directly by other MySQL code.
49class Area : public Unary_functor<double> {
52
53 boost::geometry::strategy::area::geographic<> m_geographic_strategy;
54
55 public:
57 Area(double semi_major, double semi_minor);
58
59 double operator()(const Geometry &g) const override;
60
61 double eval(const Cartesian_polygon &g) const;
62 double eval(const Cartesian_multipolygon &g) const;
63
64 double eval(const Geographic_polygon &g) const;
65 double eval(const Geographic_multipolygon &g) const;
66
67 double eval(const Geometry &g) const;
68};
69
70} // namespace gis
71
72#endif // SQL_GIS_AREA_FUNCTOR_H_INCLUDED
Area functor that calls boost::geometry::area with the correct parameter types.
Definition: area_functor.h:49
double eval(const Cartesian_polygon &g) const
Definition: area.cc:59
boost::geometry::strategy::area::geographic m_geographic_strategy
Definition: area_functor.h:53
double operator()(const Geometry &g) const override
Definition: area.cc:57
double m_semi_minor
Definition: area_functor.h:51
double m_semi_major
Definition: area_functor.h:50
A Cartesian 2d multipolygon.
Definition: geometries_cs.h:720
A Cartesian 2d polygon.
Definition: geometries_cs.h:269
A geographic (ellipsoidal) 2d multipolygon.
Definition: geometries_cs.h:774
A geographic (ellipsoidal) 2d polygon.
Definition: geometries_cs.h:322
Abstract superclass for all geometric objects.
Definition: geometries.h:100
The base class of all functors that take one geometry argument.
Definition: functor.h:615
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 declares the coordinate system specific subclasses of the geometry class hierarchy.
Definition: area.cc:47