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