spherical.hpp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. // Boost.Geometry
  2. // Copyright (c) 2020, 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_EXPAND_SPHERICAL_HPP
  7. #define BOOST_GEOMETRY_STRATEGIES_EXPAND_SPHERICAL_HPP
  8. #include <type_traits>
  9. #include <boost/geometry/strategy/spherical/expand_box.hpp>
  10. #include <boost/geometry/strategy/spherical/expand_point.hpp>
  11. #include <boost/geometry/strategy/spherical/expand_segment.hpp>
  12. #include <boost/geometry/strategies/detail.hpp>
  13. #include <boost/geometry/strategies/expand/services.hpp>
  14. namespace boost { namespace geometry
  15. {
  16. namespace strategies { namespace expand
  17. {
  18. #ifndef DOXYGEN_NO_DETAIL
  19. namespace detail
  20. {
  21. template <typename RadiusTypeOrSphere, typename CalculationType>
  22. struct spherical
  23. : strategies::detail::spherical_base<RadiusTypeOrSphere>
  24. {
  25. template <typename Box, typename Geometry>
  26. static auto expand(Box const&, Geometry const&,
  27. typename util::enable_if_point_t<Geometry> * = nullptr)
  28. {
  29. return strategy::expand::spherical_point();
  30. }
  31. template <typename Box, typename Geometry>
  32. static auto expand(Box const&, Geometry const&,
  33. typename util::enable_if_box_t<Geometry> * = nullptr)
  34. {
  35. return strategy::expand::spherical_box();
  36. }
  37. template <typename Box, typename Geometry>
  38. static auto expand(Box const&, Geometry const&,
  39. typename util::enable_if_segment_t<Geometry> * = nullptr)
  40. {
  41. return strategy::expand::spherical_segment<CalculationType>();
  42. }
  43. };
  44. } // namespace detail
  45. #endif // DOXYGEN_NO_DETAIL
  46. template <typename CalculationType = void>
  47. class spherical
  48. : public strategies::expand::detail::spherical<void, CalculationType>
  49. {};
  50. namespace services
  51. {
  52. template <typename Box, typename Geometry>
  53. struct default_strategy<Box, Geometry, spherical_tag>
  54. {
  55. using type = strategies::expand::spherical<>;
  56. };
  57. template <typename Box, typename Geometry>
  58. struct default_strategy<Box, Geometry, spherical_equatorial_tag>
  59. {
  60. using type = strategies::expand::spherical<>;
  61. };
  62. template <typename Box, typename Geometry>
  63. struct default_strategy<Box, Geometry, spherical_polar_tag>
  64. {
  65. using type = strategies::expand::spherical<>;
  66. };
  67. template <>
  68. struct strategy_converter<strategy::expand::spherical_point>
  69. {
  70. static auto get(strategy::expand::spherical_point const& )
  71. {
  72. return strategies::expand::spherical<>();
  73. }
  74. };
  75. template <>
  76. struct strategy_converter<strategy::expand::spherical_box>
  77. {
  78. static auto get(strategy::expand::spherical_box const& )
  79. {
  80. return strategies::expand::spherical<>();
  81. }
  82. };
  83. template <typename CT>
  84. struct strategy_converter<strategy::expand::spherical_segment<CT> >
  85. {
  86. static auto get(strategy::expand::spherical_segment<CT> const&)
  87. {
  88. return strategies::expand::spherical<CT>();
  89. }
  90. };
  91. } // namespace services
  92. }} // namespace strategies::envelope
  93. }} // namespace boost::geometry
  94. #endif // BOOST_GEOMETRY_STRATEGIES_EXPAND_SPHERICAL_HPP