section_box_policies.hpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2015 Barend Gehrels, Amsterdam, the Netherlands.
  3. // This file was modified by Oracle on 2018-2020.
  4. // Modifications copyright (c) 2018-2020, Oracle and/or its affiliates.
  5. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  6. // Use, modification and distribution is subject to the Boost Software License,
  7. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt)
  9. #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_SECTIONS_SECTION_BOX_POLICIES_HPP
  10. #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_SECTIONS_SECTION_BOX_POLICIES_HPP
  11. #include <boost/geometry/core/coordinate_type.hpp>
  12. #include <boost/geometry/algorithms/detail/disjoint/box_box.hpp>
  13. #include <boost/geometry/algorithms/expand.hpp>
  14. namespace boost { namespace geometry
  15. {
  16. #ifndef DOXYGEN_NO_DETAIL
  17. namespace detail { namespace section
  18. {
  19. template <typename Strategy>
  20. struct get_section_box
  21. {
  22. get_section_box(Strategy const& strategy)
  23. : m_strategy(strategy)
  24. {}
  25. template <typename Box, typename Section>
  26. inline void apply(Box& total, Section const& section) const
  27. {
  28. assert_coordinate_type_equal(total, section.bounding_box);
  29. geometry::expand(total, section.bounding_box, m_strategy);
  30. }
  31. Strategy const& m_strategy;
  32. };
  33. template <typename Strategy>
  34. struct overlaps_section_box
  35. {
  36. overlaps_section_box(Strategy const& strategy)
  37. : m_strategy(strategy)
  38. {}
  39. template <typename Box, typename Section>
  40. inline bool apply(Box const& box, Section const& section) const
  41. {
  42. assert_coordinate_type_equal(box, section.bounding_box);
  43. return ! detail::disjoint::disjoint_box_box(box, section.bounding_box,
  44. m_strategy);
  45. }
  46. Strategy const& m_strategy;
  47. };
  48. }} // namespace detail::section
  49. #endif
  50. }} // namespace boost::geometry
  51. #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_SECTIONS_SECTION_BOX_POLICIES_HPP