disjoint_interrupt_policy.hpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
  3. // Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
  4. // Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
  5. // Copyright (c) 2013-2014 Adam Wulkiewicz, Lodz, Poland.
  6. // This file was modified by Oracle on 2013-2020.
  7. // Modifications copyright (c) 2013-2020, Oracle and/or its affiliates.
  8. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  9. // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
  10. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  11. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  12. // Use, modification and distribution is subject to the Boost Software License,
  13. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  14. // http://www.boost.org/LICENSE_1_0.txt)
  15. #ifndef BOOST_GEOMETRY_ALGORITHMS_POLICIES_DISJOINT_INTERRUPT_POLICY_HPP
  16. #define BOOST_GEOMETRY_ALGORITHMS_POLICIES_DISJOINT_INTERRUPT_POLICY_HPP
  17. #include <boost/range/size.hpp>
  18. namespace boost { namespace geometry
  19. {
  20. #ifndef DOXYGEN_NO_DETAIL
  21. namespace detail { namespace disjoint
  22. {
  23. struct disjoint_interrupt_policy
  24. {
  25. static bool const enabled = true;
  26. bool has_intersections;
  27. inline disjoint_interrupt_policy()
  28. : has_intersections(false)
  29. {}
  30. template <typename Range>
  31. inline bool apply(Range const& range)
  32. {
  33. // If there is any IP in the range, it is NOT disjoint
  34. if (boost::size(range) > 0)
  35. {
  36. has_intersections = true;
  37. return true;
  38. }
  39. return false;
  40. }
  41. };
  42. }} // namespace detail::disjoint
  43. #endif // DOXYGEN_NO_DETAIL
  44. }} // namespace boost::geometry
  45. #endif // BOOST_GEOMETRY_ALGORITHMS_POLICIES_DISJOINT_INTERRUPT_POLICY_HPP