geographic.hpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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_LINE_INTERPOLATE_GEOGRAPHIC_HPP
  7. #define BOOST_GEOMETRY_STRATEGIES_LINE_INTERPOLATE_GEOGRAPHIC_HPP
  8. #include <boost/geometry/strategies/detail.hpp>
  9. #include <boost/geometry/strategies/distance/detail.hpp>
  10. #include <boost/geometry/strategies/geographic/distance.hpp>
  11. #include <boost/geometry/strategies/geographic/line_interpolate.hpp>
  12. #include <boost/geometry/strategies/line_interpolate/services.hpp>
  13. namespace boost { namespace geometry
  14. {
  15. namespace strategies { namespace line_interpolate
  16. {
  17. template
  18. <
  19. typename FormulaPolicy = strategy::andoyer,
  20. typename Spheroid = srs::spheroid<double>,
  21. typename CalculationType = void
  22. >
  23. class geographic
  24. : public strategies::detail::geographic_base<Spheroid>
  25. {
  26. using base_t = strategies::detail::geographic_base<Spheroid>;
  27. public:
  28. geographic() = default;
  29. explicit geographic(Spheroid const& spheroid)
  30. : base_t(spheroid)
  31. {}
  32. template <typename Geometry1, typename Geometry2>
  33. auto distance(Geometry1 const&, Geometry2 const&,
  34. distance::detail::enable_if_pp_t<Geometry1, Geometry2> * = nullptr) const
  35. {
  36. return strategy::distance::geographic
  37. <
  38. FormulaPolicy, Spheroid, CalculationType
  39. >(base_t::m_spheroid);
  40. }
  41. template <typename Geometry>
  42. auto line_interpolate(Geometry const&) const
  43. {
  44. return strategy::line_interpolate::geographic
  45. <
  46. FormulaPolicy, Spheroid, CalculationType
  47. >(base_t::m_spheroid);
  48. }
  49. };
  50. namespace services
  51. {
  52. template <typename Geometry>
  53. struct default_strategy<Geometry, geographic_tag>
  54. {
  55. using type = strategies::line_interpolate::geographic<>;
  56. };
  57. template <typename FP, typename S, typename CT>
  58. struct strategy_converter<strategy::line_interpolate::geographic<FP, S, CT> >
  59. {
  60. static auto get(strategy::line_interpolate::geographic<FP, S, CT> const& s)
  61. {
  62. return strategies::line_interpolate::geographic<FP, S, CT>(s.model());
  63. }
  64. };
  65. } // namespace services
  66. }} // namespace strategies::line_interpolate
  67. }} // namespace boost::geometry
  68. #endif // BOOST_GEOMETRY_STRATEGIES_LINE_INTERPOLATE_GEOGRAPHIC_HPP