1 // Boost.Geometry (aka GGL, Generic Geometry Library)
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.
8 // This file was modified by Oracle on 2014, 2020.
9 // Modifications copyright (c) 2014-2020 Oracle and/or its affiliates.
11 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
12 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
14 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
15 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
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)
21 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISTANCE_DEFAULT_STRATEGIES_HPP
22 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISTANCE_DEFAULT_STRATEGIES_HPP
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>
31 #include <boost/geometry/strategies/distance.hpp>
34 namespace boost { namespace geometry
37 #ifndef DOXYGEN_NO_DETAIL
38 namespace detail { namespace distance
43 // Helper metafunction for default strategy retrieval
47 typename Geometry2 = Geometry1,
48 typename Tag1 = typename tag_cast
50 typename tag<Geometry1>::type, pointlike_tag
52 typename Tag2 = typename tag_cast
54 typename tag<Geometry2>::type, pointlike_tag
56 bool Reverse = geometry::reverse_dispatch<Geometry1, Geometry2>::type::value
58 struct default_strategy
59 : strategy::distance::services::default_strategy
61 point_tag, segment_tag,
62 typename point_type<Geometry1>::type,
63 typename point_type<Geometry2>::type
74 struct default_strategy<Geometry1, Geometry2, Tag1, Tag2, true>
75 : default_strategy<Geometry2, Geometry1, Tag2, Tag1, false>
79 template <typename Pointlike1, typename Pointlike2>
80 struct default_strategy
82 Pointlike1, Pointlike2,
83 pointlike_tag, pointlike_tag, false
84 > : strategy::distance::services::default_strategy
87 typename point_type<Pointlike1>::type,
88 typename point_type<Pointlike2>::type
93 template <typename Pointlike, typename Box>
94 struct default_strategy<Pointlike, Box, pointlike_tag, box_tag, false>
95 : strategy::distance::services::default_strategy
98 typename point_type<Pointlike>::type,
99 typename point_type<Box>::type
104 template <typename Box1, typename Box2>
105 struct default_strategy<Box1, Box2, box_tag, box_tag, false>
106 : strategy::distance::services::default_strategy
109 typename point_type<Box1>::type,
110 typename point_type<Box2>::type
114 template <typename PolygonalOrLinear, typename Box>
115 struct default_strategy_polygonal_or_linear
116 : strategy::distance::services::default_strategy
118 segment_tag, box_tag,
119 typename point_type<PolygonalOrLinear>::type,
120 typename point_type<Box>::type
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>
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>
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>
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>
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>
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>
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
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,
171 }} // namespace detail::distance
172 #endif // DOXYGEN_NO_DETAIL
174 }} // namespace boost::geometry
177 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISTANCE_DEFAULT_STRATEGIES_HPP