1 // Boost.Geometry (aka GGL, Generic Geometry Library)
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.
7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
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)
14 #ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POLYGON_CONCEPT_HPP
15 #define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POLYGON_CONCEPT_HPP
17 #include <boost/concept_check.hpp>
18 #include <boost/range/concepts.hpp>
20 #include <boost/geometry/core/access.hpp>
21 #include <boost/geometry/core/exterior_ring.hpp>
22 #include <boost/geometry/core/interior_rings.hpp>
23 #include <boost/geometry/core/point_type.hpp>
24 #include <boost/geometry/core/ring_type.hpp>
26 #include <boost/geometry/geometries/concepts/point_concept.hpp>
27 #include <boost/geometry/geometries/concepts/ring_concept.hpp>
30 namespace boost { namespace geometry { namespace concepts
34 \brief Checks polygon concept
37 template <typename PolygonType>
40 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
41 typedef typename boost::remove_const<PolygonType>::type polygon_type;
43 typedef typename traits::ring_const_type<polygon_type>::type ring_const_type;
44 typedef typename traits::ring_mutable_type<polygon_type>::type ring_mutable_type;
45 typedef typename traits::interior_const_type<polygon_type>::type interior_const_type;
46 typedef typename traits::interior_mutable_type<polygon_type>::type interior_mutable_type;
48 typedef typename point_type<PolygonType>::type point_type;
49 typedef typename ring_type<PolygonType>::type ring_type;
51 BOOST_CONCEPT_ASSERT( (concepts::Point<point_type>) );
52 BOOST_CONCEPT_ASSERT( (concepts::Ring<ring_type>) );
54 //BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<interior_type>) );
58 static inline void apply()
60 polygon_type* poly = 0;
61 polygon_type const* cpoly = poly;
63 ring_mutable_type e = traits::exterior_ring<PolygonType>::get(*poly);
64 interior_mutable_type i = traits::interior_rings<PolygonType>::get(*poly);
65 ring_const_type ce = traits::exterior_ring<PolygonType>::get(*cpoly);
66 interior_const_type ci = traits::interior_rings<PolygonType>::get(*cpoly);
68 boost::ignore_unused_variable_warning(e);
69 boost::ignore_unused_variable_warning(i);
70 boost::ignore_unused_variable_warning(ce);
71 boost::ignore_unused_variable_warning(ci);
72 boost::ignore_unused_variable_warning(poly);
73 boost::ignore_unused_variable_warning(cpoly);
79 BOOST_CONCEPT_USAGE(Polygon)
88 \brief Checks polygon concept (const version)
89 \ingroup const_concepts
91 template <typename PolygonType>
94 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
96 typedef typename boost::remove_const<PolygonType>::type const_polygon_type;
98 typedef typename traits::ring_const_type<const_polygon_type>::type ring_const_type;
99 typedef typename traits::interior_const_type<const_polygon_type>::type interior_const_type;
101 typedef typename point_type<const_polygon_type>::type point_type;
102 typedef typename ring_type<const_polygon_type>::type ring_type;
104 BOOST_CONCEPT_ASSERT( (concepts::ConstPoint<point_type>) );
105 BOOST_CONCEPT_ASSERT( (concepts::ConstRing<ring_type>) );
107 ////BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<interior_type>) );
111 static inline void apply()
113 const_polygon_type const* cpoly = 0;
115 ring_const_type ce = traits::exterior_ring<const_polygon_type>::get(*cpoly);
116 interior_const_type ci = traits::interior_rings<const_polygon_type>::get(*cpoly);
118 boost::ignore_unused_variable_warning(ce);
119 boost::ignore_unused_variable_warning(ci);
120 boost::ignore_unused_variable_warning(cpoly);
126 BOOST_CONCEPT_USAGE(ConstPolygon)
133 }}} // namespace boost::geometry::concepts
135 #endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POLYGON_CONCEPT_HPP