multi_point.hpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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_POINT_HPP
  12. #define BOOST_GEOMETRY_GEOMETRIES_MULTI_POINT_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/point_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_point, a collection of points
  28. \ingroup geometries
  29. \tparam Point \tparam_point
  30. \tparam Container \tparam_container
  31. \tparam Allocator \tparam_allocator
  32. \details Multipoint can be used to group points belonging to each other,
  33. e.g. a constellation, or the result set of an intersection
  34. \qbk{[include reference/geometries/multi_point.qbk]}
  35. \qbk{before.synopsis,
  36. [heading Model of]
  37. [link geometry.reference.concepts.concept_multi_point MultiPoint Concept]
  38. }
  39. */
  40. template
  41. <
  42. typename Point,
  43. template<typename, typename> class Container = std::vector,
  44. template<typename> class Allocator = std::allocator
  45. >
  46. class multi_point : public Container<Point, Allocator<Point> >
  47. {
  48. BOOST_CONCEPT_ASSERT( (concepts::Point<Point>) );
  49. typedef Container<Point, Allocator<Point> > base_type;
  50. public :
  51. /// \constructor_default{multi_point}
  52. inline multi_point()
  53. : base_type()
  54. {}
  55. /// \constructor_begin_end{multi_point}
  56. template <typename Iterator>
  57. inline multi_point(Iterator begin, Iterator end)
  58. : base_type(begin, end)
  59. {}
  60. #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
  61. /// \constructor_initializer_list{multi_point}
  62. inline multi_point(std::initializer_list<Point> l)
  63. : base_type(l.begin(), l.end())
  64. {}
  65. // Commented out for now in order to support Boost.Assign
  66. // Without this assignment operator first the object should be created
  67. // from initializer list, then it shoudl be moved.
  68. //// Without this workaround in MSVC the assignment operator is ambiguous
  69. //#ifndef BOOST_MSVC
  70. // /// \assignment_initializer_list{multi_point}
  71. // inline multi_point & operator=(std::initializer_list<Point> l)
  72. // {
  73. // base_type::assign(l.begin(), l.end());
  74. // return *this;
  75. // }
  76. //#endif
  77. #endif
  78. };
  79. } // namespace model
  80. #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
  81. namespace traits
  82. {
  83. template
  84. <
  85. typename Point,
  86. template<typename, typename> class Container,
  87. template<typename> class Allocator
  88. >
  89. struct tag< model::multi_point<Point, Container, Allocator> >
  90. {
  91. typedef multi_point_tag type;
  92. };
  93. } // namespace traits
  94. #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
  95. }} // namespace boost::geometry
  96. #endif // BOOST_GEOMETRY_GEOMETRIES_MULTI_POINT_HPP