1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
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 
15 #ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_POLYGON_CONCEPT_HPP
16 #define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_POLYGON_CONCEPT_HPP
17 
18 
19 #include <boost/concept_check.hpp>
20 #include <boost/range/concepts.hpp>
21 #include <boost/range/metafunctions.hpp>
22 
23 #include <boost/geometry/geometries/concepts/polygon_concept.hpp>
24 
25 
26 namespace boost { namespace geometry { namespace concepts
27 {
28 
29 
30 /*!
31 \brief multi-polygon concept
32 \ingroup concepts
33 \par Formal definition:
34 The multi polygon concept is defined as following:
35 - there must be a specialization of traits::tag defining multi_polygon_tag
36   as type
37 - it must behave like a Boost.Range
38 - its range value must fulfil the Polygon concept
39 
40 */
41 template <typename Geometry>
42 class MultiPolygon
43 {
44 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
45     typedef typename boost::range_value<Geometry>::type polygon_type;
46 
47     BOOST_CONCEPT_ASSERT( (concepts::Polygon<polygon_type>) );
48     BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
49 
50 
51 public :
52 
BOOST_CONCEPT_USAGE(MultiPolygon)53     BOOST_CONCEPT_USAGE(MultiPolygon)
54     {
55         Geometry* mp = 0;
56         traits::clear<Geometry>::apply(*mp);
57         traits::resize<Geometry>::apply(*mp, 0);
58         polygon_type* poly = 0;
59         traits::push_back<Geometry>::apply(*mp, *poly);
60     }
61 #endif
62 };
63 
64 
65 /*!
66 \brief concept for multi-polygon (const version)
67 \ingroup const_concepts
68 */
69 template <typename Geometry>
70 class ConstMultiPolygon
71 {
72 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
73     typedef typename boost::range_value<Geometry>::type polygon_type;
74 
75     BOOST_CONCEPT_ASSERT( (concepts::ConstPolygon<polygon_type>) );
76     BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
77 
78 
79 public :
80 
BOOST_CONCEPT_USAGE(ConstMultiPolygon)81     BOOST_CONCEPT_USAGE(ConstMultiPolygon)
82     {
83     }
84 #endif
85 };
86 
87 
88 }}} // namespace boost::geometry::concepts
89 
90 
91 #endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_POLYGON_CONCEPT_HPP
92