Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 09:50:23

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
0004 // Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
0005 // Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
0006 // Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
0007 
0008 // This file was modified by Oracle on 2014-2020.
0009 // Modifications copyright (c) 2014-2020, Oracle and/or its affiliates.
0010 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
0011 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0012 
0013 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
0014 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
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_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 }} // namespace detail::counting
0096 #endif // DOXYGEN_NO_DETAIL
0097 
0098 }} // namespace boost::geometry
0099 
0100 
0101 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_COUNTING_HPP