MySQL 8.4.0
Source Code Documentation
is_simple_functor.h
Go to the documentation of this file.
1// Copyright (c) 2017, 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/// Declares the is_simple functor interface.
27///
28/// The functor is not intended for use directly by MySQL code. It should be
29/// used indirectly through the gis::is_simple() function.
30///
31/// @see gis::is_simple
32
33#ifndef SQL_GIS_IS_SIMPLE_FUNCTOR_H_INCLUDED
34#define SQL_GIS_IS_SIMPLE_FUNCTOR_H_INCLUDED
35
36#include <boost/geometry.hpp>
37
38#include "sql/gis/functor.h" // gis::Unary_functor
39#include "sql/gis/geometries.h" // gis::Geometry
40#include "sql/gis/geometries_cs.h" // gis::{Cartesian_*, Geographic_*}
41
42namespace gis {
43
44/// Is_simple functor calls boost::geometry::is_simple with the correct
45/// parameter types.
46///
47/// The functor may throw exceptions. It is intended for implementing geographic
48/// functions. It should not be used directly by other MySQL code.
49class Is_simple : public Unary_functor<bool> {
50 boost::geometry::strategy::intersection::geographic_segments<> m_geostrat;
51
52 // For instantiating gis::Intersects when evaluating a Geometrycollection.
55
56 public:
57 Is_simple(double semi_major, double semi_minor);
58
59 bool operator()(const Geometry &g) const override;
60
61 bool eval(const Cartesian_point &g) const;
62 bool eval(const Cartesian_linestring &g) const;
63 bool eval(const Cartesian_polygon &g) const;
64 bool eval(const Cartesian_multipoint &g) const;
65 bool eval(const Cartesian_multipolygon &g) const;
66 bool eval(const Cartesian_multilinestring &g) const;
67
68 bool eval(const Geographic_point &g) const;
69 bool eval(const Geographic_linestring &g) const;
70 bool eval(const Geographic_polygon &g) const;
71 bool eval(const Geographic_multipoint &g) const;
72 bool eval(const Geographic_multipolygon &g) const;
73 bool eval(const Geographic_multilinestring &g) const;
74
75 bool eval(const Geometrycollection &g) const;
76};
77
78} // namespace gis
79
80#endif // include guard
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
A geographic (ellipsoidal) 2d linestring.
Definition: geometries_cs.h:125
A geographic (ellipsoidal) 2d multilinestring.
Definition: geometries_cs.h:661
A geographic (ellipsoidal) 2d multipoint.
Definition: geometries_cs.h:552
A geographic (ellipsoidal) 2d multipolygon.
Definition: geometries_cs.h:774
A geographic (ellipsoidal) 2d point.
Definition: geometries_cs.h:58
A geographic (ellipsoidal) 2d polygon.
Definition: geometries_cs.h:322
Abstract superclass for all geometric objects.
Definition: geometries.h:100
A collection of geometries.
Definition: geometries.h:410
Is_simple functor calls boost::geometry::is_simple with the correct parameter types.
Definition: is_simple_functor.h:49
boost::geometry::strategy::intersection::geographic_segments m_geostrat
Definition: is_simple_functor.h:50
bool operator()(const Geometry &g) const override
Definition: is_simple.cc:52
double m_semi_minor
Definition: is_simple_functor.h:54
bool eval(const Cartesian_point &g) const
Definition: is_simple.cc:58
double m_semi_major
Definition: is_simple_functor.h:53
Is_simple(double semi_major, double semi_minor)
Definition: is_simple.cc:47
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 ...
This file declares the coordinate system specific subclasses of the geometry class hierarchy.
Definition: area.cc:47