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