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// Copyright (c) 2020, Oracle and/or its affiliates.
9// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
10
11// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
12// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
13
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)
17
18#ifndef BOOST_GEOMETRY_GEOMETRIES_LINESTRING_HPP
19#define BOOST_GEOMETRY_GEOMETRIES_LINESTRING_HPP
20
21#include <memory>
22#include <vector>
23
24#include <boost/concept/assert.hpp>
25#include <boost/config.hpp>
26
27#include <boost/geometry/core/tag.hpp>
28#include <boost/geometry/core/tags.hpp>
29
30#include <boost/geometry/geometries/concepts/point_concept.hpp>
31
32#include <initializer_list>
33
34namespace boost { namespace geometry
35{
36
37namespace model
38{
39
40/*!
41\brief A linestring (named so by OGC) is a collection (default a vector) of points.
42\ingroup geometries
43\tparam Point \tparam_point
44\tparam Container \tparam_container
45\tparam Allocator \tparam_allocator
46
47\qbk{[include reference/geometries/linestring.qbk]}
48\qbk{before.synopsis,
49[heading Model of]
50[link geometry.reference.concepts.concept_linestring Linestring Concept]
51}
52
53*/
54template
55<
56 typename Point,
57 template<typename,typename> class Container = std::vector,
58 template<typename> class Allocator = std::allocator
59>
60class linestring : public Container<Point, Allocator<Point> >
61{
62 BOOST_CONCEPT_ASSERT( (concepts::Point<Point>) );
63
64 typedef Container<Point, Allocator<Point> > base_type;
65
66public :
67 /// \constructor_default{linestring}
68 inline linestring()
69 : base_type()
70 {}
71
72 /// \constructor_begin_end{linestring}
73 template <typename Iterator>
74 inline linestring(Iterator begin, Iterator end)
75 : base_type(begin, end)
76 {}
77
78 /// \constructor_initializer_list{linestring}
79 inline linestring(std::initializer_list<Point> l)
80 : base_type(l.begin(), l.end())
81 {}
82
83// Commented out for now in order to support Boost.Assign
84// Without this assignment operator first the object should be created
85// from initializer list, then it should be moved.
86//// Without this workaround in MSVC the assignment operator is ambiguous
87//#ifndef BOOST_MSVC
88// /// \assignment_initializer_list{linestring}
89// inline linestring & operator=(std::initializer_list<Point> l)
90// {
91// base_type::assign(l.begin(), l.end());
92// return *this;
93// }
94//#endif
95};
96
97} // namespace model
98
99#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
100namespace traits
101{
102
103template
104<
105 typename Point,
106 template<typename,typename> class Container,
107 template<typename> class Allocator
108>
109struct tag<model::linestring<Point, Container, Allocator> >
110{
111 typedef linestring_tag type;
112};
113} // namespace traits
114
115#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
116
117}} // namespace boost::geometry
118
119#endif // BOOST_GEOMETRY_GEOMETRIES_LINESTRING_HPP
120

source code of boost/libs/geometry/include/boost/geometry/geometries/linestring.hpp