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/core/ignore_unused.hpp>
19 #include <boost/range/concepts.hpp>
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>
27 #include <boost/geometry/geometries/concepts/point_concept.hpp>
28 #include <boost/geometry/geometries/concepts/ring_concept.hpp>
31 namespace boost { namespace geometry { namespace concepts
35 \brief Checks polygon concept
38 template <typename PolygonType>
41 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
42 typedef typename boost::remove_const<PolygonType>::type polygon_type;
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;
49 typedef typename point_type<PolygonType>::type point_type;
50 typedef typename ring_type<PolygonType>::type ring_type;
52 BOOST_CONCEPT_ASSERT( (concepts::Point<point_type>) );
53 BOOST_CONCEPT_ASSERT( (concepts::Ring<ring_type>) );
55 //BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<interior_type>) );
59 static inline void apply()
61 polygon_type* poly = 0;
62 polygon_type const* cpoly = poly;
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);
69 boost::ignore_unused(poly, cpoly);
70 boost::ignore_unused(e, i, ce, ci);
76 BOOST_CONCEPT_USAGE(Polygon)
85 \brief Checks polygon concept (const version)
86 \ingroup const_concepts
88 template <typename PolygonType>
91 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
93 typedef typename boost::remove_const<PolygonType>::type const_polygon_type;
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;
98 typedef typename point_type<const_polygon_type>::type point_type;
99 typedef typename ring_type<const_polygon_type>::type ring_type;
101 BOOST_CONCEPT_ASSERT( (concepts::ConstPoint<point_type>) );
102 BOOST_CONCEPT_ASSERT( (concepts::ConstRing<ring_type>) );
104 ////BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<interior_type>) );
108 static inline void apply()
110 const_polygon_type const* cpoly = 0;
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);
115 boost::ignore_unused(ce, ci, cpoly);
121 BOOST_CONCEPT_USAGE(ConstPolygon)
128 }}} // namespace boost::geometry::concepts
130 #endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POLYGON_CONCEPT_HPP