Chris@102
|
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
|
Chris@102
|
2
|
Chris@102
|
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
Chris@102
|
4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
Chris@102
|
5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
Chris@102
|
6 // Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
|
Chris@102
|
7
|
Chris@102
|
8 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
|
Chris@102
|
9 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
|
Chris@102
|
10
|
Chris@102
|
11 // Use, modification and distribution is subject to the Boost Software License,
|
Chris@102
|
12 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@102
|
13 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@102
|
14
|
Chris@102
|
15 #ifndef BOOST_GEOMETRY_GEOMETRIES_MULTI_POLYGON_HPP
|
Chris@102
|
16 #define BOOST_GEOMETRY_GEOMETRIES_MULTI_POLYGON_HPP
|
Chris@102
|
17
|
Chris@102
|
18 #include <memory>
|
Chris@102
|
19 #include <vector>
|
Chris@102
|
20
|
Chris@102
|
21 #include <boost/concept/requires.hpp>
|
Chris@102
|
22
|
Chris@102
|
23 #include <boost/geometry/core/tags.hpp>
|
Chris@102
|
24 #include <boost/geometry/geometries/concepts/polygon_concept.hpp>
|
Chris@102
|
25
|
Chris@102
|
26 #ifdef BOOST_GEOMETRY_EXPERIMENTAL_ENABLE_INITIALIZER_LIST
|
Chris@102
|
27 #include <boost/config.hpp>
|
Chris@102
|
28 #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
Chris@102
|
29 #include <initializer_list>
|
Chris@102
|
30 #endif
|
Chris@102
|
31 #endif
|
Chris@102
|
32
|
Chris@102
|
33 namespace boost { namespace geometry
|
Chris@102
|
34 {
|
Chris@102
|
35
|
Chris@102
|
36 namespace model
|
Chris@102
|
37 {
|
Chris@102
|
38
|
Chris@102
|
39 /*!
|
Chris@102
|
40 \brief multi_polygon, a collection of polygons
|
Chris@102
|
41 \details Multi-polygon can be used to group polygons belonging to each other,
|
Chris@102
|
42 e.g. Hawaii
|
Chris@102
|
43 \ingroup geometries
|
Chris@102
|
44
|
Chris@102
|
45 \qbk{before.synopsis,
|
Chris@102
|
46 [heading Model of]
|
Chris@102
|
47 [link geometry.reference.concepts.concept_multi_polygon MultiPolygon Concept]
|
Chris@102
|
48 }
|
Chris@102
|
49 */
|
Chris@102
|
50 template
|
Chris@102
|
51 <
|
Chris@102
|
52 typename Polygon,
|
Chris@102
|
53 template<typename, typename> class Container = std::vector,
|
Chris@102
|
54 template<typename> class Allocator = std::allocator
|
Chris@102
|
55 >
|
Chris@102
|
56 class multi_polygon : public Container<Polygon, Allocator<Polygon> >
|
Chris@102
|
57 {
|
Chris@102
|
58 BOOST_CONCEPT_ASSERT( (concept::Polygon<Polygon>) );
|
Chris@102
|
59
|
Chris@102
|
60 #ifdef BOOST_GEOMETRY_EXPERIMENTAL_ENABLE_INITIALIZER_LIST
|
Chris@102
|
61
|
Chris@102
|
62 typedef Container<Polygon, Allocator<Polygon> > base_type;
|
Chris@102
|
63
|
Chris@102
|
64 public:
|
Chris@102
|
65 /// \constructor_default{multi_polygon}
|
Chris@102
|
66 multi_polygon()
|
Chris@102
|
67 : base_type()
|
Chris@102
|
68 {}
|
Chris@102
|
69
|
Chris@102
|
70 #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
Chris@102
|
71
|
Chris@102
|
72 /// \constructor_initializer_list{multi_polygon}
|
Chris@102
|
73 inline multi_polygon(std::initializer_list<Polygon> l)
|
Chris@102
|
74 : base_type(l.begin(), l.end())
|
Chris@102
|
75 {}
|
Chris@102
|
76
|
Chris@102
|
77 // Commented out for now in order to support Boost.Assign
|
Chris@102
|
78 // Without this assignment operator first the object should be created
|
Chris@102
|
79 // from initializer list, then it shoudl be moved.
|
Chris@102
|
80 //// Without this workaround in MSVC the assignment operator is ambiguous
|
Chris@102
|
81 //#ifndef BOOST_MSVC
|
Chris@102
|
82 // /// \assignment_initializer_list{multi_polygon}
|
Chris@102
|
83 // inline multi_polygon & operator=(std::initializer_list<Polygon> l)
|
Chris@102
|
84 // {
|
Chris@102
|
85 // base_type::assign(l.begin(), l.end());
|
Chris@102
|
86 // return *this;
|
Chris@102
|
87 // }
|
Chris@102
|
88 //#endif
|
Chris@102
|
89
|
Chris@102
|
90 #endif
|
Chris@102
|
91 #endif
|
Chris@102
|
92 };
|
Chris@102
|
93
|
Chris@102
|
94
|
Chris@102
|
95 } // namespace model
|
Chris@102
|
96
|
Chris@102
|
97
|
Chris@102
|
98 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
|
Chris@102
|
99 namespace traits
|
Chris@102
|
100 {
|
Chris@102
|
101
|
Chris@102
|
102 template
|
Chris@102
|
103 <
|
Chris@102
|
104 typename Polygon,
|
Chris@102
|
105 template<typename, typename> class Container,
|
Chris@102
|
106 template<typename> class Allocator
|
Chris@102
|
107 >
|
Chris@102
|
108 struct tag< model::multi_polygon<Polygon, Container, Allocator> >
|
Chris@102
|
109 {
|
Chris@102
|
110 typedef multi_polygon_tag type;
|
Chris@102
|
111 };
|
Chris@102
|
112
|
Chris@102
|
113 } // namespace traits
|
Chris@102
|
114 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
|
Chris@102
|
115
|
Chris@102
|
116 }} // namespace boost::geometry
|
Chris@102
|
117
|
Chris@102
|
118 #endif // BOOST_GEOMETRY_GEOMETRIES_MULTI_POLYGON_HPP
|