File indexing completed on 2025-01-18 09:35:27
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
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
0043
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
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
0093
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
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 }}}
0150
0151 #endif