box_areal.hpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Boost.Geometry
  2. // Copyright (c) 2022, Oracle and/or its affiliates.
  3. // Contributed and/or modified by Vissarion Fysikopoulos, 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_ALGORITHMS_DETAIL_RELATE_BOX_AREAL_HPP
  7. #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_BOX_AREAL_HPP
  8. #include <boost/geometry/algorithms/detail/relate/areal_areal.hpp>
  9. #include <boost/geometry/views/box_view.hpp>
  10. namespace boost { namespace geometry
  11. {
  12. #ifndef DOXYGEN_NO_DETAIL
  13. namespace detail { namespace relate {
  14. // The implementation of an algorithm calculating relate() for B/A
  15. template <typename Box, typename Areal>
  16. struct box_areal
  17. {
  18. static const bool interruption_enabled = true;
  19. template <typename Result, typename Strategy>
  20. static inline void apply(Box const& box, Areal const& areal,
  21. Result& result,
  22. Strategy const& strategy)
  23. {
  24. using is_cartesian = std::is_same
  25. <
  26. typename Strategy::cs_tag,
  27. cartesian_tag
  28. >;
  29. apply(box, areal, result, strategy, is_cartesian());
  30. }
  31. template <typename Result, typename Strategy>
  32. static inline void apply(Box const& box, Areal const& areal,
  33. Result& result,
  34. Strategy const& strategy,
  35. std::true_type /*is_cartesian*/)
  36. {
  37. using box_view = boost::geometry::box_view<Box>;
  38. box_view view(box);
  39. areal_areal<box_view, Areal>::apply(view, areal, result, strategy);
  40. }
  41. template <typename Result, typename Strategy>
  42. static inline void apply(Box const& /* box */, Areal const& /* areal */,
  43. Result& /* result */,
  44. Strategy const& /* strategy */,
  45. std::false_type /*is_cartesian*/)
  46. {
  47. BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
  48. "Not implemented for this coordinate system.",
  49. typename Strategy::cs_tag());
  50. }
  51. };
  52. }} // namespace detail::relate
  53. #endif // DOXYGEN_NO_DETAIL
  54. }} // namespace boost::geometry
  55. #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_BOX_AREAL_HPP