geographic.hpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Boost.Geometry
  2. // Copyright (c) 2021, Oracle and/or its affiliates.
  3. // Contributed and/or modified by Vissarion Fysikopoulos, 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_CLOSEST_POINTS_GEOGRAPHIC_HPP
  7. #define BOOST_GEOMETRY_STRATEGIES_CLOSEST_POINTS_GEOGRAPHIC_HPP
  8. #include <boost/geometry/strategies/detail.hpp>
  9. #include <boost/geometry/strategies/distance/detail.hpp>
  10. #include <boost/geometry/strategies/closest_points/services.hpp>
  11. #include <boost/geometry/strategies/geographic/closest_points_pt_seg.hpp>
  12. #include <boost/geometry/strategies/geographic/parameters.hpp>
  13. #include <boost/geometry/strategies/distance/geographic.hpp>
  14. #include <boost/geometry/util/type_traits.hpp>
  15. namespace boost { namespace geometry
  16. {
  17. namespace strategies { namespace closest_points
  18. {
  19. template
  20. <
  21. typename FormulaPolicy = geometry::strategy::andoyer,
  22. typename Spheroid = srs::spheroid<double>,
  23. typename CalculationType = void
  24. >
  25. class geographic
  26. : public strategies::distance::geographic<FormulaPolicy, Spheroid, CalculationType>
  27. {
  28. using base_t = strategies::distance::geographic<FormulaPolicy, Spheroid, CalculationType>;
  29. public:
  30. geographic() = default;
  31. explicit geographic(Spheroid const& spheroid)
  32. : base_t(spheroid)
  33. {}
  34. template <typename Geometry1, typename Geometry2>
  35. auto closest_points(Geometry1 const&, Geometry2 const&,
  36. distance::detail::enable_if_ps_t<Geometry1, Geometry2> * = nullptr) const
  37. {
  38. return strategy::closest_points::geographic_cross_track
  39. <
  40. FormulaPolicy,
  41. Spheroid,
  42. CalculationType
  43. >(base_t::m_spheroid);
  44. }
  45. };
  46. namespace services
  47. {
  48. template <typename Geometry1, typename Geometry2>
  49. struct default_strategy<Geometry1, Geometry2, geographic_tag, geographic_tag>
  50. {
  51. using type = strategies::closest_points::geographic<>;
  52. };
  53. } // namespace services
  54. }} // namespace strategies::closest_points
  55. }} // namespace boost::geometry
  56. #endif // BOOST_GEOMETRY_STRATEGIES_CLOSEST_POINTS_GEOGRAPHIC_HPP