Chris@16
|
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
|
Chris@16
|
2
|
Chris@16
|
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
Chris@16
|
4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
Chris@16
|
5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
Chris@101
|
6 // Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
|
Chris@16
|
7
|
Chris@16
|
8 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
|
Chris@16
|
9 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
|
Chris@16
|
10
|
Chris@16
|
11 // Use, modification and distribution is subject to the Boost Software License,
|
Chris@16
|
12 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
13 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
14
|
Chris@16
|
15 #ifndef BOOST_GEOMETRY_GEOMETRIES_LINESTRING_HPP
|
Chris@16
|
16 #define BOOST_GEOMETRY_GEOMETRIES_LINESTRING_HPP
|
Chris@16
|
17
|
Chris@16
|
18 #include <memory>
|
Chris@16
|
19 #include <vector>
|
Chris@16
|
20
|
Chris@16
|
21 #include <boost/concept/assert.hpp>
|
Chris@16
|
22 #include <boost/range.hpp>
|
Chris@16
|
23
|
Chris@16
|
24 #include <boost/geometry/core/tag.hpp>
|
Chris@16
|
25 #include <boost/geometry/core/tags.hpp>
|
Chris@16
|
26
|
Chris@16
|
27 #include <boost/geometry/geometries/concepts/point_concept.hpp>
|
Chris@16
|
28
|
Chris@101
|
29 #ifdef BOOST_GEOMETRY_EXPERIMENTAL_ENABLE_INITIALIZER_LIST
|
Chris@101
|
30 #include <boost/config.hpp>
|
Chris@101
|
31 #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
Chris@101
|
32 #include <initializer_list>
|
Chris@101
|
33 #endif
|
Chris@101
|
34 #endif
|
Chris@16
|
35
|
Chris@16
|
36 namespace boost { namespace geometry
|
Chris@16
|
37 {
|
Chris@16
|
38
|
Chris@16
|
39 namespace model
|
Chris@16
|
40 {
|
Chris@16
|
41
|
Chris@16
|
42 /*!
|
Chris@16
|
43 \brief A linestring (named so by OGC) is a collection (default a vector) of points.
|
Chris@16
|
44 \ingroup geometries
|
Chris@16
|
45 \tparam Point \tparam_point
|
Chris@16
|
46 \tparam Container \tparam_container
|
Chris@16
|
47 \tparam Allocator \tparam_allocator
|
Chris@16
|
48
|
Chris@16
|
49 \qbk{before.synopsis,
|
Chris@16
|
50 [heading Model of]
|
Chris@16
|
51 [link geometry.reference.concepts.concept_linestring Linestring Concept]
|
Chris@16
|
52 }
|
Chris@16
|
53
|
Chris@16
|
54 */
|
Chris@16
|
55 template
|
Chris@16
|
56 <
|
Chris@16
|
57 typename Point,
|
Chris@16
|
58 template<typename,typename> class Container = std::vector,
|
Chris@16
|
59 template<typename> class Allocator = std::allocator
|
Chris@16
|
60 >
|
Chris@16
|
61 class linestring : public Container<Point, Allocator<Point> >
|
Chris@16
|
62 {
|
Chris@16
|
63 BOOST_CONCEPT_ASSERT( (concept::Point<Point>) );
|
Chris@16
|
64
|
Chris@16
|
65 typedef Container<Point, Allocator<Point> > base_type;
|
Chris@16
|
66
|
Chris@16
|
67 public :
|
Chris@16
|
68 /// \constructor_default{linestring}
|
Chris@16
|
69 inline linestring()
|
Chris@16
|
70 : base_type()
|
Chris@16
|
71 {}
|
Chris@16
|
72
|
Chris@16
|
73 /// \constructor_begin_end{linestring}
|
Chris@16
|
74 template <typename Iterator>
|
Chris@16
|
75 inline linestring(Iterator begin, Iterator end)
|
Chris@16
|
76 : base_type(begin, end)
|
Chris@16
|
77 {}
|
Chris@101
|
78
|
Chris@101
|
79 #ifdef BOOST_GEOMETRY_EXPERIMENTAL_ENABLE_INITIALIZER_LIST
|
Chris@101
|
80 #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
Chris@101
|
81
|
Chris@101
|
82 /// \constructor_initializer_list{linestring}
|
Chris@101
|
83 inline linestring(std::initializer_list<Point> l)
|
Chris@101
|
84 : base_type(l.begin(), l.end())
|
Chris@101
|
85 {}
|
Chris@101
|
86
|
Chris@101
|
87 // Commented out for now in order to support Boost.Assign
|
Chris@101
|
88 // Without this assignment operator first the object should be created
|
Chris@101
|
89 // from initializer list, then it should be moved.
|
Chris@101
|
90 //// Without this workaround in MSVC the assignment operator is ambiguous
|
Chris@101
|
91 //#ifndef BOOST_MSVC
|
Chris@101
|
92 // /// \assignment_initializer_list{linestring}
|
Chris@101
|
93 // inline linestring & operator=(std::initializer_list<Point> l)
|
Chris@101
|
94 // {
|
Chris@101
|
95 // base_type::assign(l.begin(), l.end());
|
Chris@101
|
96 // return *this;
|
Chris@101
|
97 // }
|
Chris@101
|
98 //#endif
|
Chris@101
|
99
|
Chris@101
|
100 #endif
|
Chris@101
|
101 #endif
|
Chris@16
|
102 };
|
Chris@16
|
103
|
Chris@16
|
104 } // namespace model
|
Chris@16
|
105
|
Chris@16
|
106 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
|
Chris@16
|
107 namespace traits
|
Chris@16
|
108 {
|
Chris@16
|
109
|
Chris@16
|
110 template
|
Chris@16
|
111 <
|
Chris@16
|
112 typename Point,
|
Chris@16
|
113 template<typename,typename> class Container,
|
Chris@16
|
114 template<typename> class Allocator
|
Chris@16
|
115 >
|
Chris@16
|
116 struct tag<model::linestring<Point, Container, Allocator> >
|
Chris@16
|
117 {
|
Chris@16
|
118 typedef linestring_tag type;
|
Chris@16
|
119 };
|
Chris@16
|
120 } // namespace traits
|
Chris@16
|
121
|
Chris@16
|
122 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
|
Chris@16
|
123
|
Chris@16
|
124 }} // namespace boost::geometry
|
Chris@16
|
125
|
Chris@16
|
126 #endif // BOOST_GEOMETRY_GEOMETRIES_LINESTRING_HPP
|