123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_CALCULATE_SUM_HPP
- #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_CALCULATE_SUM_HPP
- #include <boost/range/begin.hpp>
- #include <boost/range/end.hpp>
- namespace boost { namespace geometry
- {
- #ifndef DOXYGEN_NO_DETAIL
- namespace detail
- {
- class calculate_polygon_sum
- {
- template <typename ReturnType, typename Policy, typename Rings, typename Strategy>
- static inline ReturnType sum_interior_rings(Rings const& rings, Strategy const& strategy)
- {
- ReturnType sum = ReturnType(0);
- for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
- {
- sum += Policy::apply(*it, strategy);
- }
- return sum;
- }
- public :
- template <typename ReturnType, typename Policy, typename Polygon, typename Strategy>
- static inline ReturnType apply(Polygon const& poly, Strategy const& strategy)
- {
- return Policy::apply(exterior_ring(poly), strategy)
- + sum_interior_rings<ReturnType, Policy>(interior_rings(poly), strategy)
- ;
- }
- };
- }
- #endif
- }}
- #endif
|