MySQL 8.4.0
Source Code Documentation
line_interpolate_functor.h
Go to the documentation of this file.
1/* Copyright (c) 2020, 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/**
25 @file
26
27 This file declares the line interpolate functor interface
28
29 The functor is not intended for use directly by MySQL code. It should be
30 used indirectly through the gis::line_interpolate_point() function.
31
32 @see gis::line_interpolate
33*/
34
35#ifndef SQL_GIS_LINE_INTERPOLATE_FUNCTOR_H_INCLUDED
36#define SQL_GIS_LINE_INTERPOLATE_FUNCTOR_H_INCLUDED
37
38#include <memory> // std::unique_ptr
39
40#include "sql/gis/functor.h"
41#include "sql/gis/geometries.h"
42
43namespace gis {
44
45/// Line interpolate functor that calls boost::geometry::line_interpolate with
46/// the correct parameter types.
47///
48/// The functor throws exceptions and is therefore only intended used to
49/// implement line_interpolate or other geographic functions. It should not be
50/// used directly by other MySQL code.
51class Line_interpolate_point : public Unary_functor<std::unique_ptr<Geometry>> {
52 private:
53 double m_distance;
55 boost::geometry::strategy::line_interpolate::geographic<>
57
58 public:
59 explicit Line_interpolate_point(double distance, bool return_multiple_points)
61 m_return_multiple_points(return_multiple_points) {}
62 Line_interpolate_point(double distance, bool return_multiple_points,
63 double semi_major, double semi_minor)
65 m_return_multiple_points(return_multiple_points),
67 boost::geometry::srs::spheroid<double>(semi_major, semi_minor)) {}
68
69 std::unique_ptr<Geometry> operator()(const Geometry &g) const override;
70 std::unique_ptr<Geometry> eval(const Geometry &g) const;
71 std::unique_ptr<Geometry> eval(const Geographic_linestring &g) const;
72 std::unique_ptr<Geometry> eval(const Cartesian_linestring &g) const;
73};
74
75} // namespace gis
76
77#endif // SQL_GIS_LINE_INTERPOLATE_FUNCTOR_H_INCLUDED
A Cartesian 2d linestring.
Definition: geometries_cs.h:71
A geographic (ellipsoidal) 2d linestring.
Definition: geometries_cs.h:125
Abstract superclass for all geometric objects.
Definition: geometries.h:100
Line interpolate functor that calls boost::geometry::line_interpolate with the correct parameter type...
Definition: line_interpolate_functor.h:51
Line_interpolate_point(double distance, bool return_multiple_points, double semi_major, double semi_minor)
Definition: line_interpolate_functor.h:62
std::unique_ptr< Geometry > eval(const Geometry &g) const
Definition: line_interpolate.cc:52
boost::geometry::strategy::line_interpolate::geographic m_geographic_strategy
Definition: line_interpolate_functor.h:56
std::unique_ptr< Geometry > operator()(const Geometry &g) const override
Definition: line_interpolate.cc:47
bool m_return_multiple_points
Definition: line_interpolate_functor.h:54
Line_interpolate_point(double distance, bool return_multiple_points)
Definition: line_interpolate_functor.h:59
double m_distance
Definition: line_interpolate_functor.h:53
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 ...
Tag dispatch for custom Role_properties.
Definition: sql_auth_cache.h:588
Definition: area.cc:47
bool distance(const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, double *distance, bool *is_null) noexcept
Computes the distance between two geometries.
Definition: distance.cc:40