Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r70689 - in sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index: . rtree rtree/rstar rtree/visitors
From: adam.wulkiewicz_at_[hidden]
Date: 2011-03-28 20:34:10


Author: awulkiew
Date: 2011-03-28 20:34:09 EDT (Mon, 28 Mar 2011)
New Revision: 70689
URL: http://svn.boost.org/trac/boost/changeset/70689

Log:
rtree Box template parameter removed
Text files modified:
   sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/indexable.hpp | 4 ----
   sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/filters.hpp | 8 ++++----
   sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp | 34 +++++++++++++++++++++++++++++++++-
   sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rstar/split.hpp | 4 ++--
   sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rtree.hpp | 36 ++++++++++++++++++++----------------
   sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rtree_node.hpp | 8 ++++++--
   sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp | 12 +++++++-----
   sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/print.hpp | 22 +++++++---------------
   sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/rtree_are_boxes_ok.hpp | 8 ++++----
   9 files changed, 83 insertions(+), 53 deletions(-)

Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/indexable.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/indexable.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/indexable.hpp 2011-03-28 20:34:09 EDT (Mon, 28 Mar 2011)
@@ -140,8 +140,6 @@
 
 } // namespace dispatch
 
-namespace detail {
-
 template <size_t Corner, size_t DimensionIndex, typename Indexable>
 typename traits::coordinate_type<Indexable>::type get(Indexable const& i)
 {
@@ -153,8 +151,6 @@
>::get(i);
 }
 
-} // namespace detail
-
 }}} // namespace boost::geometry::index
 
 #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_INDEXABLE_HPP

Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/filters.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/filters.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/filters.hpp 2011-03-28 20:34:09 EDT (Mon, 28 Mar 2011)
@@ -18,20 +18,20 @@
 
 namespace boost { namespace geometry { namespace index {
 
-template <typename Value, typename Translator, typename Box, typename Tag>
+template <typename Value, typename Translator, typename Tag>
 class rtree;
 
 namespace filters {
 
-template <typename Value, typename Translator, typename Box, typename Tag>
-class spatial_filter< index::rtree<Value, Translator, Box, Tag> >
+template <typename Value, typename Translator, typename Tag>
+class spatial_filter< index::rtree<Value, Translator, Tag> >
 {
 public:
     typedef typename std::vector<Value>::iterator iterator;
     typedef typename std::vector<Value>::const_iterator const_iterator;
 
     template <typename Geometry>
- spatial_filter(index::rtree<Value, Translator, Box, Tag> const& rtree, Geometry const& geom)
+ spatial_filter(index::rtree<Value, Translator, Tag> const& rtree, Geometry const& geom)
     {
         m_result = rtree.find(geom);
     }

Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp 2011-03-28 20:34:09 EDT (Mon, 28 Mar 2011)
@@ -70,6 +70,38 @@
 //
 //};
 
+//template <typename ElIter, typename Translator>
+//typename index::area_result<
+// typename detail::rtree_element_indexable_type<
+// typename std::iterator_traits<ElIter>::value_type,
+// Translator
+// >::type
+//>::type calculate_elements_overlap(ElIter el, ElIter first, ElIter last, Translator const& tr)
+//{
+// typedef typename detail::rtree_element_indexable_type<
+// typename std::iterator_traits<ElIter>::value_type,
+// Translator
+// >::type box_type;
+// typedef typename index::area_result<box_type>::type area_type;
+//
+// area_type result = 0;
+//
+// for ( ; first != last ; ++first )
+// {
+// if ( first != el )
+// {
+// box_type inters;
+// geometry::assign_zero(inters);
+// geometry::intersection(
+// detail::rtree_element_indexable(*first, tr),
+// detail::rtree_element_indexable(*el, tr),
+// inters);
+// result += index::area(inters);
+// }
+// }
+// return result;
+//}
+
 // TODO: awulkiew - wrong algorithm? Should branch check be applied to Leafs?
 // TODO: awulkiew - further optimization: don't calculate area with the overlap, calculate it only if
 // overlap < smallest_overlap (and current area must be stored) OR
@@ -130,7 +162,7 @@
 
     struct branch_areas
     {
- typedef typename area_result<Box>::type area_type;
+ typedef typename index::area_result<Box>::type area_type;
 
         template <typename Indexable>
         inline branch_areas(children_type const& ch, typename children_type::iterator const& k_it, Indexable const& indexable)

Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rstar/split.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rstar/split.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rstar/split.hpp 2011-03-28 20:34:09 EDT (Mon, 28 Mar 2011)
@@ -41,11 +41,11 @@
     inline bool operator()(element_type const& e1, element_type const e2) const
     {
         return
- index::detail::get<Corner, AxisIndex>(
+ index::get<Corner, AxisIndex>(
                 index::detail::rtree_element_indexable(e1, m_tr)
             )
             <
- index::detail::get<Corner, AxisIndex>(
+ index::get<Corner, AxisIndex>(
                 index::detail::rtree_element_indexable(e2, m_tr)
             );
     }

Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rtree.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rtree.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rtree.hpp 2011-03-28 20:34:09 EDT (Mon, 28 Mar 2011)
@@ -27,21 +27,25 @@
 template <
     typename Value,
     typename Translator = default_parameter,
- typename Box = default_parameter,
     typename Tag = rtree_rstar_tag
>
 class rtree
 {
 public:
     typedef Value value_type;
- typedef typename detail::default_translator_type<Value, Translator>::type translator_type;
- typedef typename detail::default_box_type<typename translator_type::indexable_type, Box>::type box_type;
-
- typedef typename detail::rtree_node<Value, box_type, rtree_rstar_tag>::type node;
- typedef typename detail::rtree_internal_node<Value, box_type, rtree_rstar_tag>::type internal_node;
- typedef typename detail::rtree_leaf<Value, box_type, rtree_rstar_tag>::type leaf;
-
- inline explicit rtree(size_t max_elems_per_node = 2, size_t min_elems_per_node = 1, translator_type const& translator = translator_type())
+ typedef typename detail::default_translator_type<value_type, Translator>::type translator_type;
+ typedef typename detail::geometry_box_type<typename translator_type::indexable_type>::type box_type;
+ typedef Tag tag_type;
+
+ typedef typename detail::rtree_node<value_type, box_type, tag_type>::type node;
+ typedef typename detail::rtree_internal_node<value_type, box_type, tag_type>::type internal_node;
+ typedef typename detail::rtree_leaf<value_type, box_type, tag_type>::type leaf;
+
+ inline explicit rtree(
+ size_t max_elems_per_node = 2,
+ size_t min_elems_per_node = 1,
+ translator_type const& translator = translator_type()
+ )
         : m_values_count(0)
         , m_max_elems_per_node(max_elems_per_node)
         , m_min_elems_per_node(min_elems_per_node)
@@ -58,21 +62,21 @@
 
     ~rtree()
     {
- visitors::rtree_delete<Value, translator_type, box_type, Tag> del_v;
+ visitors::rtree_delete<value_type, translator_type, box_type, tag_type> del_v;
         boost::apply_visitor(del_v, *m_root);
     }
 
     template <typename Geometry>
- inline std::vector<Value> find(Geometry const& geom) const
+ inline std::vector<value_type> find(Geometry const& geom) const
     {
- visitors::rtree_find<Value, translator_type, box_type, Tag, Geometry> find_v(geom, m_translator);
+ visitors::rtree_find<value_type, translator_type, box_type, tag_type, Geometry> find_v(geom, m_translator);
         boost::apply_visitor(find_v, *m_root);
         return find_v.result;
     }
 
- void insert(Value const& value)
+ void insert(value_type const& value)
     {
- visitors::rtree_insert<Value, translator_type, box_type, Tag>
+ visitors::rtree_insert<value_type, translator_type, box_type, tag_type>
             insert_v(m_root, value, m_min_elems_per_node, m_max_elems_per_node, m_translator);
 
         boost::apply_visitor(insert_v, *m_root);
@@ -104,8 +108,8 @@
     translator_type m_translator;
 };
 
-template <typename Value, typename Translator, typename Box, typename Tag>
-void insert(rtree<Value, Translator, Box, Tag> & tree, Value const& v)
+template <typename Value, typename Translator, typename Tag>
+void insert(rtree<Value, Translator, Tag> & tree, Value const& v)
 {
     tree.insert(v);
 }

Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rtree_node.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rtree_node.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rtree_node.hpp 2011-03-28 20:34:09 EDT (Mon, 28 Mar 2011)
@@ -159,10 +159,14 @@
 template <typename Box, typename FwdIter, typename Translator>
 inline Box rtree_elements_box(FwdIter first, FwdIter last, Translator const& tr)
 {
- assert(first != last);
-
     Box result;
 
+ if (first == last)
+ {
+ geometry::assign_zero(result);
+ return result;
+ }
+
     geometry::convert(index::detail::rtree_element_indexable(*first, tr), result);
     ++first;
 

Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp 2011-03-28 20:34:09 EDT (Mon, 28 Mar 2011)
@@ -163,15 +163,17 @@
 
 } // namespace visitors
 
-template <typename Value, typename Translator, typename Box, typename Tag>
-void gl_draw(rtree<Value, Translator, Box, Tag> const& tree)
+template <typename Value, typename Translator, typename Tag>
+void gl_draw(rtree<Value, Translator, Tag> const& tree)
 {
- typedef typename rtree<Value, Translator, Box, Tag>::translator_type translator_type;
- typedef typename rtree<Value, Translator, Box, Tag>::box_type box_type;
+ typedef typename rtree<Value, Translator, Tag>::value_type value_type;
+ typedef typename rtree<Value, Translator, Tag>::translator_type translator_type;
+ typedef typename rtree<Value, Translator, Tag>::box_type box_type;
+ typedef typename rtree<Value, Translator, Tag>::tag_type tag_type;
 
     glClear(GL_COLOR_BUFFER_BIT);
 
- visitors::rtree_gl_draw<Value, translator_type, box_type, Tag> gl_draw_v(tree.get_translator());
+ visitors::rtree_gl_draw<value_type, translator_type, box_type, tag_type> gl_draw_v(tree.get_translator());
     tree.apply_visitor(gl_draw_v);
 
     glFlush();

Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/print.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/print.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/print.hpp 2011-03-28 20:34:09 EDT (Mon, 28 Mar 2011)
@@ -179,22 +179,14 @@
 
 } // namespace visitors
 
-template <typename Value, typename Translator, typename Box, typename Tag>
-std::ostream & print(rtree<Value, Translator, Box, Tag> const& tree, std::ostream & os = std::cout)
+template <typename Value, typename Translator, typename Tag>
+std::ostream & operator<<(std::ostream & os, rtree<Value, Translator, Tag> const& tree)
 {
- typedef typename rtree<Value, Translator, Box, Tag>::translator_type translator_type;
- typedef typename rtree<Value, Translator, Box, Tag>::box_type box_type;
- visitors::rtree_print<Value, translator_type, box_type, Tag> print_v(os, tree.get_translator());
- tree.apply_visitor(print_v);
- return os;
-}
-
-template <typename Value, typename Translator, typename Box, typename Tag>
-std::ostream & operator<<(std::ostream & os, rtree<Value, Translator, Box, Tag> const& tree)
-{
- typedef typename rtree<Value, Translator, Box, Tag>::translator_type translator_type;
- typedef typename rtree<Value, Translator, Box, Tag>::box_type box_type;
- visitors::rtree_print<Value, translator_type, box_type, Tag> print_v(os, tree.get_translator());
+ typedef typename rtree<Value, Translator, Tag>::value_type value_type;
+ typedef typename rtree<Value, Translator, Tag>::translator_type translator_type;
+ typedef typename rtree<Value, Translator, Tag>::box_type box_type;
+ typedef typename rtree<Value, Translator, Tag>::tag_type tag_type;
+ visitors::rtree_print<value_type, translator_type, box_type, tag_type> print_v(os, tree.get_translator());
     tree.apply_visitor(print_v);
     return os;
 }

Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/rtree_are_boxes_ok.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/rtree_are_boxes_ok.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/rtree_are_boxes_ok.hpp 2011-03-28 20:34:09 EDT (Mon, 28 Mar 2011)
@@ -85,15 +85,15 @@
 
 } // namespace visitors
 
-template <typename Value, typename Translator, typename Box, typename Tag>
-bool rtree_are_boxes_ok(rtree<Value, Translator, Box, Tag> const& tree)
+template <typename Value, typename Translator, typename Tag>
+bool rtree_are_boxes_ok(rtree<Value, Translator, Tag> const& tree)
 {
- typedef rtree<Value, Translator, Box, Tag> rt;
+ typedef rtree<Value, Translator, Tag> rt;
     visitors::rtree_are_boxes_ok<
         typename rt::value_type,
         typename rt::translator_type,
         typename rt::box_type,
- Tag> v(tree.get_translator());
+ typename rt::tag_type> v(tree.get_translator());
     
     return 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