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_LINESTRING_HPP |
16 | #define BOOST_GEOMETRY_GEOMETRIES_MULTI_LINESTRING_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/linestring_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 | |
35 | namespace model |
36 | { |
37 | |
38 | /*! |
39 | \brief multi_line, a collection of linestring |
40 | \details Multi-linestring can be used to group lines belonging to each other, |
41 | e.g. a highway (with interruptions) |
42 | \ingroup geometries |
43 | |
44 | \qbk{[include reference/geometries/multi_linestring.qbk]} |
45 | \qbk{before.synopsis, |
46 | [heading Model of] |
47 | [link geometry.reference.concepts.concept_multi_linestring MultiLineString Concept] |
48 | } |
49 | */ |
50 | template |
51 | < |
52 | typename LineString, |
53 | template<typename, typename> class Container = std::vector, |
54 | template<typename> class Allocator = std::allocator |
55 | > |
56 | class multi_linestring : public Container<LineString, Allocator<LineString> > |
57 | { |
58 | BOOST_CONCEPT_ASSERT( (concept::Linestring<LineString>) ); |
59 | |
60 | #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST |
61 | |
62 | // default constructor and base_type definitions are required only |
63 | // if the constructor taking std::initializer_list is defined |
64 | |
65 | typedef Container<LineString, Allocator<LineString> > base_type; |
66 | |
67 | public: |
68 | /// \constructor_default{multi_linestring} |
69 | multi_linestring() |
70 | : base_type() |
71 | {} |
72 | |
73 | /// \constructor_initializer_list{multi_linestring} |
74 | inline multi_linestring(std::initializer_list<LineString> l) |
75 | : base_type(l.begin(), l.end()) |
76 | {} |
77 | |
78 | // Commented out for now in order to support Boost.Assign |
79 | // Without this assignment operator first the object should be created |
80 | // from initializer list, then it shoudl be moved. |
81 | //// Without this workaround in MSVC the assignment operator is ambiguous |
82 | //#ifndef BOOST_MSVC |
83 | // /// \assignment_initializer_list{multi_linestring} |
84 | // inline multi_linestring & operator=(std::initializer_list<LineString> l) |
85 | // { |
86 | // base_type::assign(l.begin(), l.end()); |
87 | // return *this; |
88 | // } |
89 | //#endif |
90 | |
91 | #endif |
92 | }; |
93 | |
94 | |
95 | } // namespace model |
96 | |
97 | |
98 | #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS |
99 | namespace traits |
100 | { |
101 | |
102 | template |
103 | < |
104 | typename LineString, |
105 | template<typename, typename> class Container, |
106 | template<typename> class Allocator |
107 | > |
108 | struct tag< model::multi_linestring<LineString, Container, Allocator> > |
109 | { |
110 | typedef multi_linestring_tag type; |
111 | }; |
112 | |
113 | } // namespace traits |
114 | #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS |
115 | |
116 | |
117 | }} // namespace boost::geometry |
118 | |
119 | #endif // BOOST_GEOMETRY_GEOMETRIES_MULTI_LINESTRING_HPP |
120 | |