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