123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- #ifndef BOOST_GEOMETRY_CORE_RADIUS_HPP
- #define BOOST_GEOMETRY_CORE_RADIUS_HPP
- #include <cstddef>
- #include <boost/static_assert.hpp>
- #include <boost/geometry/core/tag.hpp>
- #include <boost/geometry/core/tags.hpp>
- #include <boost/geometry/util/type_traits_std.hpp>
- namespace boost { namespace geometry
- {
- namespace traits
- {
- template <typename Geometry, std::size_t Dimension>
- struct radius_access {};
- template <typename Geometry>
- struct radius_type {};
- }
- #ifndef DOXYGEN_NO_DISPATCH
- namespace core_dispatch
- {
- template <typename Tag, typename Geometry>
- struct radius_type
- {
-
- };
- template <typename Tag,
- typename Geometry,
- std::size_t Dimension,
- typename IsPointer>
- struct radius_access
- {
-
-
- };
- }
- #endif
- template <typename Geometry>
- struct radius_type
- {
- typedef typename core_dispatch::radius_type
- <
- typename tag<Geometry>::type,
- typename util::remove_cptrref<Geometry>::type
- >::type type;
- };
- template <std::size_t I, typename Geometry>
- inline typename radius_type<Geometry>::type get_radius(Geometry const& geometry)
- {
- return core_dispatch::radius_access
- <
- typename tag<Geometry>::type,
- typename util::remove_cptrref<Geometry>::type,
- I,
- typename std::is_pointer<Geometry>::type
- >::get(geometry);
- }
- template <std::size_t I, typename Geometry>
- inline void set_radius(Geometry& geometry,
- typename radius_type<Geometry>::type const& radius)
- {
- core_dispatch::radius_access
- <
- typename tag<Geometry>::type,
- typename util::remove_cptrref<Geometry>::type,
- I,
- typename std::is_pointer<Geometry>::type
- >::set(geometry, radius);
- }
- #ifndef DOXYGEN_NO_DETAIL
- namespace detail
- {
- template <typename Tag, typename Geometry, std::size_t Dimension>
- struct radius_access
- {
- static inline typename radius_type<Geometry>::type get(Geometry const& geometry)
- {
- return traits::radius_access<Geometry, Dimension>::get(geometry);
- }
- static inline void set(Geometry& geometry,
- typename radius_type<Geometry>::type const& value)
- {
- traits::radius_access<Geometry, Dimension>::set(geometry, value);
- }
- };
- }
- #endif
- #ifndef DOXYGEN_NO_DISPATCH
- namespace core_dispatch
- {
- template <typename Tag,
- typename Geometry,
- std::size_t Dimension>
- struct radius_access<Tag, Geometry, Dimension, std::true_type>
- {
- typedef typename geometry::radius_type<Geometry>::type radius_type;
- static inline radius_type get(const Geometry * geometry)
- {
- return radius_access
- <
- Tag,
- Geometry,
- Dimension,
- typename std::is_pointer<Geometry>::type
- >::get(*geometry);
- }
- static inline void set(Geometry * geometry, radius_type const& value)
- {
- return radius_access
- <
- Tag,
- Geometry,
- Dimension,
- typename std::is_pointer<Geometry>::type
- >::set(*geometry, value);
- }
- };
- template <typename Geometry>
- struct radius_type<srs_sphere_tag, Geometry>
- {
- typedef typename traits::radius_type<Geometry>::type type;
- };
- template <typename Geometry, std::size_t Dimension>
- struct radius_access<srs_sphere_tag, Geometry, Dimension, std::false_type>
- : detail::radius_access<srs_sphere_tag, Geometry, Dimension>
- {
-
- BOOST_STATIC_ASSERT(Dimension < 3);
- };
- template <typename Geometry>
- struct radius_type<srs_spheroid_tag, Geometry>
- {
- typedef typename traits::radius_type<Geometry>::type type;
- };
- template <typename Geometry, std::size_t Dimension>
- struct radius_access<srs_spheroid_tag, Geometry, Dimension, std::false_type>
- : detail::radius_access<srs_spheroid_tag, Geometry, Dimension>
- {
-
- BOOST_STATIC_ASSERT(Dimension < 3);
- };
- }
- #endif
- }}
- #endif
|