Chris@102: // Boost.Geometry (aka GGL, Generic Geometry Library) Chris@102: Chris@102: // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. 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: // 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: // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle Chris@102: Chris@102: #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_RELATE_HPP Chris@102: #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_RELATE_HPP Chris@102: Chris@102: #include Chris@102: Chris@102: #include Chris@102: #include Chris@102: Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: Chris@102: #include Chris@102: #include Chris@102: Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: Chris@102: #include Chris@102: Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: Chris@102: namespace boost { namespace geometry Chris@102: { Chris@102: Chris@102: #ifndef DOXYGEN_NO_DETAIL Chris@102: namespace detail { namespace relate { Chris@102: Chris@102: // Those are used only to allow dispatch::relate to produce compile-time error Chris@102: Chris@102: template ::type> Chris@102: struct is_supported_by_generic Chris@102: { Chris@102: static const bool value Chris@102: = boost::is_same::value Chris@102: || boost::is_same::value Chris@102: || boost::is_same::value Chris@102: || boost::is_same::value Chris@102: || boost::is_same::value; Chris@102: }; Chris@102: Chris@102: template ::type, Chris@102: typename Tag2 = typename geometry::tag::type> Chris@102: struct is_generic Chris@102: { Chris@102: static const bool value = is_supported_by_generic::value Chris@102: && is_supported_by_generic::value; Chris@102: }; Chris@102: Chris@102: Chris@102: template Chris@102: struct is_generic Chris@102: { Chris@102: static const bool value = is_supported_by_generic::value; Chris@102: }; Chris@102: Chris@102: template Chris@102: struct is_generic Chris@102: { Chris@102: static const bool value = is_supported_by_generic::value; Chris@102: }; Chris@102: Chris@102: template Chris@102: struct is_generic Chris@102: { Chris@102: static const bool value = false; Chris@102: }; Chris@102: Chris@102: Chris@102: }} // namespace detail::relate Chris@102: Chris@102: #ifndef DOXYGEN_NO_DISPATCH Chris@102: namespace detail_dispatch { namespace relate { Chris@102: Chris@102: Chris@102: template ::type, Chris@102: typename Tag2 = typename geometry::tag::type, Chris@102: int TopDim1 = geometry::topological_dimension::value, Chris@102: int TopDim2 = geometry::topological_dimension::value, Chris@102: bool IsGeneric = detail::relate::is_generic::value Chris@102: > Chris@102: struct relate : not_implemented Chris@102: {}; Chris@102: Chris@102: Chris@102: template Chris@102: struct relate Chris@102: : detail::relate::point_point Chris@102: {}; Chris@102: Chris@102: template Chris@102: struct relate Chris@102: : detail::relate::point_multipoint Chris@102: {}; Chris@102: Chris@102: template Chris@102: struct relate Chris@102: : detail::relate::multipoint_point Chris@102: {}; Chris@102: Chris@102: template Chris@102: struct relate Chris@102: : detail::relate::multipoint_multipoint Chris@102: {}; Chris@102: Chris@102: //template Chris@102: //struct relate Chris@102: // : detail::relate::point_box Chris@102: //{}; Chris@102: // Chris@102: //template Chris@102: //struct relate Chris@102: // : detail::relate::box_point Chris@102: //{}; Chris@102: Chris@102: Chris@102: template Chris@102: struct relate Chris@102: : detail::relate::point_geometry Chris@102: {}; Chris@102: Chris@102: template Chris@102: struct relate Chris@102: : detail::relate::geometry_point Chris@102: {}; Chris@102: Chris@102: Chris@102: template Chris@102: struct relate Chris@102: : detail::relate::linear_linear Chris@102: {}; Chris@102: Chris@102: Chris@102: template Chris@102: struct relate Chris@102: : detail::relate::linear_areal Chris@102: {}; Chris@102: Chris@102: template Chris@102: struct relate Chris@102: : detail::relate::areal_linear Chris@102: {}; Chris@102: Chris@102: Chris@102: template Chris@102: struct relate Chris@102: : detail::relate::areal_areal Chris@102: {}; Chris@102: Chris@102: Chris@102: }} // namespace detail_dispatch::relate Chris@102: #endif // DOXYGEN_NO_DISPATCH Chris@102: Chris@102: namespace detail { namespace relate { Chris@102: Chris@102: template Chris@102: struct interruption_enabled Chris@102: { Chris@102: static const bool value = Chris@102: detail_dispatch::relate::relate::interruption_enabled; Chris@102: }; Chris@102: Chris@102: template ::value> Chris@102: struct result_handler_type Chris@102: : not_implemented Chris@102: {}; Chris@102: Chris@102: template Chris@102: struct result_handler_type Chris@102: { Chris@102: typedef matrix_handler type; Chris@102: }; Chris@102: Chris@102: template Chris@102: struct result_handler_type Chris@102: { Chris@102: typedef mask_handler Chris@102: < Chris@102: mask9, Chris@102: interruption_enabled Chris@102: < Chris@102: Geometry1, Chris@102: Geometry2 Chris@102: >::value Chris@102: > type; Chris@102: }; Chris@102: Chris@102: template Chris@102: struct result_handler_type, false> Chris@102: { Chris@102: typedef mask_handler Chris@102: < Chris@102: boost::tuples::cons, Chris@102: interruption_enabled Chris@102: < Chris@102: Geometry1, Chris@102: Geometry2 Chris@102: >::value Chris@102: > type; Chris@102: }; Chris@102: Chris@102: template Chris@102: struct result_handler_type, false> Chris@102: { Chris@102: typedef static_mask_handler Chris@102: < Chris@102: static_mask, Chris@102: interruption_enabled Chris@102: < Chris@102: Geometry1, Chris@102: Geometry2 Chris@102: >::value Chris@102: > type; Chris@102: }; Chris@102: Chris@102: template Chris@102: struct result_handler_type Chris@102: { Chris@102: typedef static_mask_handler Chris@102: < Chris@102: StaticSequence, Chris@102: interruption_enabled Chris@102: < Chris@102: Geometry1, Chris@102: Geometry2 Chris@102: >::value Chris@102: > type; Chris@102: }; Chris@102: Chris@102: template Chris@102: inline Chris@102: typename result_handler_type Chris@102: < Chris@102: Geometry1, Chris@102: Geometry2, Chris@102: MatrixOrMask Chris@102: >::type::result_type Chris@102: relate(Geometry1 const& geometry1, Chris@102: Geometry2 const& geometry2, Chris@102: MatrixOrMask const& matrix_or_mask = MatrixOrMask()) Chris@102: { Chris@102: typedef typename result_handler_type Chris@102: < Chris@102: Geometry1, Chris@102: Geometry2, Chris@102: MatrixOrMask Chris@102: >::type handler_type; Chris@102: Chris@102: handler_type handler(matrix_or_mask); Chris@102: detail_dispatch::relate::relate::apply(geometry1, geometry2, handler); Chris@102: return handler.result(); Chris@102: } Chris@102: Chris@102: struct implemented_tag {}; Chris@102: Chris@102: template