interface.hpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
  3. // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
  4. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
  5. // This file was modified by Oracle on 2014, 2015, 2017.
  6. // Modifications copyright (c) 2014-2017 Oracle and/or its affiliates.
  7. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  8. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  9. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  10. // Use, modification and distribution is subject to the Boost Software License,
  11. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  12. // http://www.boost.org/LICENSE_1_0.txt)
  13. #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAPS_INTERFACE_HPP
  14. #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAPS_INTERFACE_HPP
  15. #include <cstddef>
  16. #include <boost/geometry/algorithms/not_implemented.hpp>
  17. #include <boost/geometry/geometries/concepts/check.hpp>
  18. #include <boost/geometry/algorithms/detail/relate/relate_impl.hpp>
  19. #include <boost/geometry/strategies/relate.hpp>
  20. namespace boost { namespace geometry
  21. {
  22. #ifndef DOXYGEN_NO_DISPATCH
  23. namespace dispatch
  24. {
  25. template
  26. <
  27. typename Geometry1,
  28. typename Geometry2,
  29. typename Tag1 = typename tag<Geometry1>::type,
  30. typename Tag2 = typename tag<Geometry2>::type
  31. >
  32. struct overlaps
  33. : detail::relate::relate_impl
  34. <
  35. detail::de9im::static_mask_overlaps_type,
  36. Geometry1,
  37. Geometry2
  38. >
  39. {};
  40. } // namespace dispatch
  41. #endif // DOXYGEN_NO_DISPATCH
  42. /*!
  43. \brief \brief_check2{overlap}
  44. \ingroup overlaps
  45. \tparam Geometry1 \tparam_geometry
  46. \tparam Geometry2 \tparam_geometry
  47. \tparam Strategy \tparam_strategy{Overlaps}
  48. \param geometry1 \param_geometry
  49. \param geometry2 \param_geometry
  50. \param strategy \param_strategy{overlaps}
  51. \return \return_check2{overlap}
  52. \qbk{distinguish,with strategy}
  53. \qbk{[include reference/algorithms/overlaps.qbk]}
  54. */
  55. template <typename Geometry1, typename Geometry2, typename Strategy>
  56. inline bool overlaps(Geometry1 const& geometry1,
  57. Geometry2 const& geometry2,
  58. Strategy const& strategy)
  59. {
  60. concepts::check<Geometry1 const>();
  61. concepts::check<Geometry2 const>();
  62. return dispatch::overlaps
  63. <
  64. Geometry1,
  65. Geometry2
  66. >::apply(geometry1, geometry2, strategy);
  67. }
  68. /*!
  69. \brief \brief_check2{overlap}
  70. \ingroup overlaps
  71. \tparam Geometry1 \tparam_geometry
  72. \tparam Geometry2 \tparam_geometry
  73. \param geometry1 \param_geometry
  74. \param geometry2 \param_geometry
  75. \return \return_check2{overlap}
  76. \qbk{[include reference/algorithms/overlaps.qbk]}
  77. */
  78. template <typename Geometry1, typename Geometry2>
  79. inline bool overlaps(Geometry1 const& geometry1, Geometry2 const& geometry2)
  80. {
  81. concepts::check<Geometry1 const>();
  82. concepts::check<Geometry2 const>();
  83. typedef typename strategy::relate::services::default_strategy
  84. <
  85. Geometry1,
  86. Geometry2
  87. >::type strategy_type;
  88. return dispatch::overlaps
  89. <
  90. Geometry1,
  91. Geometry2
  92. >::apply(geometry1, geometry2, strategy_type());
  93. }
  94. }} // namespace boost::geometry
  95. #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAPS_INTERFACE_HPP