1 // Boost.Geometry Index 2 // 3 // R-tree queries range adaptors 4 // 5 // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. 6 // 7 // Use, modification and distribution is subject to the Boost Software License, 8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 9 // http://www.boost.org/LICENSE_1_0.txt) 10 11 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_ADAPTORS_HPP 12 #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_ADAPTORS_HPP 13 14 #include <deque> 15 #include <boost/static_assert.hpp> 16 17 #include <boost/geometry/index/adaptors/query.hpp> 18 19 namespace boost { namespace geometry { namespace index { 20 21 template <typename Value, typename Options, typename IndexableGetter, typename EqualTo, typename Allocator> 22 class rtree; 23 24 namespace adaptors { namespace detail { 25 26 template <typename Value, typename Options, typename IndexableGetter, typename EqualTo, typename Allocator> 27 class query_range< index::rtree<Value, Options, IndexableGetter, EqualTo, Allocator> > 28 { 29 public: 30 typedef std::vector<Value> result_type; 31 typedef typename result_type::iterator iterator; 32 typedef typename result_type::const_iterator const_iterator; 33 34 template <typename Predicates> inline query_range(index::rtree<Value,Options,IndexableGetter,EqualTo,Allocator> const & rtree,Predicates const & pred)35 query_range(index::rtree<Value, Options, IndexableGetter, EqualTo, Allocator> const& rtree, 36 Predicates const& pred) 37 { 38 rtree.query(pred, std::back_inserter(m_result)); 39 } 40 begin()41 inline iterator begin() { return m_result.begin(); } end()42 inline iterator end() { return m_result.end(); } begin() const43 inline const_iterator begin() const { return m_result.begin(); } end() const44 inline const_iterator end() const { return m_result.end(); } 45 46 private: 47 result_type m_result; 48 }; 49 50 }} // namespace adaptors::detail 51 52 }}} // namespace boost::geometry::index 53 54 #endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_ADAPTORS_HPP 55