Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:17

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
0004 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
0005 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
0006 // Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
0007 
0008 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
0009 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
0010 
0011 // This file was modified by Oracle on 2016-2020.
0012 // Modifications copyright (c) 2016-2020 Oracle and/or its affiliates.
0013 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
0014 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0015 
0016 // Use, modification and distribution is subject to the Boost Software License,
0017 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0018 // http://www.boost.org/LICENSE_1_0.txt)
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 } // namespace detail
0059 #endif // DOXYGEN_NO_DETAIL
0060 
0061 }} // namespace boost::geometry
0062 
0063 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_CALCULATE_SUM_HPP