// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
+// This file was modified by Oracle on 2014.
+// Modifications copyright (c) 2014 Oracle and/or its affiliates.
+
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
#ifndef BOOST_GEOMETRY_ALGORITHMS_OVERLAPS_HPP
#define BOOST_GEOMETRY_ALGORITHMS_OVERLAPS_HPP
#include <cstddef>
-#include <boost/mpl/assert.hpp>
-
#include <boost/geometry/core/access.hpp>
+#include <boost/geometry/algorithms/not_implemented.hpp>
+
#include <boost/geometry/geometries/concepts/check.hpp>
+#include <boost/geometry/algorithms/detail/relate/relate.hpp>
+
namespace boost { namespace geometry
{
template
<
- typename Box1,
- typename Box2,
std::size_t Dimension,
std::size_t DimensionCount
>
struct box_box_loop
{
+ template <typename Box1, typename Box2>
static inline void apply(Box1 const& b1, Box2 const& b2,
bool& overlaps, bool& one_in_two, bool& two_in_one)
{
box_box_loop
<
- Box1,
- Box2,
Dimension + 1,
DimensionCount
>::apply(b1, b2, overlaps, one_in_two, two_in_one);
template
<
- typename Box1,
- typename Box2,
std::size_t DimensionCount
>
-struct box_box_loop<Box1, Box2, DimensionCount, DimensionCount>
+struct box_box_loop<DimensionCount, DimensionCount>
{
+ template <typename Box1, typename Box2>
static inline void apply(Box1 const& , Box2 const&, bool&, bool&, bool&)
{
}
};
-template
-<
- typename Box1,
- typename Box2
->
struct box_box
{
+ template <typename Box1, typename Box2>
static inline bool apply(Box1 const& b1, Box2 const& b2)
{
bool overlaps = true;
bool within2 = true;
box_box_loop
<
- Box1,
- Box2,
0,
dimension<Box1>::type::value
>::apply(b1, b2, overlaps, within1, within2);
}
};
-
-
}} // namespace detail::overlaps
#endif // DOXYGEN_NO_DETAIL
template
<
- typename Tag1,
- typename Tag2,
typename Geometry1,
- typename Geometry2
+ typename Geometry2,
+ typename Tag1 = typename tag<Geometry1>::type,
+ typename Tag2 = typename tag<Geometry2>::type
>
struct overlaps
-{
- BOOST_MPL_ASSERT_MSG
- (
- false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
- , (types<Geometry1, Geometry2>)
- );
-};
+ : detail::relate::relate_base
+ <
+ detail::relate::static_mask_overlaps_type,
+ Geometry1,
+ Geometry2
+ >
+{};
template <typename Box1, typename Box2>
-struct overlaps<box_tag, box_tag, Box1, Box2>
- : detail::overlaps::box_box<Box1, Box2>
+struct overlaps<Box1, Box2, box_tag, box_tag>
+ : detail::overlaps::box_box
{};
-
-
-
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
/*!
\brief \brief_check2{overlap}
\ingroup overlaps
+\tparam Geometry1 \tparam_geometry
+\tparam Geometry2 \tparam_geometry
+\param geometry1 \param_geometry
+\param geometry2 \param_geometry
\return \return_check2{overlap}
\qbk{[include reference/algorithms/overlaps.qbk]}
return dispatch::overlaps
<
- typename tag<Geometry1>::type,
- typename tag<Geometry2>::type,
Geometry1,
Geometry2
>::apply(geometry1, geometry2);