Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:19

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
0004 // Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
0005 // Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
0006 // Copyright (c) 2013-2014 Adam Wulkiewicz, Lodz, Poland.
0007 
0008 // This file was modified by Oracle on 2014-2021.
0009 // Modifications copyright (c) 2014-2021, Oracle and/or its affiliates.
0010 
0011 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
0012 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0013 
0014 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
0015 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
0016 
0017 // Use, modification and distribution is subject to the Boost Software License,
0018 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0019 // http://www.boost.org/LICENSE_1_0.txt)
0020 
0021 #ifndef BOOST_GEOMETRY_ALGORITHMS_DISPATCH_DISTANCE_HPP
0022 #define BOOST_GEOMETRY_ALGORITHMS_DISPATCH_DISTANCE_HPP
0023 
0024 
0025 #include <boost/geometry/algorithms/not_implemented.hpp>
0026 
0027 #include <boost/geometry/core/reverse_dispatch.hpp>
0028 #include <boost/geometry/core/tag.hpp>
0029 #include <boost/geometry/core/tag_cast.hpp>
0030 #include <boost/geometry/core/tags.hpp>
0031 
0032 #include <boost/geometry/strategies/detail.hpp>
0033 #include <boost/geometry/strategies/distance.hpp>
0034 #include <boost/geometry/strategies/distance/services.hpp>
0035 
0036 
0037 namespace boost { namespace geometry
0038 {
0039 
0040 
0041 #ifndef DOXYGEN_NO_DISPATCH
0042 namespace dispatch
0043 {
0044 
0045 
0046 template
0047 <
0048     typename Geometry1, typename Geometry2, typename Strategies,
0049     bool IsUmbrella = strategies::detail::is_umbrella_strategy<Strategies>::value,
0050     bool Reverse = reverse_dispatch<Geometry1, Geometry2>::value
0051 >
0052 struct distance_strategy_type
0053 {
0054     typedef decltype(std::declval<Strategies>().distance(std::declval<Geometry1>(), std::declval<Geometry2>())) type;
0055 };
0056 
0057 // TODO: right now legacy single strategy can be passed here in some cases
0058 //       so for now dispatch also by IsUmbrella. Later this could be removed.
0059 template <typename Geometry1, typename Geometry2, typename Strategy, bool Reverse>
0060 struct distance_strategy_type<Geometry1, Geometry2, Strategy, false, Reverse>
0061 {
0062     typedef Strategy type;
0063 };
0064 
0065 template <typename Geometry1, typename Geometry2, typename Strategies>
0066 struct distance_strategy_type<Geometry1, Geometry2, Strategies, true, true>
0067     : distance_strategy_type<Geometry2, Geometry1, Strategies, true, false>
0068 {};
0069 
0070 
0071 template
0072 <
0073     typename Geometry1, typename Geometry2, typename Strategies,
0074     bool IsDynamicOrGC = util::is_dynamic_geometry<Geometry1>::value
0075                       || util::is_dynamic_geometry<Geometry2>::value
0076                       || util::is_geometry_collection<Geometry1>::value
0077                       || util::is_geometry_collection<Geometry2>::value
0078 >
0079 struct distance_strategy_tag
0080 {
0081     using type = void;
0082 };
0083 
0084 template <typename Geometry1, typename Geometry2, typename Strategies>
0085 struct distance_strategy_tag<Geometry1, Geometry2, Strategies, false>
0086 {
0087     using type = typename strategy::distance::services::tag
0088         <
0089             typename distance_strategy_type<Geometry1, Geometry2, Strategies>::type
0090         >::type;
0091 };
0092 
0093 
0094 template
0095 <
0096     typename Geometry1, typename Geometry2,
0097     typename Strategy = typename strategies::distance::services::default_strategy
0098         <
0099             Geometry1, Geometry2
0100         >::type,
0101     typename Tag1 = typename tag_cast
0102         <
0103             typename tag<Geometry1>::type,
0104             segment_tag,
0105             box_tag,
0106             linear_tag,
0107             areal_tag
0108         >::type,
0109     typename Tag2 = typename tag_cast
0110         <
0111             typename tag<Geometry2>::type,
0112             segment_tag,
0113             box_tag,
0114             linear_tag,
0115             areal_tag
0116         >::type,
0117     typename StrategyTag = typename distance_strategy_tag
0118         <
0119             Geometry1, Geometry2, Strategy
0120         >::type,
0121     bool Reverse = reverse_dispatch<Geometry1, Geometry2>::value
0122 >
0123 struct distance : not_implemented<Tag1, Tag2>
0124 {};
0125 
0126 
0127 
0128 } // namespace dispatch
0129 #endif // DOXYGEN_NO_DISPATCH
0130 
0131 
0132 }} // namespace boost::geometry
0133 
0134 
0135 #endif // BOOST_GEOMETRY_ALGORITHMS_DISPATCH_DISTANCE_HPP