spherical.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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_SPHERICAL_HPP
  7. #define BOOST_GEOMETRY_STRATEGIES_CENTROID_SPHERICAL_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 CalculationType = void
  18. >
  19. class spherical
  20. : public strategies::detail::spherical_base<void>
  21. {
  22. using base_t = strategies::detail::spherical_base<void>;
  23. public:
  24. spherical() = default;
  25. // TODO: Box and Segment should have proper strategies.
  26. template <typename Geometry, typename Point>
  27. static auto centroid(Geometry const&, Point const&,
  28. std::enable_if_t
  29. <
  30. util::is_segment<Geometry>::value
  31. || util::is_box<Geometry>::value
  32. > * = nullptr)
  33. {
  34. return strategy::centroid::not_applicable_strategy();
  35. }
  36. };
  37. namespace services
  38. {
  39. template <typename Geometry>
  40. struct default_strategy<Geometry, spherical_equatorial_tag>
  41. {
  42. using type = strategies::centroid::spherical<>;
  43. };
  44. } // namespace services
  45. }} // namespace strategies::centroid
  46. }} // namespace boost::geometry
  47. #endif // BOOST_GEOMETRY_STRATEGIES_CENTROID_SPHERICAL_HPP