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