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