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
0020 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_CALCULATE_SUM_HPP
0021 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_CALCULATE_SUM_HPP
0022
0023 #include <boost/range/begin.hpp>
0024 #include <boost/range/end.hpp>
0025
0026 namespace boost { namespace geometry
0027 {
0028
0029 #ifndef DOXYGEN_NO_DETAIL
0030 namespace detail
0031 {
0032
0033
0034 class calculate_polygon_sum
0035 {
0036 template <typename ReturnType, typename Policy, typename Rings, typename Strategy>
0037 static inline ReturnType sum_interior_rings(Rings const& rings, Strategy const& strategy)
0038 {
0039 ReturnType sum = ReturnType(0);
0040 for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
0041 {
0042 sum += Policy::apply(*it, strategy);
0043 }
0044 return sum;
0045 }
0046
0047 public :
0048 template <typename ReturnType, typename Policy, typename Polygon, typename Strategy>
0049 static inline ReturnType apply(Polygon const& poly, Strategy const& strategy)
0050 {
0051 return Policy::apply(exterior_ring(poly), strategy)
0052 + sum_interior_rings<ReturnType, Policy>(interior_rings(poly), strategy)
0053 ;
0054 }
0055 };
0056
0057
0058 }
0059 #endif
0060
0061 }}
0062
0063 #endif