#ifndef GIS_BG_TRAITS_INCLUDED #define GIS_BG_TRAITS_INCLUDED /* Copyright (c) 2014, 2024, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, as published by the Free Software Foundation. This program is designed to work with certain software (including but not limited to OpenSSL) that is licensed under separate terms, as designated in a particular file or component or in included license documentation. The authors of MySQL hereby grant you an additional permission to link the program and your derivative works with the separately licensed software that they have either included with the program or referenced in the documentation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0, for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* This file defines all boost geometry traits. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "sql/spatial.h" // Boost Geometry traits. namespace boost { namespace geometry { namespace traits { template <> struct tag { typedef boost::geometry::point_tag type; }; template <> struct coordinate_type { typedef double type; }; template <> struct coordinate_system { typedef boost::geometry::cs::cartesian type; }; template <> struct dimension : boost::mpl::int_ {}; template struct access { static inline double get(Gis_point const &p) { return p.get(); } static inline void set(Gis_point &p, double const &value) { p.set(value); } }; ////////////////////////////////// LINESTRING //////////////////////////// template <> struct tag { typedef boost::geometry::linestring_tag type; }; ////////////////////////////////// POLYGON ////////////////////////////////// template <> struct tag { typedef boost::geometry::polygon_tag type; }; template <> struct ring_const_type { typedef Gis_polygon::ring_type const &type; }; template <> struct ring_mutable_type { typedef Gis_polygon::ring_type &type; }; template <> struct interior_const_type { typedef Gis_polygon::inner_container_type const &type; }; template <> struct interior_mutable_type { typedef Gis_polygon::inner_container_type &type; }; template <> struct exterior_ring { typedef Gis_polygon polygon_type; static inline polygon_type::ring_type &get(polygon_type &p) { return p.outer(); } static inline polygon_type::ring_type const &get(polygon_type const &p) { return p.outer(); } }; template <> struct interior_rings { typedef Gis_polygon polygon_type; static inline polygon_type::inner_container_type &get(polygon_type &p) { return p.inners(); } static inline polygon_type::inner_container_type const &get( polygon_type const &p) { return p.inners(); } }; ////////////////////////////////// RING ////////////////////////////////// template <> struct point_order { static const order_selector value = counterclockwise; }; template <> struct closure { static const closure_selector value = closed; }; template <> struct tag { typedef boost::geometry::ring_tag type; }; ////////////////////////////////// MULTI GEOMETRIES ///////////////////////// /////////////////////////////////// multi linestring types ///////////////////// template <> struct tag { typedef boost::geometry::multi_linestring_tag type; }; /////////////////////////////////// multi point types ///////////////////// template <> struct tag { typedef boost::geometry::multi_point_tag type; }; /////////////////////////////////// multi polygon types ///////////////////// template <> struct tag { typedef boost::geometry::multi_polygon_tag type; }; } // namespace traits } // namespace geometry } // namespace boost #endif // !GIS_BG_TRAITS_INCLUDED