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