geographic.hpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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_CENTROID_GEOGRAPHIC_HPP
  7. #define BOOST_GEOMETRY_STRATEGIES_CENTROID_GEOGRAPHIC_HPP
  8. #include <boost/geometry/strategies/detail.hpp>
  9. #include <boost/geometry/strategies/centroid.hpp>
  10. #include <boost/geometry/strategies/centroid/services.hpp>
  11. namespace boost { namespace geometry
  12. {
  13. namespace strategies { namespace centroid
  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. // TODO: Box and Segment should have proper strategies.
  31. template <typename Geometry, typename Point>
  32. static auto centroid(Geometry const&, Point const&,
  33. std::enable_if_t
  34. <
  35. util::is_segment<Geometry>::value
  36. || util::is_box<Geometry>::value
  37. > * = nullptr)
  38. {
  39. return strategy::centroid::not_applicable_strategy();
  40. }
  41. };
  42. namespace services
  43. {
  44. template <typename Geometry>
  45. struct default_strategy<Geometry, geographic_tag>
  46. {
  47. using type = strategies::centroid::geographic<>;
  48. };
  49. } // namespace services
  50. }} // namespace strategies::centroid
  51. }} // namespace boost::geometry
  52. #endif // BOOST_GEOMETRY_STRATEGIES_CENTROID_GEOGRAPHIC_HPP