]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/algorithms/detail/covered_by/implementation.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / geometry / algorithms / detail / covered_by / implementation.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
6
7 // This file was modified by Oracle on 2013, 2014, 2017.
8 // Modifications copyright (c) 2013-2017 Oracle and/or its affiliates.
9
10 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
11
12 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
13 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
14
15 // Use, modification and distribution is subject to the Boost Software License,
16 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
17 // http://www.boost.org/LICENSE_1_0.txt)
18
19 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_COVERED_BY_IMPLEMENTATION_HPP
20 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_COVERED_BY_IMPLEMENTATION_HPP
21
22
23 #include <cstddef>
24
25 #include <boost/geometry/algorithms/detail/covered_by/interface.hpp>
26 #include <boost/geometry/algorithms/detail/within/implementation.hpp>
27
28
29 namespace boost { namespace geometry
30 {
31
32 #ifndef DOXYGEN_NO_DETAIL
33 namespace detail { namespace covered_by {
34
35 struct use_point_in_geometry
36 {
37 template <typename Geometry1, typename Geometry2, typename Strategy>
38 static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2, Strategy const& strategy)
39 {
40 return detail::within::point_in_geometry(geometry1, geometry2, strategy) >= 0;
41 }
42 };
43
44 struct use_relate
45 {
46 template <typename Geometry1, typename Geometry2, typename Strategy>
47 static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2, Strategy const& strategy)
48 {
49 typedef typename detail::de9im::static_mask_covered_by_type
50 <
51 Geometry1, Geometry2
52 >::type covered_by_mask;
53 return geometry::relate(geometry1, geometry2, covered_by_mask(), strategy);
54 }
55 };
56
57 }} // namespace detail::covered_by
58 #endif // DOXYGEN_NO_DETAIL
59
60 #ifndef DOXYGEN_NO_DISPATCH
61 namespace dispatch
62 {
63
64 template <typename Point, typename Box>
65 struct covered_by<Point, Box, point_tag, box_tag>
66 {
67 template <typename Strategy>
68 static inline bool apply(Point const& point, Box const& box, Strategy const& strategy)
69 {
70 ::boost::ignore_unused_variable_warning(strategy);
71 return strategy.apply(point, box);
72 }
73 };
74
75 template <typename Box1, typename Box2>
76 struct covered_by<Box1, Box2, box_tag, box_tag>
77 {
78 template <typename Strategy>
79 static inline bool apply(Box1 const& box1, Box2 const& box2, Strategy const& strategy)
80 {
81 assert_dimension_equal<Box1, Box2>();
82 ::boost::ignore_unused_variable_warning(strategy);
83 return strategy.apply(box1, box2);
84 }
85 };
86
87
88 // P/P
89
90 template <typename Point1, typename Point2>
91 struct covered_by<Point1, Point2, point_tag, point_tag>
92 : public detail::covered_by::use_point_in_geometry
93 {};
94
95 template <typename Point, typename MultiPoint>
96 struct covered_by<Point, MultiPoint, point_tag, multi_point_tag>
97 : public detail::covered_by::use_point_in_geometry
98 {};
99
100 template <typename MultiPoint, typename Point>
101 struct covered_by<MultiPoint, Point, multi_point_tag, point_tag>
102 : public detail::within::multi_point_point
103 {};
104
105 template <typename MultiPoint1, typename MultiPoint2>
106 struct covered_by<MultiPoint1, MultiPoint2, multi_point_tag, multi_point_tag>
107 : public detail::within::multi_point_multi_point
108 {};
109
110 // P/L
111
112 template <typename Point, typename Segment>
113 struct covered_by<Point, Segment, point_tag, segment_tag>
114 : public detail::covered_by::use_point_in_geometry
115 {};
116
117 template <typename Point, typename Linestring>
118 struct covered_by<Point, Linestring, point_tag, linestring_tag>
119 : public detail::covered_by::use_point_in_geometry
120 {};
121
122 template <typename Point, typename MultiLinestring>
123 struct covered_by<Point, MultiLinestring, point_tag, multi_linestring_tag>
124 : public detail::covered_by::use_point_in_geometry
125 {};
126
127 template <typename MultiPoint, typename Segment>
128 struct covered_by<MultiPoint, Segment, multi_point_tag, segment_tag>
129 : public detail::within::multi_point_single_geometry<false>
130 {};
131
132 template <typename MultiPoint, typename Linestring>
133 struct covered_by<MultiPoint, Linestring, multi_point_tag, linestring_tag>
134 : public detail::within::multi_point_single_geometry<false>
135 {};
136
137 template <typename MultiPoint, typename MultiLinestring>
138 struct covered_by<MultiPoint, MultiLinestring, multi_point_tag, multi_linestring_tag>
139 : public detail::within::multi_point_multi_geometry<false>
140 {};
141
142 // P/A
143
144 template <typename Point, typename Ring>
145 struct covered_by<Point, Ring, point_tag, ring_tag>
146 : public detail::covered_by::use_point_in_geometry
147 {};
148
149 template <typename Point, typename Polygon>
150 struct covered_by<Point, Polygon, point_tag, polygon_tag>
151 : public detail::covered_by::use_point_in_geometry
152 {};
153
154 template <typename Point, typename MultiPolygon>
155 struct covered_by<Point, MultiPolygon, point_tag, multi_polygon_tag>
156 : public detail::covered_by::use_point_in_geometry
157 {};
158
159 template <typename MultiPoint, typename Ring>
160 struct covered_by<MultiPoint, Ring, multi_point_tag, ring_tag>
161 : public detail::within::multi_point_single_geometry<false>
162 {};
163
164 template <typename MultiPoint, typename Polygon>
165 struct covered_by<MultiPoint, Polygon, multi_point_tag, polygon_tag>
166 : public detail::within::multi_point_single_geometry<false>
167 {};
168
169 template <typename MultiPoint, typename MultiPolygon>
170 struct covered_by<MultiPoint, MultiPolygon, multi_point_tag, multi_polygon_tag>
171 : public detail::within::multi_point_multi_geometry<false>
172 {};
173
174 // L/L
175
176 template <typename Linestring1, typename Linestring2>
177 struct covered_by<Linestring1, Linestring2, linestring_tag, linestring_tag>
178 : public detail::covered_by::use_relate
179 {};
180
181 template <typename Linestring, typename MultiLinestring>
182 struct covered_by<Linestring, MultiLinestring, linestring_tag, multi_linestring_tag>
183 : public detail::covered_by::use_relate
184 {};
185
186 template <typename MultiLinestring, typename Linestring>
187 struct covered_by<MultiLinestring, Linestring, multi_linestring_tag, linestring_tag>
188 : public detail::covered_by::use_relate
189 {};
190
191 template <typename MultiLinestring1, typename MultiLinestring2>
192 struct covered_by<MultiLinestring1, MultiLinestring2, multi_linestring_tag, multi_linestring_tag>
193 : public detail::covered_by::use_relate
194 {};
195
196 // L/A
197
198 template <typename Linestring, typename Ring>
199 struct covered_by<Linestring, Ring, linestring_tag, ring_tag>
200 : public detail::covered_by::use_relate
201 {};
202
203 template <typename MultiLinestring, typename Ring>
204 struct covered_by<MultiLinestring, Ring, multi_linestring_tag, ring_tag>
205 : public detail::covered_by::use_relate
206 {};
207
208 template <typename Linestring, typename Polygon>
209 struct covered_by<Linestring, Polygon, linestring_tag, polygon_tag>
210 : public detail::covered_by::use_relate
211 {};
212
213 template <typename MultiLinestring, typename Polygon>
214 struct covered_by<MultiLinestring, Polygon, multi_linestring_tag, polygon_tag>
215 : public detail::covered_by::use_relate
216 {};
217
218 template <typename Linestring, typename MultiPolygon>
219 struct covered_by<Linestring, MultiPolygon, linestring_tag, multi_polygon_tag>
220 : public detail::covered_by::use_relate
221 {};
222
223 template <typename MultiLinestring, typename MultiPolygon>
224 struct covered_by<MultiLinestring, MultiPolygon, multi_linestring_tag, multi_polygon_tag>
225 : public detail::covered_by::use_relate
226 {};
227
228 // A/A
229
230 template <typename Ring1, typename Ring2>
231 struct covered_by<Ring1, Ring2, ring_tag, ring_tag>
232 : public detail::covered_by::use_relate
233 {};
234
235 template <typename Ring, typename Polygon>
236 struct covered_by<Ring, Polygon, ring_tag, polygon_tag>
237 : public detail::covered_by::use_relate
238 {};
239
240 template <typename Polygon, typename Ring>
241 struct covered_by<Polygon, Ring, polygon_tag, ring_tag>
242 : public detail::covered_by::use_relate
243 {};
244
245 template <typename Polygon1, typename Polygon2>
246 struct covered_by<Polygon1, Polygon2, polygon_tag, polygon_tag>
247 : public detail::covered_by::use_relate
248 {};
249
250 template <typename Ring, typename MultiPolygon>
251 struct covered_by<Ring, MultiPolygon, ring_tag, multi_polygon_tag>
252 : public detail::covered_by::use_relate
253 {};
254
255 template <typename MultiPolygon, typename Ring>
256 struct covered_by<MultiPolygon, Ring, multi_polygon_tag, ring_tag>
257 : public detail::covered_by::use_relate
258 {};
259
260 template <typename Polygon, typename MultiPolygon>
261 struct covered_by<Polygon, MultiPolygon, polygon_tag, multi_polygon_tag>
262 : public detail::covered_by::use_relate
263 {};
264
265 template <typename MultiPolygon, typename Polygon>
266 struct covered_by<MultiPolygon, Polygon, multi_polygon_tag, polygon_tag>
267 : public detail::covered_by::use_relate
268 {};
269
270 template <typename MultiPolygon1, typename MultiPolygon2>
271 struct covered_by<MultiPolygon1, MultiPolygon2, multi_polygon_tag, multi_polygon_tag>
272 : public detail::covered_by::use_relate
273 {};
274
275 } // namespace dispatch
276 #endif // DOXYGEN_NO_DISPATCH
277
278 }} // namespace boost::geometry
279
280 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_COVERED_BY_IMPLEMENTATION_HPP