MySQL  8.0.23
Source Code Documentation
is_simple_functor.h
Go to the documentation of this file.
1 // Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
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
gis::Geographic_point
A geographic (ellipsoidal) 2d point.
Definition: geometries_cs.h:56
gis::Geographic_multilinestring
A geographic (ellipsoidal) 2d multilinestring.
Definition: geometries_cs.h:551
gis::Is_simple
Is_simple functor calls boost::geometry::is_simple with the correct parameter types.
Definition: is_simple_functor.h:48
gis::Geographic_multipoint
A geographic (ellipsoidal) 2d multipoint.
Definition: geometries_cs.h:458
gis
Definition: area.cc:45
gis::Cartesian_multipolygon
A Cartesian 2d multipolygon.
Definition: geometries_cs.h:601
geometries_cs.h
gis::Geographic_multipolygon
A geographic (ellipsoidal) 2d multipolygon.
Definition: geometries_cs.h:648
gis::Cartesian_polygon
A Cartesian 2d polygon.
Definition: geometries_cs.h:210
gis::Is_simple::m_semi_major
double m_semi_major
Definition: is_simple_functor.h:52
gis::Geometry
Abstract superclass for all geometric objects.
Definition: geometries.h:99
gis::Is_simple::m_geostrat
boost::geometry::strategy::intersection::geographic_segments m_geostrat
Definition: is_simple_functor.h:49
gis::Geographic_linestring
A geographic (ellipsoidal) 2d linestring.
Definition: geometries_cs.h:112
gis::Is_simple::Is_simple
Is_simple(double semi_major, double semi_minor)
Definition: is_simple.cc:45
gis::Cartesian_multilinestring
A Cartesian 2d multilinestring.
Definition: geometries_cs.h:501
gis::Geometrycollection
A collection of geometries.
Definition: geometries.h:360
gis::Geographic_polygon
A geographic (ellipsoidal) 2d polygon.
Definition: geometries_cs.h:259
geometries.h
gis::Cartesian_point
A Cartesian 2d point.
Definition: geometries_cs.h:46
gis::Is_simple::operator()
bool operator()(const Geometry &g) const override
Definition: is_simple.cc:50
gis::Cartesian_multipoint
A Cartesian 2d multipoint.
Definition: geometries_cs.h:414
gis::Unary_functor
The base class of all functors that take one geometry argument.
Definition: functor.h:613
gis::Is_simple::m_semi_minor
double m_semi_minor
Definition: is_simple_functor.h:53
functor.h
gis::Is_simple::eval
bool eval(const Cartesian_point &g) const
Definition: is_simple.cc:56
gis::Cartesian_linestring
A Cartesian 2d linestring.
Definition: geometries_cs.h:66