|
Boost-Commit : |
From: mariano.consoni_at_[hidden]
Date: 2008-07-08 14:02:27
Author: mconsoni
Date: 2008-07-08 14:02:26 EDT (Tue, 08 Jul 2008)
New Revision: 47242
URL: http://svn.boost.org/trac/boost/changeset/47242
Log:
- Removed set_root method.
Text files modified:
sandbox/SOC/2008/spacial_indexing/boost/spatial_index/rtree.hpp | 20 ++++++++------------
sandbox/SOC/2008/spacial_indexing/boost/spatial_index/rtree_node.hpp | 10 ++--------
2 files changed, 10 insertions(+), 20 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-07-08 14:02:26 EDT (Tue, 08 Jul 2008)
@@ -26,6 +26,7 @@
/// minimum number of elements per node
unsigned int m_;
+
/// maximum number of elements per node
unsigned int M_;
@@ -34,17 +35,19 @@
public:
rtree(const unsigned int &M, const unsigned int &m)
- : element_count_(0), m_(m), M_(M), root_(new rtree_node<Point, Value>(boost::shared_ptr< rtree_node<Point,Value> >(), 1))
+ : element_count_(0), m_(m), M_(M),
+ root_(new rtree_node<Point, Value>(boost::shared_ptr< rtree_node<Point,Value> >(), 1))
{
- root_->set_root();
}
+
/// remove the element with key 'k'
virtual void remove(const Point &k)
{
this->remove(geometry::box<Point>(k, k));
}
+
/// remove the element with key 'k'
virtual void remove(const geometry::box<Point> &k)
{
@@ -55,12 +58,9 @@
l->remove(k);
if(l->elements() < m_ && elements() > m_) {
-// std::cerr << "Few elements in Node." << std::endl;
-
q_leaves = l->get_leaves();
// we remove the leaf_node in the parent node because now it's empty
-// std::cerr << "Remove the leaf from the parent\n";
l->get_parent()->remove(l->get_parent()->get_box(l));
}
@@ -73,13 +73,11 @@
// reinserting leaves from nodes
for(typename rtree_leaf<Point,Value>::leaves_map::const_iterator itl = leaves.begin(); itl != leaves.end(); ++itl) {
-// std::cerr << "Reinserting from nodes.\n";
s.push_back(*itl);
}
}
for(typename std::vector<std::pair<geometry::box<Point>, Value> >::const_iterator it = s.begin(); it != s.end(); ++it) {
-// std::cerr << "Inserting (" << elements() << ")" << it->second << std::endl;
element_count_--;
insert(it->first, it->second);
}
@@ -88,12 +86,10 @@
if(root_->elements() == 1) {
if(!root_->first_element()->is_leaf()) {
root_ = root_->first_element();
- root_->set_root();
}
}
-// std::cerr << "Reinserting leaves " << q_leaves.size() << std::endl;
-
+ // reinserting leaves
for(typename rtree_leaf<Point,Value>::leaves_map::const_iterator it = q_leaves.begin(); it != q_leaves.end(); ++it) {
element_count_--;
insert(it->first, it->second);
@@ -103,14 +99,15 @@
} catch(std::logic_error &e) {
// not found
-// print();
std::cerr << e.what() << std::endl;
return;
}
}
+
virtual unsigned int elements(void) const { return element_count_; }
+
virtual void print(void)
{
std::cerr << "===================================" << std::endl;
@@ -250,7 +247,6 @@
if(l.get() == root_.get()) {
// std::cerr << "Root ---------> split."<< std::endl;
boost::shared_ptr< rtree_node<Point,Value> > new_root(new rtree_node<Point,Value>(boost::shared_ptr<rtree_node<Point,Value> >(), l->get_level()+1));
- new_root->set_root();
new_root->add_node(n1->compute_box(), n1);
new_root->add_node(n2->compute_box(), n2);
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-07-08 14:02:26 EDT (Tue, 08 Jul 2008)
@@ -29,11 +29,11 @@
public:
/// default constructor (needed for the containers)
- rtree_node(void) : root_(false) {}
+ rtree_node(void) {}
/// normal constructor
rtree_node(const boost::shared_ptr<rtree_node<Point, Value> > &parent, const unsigned int &level)
- : parent_(parent), level_(level), root_(false) {}
+ : parent_(parent), level_(level) {}
/// level projector
virtual unsigned int get_level(void) const { return level_; }
@@ -56,9 +56,6 @@
/// true if it is a leaf node
virtual bool is_leaf(void) const { return false; }
- /// define this node as the root
- void set_root(void) { root_ = true; }
-
/// get a node
boost::shared_ptr< rtree_node<Point, Value> > get_node(const unsigned int i) { return nodes_[i].second; }
@@ -350,9 +347,6 @@
// level of this node
unsigned int level_;
- // true if it is the root
- bool root_;
-
/// child nodes
node_map nodes_;
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