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_LINESTRING_HPP 16 #define BOOST_GEOMETRY_GEOMETRIES_LINESTRING_HPP 17 18 #include <memory> 19 #include <vector> 20 21 #include <boost/concept/assert.hpp> 22 #include <boost/range.hpp> 23 24 #include <boost/geometry/core/tag.hpp> 25 #include <boost/geometry/core/tags.hpp> 26 27 #include <boost/geometry/geometries/concepts/point_concept.hpp> 28 29 #include <boost/config.hpp> 30 #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST 31 #include <initializer_list> 32 #endif 33 34 namespace boost { namespace geometry 35 { 36 37 namespace 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 */ 54 template 55 < 56 typename Point, 57 template<typename,typename> class Container = std::vector, 58 template<typename> class Allocator = std::allocator 59 > 60 class linestring : public Container<Point, Allocator<Point> > 61 { 62 BOOST_CONCEPT_ASSERT( (concepts::Point<Point>) ); 63 64 typedef Container<Point, Allocator<Point> > base_type; 65 66 public : 67 /// \constructor_default{linestring} linestring()68 inline linestring() 69 : base_type() 70 {} 71 72 /// \constructor_begin_end{linestring} 73 template <typename Iterator> linestring(Iterator begin,Iterator end)74 inline linestring(Iterator begin, Iterator end) 75 : base_type(begin, end) 76 {} 77 78 #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST 79 80 /// \constructor_initializer_list{linestring} linestring(std::initializer_list<Point> l)81 inline linestring(std::initializer_list<Point> l) 82 : base_type(l.begin(), l.end()) 83 {} 84 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 89 //#ifndef BOOST_MSVC 90 // /// \assignment_initializer_list{linestring} 91 // inline linestring & operator=(std::initializer_list<Point> l) 92 // { 93 // base_type::assign(l.begin(), l.end()); 94 // return *this; 95 // } 96 //#endif 97 98 #endif 99 }; 100 101 } // namespace model 102 103 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS 104 namespace traits 105 { 106 107 template 108 < 109 typename Point, 110 template<typename,typename> class Container, 111 template<typename> class Allocator 112 > 113 struct tag<model::linestring<Point, Container, Allocator> > 114 { 115 typedef linestring_tag type; 116 }; 117 } // namespace traits 118 119 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS 120 121 }} // namespace boost::geometry 122 123 #endif // BOOST_GEOMETRY_GEOMETRIES_LINESTRING_HPP 124