]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/geometries/concepts/polygon_concept.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / geometry / geometries / concepts / polygon_concept.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
4 // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
6
7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
9
10 // Use, modification and distribution is subject to the Boost Software License,
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
12 // http://www.boost.org/LICENSE_1_0.txt)
13
14 #ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POLYGON_CONCEPT_HPP
15 #define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POLYGON_CONCEPT_HPP
16
17 #include <boost/concept_check.hpp>
18 #include <boost/core/ignore_unused.hpp>
19 #include <boost/range/concepts.hpp>
20
21 #include <boost/geometry/core/access.hpp>
22 #include <boost/geometry/core/exterior_ring.hpp>
23 #include <boost/geometry/core/interior_rings.hpp>
24 #include <boost/geometry/core/point_type.hpp>
25 #include <boost/geometry/core/ring_type.hpp>
26
27 #include <boost/geometry/geometries/concepts/point_concept.hpp>
28 #include <boost/geometry/geometries/concepts/ring_concept.hpp>
29
30
31 namespace boost { namespace geometry { namespace concepts
32 {
33
34 /*!
35 \brief Checks polygon concept
36 \ingroup concepts
37 */
38 template <typename PolygonType>
39 class Polygon
40 {
41 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
42 typedef typename boost::remove_const<PolygonType>::type polygon_type;
43
44 typedef typename traits::ring_const_type<polygon_type>::type ring_const_type;
45 typedef typename traits::ring_mutable_type<polygon_type>::type ring_mutable_type;
46 typedef typename traits::interior_const_type<polygon_type>::type interior_const_type;
47 typedef typename traits::interior_mutable_type<polygon_type>::type interior_mutable_type;
48
49 typedef typename point_type<PolygonType>::type point_type;
50 typedef typename ring_type<PolygonType>::type ring_type;
51
52 BOOST_CONCEPT_ASSERT( (concepts::Point<point_type>) );
53 BOOST_CONCEPT_ASSERT( (concepts::Ring<ring_type>) );
54
55 //BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<interior_type>) );
56
57 struct checker
58 {
59 static inline void apply()
60 {
61 polygon_type* poly = 0;
62 polygon_type const* cpoly = poly;
63
64 ring_mutable_type e = traits::exterior_ring<PolygonType>::get(*poly);
65 interior_mutable_type i = traits::interior_rings<PolygonType>::get(*poly);
66 ring_const_type ce = traits::exterior_ring<PolygonType>::get(*cpoly);
67 interior_const_type ci = traits::interior_rings<PolygonType>::get(*cpoly);
68
69 boost::ignore_unused(poly, cpoly);
70 boost::ignore_unused(e, i, ce, ci);
71 }
72 };
73
74 public:
75
76 BOOST_CONCEPT_USAGE(Polygon)
77 {
78 checker::apply();
79 }
80 #endif
81 };
82
83
84 /*!
85 \brief Checks polygon concept (const version)
86 \ingroup const_concepts
87 */
88 template <typename PolygonType>
89 class ConstPolygon
90 {
91 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
92
93 typedef typename boost::remove_const<PolygonType>::type const_polygon_type;
94
95 typedef typename traits::ring_const_type<const_polygon_type>::type ring_const_type;
96 typedef typename traits::interior_const_type<const_polygon_type>::type interior_const_type;
97
98 typedef typename point_type<const_polygon_type>::type point_type;
99 typedef typename ring_type<const_polygon_type>::type ring_type;
100
101 BOOST_CONCEPT_ASSERT( (concepts::ConstPoint<point_type>) );
102 BOOST_CONCEPT_ASSERT( (concepts::ConstRing<ring_type>) );
103
104 ////BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<interior_type>) );
105
106 struct checker
107 {
108 static inline void apply()
109 {
110 const_polygon_type const* cpoly = 0;
111
112 ring_const_type ce = traits::exterior_ring<const_polygon_type>::get(*cpoly);
113 interior_const_type ci = traits::interior_rings<const_polygon_type>::get(*cpoly);
114
115 boost::ignore_unused(ce, ci, cpoly);
116 }
117 };
118
119 public:
120
121 BOOST_CONCEPT_USAGE(ConstPolygon)
122 {
123 checker::apply();
124 }
125 #endif
126 };
127
128 }}} // namespace boost::geometry::concepts
129
130 #endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POLYGON_CONCEPT_HPP