|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r84896 - in trunk/boost/geometry/index/detail/rtree: . visitors
From: adam.wulkiewicz_at_[hidden]
Date: 2013-06-23 20:44:41
Author: awulkiew
Date: 2013-06-23 20:44:41 EDT (Sun, 23 Jun 2013)
New Revision: 84896
URL: http://svn.boost.org/trac/boost/changeset/84896
Log:
[geometry][index]: error fixed in iterative spatial query visitor - because of the error, the first return value in the query performed for a tree with only one node (root==leaf) was omitted. iterative distance query visitor modified for consistency.
Text files modified:
trunk/boost/geometry/index/detail/rtree/query_iterators.hpp | 6 ++----
trunk/boost/geometry/index/detail/rtree/visitors/distance_query.hpp | 6 ++++++
trunk/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp | 18 +++++++++++++-----
3 files changed, 21 insertions(+), 9 deletions(-)
Modified: trunk/boost/geometry/index/detail/rtree/query_iterators.hpp
==============================================================================
--- trunk/boost/geometry/index/detail/rtree/query_iterators.hpp Sun Jun 23 19:34:42 2013 (r84895)
+++ trunk/boost/geometry/index/detail/rtree/query_iterators.hpp 2013-06-23 20:44:41 EDT (Sun, 23 Jun 2013) (r84896)
@@ -81,8 +81,7 @@
inline spatial_query_iterator(node_pointer root, Translator const& t, Predicates const& p)
: m_visitor(t, p)
{
- detail::rtree::apply_visitor(m_visitor, *root);
- m_visitor.increment();
+ m_visitor.initialize(root);
}
reference operator*() const
@@ -162,8 +161,7 @@
inline distance_query_iterator(node_pointer root, Translator const& t, Predicates const& p)
: m_visitor(t, p)
{
- detail::rtree::apply_visitor(m_visitor, *root);
- m_visitor.increment();
+ m_visitor.initialize(root);
}
reference operator*() const
Modified: trunk/boost/geometry/index/detail/rtree/visitors/distance_query.hpp
==============================================================================
--- trunk/boost/geometry/index/detail/rtree/visitors/distance_query.hpp Sun Jun 23 19:34:42 2013 (r84895)
+++ trunk/boost/geometry/index/detail/rtree/visitors/distance_query.hpp 2013-06-23 20:44:41 EDT (Sun, 23 Jun 2013) (r84896)
@@ -318,6 +318,12 @@
return *(neighbors[current_neighbor].second);
}
+ void initialize(node_pointer root)
+ {
+ rtree::apply_visitor(*this, *root);
+ increment();
+ }
+
void increment()
{
for (;;)
Modified: trunk/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp
==============================================================================
--- trunk/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp Sun Jun 23 19:34:42 2013 (r84895)
+++ trunk/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp 2013-06-23 20:44:41 EDT (Sun, 23 Jun 2013) (r84896)
@@ -112,7 +112,6 @@
{
m_values = ::boost::addressof(rtree::elements(n));
m_current = rtree::elements(n).begin();
- m_last = rtree::elements(n).end();
}
const_reference dereference() const
@@ -121,17 +120,26 @@
return *m_current;
}
+ void initialize(node_pointer root)
+ {
+ rtree::apply_visitor(*this, *root);
+ search_value();
+ }
+
void increment()
{
- if ( m_values )
- ++m_current;
+ ++m_current;
+ search_value();
+ }
+ void search_value()
+ {
for (;;)
{
// if leaf is choosen, move to the next value in leaf
if ( m_values )
{
- if ( m_current != m_last )
+ if ( m_current != m_values->end() )
{
// return if next value is found
Value const& v = *m_current;
@@ -188,7 +196,7 @@
std::vector< std::pair<internal_iterator, internal_iterator> > m_internal_stack;
const leaf_elements * m_values;
- leaf_iterator m_current, m_last;
+ leaf_iterator m_current;
};
}}} // namespace detail::rtree::visitors
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk