File indexing completed on 2025-01-18 09:35:11
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_NEEDS_SELF_TURNS_HPP
0014 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_NEEDS_SELF_TURNS_HPP
0015
0016 #include <boost/range/begin.hpp>
0017 #include <boost/range/size.hpp>
0018
0019 #include <boost/geometry/core/tags.hpp>
0020 #include <boost/geometry/algorithms/num_interior_rings.hpp>
0021
0022
0023 namespace boost { namespace geometry
0024 {
0025
0026
0027 #ifndef DOXYGEN_NO_DETAIL
0028 namespace detail { namespace overlay
0029 {
0030
0031 template
0032 <
0033 typename Geometry,
0034 typename Tag = typename tag<Geometry>::type
0035 >
0036 struct needs_self_turns
0037 {
0038 };
0039
0040 template <typename Geometry>
0041 struct needs_self_turns<Geometry, box_tag>
0042 {
0043 static inline bool apply(Geometry const&)
0044 {
0045 return false;
0046 }
0047 };
0048
0049 template <typename Geometry>
0050 struct needs_self_turns<Geometry, ring_tag>
0051 {
0052 static inline bool apply(Geometry const&)
0053 {
0054 return false;
0055 }
0056 };
0057
0058 template <typename Geometry>
0059 struct needs_self_turns<Geometry, polygon_tag>
0060 {
0061 static inline bool apply(Geometry const& polygon)
0062 {
0063 return geometry::num_interior_rings(polygon) > 0;
0064 }
0065 };
0066
0067 template <typename Geometry>
0068 struct needs_self_turns<Geometry, multi_polygon_tag>
0069 {
0070 static inline bool apply(Geometry const& multi)
0071 {
0072 typedef typename boost::range_value<Geometry>::type polygon_type;
0073 std::size_t const n = boost::size(multi);
0074 return n > 1 || (n == 1
0075 && needs_self_turns<polygon_type>
0076 ::apply(*boost::begin(multi)));
0077 }
0078 };
0079
0080
0081 }}
0082 #endif
0083
0084
0085 }}
0086
0087
0088 #endif