Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69051 - in sandbox-branches/geometry/index_080: boost/geometry/extensions/index/rtree tests
From: adam.wulkiewicz_at_[hidden]
Date: 2011-02-19 06:19:09


Author: awulkiew
Date: 2011-02-19 06:19:08 EST (Sat, 19 Feb 2011)
New Revision: 69051
URL: http://svn.boost.org/trac/boost/changeset/69051

Log:
leaves now stores values only
Text files modified:
   sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/helpers.hpp | 19 +++---
   sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/rtree.hpp | 96 ++++++++++++++++++++-----------------
   sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/rtree_leaf.hpp | 101 ++++++++++++++++++++++++---------------
   sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/rtree_node.hpp | 50 ++++++++++---------
   sandbox-branches/geometry/index_080/tests/rtree_native.cpp | 13 +++++
   5 files changed, 162 insertions(+), 117 deletions(-)

Modified: sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/helpers.hpp
==============================================================================
--- sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/helpers.hpp (original)
+++ sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/helpers.hpp 2011-02-19 06:19:08 EST (Sat, 19 Feb 2011)
@@ -51,13 +51,13 @@
 /**
  * \brief Compute the area of the union of b1 and b2
  */
-template <typename Box>
-inline typename area_result<Box>::type compute_union_area(Box const& b1, Box const& b2)
+template <typename Box, typename Geometry>
+inline typename area_result<Box>::type compute_union_area(Box const& b, Geometry const& g)
 {
     //Box enlarged_box = enlarge_box(b1, b2);
     // awulkiew - changed to geometry::combine
- Box enlarged_box(b1);
- geometry::combine(enlarged_box, b2);
+ Box enlarged_box(b);
+ geometry::combine(enlarged_box, g);
     return geometry::area(enlarged_box);
 }
 
@@ -65,11 +65,12 @@
  * \brief Checks if boxes intersects
  */
 // TODO: move to geometry::intersects
-template <typename Box>
-inline bool is_overlapping(Box const& b1, Box const& b2)
-{
- return ! geometry::disjoint(b1, b2);
-}
+// awulkiew - geometry::intersects used
+//template <typename Geometry1, typename Geometry2>
+//inline bool is_overlapping(Geometry1 const& b1, Geometry2 const& b2)
+//{
+// return ! geometry::disjoint(b1, b2);
+//}
 
 // awulkiew - structures and functions added below
 

Modified: sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/rtree.hpp
==============================================================================
--- sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/rtree.hpp (original)
+++ sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/rtree.hpp 2011-02-19 06:19:08 EST (Sat, 19 Feb 2011)
@@ -41,8 +41,8 @@
 {
 public:
     // awulkiew - typedefs added
- typedef rtree_node<Box, Value, Translator> rtree_node;
- typedef rtree_leaf<Box, Value, Translator> rtree_leaf;
+ typedef rtree_node<Value, Translator, Box> rtree_node;
+ typedef rtree_leaf<Value, Translator, Box> rtree_leaf;
 
     typedef boost::shared_ptr<rtree_node> node_pointer;
     typedef boost::shared_ptr<rtree_leaf> leaf_pointer;
@@ -96,20 +96,20 @@
             node_pointer leaf(choose_exact_leaf(box));
             typename rtree_leaf::leaf_map q_leaves;
 
- leaf->remove_in(box);
+ leaf->remove_in(box, m_translator);
 
             if (leaf->elements() < m_min_elems_per_node && elements() > m_min_elems_per_node)
             {
                 q_leaves = leaf->get_leaves();
 
                 // we remove the leaf_node in the parent node because now it's empty
- leaf->get_parent()->remove_in(leaf->get_parent()->get_box(leaf));
+ leaf->get_parent()->remove_in(leaf->get_parent()->get_box(leaf), m_translator);
             }
 
             typename rtree_node::node_map q_nodes;
             condense_tree(leaf, q_nodes);
 
- std::vector<std::pair<Box, Value> > s;
+ std::vector<Value> s;
             for (typename rtree_node::node_map::const_iterator it = q_nodes.begin();
                  it != q_nodes.end(); ++it)
             {
@@ -123,13 +123,13 @@
                 }
             }
 
