Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2017-2017 Barend Gehrels, Amsterdam, the Netherlands.
0004 
0005 // This file was modified by Oracle on 2020.
0006 // Modifications copyright (c) 2020 Oracle and/or its affiliates.
0007 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0008 
0009 // Use, modification and distribution is subject to the Boost Software License,
0010 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0011 // http://www.boost.org/LICENSE_1_0.txt)
0012 
0013 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_NEEDS_SELF_TURNS_HPP
0014 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_NEEDS_SELF_TURNS_HPP
0015 
0016 #include <boost/range/begin.hpp>
0017 #include <boost/range/size.hpp>
0018 
0019 #include <boost/geometry/core/tags.hpp>
0020 #include <boost/geometry/algorithms/num_interior_rings.hpp>
0021 
0022 
0023 namespace boost { namespace geometry
0024 {
0025 
0026 
0027 #ifndef DOXYGEN_NO_DETAIL
0028 namespace detail { namespace overlay
0029 {
0030 
0031 template
0032 <
0033     typename Geometry,
0034     typename Tag = typename tag<Geometry>::type
0035 >
0036 struct needs_self_turns
0037 {
0038 };
0039 
0040 template <typename Geometry>
0041 struct needs_self_turns<Geometry, box_tag>
0042 {
0043     static inline bool apply(Geometry const&)
0044     {
0045         return false;
0046     }
0047 };
0048 
0049 template <typename Geometry>
0050 struct needs_self_turns<Geometry, ring_tag>
0051 {
0052     static inline bool apply(Geometry const&)
0053     {
0054         return false;
0055     }
0056 };
0057 
0058 template <typename Geometry>
0059 struct needs_self_turns<Geometry, polygon_tag>
0060 {
0061     static inline bool apply(Geometry const& polygon)
0062     {
0063         return geometry::num_interior_rings(polygon) > 0;
0064     }
0065 };
0066 
0067 template <typename Geometry>
0068 struct needs_self_turns<Geometry, multi_polygon_tag>
0069 {
0070     static inline bool apply(Geometry const& multi)
0071     {
0072         typedef typename boost::range_value<Geometry>::type polygon_type;
0073         std::size_t const n = boost::size(multi);
0074         return n > 1 || (n == 1
0075              && needs_self_turns<polygon_type>
0076                          ::apply(*boost::begin(multi)));
0077     }
0078 };
0079 
0080 
0081 }} // namespace detail::overlay
0082 #endif // DOXYGEN_NO_DETAIL
0083 
0084 
0085 }} // namespace boost::geometry
0086 
0087 
0088 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_NEEDS_SELF_TURNS_HPP