MySQL 9.0.0
Source Code Documentation
buffer.h
Go to the documentation of this file.
1#ifndef SQL_GIS_BUFFER_H_INCLUDED
2#define SQL_GIS_BUFFER_H_INCLUDED
3
4// Copyright (c) 2021, 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 interface for calculating the buffer of a geometry.
30
31#include <memory> // std::unique_ptr
32#include "sql/dd/types/spatial_reference_system.h" // dd::Spatial_reference_system
33#include "sql/gis/buffer_strategies.h" // buffer_strategies
34#include "sql/gis/geometries.h" // gis::Geometry
35
36namespace gis {
37
38/// Invalid buffer strategies exception.
39///
40/// Thrown when a buffer strategy is given as argument and the geometry is not
41/// compatible: e.g. point strategy with a Linestring. Also thrown when
42/// distance is negative and geometry is not Multi-/Polygon or GC.
43struct invalid_buffer_argument_exception : public std::exception {};
44
45/// Invalid buffer result exception.
46///
47/// Thrown when the result from buffer call to Boost is invalid.
48struct invalid_buffer_result_exception : public std::exception {};
49
50/// Creates the buffer of a geometry
51///
52/// @param[in] srs The spatial reference system.
53/// @param[in] g Input geometry.
54/// @param[in] strategies Struct holding strategy arguments for buffer creation
55/// @param[in] func_name Function name used in error reporting.
56/// @param[out] result The geometry that is the buffer of input geometry g
57///
58/// @retval false Success.
59/// @retval true An error has occurred. The error has been reported with
60/// my_error().
61
62bool buffer(const dd::Spatial_reference_system *srs, const Geometry &g,
63 const BufferStrategies &strategies, const char *func_name,
64 std::unique_ptr<Geometry> *result) noexcept;
65
66} // namespace gis
67
68#endif // SQL_GIS_BUFFER_H_INCLUDED
This file implements a struct that is used to hold information that decide how to compute the buffer ...
Definition: spatial_reference_system.h:53
Abstract superclass for all geometric objects.
Definition: geometries.h:100
This file declares the geometry class hierarchy used by the server as the internal representation of ...
Definition: area.cc:47
bool buffer(const dd::Spatial_reference_system *srs, const Geometry &g, const BufferStrategies &strategies, const char *func_name, std::unique_ptr< Geometry > *result) noexcept
Creates the buffer of a geometry.
Definition: buffer.cc:322
Definition: buffer_strategies.h:45
Invalid buffer strategies exception.
Definition: buffer.h:43
Invalid buffer result exception.
Definition: buffer.h:48
Definition: result.h:30