]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/core/point_type.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / geometry / core / point_type.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
6
7 // This file was modified by Oracle on 2020.
8 // Modifications copyright (c) 2020 Oracle and/or its affiliates.
9 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
10
11 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
12 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
13
14 // Use, modification and distribution is subject to the Boost Software License,
15 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
16 // http://www.boost.org/LICENSE_1_0.txt)
17
18 #ifndef BOOST_GEOMETRY_CORE_POINT_TYPE_HPP
19 #define BOOST_GEOMETRY_CORE_POINT_TYPE_HPP
20
21
22 #include <boost/range/value_type.hpp>
23
24 #include <boost/geometry/core/ring_type.hpp>
25 #include <boost/geometry/core/static_assert.hpp>
26 #include <boost/geometry/core/tag.hpp>
27 #include <boost/geometry/core/tags.hpp>
28 #include <boost/geometry/util/type_traits_std.hpp>
29
30
31 namespace boost { namespace geometry
32 {
33
34 namespace traits
35 {
36
37 /*!
38 \brief Traits class indicating the type of contained points
39 \ingroup traits
40 \par Geometries:
41 - all geometries except point
42 \par Specializations should provide:
43 - typedef P type (where P should fulfil the Point concept)
44 \tparam Geometry geometry
45 */
46 template <typename Geometry>
47 struct point_type
48 {
49 BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
50 "Not implemented for this Geometry type.",
51 Geometry);
52 };
53
54
55 } // namespace traits
56
57
58 #ifndef DOXYGEN_NO_DISPATCH
59 namespace core_dispatch
60 {
61
62 template <typename Tag, typename Geometry>
63 struct point_type
64 {
65 // Default: call traits to get point type
66 typedef typename std::remove_const
67 <
68 typename traits::point_type<Geometry>::type
69 >::type type;
70 };
71
72
73 // Specialization for point: the point itself
74 template <typename Point>
75 struct point_type<point_tag, Point>
76 {
77 typedef Point type;
78 };
79
80
81 // Specializations for linestring/ring, via boost::range
82 template <typename Linestring>
83 struct point_type<linestring_tag, Linestring>
84 {
85 typedef typename boost::range_value<Linestring>::type type;
86 };
87
88
89 template <typename Ring>
90 struct point_type<ring_tag, Ring>
91 {
92 typedef typename boost::range_value<Ring>::type type;
93 };
94
95
96 // Specialization for polygon: the point-type is the point-type of its rings
97 template <typename Polygon>
98 struct point_type<polygon_tag, Polygon>
99 {
100 typedef typename point_type
101 <
102 ring_tag,
103 typename ring_type<polygon_tag, Polygon>::type
104 >::type type;
105 };
106
107
108 template <typename MultiPoint>
109 struct point_type<multi_point_tag, MultiPoint>
110 {
111 typedef typename boost::range_value
112 <
113 MultiPoint
114 >::type type;
115 };
116
117
118 template <typename MultiLinestring>
119 struct point_type<multi_linestring_tag, MultiLinestring>
120 {
121 typedef typename point_type
122 <
123 linestring_tag,
124 typename boost::range_value<MultiLinestring>::type
125 >::type type;
126 };
127
128
129 template <typename MultiPolygon>
130 struct point_type<multi_polygon_tag, MultiPolygon>
131 {
132 typedef typename point_type
133 <
134 polygon_tag,
135 typename boost::range_value<MultiPolygon>::type
136 >::type type;
137 };
138
139
140 } // namespace core_dispatch
141 #endif // DOXYGEN_NO_DISPATCH
142
143
144 /*!
145 \brief \brief_meta{type, point_type, \meta_geometry_type}
146 \tparam Geometry \tparam_geometry
147 \ingroup core
148
149 \qbk{[include reference/core/point_type.qbk]}
150 */
151 template <typename Geometry>
152 struct point_type
153 {
154 typedef typename core_dispatch::point_type
155 <
156 typename tag<Geometry>::type,
157 typename util::remove_cptrref<Geometry>::type
158 >::type type;
159 };
160
161
162 }} // namespace boost::geometry
163
164
165 #endif // BOOST_GEOMETRY_CORE_POINT_TYPE_HPP