File indexing completed on 2025-12-15 09:50:14
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAPS_INTERFACE_HPP
0020 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAPS_INTERFACE_HPP
0021
0022
0023 #include <cstddef>
0024
0025 #include <boost/geometry/algorithms/not_implemented.hpp>
0026
0027 #include <boost/geometry/geometries/adapted/boost_variant.hpp>
0028 #include <boost/geometry/geometries/concepts/check.hpp>
0029
0030 #include <boost/geometry/algorithms/detail/relate/relate_impl.hpp>
0031
0032 #include <boost/geometry/strategies/default_strategy.hpp>
0033 #include <boost/geometry/strategies/detail.hpp>
0034 #include <boost/geometry/strategies/relate/services.hpp>
0035
0036
0037 namespace boost { namespace geometry
0038 {
0039
0040 #ifndef DOXYGEN_NO_DISPATCH
0041 namespace dispatch
0042 {
0043
0044
0045 template
0046 <
0047 typename Geometry1,
0048 typename Geometry2,
0049 typename Tag1 = tag_t<Geometry1>,
0050 typename Tag2 = tag_t<Geometry2>
0051 >
0052 struct overlaps
0053 : detail::relate::relate_impl
0054 <
0055 detail::de9im::static_mask_overlaps_type,
0056 Geometry1,
0057 Geometry2
0058 >
0059 {};
0060
0061
0062 }
0063 #endif
0064
0065
0066 namespace resolve_strategy
0067 {
0068
0069 template
0070 <
0071 typename Strategy,
0072 bool IsUmbrella = strategies::detail::is_umbrella_strategy<Strategy>::value
0073 >
0074 struct overlaps
0075 {
0076 template <typename Geometry1, typename Geometry2>
0077 static inline bool apply(Geometry1 const& geometry1,
0078 Geometry2 const& geometry2,
0079 Strategy const& strategy)
0080 {
0081 return dispatch::overlaps
0082 <
0083 Geometry1, Geometry2
0084 >::apply(geometry1, geometry2, strategy);
0085 }
0086 };
0087
0088 template <typename Strategy>
0089 struct overlaps<Strategy, false>
0090 {
0091 template <typename Geometry1, typename Geometry2>
0092 static inline bool apply(Geometry1 const& geometry1,
0093 Geometry2 const& geometry2,
0094 Strategy const& strategy)
0095 {
0096 using strategies::relate::services::strategy_converter;
0097 return dispatch::overlaps
0098 <
0099 Geometry1, Geometry2
0100 >::apply(geometry1, geometry2,
0101 strategy_converter<Strategy>::get(strategy));
0102 }
0103 };
0104
0105 template <>
0106 struct overlaps<default_strategy, false>
0107 {
0108 template <typename Geometry1, typename Geometry2>
0109 static inline bool apply(Geometry1 const& geometry1,
0110 Geometry2 const& geometry2,
0111 default_strategy)
0112 {
0113 typedef typename strategies::relate::services::default_strategy
0114 <
0115 Geometry1, Geometry2
0116 >::type strategy_type;
0117
0118 return dispatch::overlaps
0119 <
0120 Geometry1, Geometry2
0121 >::apply(geometry1, geometry2, strategy_type());
0122 }
0123 };
0124
0125 }
0126
0127
0128 namespace resolve_dynamic
0129 {
0130
0131 template
0132 <
0133 typename Geometry1, typename Geometry2,
0134 typename Tag1 = geometry::tag_t<Geometry1>,
0135 typename Tag2 = geometry::tag_t<Geometry2>
0136 >
0137 struct overlaps
0138 {
0139 template <typename Strategy>
0140 static inline bool apply(Geometry1 const& geometry1,
0141 Geometry2 const& geometry2,
0142 Strategy const& strategy)
0143 {
0144 return resolve_strategy::overlaps
0145 <
0146 Strategy
0147 >::apply(geometry1, geometry2, strategy);
0148 }
0149 };
0150
0151
0152 template <typename DynamicGeometry1, typename Geometry2, typename Tag2>
0153 struct overlaps<DynamicGeometry1, Geometry2, dynamic_geometry_tag, Tag2>
0154 {
0155 template <typename Strategy>
0156 static inline bool apply(DynamicGeometry1 const& geometry1,
0157 Geometry2 const& geometry2,
0158 Strategy const& strategy)
0159 {
0160 bool result = false;
0161 traits::visit<DynamicGeometry1>::apply([&](auto const& g1)
0162 {
0163 result = resolve_strategy::overlaps
0164 <
0165 Strategy
0166 >::apply(g1, geometry2, strategy);
0167 }, geometry1);
0168 return result;
0169 }
0170 };
0171
0172
0173 template <typename Geometry1, typename DynamicGeometry2, typename Tag1>
0174 struct overlaps<Geometry1, DynamicGeometry2, Tag1, dynamic_geometry_tag>
0175 {
0176 template <typename Strategy>
0177 static inline bool apply(Geometry1 const& geometry1,
0178 DynamicGeometry2 const& geometry2,
0179 Strategy const& strategy)
0180 {
0181 bool result = false;
0182 traits::visit<DynamicGeometry2>::apply([&](auto const& g2)
0183 {
0184 result = resolve_strategy::overlaps
0185 <
0186 Strategy
0187 >::apply(geometry1, g2, strategy);
0188 }, geometry2);
0189 return result;
0190 }
0191 };
0192
0193
0194 template <typename DynamicGeometry1, typename DynamicGeometry2>
0195 struct overlaps<DynamicGeometry1, DynamicGeometry2, dynamic_geometry_tag, dynamic_geometry_tag>
0196 {
0197 template <typename Strategy>
0198 static inline bool apply(DynamicGeometry1 const& geometry1,
0199 DynamicGeometry2 const& geometry2,
0200 Strategy const& strategy)
0201 {
0202 bool result = false;
0203 traits::visit<DynamicGeometry1, DynamicGeometry2>::apply([&](auto const& g1, auto const& g2)
0204 {
0205 result = resolve_strategy::overlaps
0206 <
0207 Strategy
0208 >::apply(g1, g2, strategy);
0209 }, geometry1, geometry2);
0210 return result;
0211 }
0212 };
0213
0214
0215 }
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232 template <typename Geometry1, typename Geometry2, typename Strategy>
0233 inline bool overlaps(Geometry1 const& geometry1,
0234 Geometry2 const& geometry2,
0235 Strategy const& strategy)
0236 {
0237 concepts::check<Geometry1 const>();
0238 concepts::check<Geometry2 const>();
0239
0240 return resolve_dynamic::overlaps
0241 <
0242 Geometry1, Geometry2
0243 >::apply(geometry1, geometry2, strategy);
0244 }
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259
0260
0261
0262 template <typename Geometry1, typename Geometry2>
0263 inline bool overlaps(Geometry1 const& geometry1, Geometry2 const& geometry2)
0264 {
0265 concepts::check<Geometry1 const>();
0266 concepts::check<Geometry2 const>();
0267
0268 return resolve_dynamic::overlaps
0269 <
0270 Geometry1, Geometry2
0271 >::apply(geometry1, geometry2, default_strategy());
0272 }
0273
0274 }}
0275
0276 #endif