]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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 | // Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland. | |
7 | ||
8 | // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library | |
9 | // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. | |
10 | ||
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) | |
14 | ||
15 | #ifndef BOOST_GEOMETRY_GEOMETRIES_MULTI_POLYGON_HPP | |
16 | #define BOOST_GEOMETRY_GEOMETRIES_MULTI_POLYGON_HPP | |
17 | ||
18 | #include <memory> | |
19 | #include <vector> | |
20 | ||
21 | #include <boost/concept/requires.hpp> | |
22 | ||
23 | #include <boost/geometry/core/tags.hpp> | |
24 | #include <boost/geometry/geometries/concepts/polygon_concept.hpp> | |
25 | ||
26 | #include <boost/config.hpp> | |
27 | #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST | |
28 | #include <initializer_list> | |
29 | #endif | |
30 | ||
31 | namespace boost { namespace geometry | |
32 | { | |
33 | ||
34 | namespace model | |
35 | { | |
36 | ||
37 | /*! | |
38 | \brief multi_polygon, a collection of polygons | |
39 | \details Multi-polygon can be used to group polygons belonging to each other, | |
40 | e.g. Hawaii | |
41 | \ingroup geometries | |
42 | ||
43 | \qbk{[include reference/geometries/multi_polygon.qbk]} | |
44 | \qbk{before.synopsis, | |
45 | [heading Model of] | |
46 | [link geometry.reference.concepts.concept_multi_polygon MultiPolygon Concept] | |
47 | } | |
48 | */ | |
49 | template | |
50 | < | |
51 | typename Polygon, | |
52 | template<typename, typename> class Container = std::vector, | |
53 | template<typename> class Allocator = std::allocator | |
54 | > | |
55 | class multi_polygon : public Container<Polygon, Allocator<Polygon> > | |
56 | { | |
57 | BOOST_CONCEPT_ASSERT( (concepts::Polygon<Polygon>) ); | |
58 | ||
59 | #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST | |
60 | ||
61 | // default constructor and base_type definitions are required only | |
62 | // if the constructor taking std::initializer_list is defined | |
63 | ||
64 | typedef Container<Polygon, Allocator<Polygon> > base_type; | |
65 | ||
66 | public: | |
67 | /// \constructor_default{multi_polygon} | |
68 | multi_polygon() | |
69 | : base_type() | |
70 | {} | |
71 | ||
72 | /// \constructor_initializer_list{multi_polygon} | |
73 | inline multi_polygon(std::initializer_list<Polygon> l) | |
74 | : base_type(l.begin(), l.end()) | |
75 | {} | |
76 | ||
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 | |
81 | //#ifndef BOOST_MSVC | |
82 | // /// \assignment_initializer_list{multi_polygon} | |
83 | // inline multi_polygon & operator=(std::initializer_list<Polygon> l) | |
84 | // { | |
85 | // base_type::assign(l.begin(), l.end()); | |
86 | // return *this; | |
87 | // } | |
88 | //#endif | |
89 | ||
90 | #endif | |
91 | }; | |
92 | ||
93 | ||
94 | } // namespace model | |
95 | ||
96 | ||
97 | #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS | |
98 | namespace traits | |
99 | { | |
100 | ||
101 | template | |
102 | < | |
103 | typename Polygon, | |
104 | template<typename, typename> class Container, | |
105 | template<typename> class Allocator | |
106 | > | |
107 | struct tag< model::multi_polygon<Polygon, Container, Allocator> > | |
108 | { | |
109 | typedef multi_polygon_tag type; | |
110 | }; | |
111 | ||
112 | } // namespace traits | |
113 | #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS | |
114 | ||
115 | }} // namespace boost::geometry | |
116 | ||
117 | #endif // BOOST_GEOMETRY_GEOMETRIES_MULTI_POLYGON_HPP |