geographic.hpp 1.9 KB

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