]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/geometries/adapted/boost_polygon/point.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / geometry / geometries / adapted / boost_polygon / point.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
4
5 // This file was modified by Oracle on 2020.
6 // Modifications copyright (c) 2020, Oracle and/or its affiliates.
7 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
8
9 // Use, modification and distribution is subject to the Boost Software License,
10 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
11 // http://www.boost.org/LICENSE_1_0.txt)
12
13 #ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_POINT_HPP
14 #define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_POINT_HPP
15
16 // Adapts Geometries from Boost.Polygon for usage in Boost.Geometry
17 // boost::polygon::point_data -> boost::geometry::point
18
19
20 #include <type_traits>
21
22 #include <boost/polygon/polygon.hpp>
23
24 #include <boost/geometry/core/access.hpp>
25 #include <boost/geometry/core/cs.hpp>
26 #include <boost/geometry/core/coordinate_dimension.hpp>
27 #include <boost/geometry/core/coordinate_type.hpp>
28 #include <boost/geometry/core/tags.hpp>
29
30
31 namespace boost { namespace geometry
32 {
33
34
35 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
36 namespace traits
37 {
38
39
40 template <typename CoordinateType>
41 struct tag<boost::polygon::point_data<CoordinateType> >
42 {
43 typedef point_tag type;
44 };
45
46
47 template <typename CoordinateType>
48 struct coordinate_type<boost::polygon::point_data<CoordinateType> >
49 {
50 typedef CoordinateType type;
51 };
52
53
54 template <typename CoordinateType>
55 struct coordinate_system<boost::polygon::point_data<CoordinateType> >
56 {
57 typedef cs::cartesian type;
58 };
59
60
61 template <typename CoordinateType>
62 struct dimension<boost::polygon::point_data<CoordinateType> >
63 : std::integral_constant<std::size_t, 2>
64 {};
65
66
67 template <typename CoordinateType>
68 struct access<boost::polygon::point_data<CoordinateType>, 0>
69 {
70 typedef boost::polygon::point_data<CoordinateType> point_type;
71
72 static inline CoordinateType get(point_type const& p)
73 {
74 return p.x();
75 }
76
77 static inline void set(point_type& p, CoordinateType const& value)
78 {
79 p.x(value);
80 }
81 };
82
83
84 template <typename CoordinateType>
85 struct access<boost::polygon::point_data<CoordinateType>, 1>
86 {
87 typedef boost::polygon::point_data<CoordinateType> point_type;
88
89 static inline CoordinateType get(point_type const& p)
90 {
91 return p.y();
92 }
93
94 static inline void set(point_type& p, CoordinateType const& value)
95 {
96 p.y(value);
97 }
98 };
99
100
101 } // namespace traits
102 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
103
104
105 }} // namespace boost::geometry
106
107
108 #endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_POINT_HPP