spherical.hpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // Boost.Geometry
  2. // Copyright (c) 2021, Oracle and/or its affiliates.
  3. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  4. // Licensed under the Boost Software License version 1.0.
  5. // http://www.boost.org/users/license.html
  6. #ifndef BOOST_GEOMETRY_STRATEGIES_DENSIFY_SPHERICAL_HPP
  7. #define BOOST_GEOMETRY_STRATEGIES_DENSIFY_SPHERICAL_HPP
  8. #include <boost/geometry/strategies/detail.hpp>
  9. #include <boost/geometry/strategies/densify/services.hpp>
  10. #include <boost/geometry/strategies/spherical/densify.hpp>
  11. namespace boost { namespace geometry
  12. {
  13. namespace strategies { namespace densify
  14. {
  15. template
  16. <
  17. typename RadiusTypeOrSphere = double,
  18. typename CalculationType = void
  19. >
  20. class spherical
  21. : public strategies::detail::spherical_base<RadiusTypeOrSphere>
  22. {
  23. using base_t = strategies::detail::spherical_base<RadiusTypeOrSphere>;
  24. public:
  25. spherical() = default;
  26. template <typename RadiusOrSphere>
  27. explicit spherical(RadiusOrSphere const& radius_or_sphere)
  28. : base_t(radius_or_sphere)
  29. {}
  30. template <typename Geometry>
  31. auto densify(Geometry const&) const
  32. {
  33. return strategy::densify::spherical
  34. <
  35. typename base_t::radius_type, CalculationType
  36. >(base_t::radius());
  37. }
  38. };
  39. namespace services
  40. {
  41. template <typename Geometry>
  42. struct default_strategy<Geometry, spherical_equatorial_tag>
  43. {
  44. using type = strategies::densify::spherical<>;
  45. };
  46. template <typename R, typename CT>
  47. struct strategy_converter<strategy::densify::spherical<R, CT> >
  48. {
  49. static auto get(strategy::densify::spherical<R, CT> const& s)
  50. {
  51. return strategies::densify::spherical<R, CT>(s.radius());
  52. }
  53. };
  54. } // namespace services
  55. }} // namespace strategies::densify
  56. }} // namespace boost::geometry
  57. #endif // BOOST_GEOMETRY_STRATEGIES_DENSIFY_SPHERICAL_HPP