]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/geometry/strategies/relate.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / geometry / strategies / relate.hpp
CommitLineData
b32b8144
FG
1// Boost.Geometry
2
20effc67 3// Copyright (c) 2017-2020, Oracle and/or its affiliates.
b32b8144
FG
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
20effc67 14#include <type_traits>
b32b8144
FG
15
16#include <boost/geometry/core/cs.hpp>
17#include <boost/geometry/core/point_type.hpp>
20effc67 18#include <boost/geometry/core/static_assert.hpp>
b32b8144
FG
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
26namespace boost { namespace geometry
27{
28
29namespace strategy
30{
31
32namespace point_in_geometry
33{
34
35#ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
36namespace services
37{
38
39template
40<
41 typename Point,
42 typename Geometry,
43 typename Tag1 = typename tag<Point>::type,
44 typename Tag2 = typename tag<Geometry>::type
45>
46struct 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
20effc67
TL
61 static const bool same_strategies = std::is_same<within_strategy_type, covered_by_strategy_type>::value;
62 BOOST_GEOMETRY_STATIC_ASSERT(same_strategies,
63 "Default within and covered_by strategies not compatible.",
64 within_strategy_type, covered_by_strategy_type);
b32b8144
FG
65};
66
67template<typename Point, typename Geometry>
68struct default_strategy<Point, Geometry, point_tag, point_tag>
69 : strategy::within::services::default_strategy<Point, Geometry>
70{};
71
72template<typename Point, typename Geometry>
73struct 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
84namespace relate
85{
86
87#ifndef DOXYGEN_NO_DETAIL
88namespace detail
89{
90
91template <typename Geometry>
92struct default_intersection_strategy
93 : strategy::intersection::services::default_strategy
94 <
95 typename cs_tag<Geometry>::type
96 >
97{};
98
99template <typename PointLike, typename Geometry>
100struct 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
112namespace services
113{
114
115template
116<
117 typename Geometry1,
118 typename Geometry2,
119 int TopDim1 = geometry::topological_dimension<Geometry1>::value,
120 int TopDim2 = geometry::topological_dimension<Geometry2>::value
121>
122struct default_strategy
123{
20effc67
TL
124 BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
125 "Not implemented for these types.",
126 Geometry1, Geometry2);
b32b8144
FG
127};
128
129template <typename PointLike1, typename PointLike2>
130struct default_strategy<PointLike1, PointLike2, 0, 0>
131 : detail::default_point_in_geometry_strategy<PointLike1, PointLike2>
132{};
133
134template <typename PointLike, typename Geometry, int TopDim2>
135struct default_strategy<PointLike, Geometry, 0, TopDim2>
136 : detail::default_point_in_geometry_strategy<PointLike, Geometry>
137{};
138
139template <typename Geometry, typename PointLike, int TopDim1>
140struct default_strategy<Geometry, PointLike, TopDim1, 0>
141 : detail::default_point_in_geometry_strategy<PointLike, Geometry>
142{};
143
144template <typename Geometry1, typename Geometry2>
145struct default_strategy<Geometry1, Geometry2, 1, 1>
146 : detail::default_intersection_strategy<Geometry1>
147{};
148
149template <typename Geometry1, typename Geometry2>
150struct default_strategy<Geometry1, Geometry2, 1, 2>
151 : detail::default_intersection_strategy<Geometry1>
152{};
153
154template <typename Geometry1, typename Geometry2>
155struct default_strategy<Geometry1, Geometry2, 2, 1>
156 : detail::default_intersection_strategy<Geometry1>
157{};
158
159template <typename Geometry1, typename Geometry2>
160struct default_strategy<Geometry1, Geometry2, 2, 2>
161 : detail::default_intersection_strategy<Geometry1>
162{};
163
164} // namespace services
165#endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
166
167} // namespace relate
168
169} // namespace strategy
170
171
172}} // namespace boost::geometry
173
174
175#endif // BOOST_GEOMETRY_STRATEGIES_RELATE_HPP