Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80982 - in sandbox-branches/geometry/index_dev/boost/geometry/extensions/index: . rtree/visitors
From: adam.wulkiewicz_at_[hidden]
Date: 2012-10-13 19:26:27


Author: awulkiew
Date: 2012-10-13 19:26:25 EDT (Sat, 13 Oct 2012)
New Revision: 80982
URL: http://svn.boost.org/trac/boost/changeset/80982

Log:
Added exact_match parameter to are_boxes_ok() check.

Text files modified:
   sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/pushable_array.hpp | 2 +-
   sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp | 24 ++++++++++++++++--------
   2 files changed, 17 insertions(+), 9 deletions(-)

Modified: sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/pushable_array.hpp
==============================================================================
--- sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/pushable_array.hpp (original)
+++ sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/pushable_array.hpp 2012-10-13 19:26:25 EDT (Sat, 13 Oct 2012)
@@ -46,7 +46,7 @@
         m_size = s;
     }
 
- inline void reserve(size_type s)
+ inline void reserve(size_type /*s*/)
     {
         //BOOST_GEOMETRY_INDEX_ASSERT(s <= Capacity, "size too big");
         // do nothing

Modified: sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp
==============================================================================
--- sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp (original)
+++ sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp 2012-10-13 19:26:25 EDT (Sat, 13 Oct 2012)
@@ -27,11 +27,11 @@
     typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
 
 public:
- inline are_boxes_ok(Translator const& tr)
- : result(false), m_tr(tr), m_is_root(true)
+ are_boxes_ok(Translator const& tr, bool exact_match)
+ : result(false), m_tr(tr), m_is_root(true), m_exact_match(exact_match)
     {}
 
- inline void operator()(internal_node const& n)
+ void operator()(internal_node const& n)
     {
         typedef typename rtree::elements_type<internal_node>::type elements_type;
         elements_type const& elements = rtree::elements(n);
@@ -69,10 +69,13 @@
             geometry::expand(box_exp, it->first);
         }
         
- result = m_is_root || geometry::equals(box_exp, m_box);
+ if ( m_exact_match )
+ result = m_is_root || geometry::equals(box_exp, m_box);
+ else
+ result = m_is_root || geometry::covered_by(box_exp, m_box);
     }
 
- inline void operator()(leaf const& n)
+ void operator()(leaf const& n)
     {
         typedef typename rtree::elements_type<leaf>::type elements_type;
         elements_type const& elements = rtree::elements(n);
@@ -94,7 +97,10 @@
                 geometry::expand(box_exp, m_tr(*it));
             }
 
- result = geometry::equals(box_exp, m_box);
+ if ( m_exact_match )
+ result = geometry::equals(box_exp, m_box);
+ else
+ result = geometry::covered_by(box_exp, m_box);
         }
         else
             result = true;
@@ -106,12 +112,14 @@
     Translator const& m_tr;
     Box m_box;
     bool m_is_root;
+ bool m_exact_match;
 };
 
 }}} // namespace detail::rtree::visitors
 
 template <typename Value, typename Options, typename Translator, typename Allocator>
-bool are_boxes_ok(rtree<Value, Options, Translator, Allocator> const& tree)
+bool are_boxes_ok(rtree<Value, Options, Translator, Allocator> const& tree,
+ bool exact_match = true)
 {
     typedef rtree<Value, Options, Translator, Allocator> rt;
     detail::rtree::visitors::are_boxes_ok<
@@ -120,7 +128,7 @@
         typename rt::translator_type,
         typename rt::box_type,
         typename rt::allocators_type
- > v(tree.translator());
+ > v(tree.translator(), exact_match);
     
     tree.apply_visitor(v);
 


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