MySQL 9.1.0
Source Code Documentation
so_utils.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/// @file
25///
26/// This file declares the interface of various utility functions for
27/// spatial operations (union, intersection, difference, symdifference).
28/// The functions may throw exceptions.
29
30#ifndef SQL_GIS_SO_UTILS_H_INCLUDED
31#define SQL_GIS_SO_UTILS_H_INCLUDED
32
33#include <memory> // std::unique_ptr
34
35#include "sql/gis/geometries.h"
36
37namespace gis {
38
39/// Removes all duplicates in a geometrycollection.
40///
41/// If the geometry is not a collection, the function does nothing.
42/// Duplicates are removed in all levels, so for a geometrycollection,
43/// the function is called for each member geometry as well.
44///
45/// @param[in] semi_major Semi-major axis of ellipsoid.
46/// @param[in] semi_minor Semi-minor axis of ellipsoid.
47/// @param[in, out] g The geometry to remove duplicates from.
48void remove_duplicates(double semi_major, double semi_minor,
49 std::unique_ptr<Geometry> *g);
50
51/// Narrow a geometry to its simplest form.
52///
53/// E.g. for a multipoint with only one point, the geometry is reduced to that
54/// point. For an input geometry which cannot be narrowed further, the function
55/// does nothing.
56///
57/// @param[in, out] g The geometry to possibly narrow.
58void narrow_geometry(std::unique_ptr<Geometry> *g);
59
60} // namespace gis
61
62#endif // SQL_GIS_SO_UTILS_H_INCLUDED
This file declares the geometry class hierarchy used by the server as the internal representation of ...
Definition: area.cc:47
void remove_duplicates(double semi_major, double semi_minor, std::unique_ptr< Geometry > *g)
Removes all duplicates in a geometrycollection.
Definition: so_utils.cc:118
void narrow_geometry(std::unique_ptr< Geometry > *g)
Narrow a geometry to its simplest form.
Definition: so_utils.cc:138