MySQL 9.1.0
Source Code Documentation
simplify_functor.h
Go to the documentation of this file.
1#ifndef SQL_GIS_SIMPLIFY_FUNCTOR_H_INCLUDED
2#define SQL_GIS_SIMPLIFY_FUNCTOR_H_INCLUDED
3
4// Copyright (c) 2018, 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 simplify functor interface.
30///
31/// The functor is not intended for use directly by MySQL code. It should be
32/// used indirectly through the gis::simplify() function.
33///
34/// @see gis::simplify
35
36#include <memory> // std::unique_ptr
37
38#include <boost/geometry.hpp>
39
40#include "sql/gis/functor.h"
41#include "sql/gis/geometries.h"
42
43namespace gis {
44
45/// Simplify functor that calls Boost.Geometry with the correct parameter types.
46///
47/// The functor throws exceptions and is therefore only intended used to
48/// implement simplify or other geographic functions. It should not be used
49/// directly by other MySQL code.
50class Simplify : public Unary_functor<std::unique_ptr<Geometry>> {
51 private:
53
54 public:
55 Simplify(double max_distance) : m_max_distance(max_distance) {}
56 std::unique_ptr<Geometry> operator()(const Geometry &g) const override;
57 std::unique_ptr<Geometry> eval(const Geometry &g) const;
58 std::unique_ptr<Geometry> eval(const Cartesian_point &g) const;
59 std::unique_ptr<Geometry> eval(const Cartesian_linestring &g) const;
60 std::unique_ptr<Geometry> eval(const Cartesian_polygon &g) const;
61 std::unique_ptr<Geometry> eval(const Cartesian_geometrycollection &g) const;
62 std::unique_ptr<Geometry> eval(const Cartesian_multipoint &g) const;
63 std::unique_ptr<Geometry> eval(const Cartesian_multilinestring &g) const;
64 std::unique_ptr<Geometry> eval(const Cartesian_multipolygon &g) const;
65};
66
67} // namespace gis
68
69#endif // SQL_GIS_SIMPLIFY_FUNCTOR_H_INCLUDED
A Cartesian 2d geometry collection.
Definition: geometries_cs.h:375
A Cartesian 2d linestring.
Definition: geometries_cs.h:71
A Cartesian 2d multilinestring.
Definition: geometries_cs.h:602
A Cartesian 2d multipoint.
Definition: geometries_cs.h:501
A Cartesian 2d multipolygon.
Definition: geometries_cs.h:720
A Cartesian 2d point.
Definition: geometries_cs.h:47
A Cartesian 2d polygon.
Definition: geometries_cs.h:269
Abstract superclass for all geometric objects.
Definition: geometries.h:100
Simplify functor that calls Boost.Geometry with the correct parameter types.
Definition: simplify_functor.h:50
std::unique_ptr< Geometry > eval(const Geometry &g) const
Definition: simplify.cc:53
std::unique_ptr< Geometry > operator()(const Geometry &g) const override
Definition: simplify.cc:49
double m_max_distance
Definition: simplify_functor.h:52
Simplify(double max_distance)
Definition: simplify_functor.h:55
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 ...
Definition: area.cc:47