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/range/concepts.hpp>
19
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>
25
26#include <boost/geometry/geometries/concepts/point_concept.hpp>
27#include <boost/geometry/geometries/concepts/ring_concept.hpp>
28
29
30namespace boost { namespace geometry { namespace concept
31{
32
33/*!
34\brief Checks polygon concept
35\ingroup concepts
36*/
37template <typename PolygonType>
38class Polygon
39{
40#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
41 typedef typename boost::remove_const<PolygonType>::type polygon_type;
42
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;
47
48 typedef typename point_type<PolygonType>::type point_type;
49 typedef typename ring_type<PolygonType>::type ring_type;
50
51 BOOST_CONCEPT_ASSERT( (concept::Point<point_type>) );
52 BOOST_CONCEPT_ASSERT( (concept::Ring<ring_type>) );
53
54 //BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<interior_type>) );
55
56 struct checker
57 {
58 static inline void apply()
59 {
60 polygon_type* poly = 0;
61 polygon_type const* cpoly = poly;
62
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);
67
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);
74 }
75 };
76
77public:
78
79 BOOST_CONCEPT_USAGE(Polygon)
80 {
81 checker::apply();
82 }
83#endif
84};
85
86
87/*!
88\brief Checks polygon concept (const version)
89\ingroup const_concepts
90*/
91template <typename PolygonType>
92class ConstPolygon
93{
94#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
95
96 typedef typename boost::remove_const<PolygonType>::type const_polygon_type;
97
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;
100
101 typedef typename point_type<const_polygon_type>::type point_type;
102 typedef typename ring_type<const_polygon_type>::type ring_type;
103
104 BOOST_CONCEPT_ASSERT( (concept::ConstPoint<point_type>) );
105 BOOST_CONCEPT_ASSERT( (concept::ConstRing<ring_type>) );
106
107 ////BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<interior_type>) );
108
109 struct checker
110 {
111 static inline void apply()
112 {
113 const_polygon_type const* cpoly = 0;
114
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);
117
118 boost::ignore_unused_variable_warning(ce);
119 boost::ignore_unused_variable_warning(ci);
120 boost::ignore_unused_variable_warning(cpoly);
121 }
122 };
123
124public:
125
126 BOOST_CONCEPT_USAGE(ConstPolygon)
127 {
128 checker::apply();
129 }
130#endif
131};
132
133}}} // namespace boost::geometry::concept
134
135#endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POLYGON_CONCEPT_HPP
136

source code of boost/boost/geometry/geometries/concepts/polygon_concept.hpp