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