]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/strategies/relate.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / geometry / strategies / relate.hpp
1 // Boost.Geometry
2
3 // Copyright (c) 2017, Oracle and/or its affiliates.
4 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
5
6 // Use, modification and distribution is subject to the Boost Software License,
7 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
9
10 #ifndef BOOST_GEOMETRY_STRATEGIES_RELATE_HPP
11 #define BOOST_GEOMETRY_STRATEGIES_RELATE_HPP
12
13
14 #include <boost/mpl/assert.hpp>
15 #include <boost/type_traits/is_same.hpp>
16
17 #include <boost/geometry/core/cs.hpp>
18 #include <boost/geometry/core/point_type.hpp>
19 #include <boost/geometry/core/topological_dimension.hpp>
20
21 #include <boost/geometry/strategies/covered_by.hpp>
22 #include <boost/geometry/strategies/intersection.hpp>
23 #include <boost/geometry/strategies/within.hpp>
24
25
26 namespace boost { namespace geometry
27 {
28
29 namespace strategy
30 {
31
32 namespace point_in_geometry
33 {
34
35 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
36 namespace services
37 {
38
39 template
40 <
41 typename Point,
42 typename Geometry,
43 typename Tag1 = typename tag<Point>::type,
44 typename Tag2 = typename tag<Geometry>::type
45 >
46 struct default_strategy
47 : strategy::within::services::default_strategy
48 <
49 Point,
50 Geometry
51 >
52 {
53 typedef typename default_strategy::type within_strategy_type;
54
55 typedef typename strategy::covered_by::services::default_strategy
56 <
57 Point,
58 Geometry
59 >::type covered_by_strategy_type;
60
61 static const bool same_strategies = boost::is_same<within_strategy_type, covered_by_strategy_type>::value;
62 BOOST_MPL_ASSERT_MSG((same_strategies),
63 DEFAULT_WITHIN_AND_COVERED_BY_STRATEGIES_NOT_COMPATIBLE,
64 (within_strategy_type, covered_by_strategy_type));
65 };
66
67 template<typename Point, typename Geometry>
68 struct default_strategy<Point, Geometry, point_tag, point_tag>
69 : strategy::within::services::default_strategy<Point, Geometry>
70 {};
71
72 template<typename Point, typename Geometry>
73 struct default_strategy<Point, Geometry, point_tag, multi_point_tag>
74 : strategy::within::services::default_strategy<Point, Geometry>
75 {};
76
77
78 } // namespace services
79 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
80
81
82 } // namespace point_in_geometry
83
84 namespace relate
85 {
86
87 #ifndef DOXYGEN_NO_DETAIL
88 namespace detail
89 {
90
91 template <typename Geometry>
92 struct default_intersection_strategy
93 : strategy::intersection::services::default_strategy
94 <
95 typename cs_tag<Geometry>::type
96 >
97 {};
98
99 template <typename PointLike, typename Geometry>
100 struct default_point_in_geometry_strategy
101 : point_in_geometry::services::default_strategy
102 <
103 typename point_type<PointLike>::type,
104 Geometry
105 >
106 {};
107
108 } // namespace detail
109 #endif // DOXYGEN_NO_DETAIL
110
111 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
112 namespace services
113 {
114
115 template
116 <
117 typename Geometry1,
118 typename Geometry2,
119 int TopDim1 = geometry::topological_dimension<Geometry1>::value,
120 int TopDim2 = geometry::topological_dimension<Geometry2>::value
121 >
122 struct default_strategy
123 {
124 BOOST_MPL_ASSERT_MSG
125 (
126 false, NOT_IMPLEMENTED_FOR_THESE_TYPES
127 , (types<Geometry1, Geometry2>)
128 );
129 };
130
131 template <typename PointLike1, typename PointLike2>
132 struct default_strategy<PointLike1, PointLike2, 0, 0>
133 : detail::default_point_in_geometry_strategy<PointLike1, PointLike2>
134 {};
135
136 template <typename PointLike, typename Geometry, int TopDim2>
137 struct default_strategy<PointLike, Geometry, 0, TopDim2>
138 : detail::default_point_in_geometry_strategy<PointLike, Geometry>
139 {};
140
141 template <typename Geometry, typename PointLike, int TopDim1>
142 struct default_strategy<Geometry, PointLike, TopDim1, 0>
143 : detail::default_point_in_geometry_strategy<PointLike, Geometry>
144 {};
145
146 template <typename Geometry1, typename Geometry2>
147 struct default_strategy<Geometry1, Geometry2, 1, 1>
148 : detail::default_intersection_strategy<Geometry1>
149 {};
150
151 template <typename Geometry1, typename Geometry2>
152 struct default_strategy<Geometry1, Geometry2, 1, 2>
153 : detail::default_intersection_strategy<Geometry1>
154 {};
155
156 template <typename Geometry1, typename Geometry2>
157 struct default_strategy<Geometry1, Geometry2, 2, 1>
158 : detail::default_intersection_strategy<Geometry1>
159 {};
160
161 template <typename Geometry1, typename Geometry2>
162 struct default_strategy<Geometry1, Geometry2, 2, 2>
163 : detail::default_intersection_strategy<Geometry1>
164 {};
165
166 } // namespace services
167 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
168
169 } // namespace relate
170
171 } // namespace strategy
172
173
174 }} // namespace boost::geometry
175
176
177 #endif // BOOST_GEOMETRY_STRATEGIES_RELATE_HPP