File indexing completed on 2025-01-18 09:35:17
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_WITHIN_IMPLEMENTATION_HPP
0020 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_WITHIN_IMPLEMENTATION_HPP
0021
0022 #include <cstddef>
0023 #include <deque>
0024
0025 #include <boost/core/ignore_unused.hpp>
0026
0027 #include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
0028 #include <boost/geometry/algorithms/detail/overlay/do_reverse.hpp>
0029 #include <boost/geometry/algorithms/detail/within/interface.hpp>
0030 #include <boost/geometry/algorithms/detail/within/multi_point.hpp>
0031 #include <boost/geometry/algorithms/detail/within/point_in_geometry.hpp>
0032 #include <boost/geometry/algorithms/detail/relate/implementation.hpp>
0033 #include <boost/geometry/algorithms/detail/relate/relate_impl.hpp>
0034
0035 #include <boost/geometry/core/access.hpp>
0036 #include <boost/geometry/core/closure.hpp>
0037 #include <boost/geometry/core/cs.hpp>
0038 #include <boost/geometry/core/exterior_ring.hpp>
0039 #include <boost/geometry/core/interior_rings.hpp>
0040 #include <boost/geometry/core/point_order.hpp>
0041 #include <boost/geometry/core/ring_type.hpp>
0042 #include <boost/geometry/core/interior_rings.hpp>
0043 #include <boost/geometry/core/tags.hpp>
0044
0045 #include <boost/geometry/strategies/relate/cartesian.hpp>
0046 #include <boost/geometry/strategies/relate/geographic.hpp>
0047 #include <boost/geometry/strategies/relate/spherical.hpp>
0048
0049 #include <boost/geometry/util/math.hpp>
0050 #include <boost/geometry/util/order_as_direction.hpp>
0051
0052 namespace boost { namespace geometry
0053 {
0054
0055 #ifndef DOXYGEN_NO_DETAIL
0056 namespace detail { namespace within {
0057
0058 struct use_point_in_geometry
0059 {
0060 template <typename Geometry1, typename Geometry2, typename Strategy>
0061 static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2, Strategy const& strategy)
0062 {
0063 return detail::within::within_point_geometry(geometry1, geometry2, strategy);
0064 }
0065 };
0066
0067 struct use_relate
0068 {
0069 template <typename Geometry1, typename Geometry2, typename Strategy>
0070 static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2, Strategy const& strategy)
0071 {
0072 return detail::relate::relate_impl
0073 <
0074 detail::de9im::static_mask_within_type,
0075 Geometry1,
0076 Geometry2
0077 >::apply(geometry1, geometry2, strategy);
0078 }
0079 };
0080
0081 }}
0082 #endif
0083
0084 #ifndef DOXYGEN_NO_DISPATCH
0085 namespace dispatch
0086 {
0087
0088 template <typename Point, typename Box>
0089 struct within<Point, Box, point_tag, box_tag>
0090 {
0091 template <typename Strategy>
0092 static inline bool apply(Point const& point, Box const& box, Strategy const& strategy)
0093 {
0094 return strategy.within(point, box).apply(point, box);
0095 }
0096 };
0097
0098 template <typename Box1, typename Box2>
0099 struct within<Box1, Box2, box_tag, box_tag>
0100 {
0101 template <typename Strategy>
0102 static inline bool apply(Box1 const& box1, Box2 const& box2, Strategy const& strategy)
0103 {
0104 assert_dimension_equal<Box1, Box2>();
0105 return strategy.within(box1, box2).apply(box1, box2);
0106 }
0107 };
0108
0109
0110
0111 template <typename Point1, typename Point2>
0112 struct within<Point1, Point2, point_tag, point_tag>
0113 : public detail::within::use_point_in_geometry
0114 {};
0115
0116 template <typename Point, typename MultiPoint>
0117 struct within<Point, MultiPoint, point_tag, multi_point_tag>
0118 : public detail::within::use_point_in_geometry
0119 {};
0120
0121 template <typename MultiPoint, typename Point>
0122 struct within<MultiPoint, Point, multi_point_tag, point_tag>
0123 : public detail::within::multi_point_point
0124 {};
0125
0126 template <typename MultiPoint1, typename MultiPoint2>
0127 struct within<MultiPoint1, MultiPoint2, multi_point_tag, multi_point_tag>
0128 : public detail::within::multi_point_multi_point
0129 {};
0130
0131
0132
0133 template <typename Point, typename Segment>
0134 struct within<Point, Segment, point_tag, segment_tag>
0135 : public detail::within::use_point_in_geometry
0136 {};
0137
0138 template <typename Point, typename Linestring>
0139 struct within<Point, Linestring, point_tag, linestring_tag>
0140 : public detail::within::use_point_in_geometry
0141 {};
0142
0143 template <typename Point, typename MultiLinestring>
0144 struct within<Point, MultiLinestring, point_tag, multi_linestring_tag>
0145 : public detail::within::use_point_in_geometry
0146 {};
0147
0148 template <typename MultiPoint, typename Segment>
0149 struct within<MultiPoint, Segment, multi_point_tag, segment_tag>
0150 : public detail::within::multi_point_single_geometry<true>
0151 {};
0152
0153 template <typename MultiPoint, typename Linestring>
0154 struct within<MultiPoint, Linestring, multi_point_tag, linestring_tag>
0155 : public detail::within::multi_point_single_geometry<true>
0156 {};
0157
0158 template <typename MultiPoint, typename MultiLinestring>
0159 struct within<MultiPoint, MultiLinestring, multi_point_tag, multi_linestring_tag>
0160 : public detail::within::multi_point_multi_geometry<true>
0161 {};
0162
0163
0164
0165 template <typename Point, typename Ring>
0166 struct within<Point, Ring, point_tag, ring_tag>
0167 : public detail::within::use_point_in_geometry
0168 {};
0169
0170 template <typename Point, typename Polygon>
0171 struct within<Point, Polygon, point_tag, polygon_tag>
0172 : public detail::within::use_point_in_geometry
0173 {};
0174
0175 template <typename Point, typename MultiPolygon>
0176 struct within<Point, MultiPolygon, point_tag, multi_polygon_tag>
0177 : public detail::within::use_point_in_geometry
0178 {};
0179
0180 template <typename MultiPoint, typename Ring>
0181 struct within<MultiPoint, Ring, multi_point_tag, ring_tag>
0182 : public detail::within::multi_point_single_geometry<true>
0183 {};
0184
0185 template <typename MultiPoint, typename Polygon>
0186 struct within<MultiPoint, Polygon, multi_point_tag, polygon_tag>
0187 : public detail::within::multi_point_single_geometry<true>
0188 {};
0189
0190 template <typename MultiPoint, typename MultiPolygon>
0191 struct within<MultiPoint, MultiPolygon, multi_point_tag, multi_polygon_tag>
0192 : public detail::within::multi_point_multi_geometry<true>
0193 {};
0194
0195
0196
0197 template <typename Linestring1, typename Linestring2>
0198 struct within<Linestring1, Linestring2, linestring_tag, linestring_tag>
0199 : public detail::within::use_relate
0200 {};
0201
0202 template <typename Linestring, typename MultiLinestring>
0203 struct within<Linestring, MultiLinestring, linestring_tag, multi_linestring_tag>
0204 : public detail::within::use_relate
0205 {};
0206
0207 template <typename MultiLinestring, typename Linestring>
0208 struct within<MultiLinestring, Linestring, multi_linestring_tag, linestring_tag>
0209 : public detail::within::use_relate
0210 {};
0211
0212 template <typename MultiLinestring1, typename MultiLinestring2>
0213 struct within<MultiLinestring1, MultiLinestring2, multi_linestring_tag, multi_linestring_tag>
0214 : public detail::within::use_relate
0215 {};
0216
0217
0218
0219 template <typename Linestring, typename Ring>
0220 struct within<Linestring, Ring, linestring_tag, ring_tag>
0221 : public detail::within::use_relate
0222 {};
0223
0224 template <typename MultiLinestring, typename Ring>
0225 struct within<MultiLinestring, Ring, multi_linestring_tag, ring_tag>
0226 : public detail::within::use_relate
0227 {};
0228
0229 template <typename Linestring, typename Polygon>
0230 struct within<Linestring, Polygon, linestring_tag, polygon_tag>
0231 : public detail::within::use_relate
0232 {};
0233
0234 template <typename MultiLinestring, typename Polygon>
0235 struct within<MultiLinestring, Polygon, multi_linestring_tag, polygon_tag>
0236 : public detail::within::use_relate
0237 {};
0238
0239 template <typename Linestring, typename MultiPolygon>
0240 struct within<Linestring, MultiPolygon, linestring_tag, multi_polygon_tag>
0241 : public detail::within::use_relate
0242 {};
0243
0244 template <typename MultiLinestring, typename MultiPolygon>
0245 struct within<MultiLinestring, MultiPolygon, multi_linestring_tag, multi_polygon_tag>
0246 : public detail::within::use_relate
0247 {};
0248
0249
0250
0251 template <typename Ring1, typename Ring2>
0252 struct within<Ring1, Ring2, ring_tag, ring_tag>
0253 : public detail::within::use_relate
0254 {};
0255
0256 template <typename Ring, typename Polygon>
0257 struct within<Ring, Polygon, ring_tag, polygon_tag>
0258 : public detail::within::use_relate
0259 {};
0260
0261 template <typename Polygon, typename Ring>
0262 struct within<Polygon, Ring, polygon_tag, ring_tag>
0263 : public detail::within::use_relate
0264 {};
0265
0266 template <typename Polygon1, typename Polygon2>
0267 struct within<Polygon1, Polygon2, polygon_tag, polygon_tag>
0268 : public detail::within::use_relate
0269 {};
0270
0271 template <typename Ring, typename MultiPolygon>
0272 struct within<Ring, MultiPolygon, ring_tag, multi_polygon_tag>
0273 : public detail::within::use_relate
0274 {};
0275
0276 template <typename MultiPolygon, typename Ring>
0277 struct within<MultiPolygon, Ring, multi_polygon_tag, ring_tag>
0278 : public detail::within::use_relate
0279 {};
0280
0281 template <typename Polygon, typename MultiPolygon>
0282 struct within<Polygon, MultiPolygon, polygon_tag, multi_polygon_tag>
0283 : public detail::within::use_relate
0284 {};
0285
0286 template <typename MultiPolygon, typename Polygon>
0287 struct within<MultiPolygon, Polygon, multi_polygon_tag, polygon_tag>
0288 : public detail::within::use_relate
0289 {};
0290
0291 template <typename MultiPolygon1, typename MultiPolygon2>
0292 struct within<MultiPolygon1, MultiPolygon2, multi_polygon_tag, multi_polygon_tag>
0293 : public detail::within::use_relate
0294 {};
0295
0296 }
0297 #endif
0298
0299
0300 }}
0301
0302 #include <boost/geometry/index/rtree.hpp>
0303
0304 #endif