File indexing completed on 2025-01-18 09:35:23
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #ifndef BOOST_GEOMETRY_CORE_RADIUS_HPP
0021 #define BOOST_GEOMETRY_CORE_RADIUS_HPP
0022
0023
0024 #include <cstddef>
0025
0026 #include <boost/static_assert.hpp>
0027
0028 #include <boost/geometry/core/tag.hpp>
0029 #include <boost/geometry/core/tags.hpp>
0030 #include <boost/geometry/util/type_traits_std.hpp>
0031
0032
0033 namespace boost { namespace geometry
0034 {
0035
0036 namespace traits
0037 {
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056 template <typename Geometry, std::size_t Dimension>
0057 struct radius_access {};
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069 template <typename Geometry>
0070 struct radius_type {};
0071
0072 }
0073
0074
0075 #ifndef DOXYGEN_NO_DISPATCH
0076 namespace core_dispatch
0077 {
0078
0079 template <typename Tag, typename Geometry>
0080 struct radius_type
0081 {
0082
0083 };
0084
0085
0086
0087
0088 template <typename Tag,
0089 typename Geometry,
0090 std::size_t Dimension,
0091 typename IsPointer>
0092 struct radius_access
0093 {
0094
0095
0096 };
0097
0098 }
0099 #endif
0100
0101
0102
0103
0104
0105
0106
0107 template <typename Geometry>
0108 struct radius_type
0109 {
0110 typedef typename core_dispatch::radius_type
0111 <
0112 typename tag<Geometry>::type,
0113 typename util::remove_cptrref<Geometry>::type
0114 >::type type;
0115 };
0116
0117
0118
0119
0120
0121
0122
0123
0124 template <std::size_t I, typename Geometry>
0125 inline typename radius_type<Geometry>::type get_radius(Geometry const& geometry)
0126 {
0127 return core_dispatch::radius_access
0128 <
0129 typename tag<Geometry>::type,
0130 typename util::remove_cptrref<Geometry>::type,
0131 I,
0132 typename std::is_pointer<Geometry>::type
0133 >::get(geometry);
0134 }
0135
0136
0137
0138
0139
0140
0141
0142
0143 template <std::size_t I, typename Geometry>
0144 inline void set_radius(Geometry& geometry,
0145 typename radius_type<Geometry>::type const& radius)
0146 {
0147 core_dispatch::radius_access
0148 <
0149 typename tag<Geometry>::type,
0150 typename util::remove_cptrref<Geometry>::type,
0151 I,
0152 typename std::is_pointer<Geometry>::type
0153 >::set(geometry, radius);
0154 }
0155
0156
0157
0158 #ifndef DOXYGEN_NO_DETAIL
0159 namespace detail
0160 {
0161
0162 template <typename Tag, typename Geometry, std::size_t Dimension>
0163 struct radius_access
0164 {
0165 static inline typename radius_type<Geometry>::type get(Geometry const& geometry)
0166 {
0167 return traits::radius_access<Geometry, Dimension>::get(geometry);
0168 }
0169 static inline void set(Geometry& geometry,
0170 typename radius_type<Geometry>::type const& value)
0171 {
0172 traits::radius_access<Geometry, Dimension>::set(geometry, value);
0173 }
0174 };
0175
0176 }
0177 #endif
0178
0179
0180 #ifndef DOXYGEN_NO_DISPATCH
0181 namespace core_dispatch
0182 {
0183
0184 template <typename Tag,
0185 typename Geometry,
0186 std::size_t Dimension>
0187 struct radius_access<Tag, Geometry, Dimension, std::true_type>
0188 {
0189 typedef typename geometry::radius_type<Geometry>::type radius_type;
0190
0191 static inline radius_type get(const Geometry * geometry)
0192 {
0193 return radius_access
0194 <
0195 Tag,
0196 Geometry,
0197 Dimension,
0198 typename std::is_pointer<Geometry>::type
0199 >::get(*geometry);
0200 }
0201
0202 static inline void set(Geometry * geometry, radius_type const& value)
0203 {
0204 return radius_access
0205 <
0206 Tag,
0207 Geometry,
0208 Dimension,
0209 typename std::is_pointer<Geometry>::type
0210 >::set(*geometry, value);
0211 }
0212 };
0213
0214
0215 template <typename Geometry>
0216 struct radius_type<srs_sphere_tag, Geometry>
0217 {
0218 typedef typename traits::radius_type<Geometry>::type type;
0219 };
0220
0221 template <typename Geometry, std::size_t Dimension>
0222 struct radius_access<srs_sphere_tag, Geometry, Dimension, std::false_type>
0223 : detail::radius_access<srs_sphere_tag, Geometry, Dimension>
0224 {
0225
0226 BOOST_STATIC_ASSERT(Dimension < 3);
0227 };
0228
0229 template <typename Geometry>
0230 struct radius_type<srs_spheroid_tag, Geometry>
0231 {
0232 typedef typename traits::radius_type<Geometry>::type type;
0233 };
0234
0235 template <typename Geometry, std::size_t Dimension>
0236 struct radius_access<srs_spheroid_tag, Geometry, Dimension, std::false_type>
0237 : detail::radius_access<srs_spheroid_tag, Geometry, Dimension>
0238 {
0239
0240 BOOST_STATIC_ASSERT(Dimension < 3);
0241 };
0242
0243 }
0244 #endif
0245
0246
0247 }}
0248
0249
0250 #endif