- for (typename std::vector<std::pair<Box, Value> >::const_iterator it = s.begin();
+ for (typename std::vector<Value>::const_iterator it = s.begin();
                 it != s.end();
                 ++it)
             {
                 m_count--;
                 // awulkiew - changed
- insert(it->second);
+ insert(*it);
             }
 
             // if the root has only one child and the child is not a leaf,
@@ -147,7 +147,7 @@
             {
                 m_count--;
                 // awulkiew - parameters changed
- insert(it->second);
+ insert(*it);
             }
 
             m_count--;
@@ -205,13 +205,13 @@
                 q_leaves = leaf->get_leaves();
 
                 // we remove the leaf_node in the parent node because now it's empty
- leaf->get_parent()->remove_in(leaf->get_parent()->get_box(leaf));
+ leaf->get_parent()->remove_in(leaf->get_parent()->get_box(leaf), m_translator);
             }
 
             typename rtree_node::node_map q_nodes;
             condense_tree(leaf, q_nodes);
 
- std::vector<std::pair<Box, Value> > s;
+ std::vector<Value> s;
             for (typename rtree_node::node_map::const_iterator it = q_nodes.begin();
                  it != q_nodes.end(); ++it)
             {
@@ -225,13 +225,13 @@
                 }
             }
 
- for (typename std::vector<std::pair<Box, Value> >::const_iterator it = s.begin();
+ for (typename std::vector<Value>::const_iterator it = s.begin();
                 it != s.end(); ++it)
             {
                 m_count--;
                 // awulkiew - changed
                 //insert(it->first, it->second);
- insert(it->second);
+ insert(*it);
             }
 
             // if the root has only one child and the child is not a leaf,
@@ -251,7 +251,7 @@
                 m_count--;
                 // awulkiew - changed
                 //insert(it->first, it->second);
- insert(it->second);
+ insert(*it);
             }
 
             m_count--;
@@ -292,7 +292,7 @@
         // check if the selected leaf is full to do the split if necessary
         if (leaf->elements() >= m_max_elems_per_node)
         {
- leaf->insert(box, value);
+ leaf->insert(value);
 
             // split!
             node_pointer n1(new rtree_leaf(leaf->get_parent()));
@@ -303,7 +303,7 @@
         }
         else
         {
- leaf->insert(box, value);
+ leaf->insert(value);
             adjust_tree(leaf);
         }
     }
@@ -327,7 +327,7 @@
         std::cerr << "===================================" << std::endl;
         std::cerr << " Min/Max: " << m_min_elems_per_node << " / " << m_max_elems_per_node << std::endl;
         std::cerr << "Leaves: " << m_root->get_leaves().size() << std::endl;
- m_root->print();
+ m_root->print(m_translator);
         std::cerr << "===================================" << std::endl;
     }
 
@@ -361,7 +361,7 @@
         }
 
         node_pointer parent = leaf->get_parent();
- parent->adjust_box(leaf);
+ parent->adjust_box(leaf, m_translator);
 
         if (parent->elements() < m_min_elems_per_node)
         {
@@ -381,7 +381,7 @@
 
             // we remove the node in the parent node because now it should be
             // re inserted
- parent->get_parent()->remove_in(parent->get_parent()->get_box(parent));
+ parent->get_parent()->remove_in(parent->get_parent()->get_box(parent), m_translator);
         }
 
         condense_tree(parent, q_nodes);
@@ -400,7 +400,7 @@
 
         // as there are no splits just adjust the box of the parent and go on
         node_pointer parent = node->get_parent();
- parent->adjust_box(node);
+ parent->adjust_box(node, m_translator);
         adjust_tree(parent);
     }
 
