MySQL 8.0.29
Source Code Documentation
gis_bg_traits.h
Go to the documentation of this file.
1#ifndef GIS_BG_TRAITS_INCLUDED
2#define GIS_BG_TRAITS_INCLUDED
3
4/* Copyright (c) 2014, 2021, 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 also distributed 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 included with MySQL.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License, version 2.0, for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25*/
26
27/* This file defines all boost geometry traits. */
28
29#include <boost/concept/requires.hpp>
30#include <boost/geometry/core/access.hpp>
31#include <boost/geometry/core/closure.hpp>
32#include <boost/geometry/core/coordinate_dimension.hpp>
33#include <boost/geometry/core/coordinate_system.hpp>
34#include <boost/geometry/core/coordinate_type.hpp>
35#include <boost/geometry/core/cs.hpp>
36#include <boost/geometry/core/exterior_ring.hpp>
37#include <boost/geometry/core/interior_rings.hpp>
38#include <boost/geometry/core/interior_type.hpp>
39#include <boost/geometry/core/point_order.hpp>
40#include <boost/geometry/core/ring_type.hpp>
41#include <boost/geometry/core/tags.hpp>
42#include <boost/geometry/geometries/concepts/linestring_concept.hpp>
43#include <boost/geometry/geometries/concepts/point_concept.hpp>
44#include <boost/geometry/geometries/concepts/polygon_concept.hpp>
45#include <boost/geometry/multi/core/tags.hpp>
46#include <boost/geometry/util/math.hpp>
47#include <boost/static_assert.hpp>
48
49#include "sql/spatial.h"
50
51// Boost Geometry traits.
52namespace boost {
53namespace geometry {
54namespace traits {
55template <>
56struct tag<Gis_point> {
57 typedef boost::geometry::point_tag type;
58};
59
60template <>
61struct coordinate_type<Gis_point> {
62 typedef double type;
63};
64
65template <>
66struct coordinate_system<Gis_point> {
67 typedef boost::geometry::cs::cartesian type;
68};
69
70template <>
71struct dimension<Gis_point> : boost::mpl::int_<GEOM_DIM> {};
72
73template <std::size_t Dimension>
74struct access<Gis_point, Dimension> {
75 static inline double get(Gis_point const &p) { return p.get<Dimension>(); }
76
77 static inline void set(Gis_point &p, double const &value) {
78 p.set<Dimension>(value);
79 }
80};
81
82////////////////////////////////// LINESTRING ////////////////////////////
83template <>
84struct tag<Gis_line_string> {
85 typedef boost::geometry::linestring_tag type;
86};
87
88////////////////////////////////// POLYGON //////////////////////////////////
89
90template <>
91struct tag<Gis_polygon> {
92 typedef boost::geometry::polygon_tag type;
93};
94
95template <>
96struct ring_const_type<Gis_polygon> {
98};
99
100template <>
101struct ring_mutable_type<Gis_polygon> {
103};
104
105template <>
106struct interior_const_type<Gis_polygon> {
108};
109
110template <>
111struct interior_mutable_type<Gis_polygon> {
113};
114
115template <>
116struct exterior_ring<Gis_polygon> {
118
120 return p.outer();
121 }
122
123 static inline polygon_type::ring_type const &get(polygon_type const &p) {
124 return p.outer();
125 }
126};
127
128template <>
129struct interior_rings<Gis_polygon> {
131
133 return p.inners();
134 }
135
137 polygon_type const &p) {
138 return p.inners();
139 }
140};
141
142////////////////////////////////// RING //////////////////////////////////
143template <>
144struct point_order<Gis_polygon_ring> {
145 static const order_selector value = counterclockwise;
146};
147
148template <>
149struct closure<Gis_polygon_ring> {
150 static const closure_selector value = closed;
151};
152
153template <>
154struct tag<Gis_polygon_ring> {
155 typedef boost::geometry::ring_tag type;
156};
157
158////////////////////////////////// MULTI GEOMETRIES /////////////////////////
159
160/////////////////////////////////// multi linestring types /////////////////////
161template <>
163 typedef boost::geometry::multi_linestring_tag type;
164};
165
166/////////////////////////////////// multi point types /////////////////////
167
168template <>
169struct tag<Gis_multi_point> {
170 typedef boost::geometry::multi_point_tag type;
171};
172
173/////////////////////////////////// multi polygon types /////////////////////
174template <>
175struct tag<Gis_multi_polygon> {
176 typedef boost::geometry::multi_polygon_tag type;
177};
178
179} // namespace traits
180
181} // namespace geometry
182} // namespace boost
183
184#endif // !GIS_BG_TRAITS_INCLUDED
Definition: spatial.h:2089
Definition: spatial.h:2323
Definition: spatial.h:2280
Definition: spatial.h:2363
Definition: spatial.h:1142
Definition: spatial.h:2142
Definition: spatial.h:2177
Gis_wkb_vector class template definition.
Definition: spatial.h:1892
const char * p
Definition: ctype-mb.cc:1236
Tag dispatch for custom Role_properties.
Definition: sql_auth_cache.h:587
static void set(Gis_point &p, double const &value)
Definition: gis_bg_traits.h:77
static double get(Gis_point const &p)
Definition: gis_bg_traits.h:75
boost::geometry::cs::cartesian type
Definition: gis_bg_traits.h:67
double type
Definition: gis_bg_traits.h:62
static polygon_type::ring_type & get(polygon_type &p)
Definition: gis_bg_traits.h:119
static polygon_type::ring_type const & get(polygon_type const &p)
Definition: gis_bg_traits.h:123
Gis_polygon polygon_type
Definition: gis_bg_traits.h:117
Gis_polygon::inner_container_type const & type
Definition: gis_bg_traits.h:107
Gis_polygon::inner_container_type & type
Definition: gis_bg_traits.h:112
static polygon_type::inner_container_type const & get(polygon_type const &p)
Definition: gis_bg_traits.h:136
static polygon_type::inner_container_type & get(polygon_type &p)
Definition: gis_bg_traits.h:132
Gis_polygon polygon_type
Definition: gis_bg_traits.h:130
Gis_polygon::ring_type const & type
Definition: gis_bg_traits.h:97
Gis_polygon::ring_type & type
Definition: gis_bg_traits.h:102
boost::geometry::linestring_tag type
Definition: gis_bg_traits.h:85
boost::geometry::multi_linestring_tag type
Definition: gis_bg_traits.h:163
boost::geometry::multi_point_tag type
Definition: gis_bg_traits.h:170
boost::geometry::multi_polygon_tag type
Definition: gis_bg_traits.h:176
boost::geometry::point_tag type
Definition: gis_bg_traits.h:57
boost::geometry::polygon_tag type
Definition: gis_bg_traits.h:92
boost::geometry::ring_tag type
Definition: gis_bg_traits.h:155