|
Boost-Commit : |
From: mariano.consoni_at_[hidden]
Date: 2008-06-18 11:06:47
Author: mconsoni
Date: 2008-06-18 11:06:47 EDT (Wed, 18 Jun 2008)
New Revision: 46479
URL: http://svn.boost.org/trac/boost/changeset/46479
Log:
- find() bug fixed.
Text files modified:
sandbox/SOC/2008/spacial_indexing/boost/spatial_index/rtree.hpp | 4 +-
sandbox/SOC/2008/spacial_indexing/boost/spatial_index/rtree_leaf.hpp | 12 +++++++--
sandbox/SOC/2008/spacial_indexing/boost/spatial_index/rtree_node.hpp | 4 +-
sandbox/SOC/2008/spacial_indexing/libs/spatial_index/test/simple_test_rtree.cpp | 46 ++++++++++++++++-----------------------
4 files changed, 32 insertions(+), 34 deletions(-)
Modified: sandbox/SOC/2008/spacial_indexing/boost/spatial_index/rtree.hpp
==============================================================================
--- sandbox/SOC/2008/spacial_indexing/boost/spatial_index/rtree.hpp (original)
+++ sandbox/SOC/2008/spacial_indexing/boost/spatial_index/rtree.hpp 2008-06-18 11:06:47 EDT (Wed, 18 Jun 2008)
@@ -154,7 +154,7 @@
std::deque<Value> result;
geometry::box<geometry::point_xy<double> > query_box(k, k);
- root_->find(query_box, result);
+ root_->find(query_box, result, true);
if(result.size() >= 1) {
return result[0];
}
@@ -164,7 +164,7 @@
virtual std::deque<Value> find(const geometry::box<Point> &r)
{
std::deque<Value> result;
- root_->find(r, result);
+ root_->find(r, result, false);
return result;
}
Modified: sandbox/SOC/2008/spacial_indexing/boost/spatial_index/rtree_leaf.hpp
==============================================================================
--- sandbox/SOC/2008/spacial_indexing/boost/spatial_index/rtree_leaf.hpp (original)
+++ sandbox/SOC/2008/spacial_indexing/boost/spatial_index/rtree_leaf.hpp 2008-06-18 11:06:47 EDT (Wed, 18 Jun 2008)
@@ -29,11 +29,17 @@
: rtree_node<Point,Value>(parent, 0), level_(0) {}
/// query method
- virtual void find(const geometry::box<Point> &e, std::deque<Value> &r)
+ virtual void find(const geometry::box<Point> &e, std::deque<Value> &r, const bool exact_match)
{
for(typename leaves_map::const_iterator it = nodes_.begin(); it != nodes_.end(); ++it) {
- if(overlaps(it->first, e)) {
- r.push_back(it->second);
+ if(exact_match) {
+ if(it->first.max() == e.max() && it->first.min() == e.min()) {
+ r.push_back(it->second);
+ }
+ } else {
+ if(overlaps(it->first, e)) {
+ r.push_back(it->second);
+ }
}
}
}
Modified: sandbox/SOC/2008/spacial_indexing/boost/spatial_index/rtree_node.hpp
==============================================================================
--- sandbox/SOC/2008/spacial_indexing/boost/spatial_index/rtree_node.hpp (original)
+++ sandbox/SOC/2008/spacial_indexing/boost/spatial_index/rtree_node.hpp 2008-06-18 11:06:47 EDT (Wed, 18 Jun 2008)
@@ -66,11 +66,11 @@
boost::shared_ptr< rtree_node<Point, Value> > get_node(const unsigned int i) { return nodes_[i].second; }
/// query method
- virtual void find(const geometry::box<Point> &e, std::deque<Value> &r)
+ virtual void find(const geometry::box<Point> &e, std::deque<Value> &r, const bool exact_match)
{
for(typename node_map::const_iterator it = nodes_.begin(); it != nodes_.end(); ++it) {
if(overlaps(it->first, e)) {
- it->second->find(e, r);
+ it->second->find(e, r, exact_match);
}
}
}
Modified: sandbox/SOC/2008/spacial_indexing/libs/spatial_index/test/simple_test_rtree.cpp
==============================================================================
--- sandbox/SOC/2008/spacial_indexing/libs/spatial_index/test/simple_test_rtree.cpp (original)
+++ sandbox/SOC/2008/spacial_indexing/libs/spatial_index/test/simple_test_rtree.cpp 2008-06-18 11:06:47 EDT (Wed, 18 Jun 2008)
@@ -87,6 +87,13 @@
geometry::box<geometry::point_xy<double> > e24(geometry::point_xy<double>(13.0, 12.0), geometry::point_xy<double>(13.5,12.5));
geometry::box<geometry::point_xy<double> > e25(geometry::point_xy<double>(13.0, 13.0), geometry::point_xy<double>(13.5,13.5));
+ geometry::box<geometry::point_xy<double> > e26(geometry::point_xy<double>(11.0, 13.0), geometry::point_xy<double>(13.5,15.5));
+ geometry::box<geometry::point_xy<double> > e27(geometry::point_xy<double>(11.0, 13.0), geometry::point_xy<double>(13.5,13.5));
+
+
+ geometry::box<geometry::point_xy<double> > e28(geometry::point_xy<double>(9.0, 13.0), geometry::point_xy<double>(10.0,14.0));
+ geometry::box<geometry::point_xy<double> > e29(geometry::point_xy<double>(9.0, 10.0), geometry::point_xy<double>(15.0,15.0));
+
std::cerr << " --> insert env" << std::endl;
q->insert(e1, 1);
@@ -117,40 +124,24 @@
q->insert(e18, 18);
q->insert(e19, 19);
q->insert(e20, 20);
-
- q->print();
-
q->insert(e21, 21);
- q->print();
- return 0;
q->insert(e22, 22);
q->insert(e23, 23);
+ q->insert(e24, 24);
+ q->insert(e25, 25);
+// q->print();
-// q->insert(e24, 24);
-// q->insert(e25, 25);
-
-// q->print();
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ q->insert(e26, 26);
+ q->insert(e27, 27);
+ q->insert(e28, 28);
+ q->insert(e29, 29);
+ q->print();
/// find everything overlaping with an envelope
std::cerr << " --> find in envelope" << std::endl;
@@ -187,6 +178,8 @@
std::cout << "Value: " << v << std::endl;
}
+ return 0;
+
// remove test
std::cerr << " --> remove" << std::endl;
q->remove(geometry::box<geometry::point_xy<double> >(geometry::point_xy<double>(10.0,10.0), geometry::point_xy<double>(12.0,13.0)));
@@ -194,8 +187,7 @@
std::cerr << " --> remove" << std::endl;
// q->print();
q->remove(geometry::box<geometry::point_xy<double> >(geometry::point_xy<double>(7.0,4.0), geometry::point_xy<double>(12.0,7.0)));
-// q->print();
-
+ q->print();
return 0;
-};
+}
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