MySQL 8.4.0
Source Code Documentation
frechet_distance_functor.h
Go to the documentation of this file.
1#ifndef GIS__FRECHET_DISTANCE_FUNCTOR_H_INCLUDED
2#define GIS__FRECHET_DISTANCE_FUNCTOR_H_INCLUDED
3
4// Copyright (c) 2020, 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 frechet_distance functor interface.
30///
31/// The functor is not intended for use directly by MySQL code. It should be
32/// used indirectly through the gis::frechet_distance() function.
33///
34/// @see gis::frechet_distance
35
36#include <memory> // std::unique_ptr
37
38#include <boost/geometry.hpp>
39#include "sql/gis/functor.h"
40#include "sql/gis/geometries.h"
41
42namespace gis {
43
44/// Frechet_distance functor that calls Boost.Geometry with the correct
45/// parameter types.
46///
47/// The functor throws exceptions and is therefore only intended used to
48/// implement frechet_distance or other geographic functions.
49/// It should not be used directly by other MySQL code.
50class Frechet_distance : public Functor<double> {
51 private:
52 std::unique_ptr<boost::geometry::strategy::distance::geographic<
53 boost::geometry::strategy::andoyer,
54 boost::geometry::srs::spheroid<double>>>
56
57 public:
58 Frechet_distance(double major, double minor);
59 double operator()(const Geometry *g1, const Geometry *g2) const override;
60
61 double eval(const Geometry *g1, const Geometry *g2) const;
62
63 double eval(const Geographic_linestring *g1,
64 const Geographic_linestring *g2) const;
65 double eval(const Cartesian_linestring *g1,
66 const Cartesian_linestring *g2) const;
67};
68
69} // namespace gis
70
71#endif // GIS__FRECHET_DISTANCE_FUNCTOR_H_INCLUDED
A Cartesian 2d linestring.
Definition: geometries_cs.h:71
Frechet_distance functor that calls Boost.Geometry with the correct parameter types.
Definition: frechet_distance_functor.h:50
std::unique_ptr< boost::geometry::strategy::distance::geographic< boost::geometry::strategy::andoyer, boost::geometry::srs::spheroid< double > > > m_geographic_strategy
Definition: frechet_distance_functor.h:55
double eval(const Geometry *g1, const Geometry *g2) const
Definition: frechet_distance.cc:58
Frechet_distance(double major, double minor)
Definition: frechet_distance.cc:47
double operator()(const Geometry *g1, const Geometry *g2) const override
Definition: frechet_distance.cc:53
The base class of all functors that takes two geometry arguments.
Definition: functor.h:165
A geographic (ellipsoidal) 2d linestring.
Definition: geometries_cs.h:125
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 ...
Definition: area.cc:47
std::conditional_t< !std::is_array< T >::value, std::unique_ptr< T, detail::Deleter< T > >, std::conditional_t< detail::is_unbounded_array_v< T >, std::unique_ptr< T, detail::Array_deleter< std::remove_extent_t< T > > >, void > > unique_ptr
The following is a common type that is returned by all the ut::make_unique (non-aligned) specializati...
Definition: ut0new.h:2438