Chris@102: // Boost.Geometry (aka GGL, Generic Geometry Library) Chris@102: Chris@102: // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. Chris@102: // Copyright (c) 2008-2014 Bruno Lalande, Paris, France. Chris@102: // Copyright (c) 2009-2014 Mateusz Loskot, London, UK. Chris@102: // Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland. Chris@102: Chris@102: // This file was modified by Oracle on 2014. Chris@102: // Modifications copyright (c) 2014, Oracle and/or its affiliates. Chris@102: Chris@102: // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle Chris@102: Chris@102: // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library Chris@102: // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. Chris@102: Chris@102: // Use, modification and distribution is subject to the Boost Software License, Chris@102: // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@102: // http://www.boost.org/LICENSE_1_0.txt) Chris@102: Chris@102: #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_COUNTING_HPP Chris@102: #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_COUNTING_HPP Chris@102: Chris@102: #include Chris@102: Chris@102: #include Chris@102: Chris@102: #include Chris@102: #include Chris@102: Chris@102: #include Chris@102: Chris@102: #include Chris@102: Chris@102: Chris@102: namespace boost { namespace geometry Chris@102: { Chris@102: Chris@102: Chris@102: #ifndef DOXYGEN_NO_DETAIL Chris@102: namespace detail { namespace counting Chris@102: { Chris@102: Chris@102: Chris@102: template Chris@102: struct other_count Chris@102: { Chris@102: template Chris@102: static inline std::size_t apply(Geometry const&) Chris@102: { Chris@102: return D; Chris@102: } Chris@102: Chris@102: template Chris@102: static inline std::size_t apply(Geometry const&, bool) Chris@102: { Chris@102: return D; Chris@102: } Chris@102: }; Chris@102: Chris@102: Chris@102: template Chris@102: struct polygon_count Chris@102: { Chris@102: template Chris@102: static inline std::size_t apply(Polygon const& poly) Chris@102: { Chris@102: std::size_t n = RangeCount::apply(exterior_ring(poly)); Chris@102: Chris@102: typename interior_return_type::type Chris@102: rings = interior_rings(poly); Chris@102: for (typename detail::interior_iterator::type Chris@102: it = boost::begin(rings); it != boost::end(rings); ++it) Chris@102: { Chris@102: n += RangeCount::apply(*it); Chris@102: } Chris@102: Chris@102: return n; Chris@102: } Chris@102: }; Chris@102: Chris@102: Chris@102: template Chris@102: struct multi_count Chris@102: { Chris@102: template Chris@102: static inline std::size_t apply(MultiGeometry const& geometry) Chris@102: { Chris@102: std::size_t n = 0; Chris@102: for (typename boost::range_iterator::type Chris@102: it = boost::begin(geometry); Chris@102: it != boost::end(geometry); Chris@102: ++it) Chris@102: { Chris@102: n += SingleCount::apply(*it); Chris@102: } Chris@102: return n; Chris@102: } Chris@102: }; Chris@102: Chris@102: Chris@102: }} // namespace detail::counting Chris@102: #endif // DOXYGEN_NO_DETAIL Chris@102: Chris@102: }} // namespace boost::geometry Chris@102: Chris@102: Chris@102: #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_COUNTING_HPP