1 // Boost.Geometry (aka GGL, Generic Geometry Library)
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 // Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
8 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
9 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
11 // Use, modification and distribution is subject to the Boost Software License,
12 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
13 // http://www.boost.org/LICENSE_1_0.txt)
15 #ifndef BOOST_GEOMETRY_GEOMETRIES_MULTI_POLYGON_HPP
16 #define BOOST_GEOMETRY_GEOMETRIES_MULTI_POLYGON_HPP
21 #include <boost/concept/requires.hpp>
23 #include <boost/geometry/core/tags.hpp>
24 #include <boost/geometry/geometries/concepts/polygon_concept.hpp>
26 #include <boost/config.hpp>
27 #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
28 #include <initializer_list>
31 namespace boost { namespace geometry
38 \brief multi_polygon, a collection of polygons
39 \details Multi-polygon can be used to group polygons belonging to each other,
43 \qbk{[include reference/geometries/multi_polygon.qbk]}
46 [link geometry.reference.concepts.concept_multi_polygon MultiPolygon Concept]
52 template<typename, typename> class Container = std::vector,
53 template<typename> class Allocator = std::allocator
55 class multi_polygon : public Container<Polygon, Allocator<Polygon> >
57 BOOST_CONCEPT_ASSERT( (concepts::Polygon<Polygon>) );
59 #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
61 // default constructor and base_type definitions are required only
62 // if the constructor taking std::initializer_list is defined
64 typedef Container<Polygon, Allocator<Polygon> > base_type;
67 /// \constructor_default{multi_polygon}
72 /// \constructor_initializer_list{multi_polygon}
73 inline multi_polygon(std::initializer_list<Polygon> l)
74 : base_type(l.begin(), l.end())
77 // Commented out for now in order to support Boost.Assign
78 // Without this assignment operator first the object should be created
79 // from initializer list, then it shoudl be moved.
80 //// Without this workaround in MSVC the assignment operator is ambiguous
82 // /// \assignment_initializer_list{multi_polygon}
83 // inline multi_polygon & operator=(std::initializer_list<Polygon> l)
85 // base_type::assign(l.begin(), l.end());
97 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
104 template<typename, typename> class Container,
105 template<typename> class Allocator
107 struct tag< model::multi_polygon<Polygon, Container, Allocator> >
109 typedef multi_polygon_tag type;
112 } // namespace traits
113 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
115 }} // namespace boost::geometry
117 #endif // BOOST_GEOMETRY_GEOMETRIES_MULTI_POLYGON_HPP