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_LINESTRING_HPP
16 #define BOOST_GEOMETRY_GEOMETRIES_LINESTRING_HPP
21 #include <boost/concept/assert.hpp>
22 #include <boost/range.hpp>
24 #include <boost/geometry/core/tag.hpp>
25 #include <boost/geometry/core/tags.hpp>
27 #include <boost/geometry/geometries/concepts/point_concept.hpp>
29 #include <boost/config.hpp>
30 #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
31 #include <initializer_list>
34 namespace boost { namespace geometry
41 \brief A linestring (named so by OGC) is a collection (default a vector) of points.
43 \tparam Point \tparam_point
44 \tparam Container \tparam_container
45 \tparam Allocator \tparam_allocator
47 \qbk{[include reference/geometries/linestring.qbk]}
50 [link geometry.reference.concepts.concept_linestring Linestring Concept]
57 template<typename,typename> class Container = std::vector,
58 template<typename> class Allocator = std::allocator
60 class linestring : public Container<Point, Allocator<Point> >
62 BOOST_CONCEPT_ASSERT( (concepts::Point<Point>) );
64 typedef Container<Point, Allocator<Point> > base_type;
67 /// \constructor_default{linestring}
72 /// \constructor_begin_end{linestring}
73 template <typename Iterator>
74 inline linestring(Iterator begin, Iterator end)
75 : base_type(begin, end)
78 #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
80 /// \constructor_initializer_list{linestring}
81 inline linestring(std::initializer_list<Point> l)
82 : base_type(l.begin(), l.end())
85 // Commented out for now in order to support Boost.Assign
86 // Without this assignment operator first the object should be created
87 // from initializer list, then it should be moved.
88 //// Without this workaround in MSVC the assignment operator is ambiguous
90 // /// \assignment_initializer_list{linestring}
91 // inline linestring & operator=(std::initializer_list<Point> l)
93 // base_type::assign(l.begin(), l.end());
103 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
110 template<typename,typename> class Container,
111 template<typename> class Allocator
113 struct tag<model::linestring<Point, Container, Allocator> >
115 typedef linestring_tag type;
117 } // namespace traits
119 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
121 }} // namespace boost::geometry
123 #endif // BOOST_GEOMETRY_GEOMETRIES_LINESTRING_HPP