multi_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. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  7. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  8. // Use, modification and distribution is subject to the Boost Software License,
  9. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  10. // http://www.boost.org/LICENSE_1_0.txt)
  11. #ifndef BOOST_GEOMETRY_GEOMETRIES_MULTI_LINESTRING_HPP
  12. #define BOOST_GEOMETRY_GEOMETRIES_MULTI_LINESTRING_HPP
  13. #include <memory>
  14. #include <vector>
  15. #include <boost/concept/requires.hpp>
  16. #include <boost/geometry/core/tags.hpp>
  17. #include <boost/geometry/geometries/concepts/linestring_concept.hpp>
  18. #include <boost/config.hpp>
  19. #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
  20. #include <initializer_list>
  21. #endif
  22. namespace boost { namespace geometry
  23. {
  24. namespace model
  25. {
  26. /*!
  27. \brief multi_line, a collection of linestring
  28. \details Multi-linestring can be used to group lines belonging to each other,
  29. e.g. a highway (with interruptions)
  30. \ingroup geometries
  31. \qbk{[include reference/geometries/multi_linestring.qbk]}
  32. \qbk{before.synopsis,
  33. [heading Model of]
  34. [link geometry.reference.concepts.concept_multi_linestring MultiLineString Concept]
  35. }
  36. */
  37. template
  38. <
  39. typename LineString,
  40. template<typename, typename> class Container = std::vector,
  41. template<typename> class Allocator = std::allocator
  42. >
  43. class multi_linestring : public Container<LineString, Allocator<LineString> >
  44. {
  45. BOOST_CONCEPT_ASSERT( (concepts::Linestring<LineString>) );
  46. #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
  47. // default constructor and base_type definitions are required only
  48. // if the constructor taking std::initializer_list is defined
  49. typedef Container<LineString, Allocator<LineString> > base_type;
  50. public:
  51. /// \constructor_default{multi_linestring}
  52. multi_linestring()
  53. : base_type()
  54. {}
  55. /// \constructor_initializer_list{multi_linestring}
  56. inline multi_linestring(std::initializer_list<LineString> l)
  57. : base_type(l.begin(), l.end())
  58. {}
  59. // Commented out for now in order to support Boost.Assign
  60. // Without this assignment operator first the object should be created
  61. // from initializer list, then it shoudl be moved.
  62. //// Without this workaround in MSVC the assignment operator is ambiguous
  63. //#ifndef BOOST_MSVC
  64. // /// \assignment_initializer_list{multi_linestring}
  65. // inline multi_linestring & operator=(std::initializer_list<LineString> l)
  66. // {
  67. // base_type::assign(l.begin(), l.end());
  68. // return *this;
  69. // }
  70. //#endif
  71. #endif
  72. };
  73. } // namespace model
  74. #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
  75. namespace traits
  76. {
  77. template
  78. <
  79. typename LineString,
  80. template<typename, typename> class Container,
  81. template<typename> class Allocator
  82. >
  83. struct tag< model::multi_linestring<LineString, Container, Allocator> >
  84. {
  85. typedef multi_linestring_tag type;
  86. };
  87. } // namespace traits
  88. #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
  89. }} // namespace boost::geometry
  90. #endif // BOOST_GEOMETRY_GEOMETRIES_MULTI_LINESTRING_HPP