]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/geometry/algorithms/detail/distance/default_strategies.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / geometry / algorithms / detail / distance / default_strategies.hpp
CommitLineData
7c673cae
FG
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
33namespace boost { namespace geometry
34{
35
36#ifndef DOXYGEN_NO_DETAIL
37namespace detail { namespace distance
38{
39
40
41
42// Helper metafunction for default strategy retrieval
43template
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>
57struct 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
66template
67<
68 typename Geometry1,
69 typename Geometry2,
70 typename Tag1,
71 typename Tag2
72>
73struct default_strategy<Geometry1, Geometry2, Tag1, Tag2, true>
74 : default_strategy<Geometry2, Geometry1, Tag2, Tag1, false>
75{};
76
77
78template <typename Pointlike1, typename Pointlike2>
79struct 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
92template <typename Pointlike, typename Box>
93struct 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
103template <typename Box1, typename Box2>
104struct 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
92f5a8d4
TL
113template <typename Linear, typename Box>
114struct default_strategy<Linear, Box, segment_tag, box_tag, false>
115 : strategy::distance::services::default_strategy
116 <
117 segment_tag, box_tag,
118 typename point_type<Linear>::type,
119 typename point_type<Box>::type
120 >
121{};
122
123template <typename Linear, typename Box>
124struct default_strategy<Linear, Box, linear_tag, box_tag, false>
125 : strategy::distance::services::default_strategy
126 <
127 segment_tag, box_tag,
128 typename point_type<Linear>::type,
129 typename point_type<Box>::type
130 >
131{};
132
7c673cae
FG
133
134
135// Helper metafunction for default point-segment strategy retrieval
136template <typename Geometry1, typename Geometry2, typename Strategy>
137struct default_ps_strategy
138 : strategy::distance::services::default_strategy
139 <
140 point_tag, segment_tag,
141 typename point_type<Geometry1>::type,
142 typename point_type<Geometry2>::type,
143 typename cs_tag<typename point_type<Geometry1>::type>::type,
144 typename cs_tag<typename point_type<Geometry2>::type>::type,
145 Strategy
146 >
147{};
148
149
150
151}} // namespace detail::distance
152#endif // DOXYGEN_NO_DETAIL
153
154}} // namespace boost::geometry
155
156
157#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISTANCE_DEFAULT_STRATEGIES_HPP