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