@@ -414,8 +414,8 @@
         if (leaf.get() == m_root.get())
         {
             node_pointer new_root(new rtree_node(node_pointer(), leaf->get_level() + 1));
- new_root->add_node(n1->compute_box(), n1);
- new_root->add_node(n2->compute_box(), n2);
+ new_root->add_node(n1->compute_box(m_translator), n1);
+ new_root->add_node(n2->compute_box(m_translator), n2);
 
             n1->set_parent(new_root);
             n2->set_parent(new_root);
@@ -429,8 +429,8 @@
 
         node_pointer parent = leaf->get_parent();
 
- parent->replace_node(leaf, n1);
- parent->add_node(n2->compute_box(), n2);
+ parent->replace_node(leaf, n1, m_translator);
+ parent->add_node(n2->compute_box(m_translator), n2);
 
         // if parent is full, split and readjust
         if (parent->elements() > m_max_elems_per_node)
@@ -454,17 +454,18 @@
     {
         unsigned int seed1 = 0;
         unsigned int seed2 = 0;
- std::vector<Box> boxes = n->get_boxes();
+ std::vector<Box> boxes = n->get_boxes(m_translator);
 
         n1->set_parent(n->get_parent());
         n2->set_parent(n->get_parent());
 
- linear_pick_seeds(n, seed1, seed2);
+ // awulkiew - node_pointer parameter changed to std::vector<Box>
+ linear_pick_seeds(boxes, seed1, seed2);
 
         if (n->is_leaf())
         {
- n1->add_value(boxes[seed1], n->get_value(seed1));
- n2->add_value(boxes[seed2], n->get_value(seed2));
+ n1->add_value(n->get_value(seed1));
+ n2->add_value(n->get_value(seed2));
         }
         else
         {
@@ -488,12 +489,12 @@
                 {
                     if (n1->elements() + remaining == m_min_elems_per_node)
                     {
- n1->add_value(it->first, it->second);
+ n1->add_value(*it);
                         continue;
                     }
                     if (n2->elements() + remaining == m_min_elems_per_node)
                     {
- n2->add_value(it->first, it->second);
+ n2->add_value(*it);
                         continue;
                     }
 
@@ -504,8 +505,8 @@
 
                     /// enlarged boxes of each group
                     Box eb1, eb2;
- b1 = n1->compute_box();
- b2 = n2->compute_box();
+ b1 = n1->compute_box(m_translator);
+ b2 = n2->compute_box(m_translator);
 
                     /// areas
                     // awulkiew - areas types changed
@@ -515,36 +516,36 @@
 
                     b1_area = geometry::area(b1);
                     b2_area = geometry::area(b2);
- eb1_area = compute_union_area(b1, it->first);
- eb2_area = compute_union_area(b2, it->first);
+ eb1_area = compute_union_area(b1, m_translator(*it));
+ eb2_area = compute_union_area(b2, m_translator(*it));
 
                     if (eb1_area - b1_area > eb2_area - b2_area)
                     {
- n2->add_value(it->first, it->second);
+ n2->add_value(*it);
                     }
                     if (eb1_area - b1_area < eb2_area - b2_area)
                     {
- n1->add_value(it->first, it->second);
+ n1->add_value(*it);
                     }
                     if (eb1_area - b1_area == eb2_area - b2_area)
                     {
                         if (b1_area < b2_area)
                         {
- n1->add_value(it->first, it->second);
+ n1->add_value(*it);
                         }
                         if (b1_area > b2_area)
                         {
- n2->add_value(it->first, it->second);
+ n2->add_value(*it);
                         }
                         if (b1_area == b2_area)
                         {
                             if (n1->elements() > n2->elements())
                             {
- n2->add_value(it->first, it->second);
+ n2->add_value(*it);
                             }
                             else
                             {
- n1->add_value(it->first, it->second);
+ n1->add_value(*it);
                             }
                         }
                     }
@@ -582,8 +583,8 @@
 
                     /// enlarged boxes of each group
                     Box eb1, eb2;
- b1 = n1->compute_box();
- b2 = n2->compute_box();
+ b1 = n1->compute_box(m_translator);
+ b2 = n2->compute_box(m_translator);
 
                     /// areas
                     // awulkiew - areas types changed
@@ -635,10 +636,12 @@
     /**
      * \brief Choose initial values for the split algorithm (linear version)
      */
- void linear_pick_seeds(node_pointer const& n, unsigned int &seed1, unsigned int &seed2) const
+ // awulkiew - parameter changed from node_pointer to std::vector<Box>
+ void linear_pick_seeds(std::vector<Box> const& boxes, unsigned int &seed1, unsigned int &seed2) const
     {
         // get boxes from the node
- std::vector<Box>boxes = n->get_boxes();
+ // awulkiew - use of passed boxes instead of retrieving them second time
+ //std::vector<Box> boxes = n->get_boxes(m_translator);
         if (boxes.size() == 0)
         {
             // TODO: mloskot - throw ggl exception
@@ -797,14 +800,17 @@
         // refine the result
         for (typename node_type::const_iterator it = nodes.begin(); it != nodes.end(); ++it)
         {
- typedef std::vector<std::pair<Box, Value> > leaves_type;
+ typedef std::vector<Value> leaves_type;
             leaves_type leaves = (*it)->get_leaves();
 
             for (typename leaves_type::const_iterator itl = leaves.begin();
                  itl != leaves.end(); ++itl)
             {
                 // awulkiew - operator== changed to geometry::equals
- if ( geometry::equals(itl->first, e) )
+ // TODO - implement object specific equals() function
+ Box b;
+ detail::convert_to_box(m_translator(*itl), b);
+ if ( geometry::equals(b, e) )
                 {
                     return *it;
                 }

Modified: sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/rtree_leaf.hpp
==============================================================================
--- sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/rtree_leaf.hpp (original)
+++ sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/rtree_leaf.hpp 2011-02-19 06:19:08 EST (Sat, 19 Feb 2011)
@@ -21,23 +21,24 @@
 #include <boost/geometry/algorithms/area.hpp>
 #include <boost/geometry/algorithms/assign.hpp>
 #include <boost/geometry/algorithms/combine.hpp>
+#include <boost/geometry/algorithms/intersects.hpp>
 
 #include <boost/geometry/extensions/index/rtree/rtree_node.hpp>
 
 namespace boost { namespace geometry { namespace index
 {
 
-template <typename Box, typename Value, typename Translator>
-class rtree_leaf : public rtree_node<Box, Value, Translator>
+template <typename Value, typename Translator, typename Box>
+class rtree_leaf : public rtree_node<Value, Translator, Box>
 {
 public:
 
     // awulkiew - typedef added
- typedef rtree_node<Box, Value, Translator> rtree_node;
+ typedef rtree_node<Value, Translator, Box> rtree_node;
 
     /// container type for the leaves
     typedef boost::shared_ptr<rtree_node> node_pointer;
- typedef std::vector<std::pair<Box, Value> > leaf_map;
+ typedef std::vector<Value> leaf_map;
 
     /**
      * \brief Creates an empty leaf
@@ -59,32 +60,37 @@
      * If exact_match is true only return the elements having as
      * key the 'box'. Otherwise return everything inside 'box'.
      */
- virtual void find(Box const& box, std::deque<Value>& result, bool const exact_match)
+ // awulkiew - exact match case removed
+ virtual void find(Box const& box, std::deque<Value>& result, Translator const& tr)
     {
         for (typename leaf_map::const_iterator it = m_nodes.begin();
              it != m_nodes.end(); ++it)
         {
- if (exact_match)
- {
- if (geometry::equals(it->first, box))
- {
- result.push_back(it->second);
- }
- }
- else
+ // awulkiew - commented
+ //if (exact_match)
+ //{
+ // if (geometry::equals(it->first, box))
+ // {
+ // result.push_back(it->second);
+ // }
+ //}
+ //else
+ //{
+
+ // awulkiew - is_overlapping changed to geometry::intersects
+ if (geometry::intersects(tr(*it), box))
             {
- if (is_overlapping(it->first, box))
- {
- result.push_back(it->second);
- }
+ result.push_back(*it);
             }
+
+ //}
         }
     }
 
     /**
      * \brief Compute bounding box for this leaf
      */
- virtual Box compute_box() const
+ virtual Box compute_box(Translator const& tr) const
     {
         if (m_nodes.empty())
         {
@@ -95,7 +101,7 @@
         geometry::assign_inverse(r);
         for(typename leaf_map::const_iterator it = m_nodes.begin(); it != m_nodes.end(); ++it)
         {
- geometry::combine(r, it->first);
+ geometry::combine(r, tr(*it));
         }
         return r;
     }
@@ -119,15 +125,15 @@
     /**
      * \brief Insert a new element, with key 'box' and value 'v'
      */
- virtual void insert(Box const& box, Value const& v)
+ virtual void insert(Value const& v)
     {
- m_nodes.push_back(std::make_pair(box, v));
+ m_nodes.push_back(v);
     }
 
     /**
      * \brief Proyect leaves of this node.
      */
- virtual std::vector< std::pair<Box, Value> > get_leaves() const
+ virtual std::vector<Value> get_leaves() const
     {
         return m_nodes;
     }
@@ -144,39 +150,46 @@
     /**
      * \brief Add a new leaf to this node
      */
- virtual void add_value(Box const& box, Value const& v)
+ virtual void add_value(Value const& v)
     {
- m_nodes.push_back(std::make_pair(box, v));
+ m_nodes.push_back(v);
     }
 
-
     /**
      * \brief Proyect value in position 'index' in the nodes container
      */
     virtual Value get_value(unsigned int index) const
     {
- return m_nodes[index].second;
+ return m_nodes[index];
     }
 
     /**
      * \brief Box projector for leaf
      */
- virtual Box get_box(unsigned int index) const
- {
- return m_nodes[index].first;
- }
+ // awulkiew - commented, not used
+ //virtual Box get_box(unsigned int index, Translator const& tr) const
+ //{
+ // // TODO: awulkiew - get_bounding_object - add object specific behaviour
+ // // or just base on get_value
+ // Box box;
+ // detail::convert_to_box(tr(m_nodes[index]), box);
+ // return box;
+ //}
 
     /**
      * \brief Remove value with key 'box' in this leaf
      */
     // awulkiew - name changed to avoid ambiguity (Value may be of type Box)
- virtual void remove_in(Box const& box)
+ virtual void remove_in(Box const& box, Translator const& tr)
     {
 
         for (typename leaf_map::iterator it = m_nodes.begin();
              it != m_nodes.end(); ++it)
         {
- if (geometry::equals(it->first, box))
+ // TODO - awulkiew - implement object specific equals() function
+ Box b;
+ detail::convert_to_box(tr(*it), b);
+ if (geometry::equals(b, box))
             {
                 m_nodes.erase(it);
                 return;
@@ -196,7 +209,7 @@
              it != m_nodes.end(); ++it)
         {
             // awulkiew - use of translator
- if ( tr.equals(it->second, v) )
+ if ( tr.equals(*it, v) )
             {
                 m_nodes.erase(it);
                 return;
@@ -210,13 +223,17 @@
     /**
     * \brief Proyect boxes from this node
     */
- virtual std::vector<Box> get_boxes() const
+ virtual std::vector<Box> get_boxes(Translator const& tr) const
     {
         std::vector<Box> result;
         for (typename leaf_map::const_iterator it = m_nodes.begin();
              it != m_nodes.end(); ++it)
         {
- result.push_back(it->first);
+ // TODO: awulkiew - implement object specific behaviour - get_bounding_objects(get boxes or points)
+ Box box;
+ detail::convert_to_box(tr(*it), box);
+
+ result.push_back(box);
         }
 
         return result;
@@ -225,20 +242,24 @@
     /**
     * \brief Print leaf (mainly for debug)
     */
- virtual void print() const
+ virtual void print(Translator const& tr) const
     {
         std::cerr << "\t" << " --> Leaf --------" << std::endl;
         std::cerr << "\t" << " Size: " << m_nodes.size() << std::endl;
         for (typename leaf_map::const_iterator it = m_nodes.begin();
              it != m_nodes.end(); ++it)
         {
+ // TODO: awulkiew - implement object specific behaviour - display boxes or points
+ Box box;
+ detail::convert_to_box(tr(*it), box);
+
             std::cerr << "\t" << " | ";
             std::cerr << "( " << geometry::get<min_corner, 0>
- (it->first) << " , " << geometry::get<min_corner, 1>
- (it->first) << " ) x ";
+ (box) << " , " << geometry::get<min_corner, 1>
+ (box) << " ) x ";
             std::cerr << "( " << geometry::get<max_corner, 0>
- (it->first) << " , " << geometry::get<max_corner, 1>
- (it->first) << " )";
+ (box) << " , " << geometry::get<max_corner, 1>
+ (box) << " )";
             // awulkiew - commented
             //std::cerr << " -> ";
             //std::cerr << it->second;

Modified: sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/rtree_node.hpp
==============================================================================
--- sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/rtree_node.hpp (original)
+++ sandbox-branches/geometry/index_080/boost/geometry/extensions/index/rtree/rtree_node.hpp 2011-02-19 06:19:08 EST (Sat, 19 Feb 2011)
@@ -28,16 +28,16 @@
 namespace boost { namespace geometry { namespace index {
 
 /// forward declaration
-template <typename Box, typename Value, typename Translator>
+template <typename Value, typename Translator, typename Box>
 class rtree_leaf;
 
-template <typename Box, typename Value, typename Translator>
+template <typename Value, typename Translator, typename Box>
 class rtree_node
 {
 public:
 
- typedef boost::shared_ptr<rtree_node<Box, Value, Translator> > node_pointer;
- typedef boost::shared_ptr<rtree_leaf<Box, Value, Translator> > leaf_pointer;
+ typedef boost::shared_ptr<rtree_node<Value, Translator, Box> > node_pointer;
+ typedef boost::shared_ptr<rtree_leaf<Value, Translator, Box> > leaf_pointer;
 
     /// type for the node map
     typedef std::vector<std::pair<Box, node_pointer > > node_map;
@@ -114,14 +114,15 @@
      * If exact_match is true only return the elements having as
      * key the box 'box'. Otherwise return everything inside 'box'.
      */
- virtual void find(Box const& box, std::deque<Value>& result, bool const exact_match)
+ virtual void find(Box const& box, std::deque<Value>& result, bool const exact_match, Translator const& tr)
     {
         for (typename node_map::const_iterator it = m_nodes.begin();
              it != m_nodes.end(); ++it)
         {
- if (is_overlapping(it->first, box))
+ // awulkiew - is_overlapping changed to geometry::intersects
+ if (geometry::intersects(it->first, box))
             {
- it->second->find(box, result, exact_match);
+ it->second->find(box, result, exact_match, tr);
             }
         }
     }
@@ -134,7 +135,8 @@
         for (typename node_map::const_iterator it = m_nodes.begin();
              it != m_nodes.end(); ++it)
         {
- if (is_overlapping(it->first, box))
+ // awulkiew - is_overlapping changed to geometry::intersects
+ if (geometry::intersects(it->first, box))
             {
                 if (it->second->is_leaf())
                 {
@@ -151,7 +153,7 @@
     /**
     * \brief Compute bounding box for this node
     */
- virtual Box compute_box() const
+ virtual Box compute_box(Translator const&) const
     {
         if (m_nodes.empty())
         {
@@ -171,7 +173,7 @@
     /**
      * \brief Insert a value (not allowed for a node, only on leaves)
      */
- virtual void insert(Box const&, Value const&)
+ virtual void insert(Value const&)
     {
         // TODO: mloskot - define & use GGL exception
         throw std::logic_error("Insert in node!");
@@ -180,7 +182,7 @@
     /**
      * \brief Get the envelopes of a node
      */
- virtual std::vector<Box> get_boxes() const
+ virtual std::vector<Box> get_boxes(Translator const&) const
     {
         std::vector<Box> result;
         for(typename node_map::const_iterator it = m_nodes.begin(); it != m_nodes.end(); ++it)
@@ -193,7 +195,7 @@
     /**
      * \brief Recompute the bounding box
      */
- void adjust_box(node_pointer const& node)
+ void adjust_box(node_pointer const& node, Translator const& tr)
     {
         unsigned int index = 0;
         for (typename node_map::iterator it = m_nodes.begin();
@@ -201,7 +203,7 @@
         {
             if (it->second.get() == node.get())
             {
- m_nodes[index] = std::make_pair(node->compute_box(), node);
+ m_nodes[index] = std::make_pair(node->compute_box(tr), node);
                 return;
             }
         }
@@ -211,7 +213,7 @@
      * \brief Remove elements inside the 'box'
      */
     // awulkiew - name changed to avoid ambiguity (Value may be of type Box)
- virtual void remove_in(Box const& box)
+ virtual void remove_in(Box const& box, Translator const&)
     {
         for (typename node_map::iterator it = m_nodes.begin();
              it != m_nodes.end(); ++it)
@@ -236,14 +238,14 @@
     /**
      * \brief Replace the node in the m_nodes vector and recompute the box
      */
- void replace_node(node_pointer const& leaf, node_pointer& new_leaf)
+ void replace_node(node_pointer const& leaf, node_pointer& new_leaf, Translator const& tr)
     {
         unsigned int index = 0;
         for(typename node_map::iterator it = m_nodes.begin(); it != m_nodes.end(); ++it, index++)
         {
             if (it->second.get() == leaf.get())
             {
- m_nodes[index] = std::make_pair(new_leaf->compute_box(), new_leaf);
+ m_nodes[index] = std::make_pair(new_leaf->compute_box(tr), new_leaf);
                 new_leaf->update_parent(new_leaf);
                 return;
             }
@@ -265,7 +267,7 @@
     /**
      * \brief add a value (not allowed in nodes, only on leaves)
      */
- virtual void add_value(Box const&, Value const&)
+ virtual void add_value(Value const&)
     {
         // TODO: mloskot - define & use GGL exception
         throw std::logic_error("Can't add value to non-leaf node.");
@@ -386,14 +388,16 @@
     /**
      * \brief Box projector for node 'index'
      */
- virtual Box get_box(unsigned int index) const
+ // awulkiew - commented, not used
+ /*virtual Box get_box(unsigned int index, Translator const& tr) const
     {
         return m_nodes[index].first;
- }
+ }*/
 
     /**
      * \brief Box projector for node pointed by 'leaf'
      */
+ // awulkiew - virtual keyword not needed
     virtual Box get_box(node_pointer const& leaf) const
     {
         for (typename node_map::const_iterator it = m_nodes.begin();
@@ -420,9 +424,9 @@
     /**
     * \brief Get leaves for a node
     */
- virtual std::vector<std::pair<Box, Value> > get_leaves() const
+ virtual std::vector<Value> get_leaves() const
     {
- typedef std::vector<std::pair<Box, Value> > leaf_type;
+ typedef std::vector<Value> leaf_type;
         leaf_type leaf;
 
         for (typename node_map::const_iterator it = m_nodes.begin();
@@ -443,7 +447,7 @@
     /**
      * \brief Print Rtree subtree (mainly for debug)
      */
- virtual void print() const
+ virtual void print(Translator const& tr) const
     {
         std::cerr << " --> Node --------" << std::endl;
         std::cerr << " Address: " << this << std::endl;
@@ -471,7 +475,7 @@
         for (typename node_map::const_iterator it = m_nodes.begin();
              it != m_nodes.end(); ++it)
         {
- it->second->print();
+ it->second->print(tr);
         }
     }
 

Modified: sandbox-branches/geometry/index_080/tests/rtree_native.cpp
==============================================================================
--- sandbox-branches/geometry/index_080/tests/rtree_native.cpp (original)
+++ sandbox-branches/geometry/index_080/tests/rtree_native.cpp 2011-02-19 06:19:08 EST (Sat, 19 Feb 2011)
@@ -186,6 +186,19 @@
         t.print();
     }
 
+ {
+ typedef boost::geometry::model::point<float, 2, boost::geometry::cs::cartesian> P;
+ typedef boost::geometry::model::box<P> B;
+
+ boost::geometry::index::rtree<B>::rtree_leaf l;
+ boost::geometry::index::rtree<B>::rtree_node n;
+
+ std::cout << sizeof(boost::shared_ptr<int>) << '\n';
+ std::cout << sizeof(std::vector<int>) << '\n';
+ std::cout << sizeof(n) << '\n';
+ std::cout << sizeof(l) << '\n';
+ }
+
     // ERROR!
     // remove_in expects previously inserted box - it should remove all objects inside some bigger box
 


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