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