1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 
3 // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
6 // Copyright (c) 2013-2014 Adam Wulkiewicz, Lodz, Poland.
7 
8 // This file was modified by Oracle on 2014.
9 // Modifications copyright (c) 2014, Oracle and/or its affiliates.
10 
11 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
12 
13 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
14 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
15 
16 // Use, modification and distribution is subject to the Boost Software License,
17 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
18 // http://www.boost.org/LICENSE_1_0.txt)
19 
20 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISTANCE_DEFAULT_STRATEGIES_HPP
21 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISTANCE_DEFAULT_STRATEGIES_HPP
22 
23 #include <boost/geometry/core/cs.hpp>
24 #include <boost/geometry/core/tag.hpp>
25 #include <boost/geometry/core/tag_cast.hpp>
26 #include <boost/geometry/core/tags.hpp>
27 #include <boost/geometry/core/point_type.hpp>
28 #include <boost/geometry/core/reverse_dispatch.hpp>
29 
30 #include <boost/geometry/strategies/distance.hpp>
31 
32 
33 namespace boost { namespace geometry
34 {
35 
36 #ifndef DOXYGEN_NO_DETAIL
37 namespace detail { namespace distance
38 {
39 
40 
41 
42 // Helper metafunction for default strategy retrieval
43 template
44 <
45     typename Geometry1,
46     typename Geometry2 = Geometry1,
47     typename Tag1 = typename tag_cast
48         <
49             typename tag<Geometry1>::type, pointlike_tag
50         >::type,
51     typename Tag2 = typename tag_cast
52         <
53             typename tag<Geometry2>::type, pointlike_tag
54         >::type,
55     bool Reverse = geometry::reverse_dispatch<Geometry1, Geometry2>::type::value
56 >
57 struct default_strategy
58     : strategy::distance::services::default_strategy
59           <
60               point_tag, segment_tag,
61               typename point_type<Geometry1>::type,
62               typename point_type<Geometry2>::type
63           >
64 {};
65 
66 template
67 <
68     typename Geometry1,
69     typename Geometry2,
70     typename Tag1,
71     typename Tag2
72 >
73 struct default_strategy<Geometry1, Geometry2, Tag1, Tag2, true>
74     : default_strategy<Geometry2, Geometry1, Tag2, Tag1, false>
75 {};
76 
77 
78 template <typename Pointlike1, typename Pointlike2>
79 struct default_strategy
80     <
81         Pointlike1, Pointlike2,
82         pointlike_tag, pointlike_tag, false
83     > : strategy::distance::services::default_strategy
84           <
85               point_tag, point_tag,
86               typename point_type<Pointlike1>::type,
87               typename point_type<Pointlike2>::type
88           >
89 {};
90 
91 
92 template <typename Pointlike, typename Box>
93 struct default_strategy<Pointlike, Box, pointlike_tag, box_tag, false>
94     : strategy::distance::services::default_strategy
95           <
96               point_tag, box_tag,
97               typename point_type<Pointlike>::type,
98               typename point_type<Box>::type
99           >
100 {};
101 
102 
103 template <typename Box1, typename Box2>
104 struct default_strategy<Box1, Box2, box_tag, box_tag, false>
105     : strategy::distance::services::default_strategy
106           <
107               box_tag, box_tag,
108               typename point_type<Box1>::type,
109               typename point_type<Box2>::type
110           >
111 {};
112 
113 
114 
115 // Helper metafunction for default point-segment strategy retrieval
116 template <typename Geometry1, typename Geometry2, typename Strategy>
117 struct default_ps_strategy
118     : strategy::distance::services::default_strategy
119           <
120               point_tag, segment_tag,
121               typename point_type<Geometry1>::type,
122               typename point_type<Geometry2>::type,
123               typename cs_tag<typename point_type<Geometry1>::type>::type,
124               typename cs_tag<typename point_type<Geometry2>::type>::type,
125               Strategy
126           >
127 {};
128 
129 
130 
131 }} // namespace detail::distance
132 #endif // DOXYGEN_NO_DETAIL
133 
134 }} // namespace boost::geometry
135 
136 
137 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISTANCE_DEFAULT_STRATEGIES_HPP
138