geographic.hpp 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // Boost.Geometry
  2. // Copyright (c) 2020-2023, Oracle and/or its affiliates.
  3. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
  4. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  5. // Licensed under the Boost Software License version 1.0.
  6. // http://www.boost.org/users/license.html
  7. #ifndef BOOST_GEOMETRY_STRATEGIES_CONVEX_HULL_GEOGRAPHIC_HPP
  8. #define BOOST_GEOMETRY_STRATEGIES_CONVEX_HULL_GEOGRAPHIC_HPP
  9. #include <boost/geometry/strategies/convex_hull/services.hpp>
  10. #include <boost/geometry/strategies/compare.hpp>
  11. #include <boost/geometry/strategies/detail.hpp>
  12. #include <boost/geometry/strategies/geographic/side.hpp>
  13. #include <boost/geometry/strategies/spherical/point_in_point.hpp>
  14. #include <boost/geometry/util/type_traits.hpp>
  15. namespace boost { namespace geometry
  16. {
  17. namespace strategies { namespace convex_hull
  18. {
  19. template
  20. <
  21. typename FormulaPolicy = strategy::andoyer,
  22. typename Spheroid = srs::spheroid<double>,
  23. typename CalculationType = void
  24. >
  25. class geographic : public strategies::detail::geographic_base<Spheroid>
  26. {
  27. using base_t = strategies::detail::geographic_base<Spheroid>;
  28. public:
  29. geographic() = default;
  30. explicit geographic(Spheroid const& spheroid)
  31. : base_t(spheroid)
  32. {}
  33. template <typename Geometry1, typename Geometry2>
  34. static auto relate(Geometry1 const&, Geometry2 const&,
  35. std::enable_if_t
  36. <
  37. util::is_pointlike<Geometry1>::value
  38. && util::is_pointlike<Geometry2>::value
  39. > * = nullptr)
  40. {
  41. return strategy::within::spherical_point_point();
  42. }
  43. auto side() const
  44. {
  45. return strategy::side::geographic
  46. <
  47. FormulaPolicy,
  48. Spheroid,
  49. CalculationType
  50. >(base_t::m_spheroid);
  51. }
  52. template <typename ComparePolicy, typename EqualsPolicy>
  53. using compare_type = typename strategy::compare::spherical
  54. <
  55. ComparePolicy,
  56. EqualsPolicy,
  57. -1
  58. >;
  59. };
  60. namespace services
  61. {
  62. template <typename Geometry>
  63. struct default_strategy<Geometry, geographic_tag>
  64. {
  65. using type = strategies::convex_hull::geographic<>;
  66. };
  67. } // namespace services
  68. }} // namespace strategies::convex_hull
  69. }} // namespace boost::geometry
  70. #endif // BOOST_GEOMETRY_STRATEGIES_CONVEX_HULL_GEOGRAPHIC_HPP