linestring.hpp 3.2 KB

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