MySQL  8.0.28
Source Code Documentation
line_interpolate_functor.h
Go to the documentation of this file.
1 /* Copyright (c) 2020, 2021, 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 also distributed 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 included with MySQL.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License, version 2.0, for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 /**
24  @file
25 
26  This file declares the line interpolate functor interface
27 
28  The functor is not intended for use directly by MySQL code. It should be
29  used indirectly through the gis::line_interpolate_point() function.
30 
31  @see gis::line_interpolate
32 */
33 
34 #ifndef SQL_GIS_LINE_INTERPOLATE_FUNCTOR_H_INCLUDED
35 #define SQL_GIS_LINE_INTERPOLATE_FUNCTOR_H_INCLUDED
36 
37 #include <memory> // std::unique_ptr
38 
39 #include "sql/gis/functor.h"
40 #include "sql/gis/geometries.h"
41 
42 namespace gis {
43 
44 /// Line interpolate functor that calls boost::geometry::line_interpolate with
45 /// the correct parameter types.
46 ///
47 /// The functor throws exceptions and is therefore only intended used to
48 /// implement line_interpolate or other geographic functions. It should not be
49 /// used directly by other MySQL code.
50 class Line_interpolate_point : public Unary_functor<std::unique_ptr<Geometry>> {
51  private:
52  double m_distance;
54  boost::geometry::strategy::line_interpolate::geographic<>
56 
57  public:
58  explicit Line_interpolate_point(double distance, bool return_multiple_points)
60  m_return_multiple_points(return_multiple_points) {}
61  Line_interpolate_point(double distance, bool return_multiple_points,
62  double semi_major, double semi_minor)
64  m_return_multiple_points(return_multiple_points),
66  boost::geometry::srs::spheroid<double>(semi_major, semi_minor)) {}
67 
68  std::unique_ptr<Geometry> operator()(const Geometry &g) const override;
69  std::unique_ptr<Geometry> eval(const Geometry &g) const;
70  std::unique_ptr<Geometry> eval(const Geographic_linestring &g) const;
71  std::unique_ptr<Geometry> eval(const Cartesian_linestring &g) const;
72 };
73 
74 } // namespace gis
75 
76 #endif // SQL_GIS_LINE_INTERPOLATE_FUNCTOR_H_INCLUDED
A Cartesian 2d linestring.
Definition: geometries_cs.h:70
A geographic (ellipsoidal) 2d linestring.
Definition: geometries_cs.h:124
Abstract superclass for all geometric objects.
Definition: geometries.h:99
Line interpolate functor that calls boost::geometry::line_interpolate with the correct parameter type...
Definition: line_interpolate_functor.h:50
Line_interpolate_point(double distance, bool return_multiple_points, double semi_major, double semi_minor)
Definition: line_interpolate_functor.h:61
std::unique_ptr< Geometry > eval(const Geometry &g) const
Definition: line_interpolate.cc:51
boost::geometry::strategy::line_interpolate::geographic m_geographic_strategy
Definition: line_interpolate_functor.h:55
std::unique_ptr< Geometry > operator()(const Geometry &g) const override
Definition: line_interpolate.cc:46
bool m_return_multiple_points
Definition: line_interpolate_functor.h:53
Line_interpolate_point(double distance, bool return_multiple_points)
Definition: line_interpolate_functor.h:58
double m_distance
Definition: line_interpolate_functor.h:52
The base class of all functors that take one geometry argument.
Definition: functor.h:614
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:590
Definition: area.cc:46
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:39