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