Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:50:10

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 
0007 // This file was modified by Oracle on 2020-2023.
0008 // Modifications copyright (c) 2020-2023, Oracle and/or its affiliates.
0009 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
0010 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0011 
0012 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
0013 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
0014 
0015 // Use, modification and distribution is subject to the Boost Software License,
0016 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0017 // http://www.boost.org/LICENSE_1_0.txt)
0018 
0019 #ifndef BOOST_GEOMETRY_CORE_INTERIOR_RINGS_HPP
0020 #define BOOST_GEOMETRY_CORE_INTERIOR_RINGS_HPP
0021 
0022 #include <type_traits>
0023 
0024 #include <boost/range/value_type.hpp>
0025 
0026 #include <boost/geometry/core/interior_type.hpp>
0027 #include <boost/geometry/core/static_assert.hpp>
0028 #include <boost/geometry/core/tag.hpp>
0029 #include <boost/geometry/core/tags.hpp>
0030 
0031 namespace boost { namespace geometry
0032 {
0033 
0034 namespace traits
0035 {
0036 
0037 
0038 /*!
0039     \brief Traits class defining access to interior_rings of a polygon
0040     \details defines access (const and non const) to interior ring
0041     \ingroup traits
0042     \par Geometries:
0043         - polygon
0044     \par Specializations should provide:
0045         - static inline INTERIOR& get(POLY&)
0046         - static inline const INTERIOR& get(POLY const&)
0047     \tparam Geometry geometry
0048 */
0049 template <typename Geometry>
0050 struct interior_rings
0051 {
0052     BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
0053         "Not implemented for this Geometry type.",
0054         Geometry);
0055 };
0056 
0057 
0058 } // namespace traits
0059 
0060 
0061 
0062 
0063 #ifndef DOXYGEN_NO_DISPATCH
0064 namespace core_dispatch
0065 {
0066 
0067 template
0068 <
0069     typename GeometryTag,
0070     typename Geometry
0071 >
0072 struct interior_rings {};
0073 
0074 
0075 template <typename Polygon>
0076 struct interior_rings<polygon_tag, Polygon>
0077 {
0078     static inline
0079     typename geometry::interior_return_type<Polygon>::type
0080                 apply(Polygon& polygon)
0081     {
0082         return traits::interior_rings
0083             <
0084                 typename std::remove_const<Polygon>::type
0085             >::get(polygon);
0086     }
0087 };
0088 
0089 
0090 template <typename MultiPolygon>
0091 struct interior_type<multi_polygon_tag, MultiPolygon>
0092 {
0093     using type = typename core_dispatch::interior_type
0094         <
0095             polygon_tag,
0096             typename boost::range_value<MultiPolygon>::type
0097         >::type;
0098 };
0099 
0100 
0101 } // namespace core_dispatch
0102 #endif
0103 
0104 
0105 
0106 /*!
0107 \brief Function to get the interior rings of a polygon (non const version)
0108 \ingroup interior_rings
0109 \note OGC compliance: instead of InteriorRingN
0110 \tparam Polygon polygon type
0111 \param polygon the polygon to get the interior rings from
0112 \return the interior rings (possibly a reference)
0113 */
0114 
0115 template <typename Polygon>
0116 inline interior_return_type_t<Polygon> interior_rings(Polygon& polygon)
0117 {
0118     return core_dispatch::interior_rings
0119         <
0120             tag_t<Polygon>,
0121             Polygon
0122         >::apply(polygon);
0123 }
0124 
0125 
0126 /*!
0127 \brief Function to get the interior rings of a polygon (const version)
0128 \ingroup interior_rings
0129 \note OGC compliance: instead of InteriorRingN
0130 \tparam Polygon polygon type
0131 \param polygon the polygon to get the interior rings from
0132 \return the interior rings (possibly a const reference)
0133 
0134 \qbk{distinguish,const version}
0135 */
0136 template <typename Polygon>
0137 inline interior_return_type_t<Polygon const> interior_rings(Polygon const& polygon)
0138 {
0139     return core_dispatch::interior_rings
0140         <
0141             tag_t<Polygon>,
0142             Polygon const
0143         >::apply(polygon);
0144 }
0145 
0146 
0147 
0148 }} // namespace boost::geometry
0149 
0150 
0151 #endif // BOOST_GEOMETRY_CORE_INTERIOR_RINGS_HPP