adaptors.hpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Boost.Geometry Index
  2. //
  3. // R-tree queries range adaptors
  4. //
  5. // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
  6. //
  7. // This file was modified by Oracle on 2021.
  8. // Modifications copyright (c) 2021 Oracle and/or its affiliates.
  9. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  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. #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_ADAPTORS_HPP
  15. #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_ADAPTORS_HPP
  16. #include <vector>
  17. #include <boost/geometry/index/adaptors/query.hpp>
  18. namespace boost { namespace geometry { namespace index {
  19. // Forward declaration
  20. template <typename Value, typename Options, typename IndexableGetter, typename EqualTo, typename Allocator>
  21. class rtree;
  22. namespace adaptors { namespace detail {
  23. template <typename Value, typename Options, typename IndexableGetter, typename EqualTo, typename Allocator>
  24. class query_range< index::rtree<Value, Options, IndexableGetter, EqualTo, Allocator> >
  25. {
  26. public:
  27. typedef std::vector<Value> result_type;
  28. typedef typename result_type::iterator iterator;
  29. typedef typename result_type::const_iterator const_iterator;
  30. template <typename Predicates> inline
  31. query_range(index::rtree<Value, Options, IndexableGetter, EqualTo, Allocator> const& rtree,
  32. Predicates const& pred)
  33. {
  34. rtree.query(pred, std::back_inserter(m_result));
  35. }
  36. inline iterator begin() { return m_result.begin(); }
  37. inline iterator end() { return m_result.end(); }
  38. inline const_iterator begin() const { return m_result.begin(); }
  39. inline const_iterator end() const { return m_result.end(); }
  40. private:
  41. result_type m_result;
  42. };
  43. }} // namespace adaptors::detail
  44. }}} // namespace boost::geometry::index
  45. #endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_ADAPTORS_HPP