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 // Copyright (c) 2020, Oracle and/or its affiliates.
9 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
11 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
12 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
14 // Use, modification and distribution is subject to the Boost Software License,
15 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
16 // http://www.boost.org/LICENSE_1_0.txt)
18 #ifndef BOOST_GEOMETRY_GEOMETRIES_LINESTRING_HPP
19 #define BOOST_GEOMETRY_GEOMETRIES_LINESTRING_HPP
24 #include <boost/concept/assert.hpp>
25 #include <boost/config.hpp>
27 #include <boost/geometry/core/tag.hpp>
28 #include <boost/geometry/core/tags.hpp>
30 #include <boost/geometry/geometries/concepts/point_concept.hpp>
32 #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
33 #include <initializer_list>
36 namespace boost { namespace geometry
43 \brief A linestring (named so by OGC) is a collection (default a vector) of points.
45 \tparam Point \tparam_point
46 \tparam Container \tparam_container
47 \tparam Allocator \tparam_allocator
49 \qbk{[include reference/geometries/linestring.qbk]}
52 [link geometry.reference.concepts.concept_linestring Linestring Concept]
59 template<typename,typename> class Container = std::vector,
60 template<typename> class Allocator = std::allocator
62 class linestring : public Container<Point, Allocator<Point> >
64 BOOST_CONCEPT_ASSERT( (concepts::Point<Point>) );
66 typedef Container<Point, Allocator<Point> > base_type;
69 /// \constructor_default{linestring}
74 /// \constructor_begin_end{linestring}
75 template <typename Iterator>
76 inline linestring(Iterator begin, Iterator end)
77 : base_type(begin, end)
80 #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
82 /// \constructor_initializer_list{linestring}
83 inline linestring(std::initializer_list<Point> l)
84 : base_type(l.begin(), l.end())
87 // Commented out for now in order to support Boost.Assign
88 // Without this assignment operator first the object should be created
89 // from initializer list, then it should be moved.
90 //// Without this workaround in MSVC the assignment operator is ambiguous
92 // /// \assignment_initializer_list{linestring}
93 // inline linestring & operator=(std::initializer_list<Point> l)
95 // base_type::assign(l.begin(), l.end());
105 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
112 template<typename,typename> class Container,
113 template<typename> class Allocator
115 struct tag<model::linestring<Point, Container, Allocator> >
117 typedef linestring_tag type;
119 } // namespace traits
121 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
123 }} // namespace boost::geometry
125 #endif // BOOST_GEOMETRY_GEOMETRIES_LINESTRING_HPP