Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
0004 // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
0005 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
0006 
0007 // This file was modified by Oracle on 2020-2021.
0008 // Modifications copyright (c) 2020-2021, 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 #ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POLYGON_CONCEPT_HPP
0019 #define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POLYGON_CONCEPT_HPP
0020 
0021 #include <type_traits>
0022 
0023 #include <boost/concept_check.hpp>
0024 #include <boost/core/ignore_unused.hpp>
0025 #include <boost/range/concepts.hpp>
0026 
0027 #include <boost/geometry/core/access.hpp>
0028 #include <boost/geometry/core/exterior_ring.hpp>
0029 #include <boost/geometry/core/interior_rings.hpp>
0030 #include <boost/geometry/core/point_type.hpp>
0031 #include <boost/geometry/core/ring_type.hpp>
0032 
0033 #include <boost/geometry/geometries/concepts/concept_type.hpp>
0034 #include <boost/geometry/geometries/concepts/point_concept.hpp>
0035 #include <boost/geometry/geometries/concepts/ring_concept.hpp>
0036 
0037 
0038 namespace boost { namespace geometry { namespace concepts
0039 {
0040 
0041 /*!
0042 \brief Checks polygon concept
0043 \ingroup concepts
0044 */
0045 template <typename PolygonType>
0046 class Polygon
0047 {
0048 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
0049     typedef typename std::remove_const<PolygonType>::type polygon_type;
0050 
0051     typedef typename traits::ring_const_type<polygon_type>::type ring_const_type;
0052     typedef typename traits::ring_mutable_type<polygon_type>::type ring_mutable_type;
0053     typedef typename traits::interior_const_type<polygon_type>::type interior_const_type;
0054     typedef typename traits::interior_mutable_type<polygon_type>::type interior_mutable_type;
0055 
0056     typedef typename point_type<PolygonType>::type point_type;
0057     typedef typename ring_type<PolygonType>::type ring_type;
0058 
0059     BOOST_CONCEPT_ASSERT( (concepts::Point<point_type>) );
0060     BOOST_CONCEPT_ASSERT( (concepts::Ring<ring_type>) );
0061 
0062     //BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<interior_type>) );
0063 
0064     struct checker
0065     {
0066         static inline void apply()
0067         {
0068             polygon_type* poly = 0;
0069             polygon_type const* cpoly = poly;
0070 
0071             ring_mutable_type e = traits::exterior_ring<PolygonType>::get(*poly);
0072             interior_mutable_type i = traits::interior_rings<PolygonType>::get(*poly);
0073             ring_const_type ce = traits::exterior_ring<PolygonType>::get(*cpoly);
0074             interior_const_type ci = traits::interior_rings<PolygonType>::get(*cpoly);
0075 
0076             boost::ignore_unused(poly, cpoly);
0077             boost::ignore_unused(e, i, ce, ci);
0078         }
0079     };
0080 
0081 public:
0082 
0083     BOOST_CONCEPT_USAGE(Polygon)
0084     {
0085         checker::apply();
0086     }
0087 #endif
0088 };
0089 
0090 
0091 /*!
0092 \brief Checks polygon concept (const version)
0093 \ingroup const_concepts
0094 */
0095 template <typename PolygonType>
0096 class ConstPolygon
0097 {
0098 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
0099 
0100     typedef typename std::remove_const<PolygonType>::type const_polygon_type;
0101 
0102     typedef typename traits::ring_const_type<const_polygon_type>::type ring_const_type;
0103     typedef typename traits::interior_const_type<const_polygon_type>::type interior_const_type;
0104 
0105     typedef typename point_type<const_polygon_type>::type point_type;
0106     typedef typename ring_type<const_polygon_type>::type ring_type;
0107 
0108     BOOST_CONCEPT_ASSERT( (concepts::ConstPoint<point_type>) );
0109     BOOST_CONCEPT_ASSERT( (concepts::ConstRing<ring_type>) );
0110 
0111     ////BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<interior_type>) );
0112 
0113     struct checker
0114     {
0115         static inline void apply()
0116         {
0117             const_polygon_type const* cpoly = 0;
0118 
0119             ring_const_type ce = traits::exterior_ring<const_polygon_type>::get(*cpoly);
0120             interior_const_type ci = traits::interior_rings<const_polygon_type>::get(*cpoly);
0121 
0122             boost::ignore_unused(ce, ci, cpoly);
0123         }
0124     };
0125 
0126 public:
0127 
0128     BOOST_CONCEPT_USAGE(ConstPolygon)
0129     {
0130         checker::apply();
0131     }
0132 #endif
0133 };
0134 
0135 
0136 template <typename Geometry>
0137 struct concept_type<Geometry, polygon_tag>
0138 {
0139     using type = Polygon<Geometry>;
0140 };
0141 
0142 template <typename Geometry>
0143 struct concept_type<Geometry const, polygon_tag>
0144 {
0145     using type = ConstPolygon<Geometry>;
0146 };
0147 
0148 
0149 }}} // namespace boost::geometry::concepts
0150 
0151 #endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POLYGON_CONCEPT_HPP