Chris@102: // Boost.Geometry (aka GGL, Generic Geometry Library) Chris@102: Chris@102: // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. Chris@102: // Copyright (c) 2008-2014 Bruno Lalande, Paris, France. Chris@102: // Copyright (c) 2009-2014 Mateusz Loskot, London, UK. Chris@102: // Copyright (c) 2013-2014 Adam Wulkiewicz, Lodz, Poland. Chris@102: Chris@102: // This file was modified by Oracle on 2013-2014. Chris@102: // Modifications copyright (c) 2013-2014, Oracle and/or its affiliates. Chris@102: Chris@102: // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle Chris@102: // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle Chris@102: Chris@102: // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library Chris@102: // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. Chris@102: Chris@102: // Use, modification and distribution is subject to the Boost Software License, Chris@102: // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@102: // http://www.boost.org/LICENSE_1_0.txt) Chris@102: Chris@102: #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_INTERFACE_HPP Chris@102: #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_INTERFACE_HPP Chris@102: Chris@102: #include Chris@102: Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: Chris@102: #include Chris@102: Chris@102: #include Chris@102: Chris@102: Chris@102: namespace boost { namespace geometry Chris@102: { Chris@102: Chris@102: Chris@102: #ifndef DOXYGEN_NO_DISPATCH Chris@102: namespace dispatch Chris@102: { Chris@102: Chris@102: Chris@102: // If reversal is needed, perform it Chris@102: template Chris@102: < Chris@102: typename Geometry1, typename Geometry2, Chris@102: std::size_t DimensionCount, Chris@102: typename Tag1, typename Tag2 Chris@102: > Chris@102: struct disjoint Chris@102: { Chris@102: static inline bool apply(Geometry1 const& g1, Geometry2 const& g2) Chris@102: { Chris@102: return disjoint Chris@102: < Chris@102: Geometry2, Geometry1, Chris@102: DimensionCount, Chris@102: Tag2, Tag1 Chris@102: >::apply(g2, g1); Chris@102: } Chris@102: }; Chris@102: Chris@102: Chris@102: } // namespace dispatch Chris@102: #endif // DOXYGEN_NO_DISPATCH Chris@102: Chris@102: Chris@102: namespace resolve_variant { Chris@102: Chris@102: template Chris@102: struct disjoint Chris@102: { Chris@102: static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2) Chris@102: { Chris@102: concept::check_concepts_and_equal_dimensions Chris@102: < Chris@102: Geometry1 const, Chris@102: Geometry2 const Chris@102: >(); Chris@102: Chris@102: return dispatch::disjoint::apply(geometry1, geometry2); Chris@102: } Chris@102: }; Chris@102: Chris@102: template Chris@102: struct disjoint, Geometry2> Chris@102: { Chris@102: struct visitor: boost::static_visitor Chris@102: { Chris@102: Geometry2 const& m_geometry2; Chris@102: Chris@102: visitor(Geometry2 const& geometry2): m_geometry2(geometry2) {} Chris@102: Chris@102: template Chris@102: bool operator()(Geometry1 const& geometry1) const Chris@102: { Chris@102: return disjoint::apply(geometry1, m_geometry2); Chris@102: } Chris@102: }; Chris@102: Chris@102: static inline bool Chris@102: apply(boost::variant const& geometry1, Chris@102: Geometry2 const& geometry2) Chris@102: { Chris@102: return boost::apply_visitor(visitor(geometry2), geometry1); Chris@102: } Chris@102: }; Chris@102: Chris@102: template Chris@102: struct disjoint > Chris@102: { Chris@102: struct visitor: boost::static_visitor Chris@102: { Chris@102: Geometry1 const& m_geometry1; Chris@102: Chris@102: visitor(Geometry1 const& geometry1): m_geometry1(geometry1) {} Chris@102: Chris@102: template Chris@102: bool operator()(Geometry2 const& geometry2) const Chris@102: { Chris@102: return disjoint::apply(m_geometry1, geometry2); Chris@102: } Chris@102: }; Chris@102: Chris@102: static inline bool Chris@102: apply(Geometry1 const& geometry1, Chris@102: boost::variant const& geometry2) Chris@102: { Chris@102: return boost::apply_visitor(visitor(geometry1), geometry2); Chris@102: } Chris@102: }; Chris@102: Chris@102: template < Chris@102: BOOST_VARIANT_ENUM_PARAMS(typename T1), Chris@102: BOOST_VARIANT_ENUM_PARAMS(typename T2) Chris@102: > Chris@102: struct disjoint< Chris@102: boost::variant, Chris@102: boost::variant Chris@102: > Chris@102: { Chris@102: struct visitor: boost::static_visitor Chris@102: { Chris@102: template Chris@102: bool operator()(Geometry1 const& geometry1, Chris@102: Geometry2 const& geometry2) const Chris@102: { Chris@102: return disjoint::apply(geometry1, geometry2); Chris@102: } Chris@102: }; Chris@102: Chris@102: static inline bool Chris@102: apply(boost::variant const& geometry1, Chris@102: boost::variant const& geometry2) Chris@102: { Chris@102: return boost::apply_visitor(visitor(), geometry1, geometry2); Chris@102: } Chris@102: }; Chris@102: Chris@102: } // namespace resolve_variant Chris@102: Chris@102: Chris@102: Chris@102: /*! Chris@102: \brief \brief_check2{are disjoint} Chris@102: \ingroup disjoint Chris@102: \tparam Geometry1 \tparam_geometry Chris@102: \tparam Geometry2 \tparam_geometry Chris@102: \param geometry1 \param_geometry Chris@102: \param geometry2 \param_geometry Chris@102: \return \return_check2{are disjoint} Chris@102: Chris@102: \qbk{[include reference/algorithms/disjoint.qbk]} Chris@102: */ Chris@102: template Chris@102: inline bool disjoint(Geometry1 const& geometry1, Chris@102: Geometry2 const& geometry2) Chris@102: { Chris@102: return resolve_variant::disjoint::apply(geometry1, geometry2); Chris@102: } Chris@102: Chris@102: Chris@102: }} // namespace boost::geometry Chris@102: Chris@102: Chris@102: #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_INTERFACE_HPP