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