1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2014, Oracle and/or its affiliates.
5 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
7 // Licensed under the Boost Software License version 1.0.
8 // http://www.boost.org/users/license.html
10 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISTANCE_LINEAR_OR_AREAL_TO_AREAL_HPP
11 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISTANCE_LINEAR_OR_AREAL_TO_AREAL_HPP
13 #include <boost/geometry/core/point_type.hpp>
15 #include <boost/geometry/strategies/distance.hpp>
17 #include <boost/geometry/algorithms/intersects.hpp>
19 #include <boost/geometry/algorithms/detail/distance/linear_to_linear.hpp>
22 namespace boost { namespace geometry
25 #ifndef DOXYGEN_NO_DETAIL
26 namespace detail { namespace distance
30 template <typename Linear, typename Areal, typename Strategy>
31 struct linear_to_areal
33 typedef typename strategy::distance::services::return_type
36 typename point_type<Linear>::type,
37 typename point_type<Areal>::type
40 static inline return_type apply(Linear const& linear,
42 Strategy const& strategy)
44 if ( geometry::intersects(linear, areal) )
49 return linear_to_linear
51 Linear, Areal, Strategy
52 >::apply(linear, areal, strategy, false);
56 static inline return_type apply(Areal const& areal,
58 Strategy const& strategy)
60 return apply(linear, areal, strategy);
65 template <typename Areal1, typename Areal2, typename Strategy>
68 typedef typename strategy::distance::services::return_type
71 typename point_type<Areal1>::type,
72 typename point_type<Areal2>::type
75 static inline return_type apply(Areal1 const& areal1,
77 Strategy const& strategy)
79 if ( geometry::intersects(areal1, areal2) )
84 return linear_to_linear
86 Areal1, Areal2, Strategy
87 >::apply(areal1, areal2, strategy, false);
92 }} // namespace detail::distance
93 #endif // DOXYGEN_NO_DETAIL
96 #ifndef DOXYGEN_NO_DISPATCH
100 template <typename Linear, typename Areal, typename Strategy>
103 Linear, Areal, Strategy,
104 linear_tag, areal_tag,
105 strategy_tag_distance_point_segment, false
107 : detail::distance::linear_to_areal
109 Linear, Areal, Strategy
114 template <typename Areal, typename Linear, typename Strategy>
117 Areal, Linear, Strategy,
118 areal_tag, linear_tag,
119 strategy_tag_distance_point_segment, false
121 : detail::distance::linear_to_areal
123 Linear, Areal, Strategy
128 template <typename Areal1, typename Areal2, typename Strategy>
131 Areal1, Areal2, Strategy,
132 areal_tag, areal_tag,
133 strategy_tag_distance_point_segment, false
135 : detail::distance::areal_to_areal
137 Areal1, Areal2, Strategy
142 } // namespace dispatch
143 #endif // DOXYGEN_NO_DISPATCH
145 }} // namespace boost::geometry
147 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISTANCE_LINEAR_OR_AREAL_TO_AREAL_HPP