]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/algorithms/detail/distance/default_strategies.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / geometry / algorithms / detail / distance / default_strategies.hpp
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, 2020.
9 // Modifications copyright (c) 2014-2020 Oracle and/or its affiliates.
10
11 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
12 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
13
14 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
15 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
16
17 // Use, modification and distribution is subject to the Boost Software License,
18 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
19 // http://www.boost.org/LICENSE_1_0.txt)
20
21 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISTANCE_DEFAULT_STRATEGIES_HPP
22 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISTANCE_DEFAULT_STRATEGIES_HPP
23
24 #include <boost/geometry/core/cs.hpp>
25 #include <boost/geometry/core/tag.hpp>
26 #include <boost/geometry/core/tag_cast.hpp>
27 #include <boost/geometry/core/tags.hpp>
28 #include <boost/geometry/core/point_type.hpp>
29 #include <boost/geometry/core/reverse_dispatch.hpp>
30
31 #include <boost/geometry/strategies/distance.hpp>
32
33
34 namespace boost { namespace geometry
35 {
36
37 #ifndef DOXYGEN_NO_DETAIL
38 namespace detail { namespace distance
39 {
40
41
42
43 // Helper metafunction for default strategy retrieval
44 template
45 <
46 typename Geometry1,
47 typename Geometry2 = Geometry1,
48 typename Tag1 = typename tag_cast
49 <
50 typename tag<Geometry1>::type, pointlike_tag
51 >::type,
52 typename Tag2 = typename tag_cast
53 <
54 typename tag<Geometry2>::type, pointlike_tag
55 >::type,
56 bool Reverse = geometry::reverse_dispatch<Geometry1, Geometry2>::type::value
57 >
58 struct default_strategy
59 : strategy::distance::services::default_strategy
60 <
61 point_tag, segment_tag,
62 typename point_type<Geometry1>::type,
63 typename point_type<Geometry2>::type
64 >
65 {};
66
67 template
68 <
69 typename Geometry1,
70 typename Geometry2,
71 typename Tag1,
72 typename Tag2
73 >
74 struct default_strategy<Geometry1, Geometry2, Tag1, Tag2, true>
75 : default_strategy<Geometry2, Geometry1, Tag2, Tag1, false>
76 {};
77
78
79 template <typename Pointlike1, typename Pointlike2>
80 struct default_strategy
81 <
82 Pointlike1, Pointlike2,
83 pointlike_tag, pointlike_tag, false
84 > : strategy::distance::services::default_strategy
85 <
86 point_tag, point_tag,
87 typename point_type<Pointlike1>::type,
88 typename point_type<Pointlike2>::type
89 >
90 {};
91
92
93 template <typename Pointlike, typename Box>
94 struct default_strategy<Pointlike, Box, pointlike_tag, box_tag, false>
95 : strategy::distance::services::default_strategy
96 <
97 point_tag, box_tag,
98 typename point_type<Pointlike>::type,
99 typename point_type<Box>::type
100 >
101 {};
102
103
104 template <typename Box1, typename Box2>
105 struct default_strategy<Box1, Box2, box_tag, box_tag, false>
106 : strategy::distance::services::default_strategy
107 <
108 box_tag, box_tag,
109 typename point_type<Box1>::type,
110 typename point_type<Box2>::type
111 >
112 {};
113
114 template <typename PolygonalOrLinear, typename Box>
115 struct default_strategy_polygonal_or_linear
116 : strategy::distance::services::default_strategy
117 <
118 segment_tag, box_tag,
119 typename point_type<PolygonalOrLinear>::type,
120 typename point_type<Box>::type
121 >
122 {};
123
124 template <typename Linear, typename Box>
125 struct default_strategy<Linear, Box, segment_tag, box_tag, false>
126 : default_strategy_polygonal_or_linear<Linear, Box>
127 {};
128
129 template <typename Linear, typename Box>
130 struct default_strategy<Linear, Box, linestring_tag, box_tag, false>
131 : default_strategy_polygonal_or_linear<Linear, Box>
132 {};
133
134 template <typename Linear, typename Box>
135 struct default_strategy<Linear, Box, multi_linestring_tag, box_tag, false>
136 : default_strategy_polygonal_or_linear<Linear, Box>
137 {};
138
139 template <typename Polygonal, typename Box>
140 struct default_strategy<Polygonal, Box, polygon_tag, box_tag, false>
141 : default_strategy_polygonal_or_linear<Polygonal, Box>
142 {};
143
144 template <typename Polygonal, typename Box>
145 struct default_strategy<Polygonal, Box, ring_tag, box_tag, false>
146 : default_strategy_polygonal_or_linear<Polygonal, Box>
147 {};
148
149 template <typename Polygonal, typename Box>
150 struct default_strategy<Polygonal, Box, multi_polygon_tag, box_tag, false>
151 : default_strategy_polygonal_or_linear<Polygonal, Box>
152 {};
153
154
155 // Helper metafunction for default point-segment strategy retrieval
156 template <typename Geometry1, typename Geometry2, typename Strategy>
157 struct default_ps_strategy
158 : strategy::distance::services::default_strategy
159 <
160 point_tag, segment_tag,
161 typename point_type<Geometry1>::type,
162 typename point_type<Geometry2>::type,
163 typename cs_tag<typename point_type<Geometry1>::type>::type,
164 typename cs_tag<typename point_type<Geometry2>::type>::type,
165 Strategy
166 >
167 {};
168
169
170
171 }} // namespace detail::distance
172 #endif // DOXYGEN_NO_DETAIL
173
174 }} // namespace boost::geometry
175
176
177 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISTANCE_DEFAULT_STRATEGIES_HPP