spherical.hpp 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // Boost.Geometry
  2. // Copyright (c) 2019-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_IO_SPHERICAL_HPP
  7. #define BOOST_GEOMETRY_STRATEGIES_IO_SPHERICAL_HPP
  8. #include <boost/geometry/strategies/detail.hpp>
  9. #include <boost/geometry/strategies/io/services.hpp>
  10. #include <boost/geometry/strategies/spherical/point_order.hpp>
  11. #include <boost/geometry/strategies/spherical/point_in_point.hpp>
  12. #include <boost/geometry/strategies/spherical/point_in_poly_winding.hpp>
  13. namespace boost { namespace geometry
  14. {
  15. namespace strategies { namespace io
  16. {
  17. template <typename CalculationType = void>
  18. class spherical
  19. : public strategies::detail::spherical_base<void>
  20. {
  21. public:
  22. static auto point_order()
  23. {
  24. return strategy::point_order::spherical<CalculationType>();
  25. }
  26. template <typename Geometry1, typename Geometry2>
  27. static auto relate(Geometry1 const&, Geometry2 const&,
  28. std::enable_if_t
  29. <
  30. util::is_pointlike<Geometry1>::value
  31. && util::is_pointlike<Geometry2>::value
  32. > * = nullptr)
  33. {
  34. return strategy::within::spherical_point_point();
  35. }
  36. template <typename Geometry1, typename Geometry2>
  37. static auto relate(Geometry1 const&, Geometry2 const&,
  38. std::enable_if_t
  39. <
  40. util::is_pointlike<Geometry1>::value
  41. && ( util::is_linear<Geometry2>::value
  42. || util::is_polygonal<Geometry2>::value )
  43. > * = nullptr)
  44. {
  45. return strategy::within::spherical_winding<void, void, CalculationType>();
  46. }
  47. };
  48. namespace services
  49. {
  50. template <typename Geometry>
  51. struct default_strategy<Geometry, spherical_tag>
  52. {
  53. typedef spherical<> type;
  54. };
  55. template <typename Geometry>
  56. struct default_strategy<Geometry, spherical_equatorial_tag>
  57. {
  58. typedef spherical<> type;
  59. };
  60. template <typename Geometry>
  61. struct default_strategy<Geometry, spherical_polar_tag>
  62. {
  63. typedef spherical<> type;
  64. };
  65. } // namespace services
  66. }} // namespace strategies::io
  67. }} // namespace boost::geometry
  68. #endif // BOOST_GEOMETRY_STRATEGIES_IO_SPHERICAL_HPP