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