File indexing completed on 2025-12-15 09:50:23
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_COUNTING_HPP
0021 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_COUNTING_HPP
0022
0023 #include <cstddef>
0024
0025 #include <boost/range/begin.hpp>
0026 #include <boost/range/end.hpp>
0027
0028 #include <boost/geometry/core/exterior_ring.hpp>
0029 #include <boost/geometry/core/interior_rings.hpp>
0030
0031 #include <boost/geometry/util/range.hpp>
0032
0033
0034 namespace boost { namespace geometry
0035 {
0036
0037
0038 #ifndef DOXYGEN_NO_DETAIL
0039 namespace detail { namespace counting
0040 {
0041
0042
0043 template <std::size_t D>
0044 struct other_count
0045 {
0046 template <typename Geometry>
0047 static inline std::size_t apply(Geometry const&)
0048 {
0049 return D;
0050 }
0051
0052 template <typename Geometry>
0053 static inline std::size_t apply(Geometry const&, bool)
0054 {
0055 return D;
0056 }
0057 };
0058
0059
0060 template <typename RangeCount>
0061 struct polygon_count
0062 {
0063 template <typename Polygon>
0064 static inline std::size_t apply(Polygon const& poly)
0065 {
0066 std::size_t n = RangeCount::apply(exterior_ring(poly));
0067
0068 auto const& rings = interior_rings(poly);
0069 for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
0070 {
0071 n += RangeCount::apply(*it);
0072 }
0073
0074 return n;
0075 }
0076 };
0077
0078
0079 template <typename SingleCount>
0080 struct multi_count
0081 {
0082 template <typename MultiGeometry>
0083 static inline std::size_t apply(MultiGeometry const& multi)
0084 {
0085 std::size_t n = 0;
0086 for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
0087 {
0088 n += SingleCount::apply(*it);
0089 }
0090 return n;
0091 }
0092 };
0093
0094
0095 }}
0096 #endif
0097
0098 }}
0099
0100
0101 #endif