Boost logo

Boost-Commit :

From: mariano.consoni_at_[hidden]
Date: 2008-06-13 09:21:13


Author: mconsoni
Date: 2008-06-13 09:21:13 EDT (Fri, 13 Jun 2008)
New Revision: 46371
URL: http://svn.boost.org/trac/boost/changeset/46371

Log:

- more documentation

Text files modified:
   sandbox/SOC/2008/spacial_indexing/boost/spatial_index/rtree_leaf.hpp | 4 ++++
   sandbox/SOC/2008/spacial_indexing/boost/spatial_index/rtree_node.hpp | 26 +++++++++++++++++++++++---
   2 files changed, 27 insertions(+), 3 deletions(-)

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-13 09:21:13 EDT (Fri, 13 Jun 2008)
@@ -2,6 +2,10 @@
 // Distributed under the Boost Software License, Version 1.0. (See
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
+//
+//
+// Spatial Index - rTree Leaf
+//
 
 
 #ifndef BOOST_SPATIAL_INDEX_RTREE_LEAF_HPP

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-13 09:21:13 EDT (Fri, 13 Jun 2008)
@@ -2,6 +2,10 @@
 // Distributed under the Boost Software License, Version 1.0. (See
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
+//
+//
+// Spatial Index - rTree Node
+//
 
 
 #ifndef BOOST_SPATIAL_INDEX_RTREE_NODE_HPP
@@ -19,7 +23,10 @@
   class rtree_node
   {
   public:
+ /// default constructor (needed for the containers)
     rtree_node(void) : m_(4), M_(8) {}
+
+ /// normal constructor
     rtree_node(const boost::shared_ptr<rtree_node<Point, Value> > &parent, const unsigned int &level, const unsigned int &m, const unsigned int &M)
       : parent_(parent), level_(level), m_(m), M_(M) {}
 
@@ -50,6 +57,7 @@
       return M_;
     }
 
+ /// get the envelopes of a node
     virtual std::vector< geometry::box<Point> > get_boxes(void) const
     {
       std::vector< geometry::box<Point> > r;
@@ -59,22 +67,25 @@
       return r;
     }
 
+ /// add a node
     virtual void add_node(const geometry::box<Point> &b, const boost::shared_ptr<rtree_node<Point, Value> > &n)
     {
       nodes_.push_back(std::make_pair(b, n));
     }
 
+ /// add a value (not allowed in nodes)
     virtual void add_value(const geometry::box<Point> &b, const Value &v)
     {
       throw std::logic_error("Can't add value to non-leaf node.");
     }
 
-
+ ///
     void add_leaf_node(const geometry::box<Point> &b, const boost::shared_ptr<rtree_leaf<Point, Value> > &l)
     {
       nodes_.push_back(std::make_pair(b, l));
     }
 
+ /// insertion algorithm choose node
     boost::shared_ptr<rtree_node<Point, Value> > choose_node(const geometry::box<Point> e)
     {
       std::cerr << "Choose node" << std::endl;
@@ -119,16 +130,20 @@
       return chosen_node;
     }
 
+ /// empty the node
     virtual void empty_nodes(void) {
       nodes_.clear();
     }
 
+ /// projector for parent
     boost::shared_ptr<rtree_node<Point,Value> > get_parent(void) const {
       return parent_;
     }
 
+ /// value projector for leaf_node (not allowed here)
     virtual Value get_value(const unsigned int i) const { throw std::logic_error("No values in a non-leaf node."); }
 
+ /// print node
     virtual void print(void) const
     {
       std::cerr << " --> Node --------" << std::endl;
@@ -151,6 +166,7 @@
       }
     }
 
+ /// destructor (virtual because we have virtual functions)
     virtual ~rtree_node(void) {}
 
   private:
@@ -166,14 +182,19 @@
 
     // minimum number of elements per node
     unsigned int m_;
+
     // maximum number of elements per node
     unsigned int M_;
 
+ /// type for the node map
     typedef std::vector< std::pair<geometry::box<Point>, boost::shared_ptr<rtree_node> > > node_map;
+
+ /// child nodes
     node_map nodes_;
 
   private:
 
+ /// given two boxes, create the minimal box that contains them
     geometry::box<Point> enlarge_box(const geometry::box<Point> &b1, const geometry::box<Point> &b2) const
     {
       Point min(
@@ -189,14 +210,13 @@
       return geometry::box<Point>(min, max);
     }
 
+ /// compute the area of the union of b1 and b2
     double compute_union_area(const geometry::box<Point> &b1, const geometry::box<Point> &b2) const
     {
       geometry::box<Point> enlarged_box = enlarge_box(b1, b2);
       return geometry::area(enlarged_box);
     }
 
-
-
   };
 
 } // namespace spatial_index


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