Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73027 - in sandbox-branches/geometry/index: boost/geometry/extensions/index/algorithms boost/geometry/extensions/index/rtree boost/geometry/extensions/index/rtree/linear boost/geometry/extensions/index/rtree/quadratic boost/geometry/extensions/index/rtree/rstar boost/geometry/extensions/index/rtree/visitors tests
From: adam.wulkiewicz_at_[hidden]
Date: 2011-07-12 21:27:32


Author: awulkiew
Date: 2011-07-12 21:27:30 EDT (Tue, 12 Jul 2011)
New Revision: 73027
URL: http://svn.boost.org/trac/boost/changeset/73027

Log:
area-related names changed to content-related names. index::within parameters sequence corrected to match the geometry::within parameters sequence.
Added:
   sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/content.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/intersection_content.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/union_content.hpp (contents, props changed)
Removed:
   sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/area.hpp
   sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/intersection_area.hpp
   sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/union_area.hpp
Text files modified:
   sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/overlap.hpp | 4
   sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/within.hpp | 30 ++++++------
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp | 38 +++++++---------
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/options.hpp | 6 +-
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp | 68 +++++++++++++++---------------
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp | 64 ++++++++++++++--------------
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/insert.hpp | 13 ++---
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp | 86 ++++++++++++++++++++--------------------
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rtree.hpp | 6 +
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/find.hpp | 2
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/insert.hpp | 24 +++++-----
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/remove.hpp | 2
   sandbox-branches/geometry/index/tests/additional_sizes_and_times.cpp | 22 ---------
   13 files changed, 170 insertions(+), 195 deletions(-)

Deleted: sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/area.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/area.hpp 2011-07-12 21:27:30 EDT (Tue, 12 Jul 2011)
+++ (empty file)
@@ -1,86 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-//
-// Boost.SpatialIndex - n-dimensional box's area/volume
-//
-// Copyright 2011 Adam Wulkiewicz.
-// Use, modification and distribution is subject to 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)
-
-#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_AREA_HPP
-#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_AREA_HPP
-
-namespace boost { namespace geometry { namespace index {
-
-template <typename Indexable>
-struct default_area_result
-{
- typedef typename select_most_precise<
- typename traits::coordinate_type<Indexable>::type,
- long double
- >::type type;
-};
-
-namespace detail {
-
-template <typename Box, size_t CurrentDimension>
-struct area_for_each_dimension
-{
- BOOST_STATIC_ASSERT(0 < CurrentDimension);
- BOOST_STATIC_ASSERT(CurrentDimension <= traits::dimension<Box>::value);
-
- static inline typename default_area_result<Box>::type apply(Box const& b)
- {
- return area_for_each_dimension<Box, CurrentDimension - 1>::apply(b) *
- ( index::get<max_corner, CurrentDimension - 1>(b) - index::get<min_corner, CurrentDimension - 1>(b) );
- }
-};
-
-template <typename Box>
-struct area_for_each_dimension<Box, 1>
-{
- static inline typename default_area_result<Box>::type apply(Box const& b)
- {
- return index::get<max_corner, 0>(b) - index::get<min_corner, 0>(b);
- }
-};
-
-} // namespace detail
-
-namespace dispatch {
-
-template <typename Indexable, typename Tag>
-struct area
-{
- // TODO: awulkiew - static assert?
-};
-
-template <typename Indexable>
-struct area<Indexable, point_tag>
-{
- static typename default_area_result<Indexable>::type apply(Indexable const&)
- {
- return 0;
- }
-};
-
-template <typename Indexable>
-struct area<Indexable, box_tag>
-{
- static typename default_area_result<Indexable>::type apply(Indexable const& b)
- {
- return detail::area_for_each_dimension<Indexable, traits::dimension<Indexable>::value>::apply(b);
- }
-};
-
-} // namespace dispatch
-
-template <typename Indexable>
-typename default_area_result<Indexable>::type area(Indexable const& b)
-{
- return dispatch::area<Indexable, typename index::traits::tag<Indexable>::type>::apply(b);
-}
-
-}}} // namespace boost::geometry::index
-
-#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_AREA_HPP

Added: sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/content.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/content.hpp 2011-07-12 21:27:30 EDT (Tue, 12 Jul 2011)
@@ -0,0 +1,86 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Boost.SpatialIndex - n-dimensional box's content (2d-area/3d-volume/...)
+//
+// Copyright 2011 Adam Wulkiewicz.
+// Use, modification and distribution is subject to 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)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_CONTENT_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_CONTENT_HPP
+
+namespace boost { namespace geometry { namespace index {
+
+template <typename Indexable>
+struct default_content_result
+{
+ typedef typename select_most_precise<
+ typename traits::coordinate_type<Indexable>::type,
+ long double
+ >::type type;
+};
+
+namespace detail {
+
+template <typename Box, size_t CurrentDimension>
+struct content_for_each_dimension
+{
+ BOOST_STATIC_ASSERT(0 < CurrentDimension);
+ BOOST_STATIC_ASSERT(CurrentDimension <= traits::dimension<Box>::value);
+
+ static inline typename default_content_result<Box>::type apply(Box const& b)
+ {
+ return content_for_each_dimension<Box, CurrentDimension - 1>::apply(b) *
+ ( index::get<max_corner, CurrentDimension - 1>(b) - index::get<min_corner, CurrentDimension - 1>(b) );
+ }
+};
+
+template <typename Box>
+struct content_for_each_dimension<Box, 1>
+{
+ static inline typename default_area_result<Box>::type apply(Box const& b)
+ {
+ return index::get<max_corner, 0>(b) - index::get<min_corner, 0>(b);
+ }
+};
+
+} // namespace detail
+
+namespace dispatch {
+
+template <typename Indexable, typename Tag>
+struct content
+{
+ // TODO: awulkiew - static assert?
+};
+
+template <typename Indexable>
+struct content<Indexable, point_tag>
+{
+ static typename default_content_result<Indexable>::type apply(Indexable const&)
+ {
+ return 0;
+ }
+};
+
+template <typename Indexable>
+struct content<Indexable, box_tag>
+{
+ static typename default_content_result<Indexable>::type apply(Indexable const& b)
+ {
+ return detail::content_for_each_dimension<Indexable, traits::dimension<Indexable>::value>::apply(b);
+ }
+};
+
+} // namespace dispatch
+
+template <typename Indexable>
+typename default_content_result<Indexable>::type content(Indexable const& b)
+{
+ return dispatch::content<Indexable, typename index::traits::tag<Indexable>::type>::apply(b);
+}
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_CONTENT_HPP

Deleted: sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/intersection_area.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/intersection_area.hpp 2011-07-12 21:27:30 EDT (Tue, 12 Jul 2011)
+++ (empty file)
@@ -1,36 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-//
-// Boost.SpatialIndex - boxes union/intersection area/volume
-//
-// Copyright 2011 Adam Wulkiewicz.
-// Use, modification and distribution is subject to 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)
-
-#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_INTERSECTION_AREA_HPP
-#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_INTERSECTION_AREA_HPP
-
-#include <boost/geometry/algorithms/intersection.hpp>
-#include <boost/geometry/extensions/index/algorithms/area.hpp>
-
-namespace boost { namespace geometry { namespace index {
-
-/**
- * \brief Compute the area of the intersection of b1 and b2
- */
-template <typename Box>
-inline typename default_area_result<Box>::type intersection_area(Box const& box1, Box const& box2)
-{
- typename default_area_result<Box>::type result = 0;
- if ( geometry::intersects(box1, box2) )
- {
- Box box_intersection;
- geometry::intersection(box1, box2, box_intersection);
- result = index::area(box_intersection);
- }
- return result;
-}
-
-}}} // namespace boost::geometry::index
-
-#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_INTERSECTION_AREA_HPP

Added: sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/intersection_content.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/intersection_content.hpp 2011-07-12 21:27:30 EDT (Tue, 12 Jul 2011)
@@ -0,0 +1,36 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Boost.SpatialIndex - boxes union/intersection area/volume
+//
+// Copyright 2011 Adam Wulkiewicz.
+// Use, modification and distribution is subject to 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)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_INTERSECTION_CONTENT_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_INTERSECTION_CONTENT_HPP
+
+#include <boost/geometry/algorithms/intersection.hpp>
+#include <boost/geometry/extensions/index/algorithms/content.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+/**
+ * \brief Compute the area of the intersection of b1 and b2
+ */
+template <typename Box>
+inline typename default_content_result<Box>::type intersection_content(Box const& box1, Box const& box2)
+{
+ typename default_content_result<Box>::type result = 0;
+ if ( geometry::intersects(box1, box2) )
+ {
+ Box box_intersection;
+ geometry::intersection(box1, box2, box_intersection);
+ result = index::content(box_intersection);
+ }
+ return result;
+}
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_INTERSECTION_CONTENT_HPP

Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/overlap.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/overlap.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/overlap.hpp 2011-07-12 21:27:30 EDT (Tue, 12 Jul 2011)
@@ -11,7 +11,7 @@
 #define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_OVERLAP_HPP
 
 #include <boost/geometry/algorithms/intersection.hpp>
-#include <boost/geometry/extensions/index/algorithms/area.hpp>
+#include <boost/geometry/extensions/index/algorithms/content.hpp>
 
 namespace boost { namespace geometry { namespace index {
 
@@ -27,7 +27,7 @@
     Box inters;
     geometry::assign_zero(inters);
     geometry::intersection(b1, b2, inters);
- return index::area(inters);
+ return index::content(inters);
 }
 
 }}} // namespace boost::geometry::index

Deleted: sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/union_area.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/union_area.hpp 2011-07-12 21:27:30 EDT (Tue, 12 Jul 2011)
+++ (empty file)
@@ -1,32 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-//
-// Boost.SpatialIndex - boxes union/sum area/volume
-//
-// Copyright 2008 Federico J. Fernandez.
-// Copyright 2011 Adam Wulkiewicz.
-// Use, modification and distribution is subject to 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)
-
-#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_UNION_AREA_HPP
-#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_UNION_AREA_HPP
-
-#include <boost/geometry/algorithms/expand.hpp>
-#include <boost/geometry/extensions/index/algorithms/area.hpp>
-
-namespace boost { namespace geometry { namespace index {
-
-/**
- * \brief Compute the area of the union of b1 and b2
- */
-template <typename Box, typename Geometry>
-inline typename default_area_result<Box>::type union_area(Box const& b, Geometry const& g)
-{
- Box expanded_box(b);
- geometry::expand(expanded_box, g);
- return index::area(expanded_box);
-}
-
-}}} // namespace boost::geometry::index
-
-#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_UNION_AREA_HPP

Added: sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/union_content.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/union_content.hpp 2011-07-12 21:27:30 EDT (Tue, 12 Jul 2011)
@@ -0,0 +1,32 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Boost.SpatialIndex - boxes union/sum area/volume
+//
+// Copyright 2008 Federico J. Fernandez.
+// Copyright 2011 Adam Wulkiewicz.
+// Use, modification and distribution is subject to 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)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_UNION_CONTENT_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_UNION_CONTENT_HPP
+
+#include <boost/geometry/algorithms/expand.hpp>
+#include <boost/geometry/extensions/index/algorithms/content.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+/**
+ * \brief Compute the area of the union of b1 and b2
+ */
+template <typename Box, typename Geometry>
+inline typename default_content_result<Box>::type union_content(Box const& b, Geometry const& g)
+{
+ Box expanded_box(b);
+ geometry::expand(expanded_box, g);
+ return index::content(expanded_box);
+}
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_UNION_CONTENT_HPP

Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/within.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/within.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/within.hpp 2011-07-12 21:27:30 EDT (Tue, 12 Jul 2011)
@@ -24,9 +24,9 @@
 struct within_compare<min_corner, DimensionIndex, Indexable, box_tag>
 {
     template <typename Box>
- static inline bool apply(Box const& b1, Indexable const& b2)
+ static inline bool apply(Indexable const& b1, Box const& b2)
     {
- return index::get<min_corner, DimensionIndex>(b1) <= index::get<min_corner, DimensionIndex>(b2);
+ return index::get<min_corner, DimensionIndex>(b2) <= index::get<min_corner, DimensionIndex>(b1);
     }
 };
 
@@ -34,9 +34,9 @@
 struct within_compare<max_corner, DimensionIndex, Indexable, box_tag>
 {
     template <typename Box>
- static inline bool apply(Box const& b1, Indexable const& b2)
+ static inline bool apply(Indexable const& b1, Box const& b2)
     {
- return index::get<max_corner, DimensionIndex>(b2) <= index::get<max_corner, DimensionIndex>(b1);
+ return index::get<max_corner, DimensionIndex>(b1) <= index::get<max_corner, DimensionIndex>(b2);
     }
 };
 
@@ -44,7 +44,7 @@
 struct within_compare<min_corner, DimensionIndex, Indexable, point_tag>
 {
     template <typename Box>
- static inline bool apply(Box const& b, Indexable const& p)
+ static inline bool apply(Indexable const& p, Box const& b)
     {
         return index::get<min_corner, DimensionIndex>(b) <= geometry::get<DimensionIndex>(p);
     }
@@ -54,7 +54,7 @@
 struct within_compare<max_corner, DimensionIndex, Indexable, point_tag>
 {
     template <typename Box>
- static inline bool apply(Box const& b, Indexable const& p)
+ static inline bool apply(Indexable const& p, Box const& b)
     {
         return geometry::get<DimensionIndex>(p) <= index::get<max_corner, DimensionIndex>(b);
     }
@@ -71,26 +71,26 @@
     BOOST_STATIC_ASSERT(CurrentDimension <= traits::dimension<Box>::value);
     BOOST_STATIC_ASSERT(traits::dimension<Indexable>::value == traits::dimension<Box>::value);
 
- static inline bool apply(Box const& b, Indexable const& i)
+ static inline bool apply(Indexable const& i, Box const& b)
     {
         return
             within_for_each_dimension<
                 Box,
                 Indexable,
                 CurrentDimension - 1
- >::apply(b, i) &&
+ >::apply(i, b) &&
             dispatch::within_compare<
                 min_corner,
                 CurrentDimension - 1,
                 Indexable,
                 typename traits::tag<Indexable>::type
- >::apply(b, i) &&
+ >::apply(i, b) &&
             dispatch::within_compare<
                 max_corner,
                 CurrentDimension - 1,
                 Indexable,
                 typename traits::tag<Indexable>::type
- >::apply(b, i);
+ >::apply(i, b);
     }
 };
 
@@ -100,7 +100,7 @@
     BOOST_STATIC_ASSERT(1 <= traits::dimension<Box>::value);
     BOOST_STATIC_ASSERT(traits::dimension<Indexable>::value == traits::dimension<Box>::value);
 
- static inline bool apply(Box const& b, Indexable const& i)
+ static inline bool apply(Indexable const& i, Box const& b)
     {
         return
             dispatch::within_compare<
@@ -108,22 +108,22 @@
                 0,
                 Indexable,
                 typename traits::tag<Indexable>::type
- >::apply(b, i) &&
+ >::apply(i, b) &&
             dispatch::within_compare<
                 max_corner,
                 0,
                 Indexable,
                 typename traits::tag<Indexable>::type
- >::apply(b, i);
+ >::apply(i, b);
     }
 };
 
 } // namespace detail
 
 template <typename Box, typename Indexable>
-bool within(Box const& box, Indexable const& i)
+bool within(Indexable const& i, Box const& box)
 {
- return detail::within_for_each_dimension<Box, Indexable, traits::dimension<Box>::value>::apply(box, i);
+ return detail::within_for_each_dimension<Box, Indexable, traits::dimension<Box>::value>::apply(i, box);
 }
 
 }}} // namespace boost::geometry::index

Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp 2011-07-12 21:27:30 EDT (Tue, 12 Jul 2011)
@@ -11,12 +11,8 @@
 #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_REDISTRIBUTE_ELEMENTS_HPP
 #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_REDISTRIBUTE_ELEMENTS_HPP
 
-#include <algorithm>
-
-#include <boost/tuple/tuple.hpp>
-
-#include <boost/geometry/extensions/index/algorithms/area.hpp>
-#include <boost/geometry/extensions/index/algorithms/union_area.hpp>
+#include <boost/geometry/extensions/index/algorithms/content.hpp>
+#include <boost/geometry/extensions/index/algorithms/union_content.hpp>
 
 #include <boost/geometry/extensions/index/rtree/node/node.hpp>
 #include <boost/geometry/extensions/index/rtree/visitors/insert.hpp>
@@ -192,7 +188,7 @@
         typedef typename elements_type::value_type element_type;
         typedef typename rtree::element_indexable_type<element_type, Translator>::type indexable_type;
         typedef typename index::traits::coordinate_type<indexable_type>::type coordinate_type;
- typedef typename index::default_area_result<Box>::type area_type;
+ typedef typename index::default_content_result<Box>::type content_type;
 
                 elements_type & elements1 = rtree::elements(n);
                 elements_type & elements2 = rtree::elements(second_node);
@@ -224,8 +220,8 @@
         geometry::convert(rtree::element_indexable(elements_copy[seed2], tr), box2);
 
         // initialize areas
- area_type area1 = index::area(box1);
- area_type area2 = index::area(box2);
+ content_type content1 = index::content(box1);
+ content_type content2 = index::content(box2);
 
         BOOST_STATIC_ASSERT(2 <= elements1_count);
         size_t remaining = elements1_count - 2;
@@ -244,13 +240,13 @@
                 {
                     elements1.push_back(elem);
                     geometry::expand(box1, indexable);
- area1 = index::area(box1);
+ content1 = index::content(box1);
                 }
                 else if ( elements2.size() + remaining <= parameters_type::min_elements )
                 {
                     elements2.push_back(elem);
                     geometry::expand(box2, indexable);
- area2 = index::area(box2);
+ content2 = index::content(box2);
                 }
                 // choose better node and insert element
                 else
@@ -260,26 +256,26 @@
                     Box enlarged_box2(box2);
                     geometry::expand(enlarged_box1, indexable);
                     geometry::expand(enlarged_box2, indexable);
- area_type enlarged_area1 = index::area(enlarged_box1);
- area_type enlarged_area2 = index::area(enlarged_box2);
+ content_type enlarged_content1 = index::content(enlarged_box1);
+ content_type enlarged_content2 = index::content(enlarged_box2);
 
- area_type area_increase1 = enlarged_area1 - area1;
- area_type area_increase2 = enlarged_area2 - area2;
+ content_type content_increase1 = enlarged_content1 - content1;
+ content_type content_increase2 = enlarged_content2 - content2;
 
- // choose group which box area have to be enlarged least or has smaller area or has fewer elements
- if ( area_increase1 < area_increase2 ||
- ( area_increase1 == area_increase2 && area1 < area2 ) ||
- ( area1 == area2 && elements1.size() <= elements2.size() ) )
+ // choose group which box content have to be enlarged least or has smaller content or has fewer elements
+ if ( content_increase1 < content_increase2 ||
+ ( content_increase1 == content_increase2 && content1 < content2 ) ||
+ ( content1 == content2 && elements1.size() <= elements2.size() ) )
                     {
                         elements1.push_back(elem);
                         box1 = enlarged_box1;
- area1 = enlarged_area1;
+ content1 = enlarged_content1;
                     }
                     else
                     {
                         elements2.push_back(elem);
                         box2 = enlarged_box2;
- area2 = enlarged_area2;
+ content2 = enlarged_content2;
                     }
                 }
                 

Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/options.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/options.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/options.hpp 2011-07-12 21:27:30 EDT (Tue, 12 Jul 2011)
@@ -17,7 +17,7 @@
 struct reinsert_tag {};
 
 // ChooseNextNodeTag
-struct choose_by_area_diff_tag {};
+struct choose_by_content_diff_tag {};
 struct choose_by_overlap_diff_tag {};
 
 // RedistributeTag
@@ -113,7 +113,7 @@
         typedef options::rtree<
                 linear<MaxElements, MinElements>,
                 insert_tag,
- choose_by_area_diff_tag,
+ choose_by_content_diff_tag,
                 linear_tag,
                 default_tag
> type;
@@ -125,7 +125,7 @@
         typedef options::rtree<
                 quadratic<MaxElements, MinElements>,
                 insert_tag,
- choose_by_area_diff_tag,
+ choose_by_content_diff_tag,
                 quadratic_tag,
                 default_tag
> type;

Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp 2011-07-12 21:27:30 EDT (Tue, 12 Jul 2011)
@@ -12,8 +12,8 @@
 
 #include <algorithm>
 
-#include <boost/geometry/extensions/index/algorithms/area.hpp>
-#include <boost/geometry/extensions/index/algorithms/union_area.hpp>
+#include <boost/geometry/extensions/index/algorithms/content.hpp>
+#include <boost/geometry/extensions/index/algorithms/union_content.hpp>
 
 #include <boost/geometry/extensions/index/rtree/node/node.hpp>
 #include <boost/geometry/extensions/index/rtree/visitors/insert.hpp>
@@ -34,7 +34,7 @@
     typedef typename rtree::element_indexable_type<element_type, Translator>::type indexable_type;
     typedef typename index::traits::coordinate_type<indexable_type>::type coordinate_type;
     typedef Box box_type;
- typedef typename index::default_area_result<box_type>::type area_type;
+ typedef typename index::default_content_result<box_type>::type content_type;
 
     static inline void apply(Elements const& elements,
                              Translator const& tr,
@@ -45,7 +45,7 @@
                 BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == elements_count, "wrong number of elements");
                 BOOST_STATIC_ASSERT(2 <= elements_count);
 
- area_type greatest_free_area = 0;
+ content_type greatest_free_content = 0;
         seed1 = 0;
         seed2 = 1;
 
@@ -60,11 +60,11 @@
                 geometry::convert(ind1, enlarged_box);
                 geometry::expand(enlarged_box, ind2);
 
- area_type free_area = index::area(enlarged_box) - index::area(ind1) - index::area(ind2);
+ content_type free_content = (index::content(enlarged_box) - index::content(ind1)) - index::content(ind2);
                 
- if ( greatest_free_area < free_area )
+ if ( greatest_free_content < free_content )
                 {
- greatest_free_area = free_area;
+ greatest_free_content = free_content;
                     seed1 = i;
                     seed2 = j;
                 }
@@ -84,7 +84,7 @@
     typedef typename rtree::internal_node<Value, parameters_type, Box, typename Options::node_tag>::type internal_node;
     typedef typename rtree::leaf<Value, parameters_type, Box, typename Options::node_tag>::type leaf;
 
- typedef typename index::default_area_result<Box>::type area_type;
+ typedef typename index::default_content_result<Box>::type content_type;
 
     template <typename Node>
     static inline void apply(Node & n,
@@ -140,8 +140,8 @@
         }
 
         // initialize areas
- area_type area1 = index::area(box1);
- area_type area2 = index::area(box2);
+ content_type content1 = index::content(box1);
+ content_type content2 = index::content(box2);
 
         size_t remaining = elements_copy.size();
 
@@ -168,15 +168,15 @@
             else
             {
                 // find element with minimum groups areas increses differences
- area_type area_increase1 = 0;
- area_type area_increase2 = 0;
+ content_type content_increase1 = 0;
+ content_type content_increase2 = 0;
                 el_it = pick_next(elements_copy.rbegin(), elements_copy.rend(),
- box1, box2, area1, area2, tr,
- area_increase1, area_increase2);
+ box1, box2, content1, content2, tr,
+ content_increase1, content_increase2);
 
- if ( area_increase1 < area_increase2 ||
- ( area_increase1 == area_increase2 && area1 < area2 ) ||
- ( area1 == area2 && elements1_count <= elements2_count ) )
+ if ( content_increase1 < content_increase2 ||
+ ( content_increase1 == content_increase2 && content1 < content2 ) ||
+ ( content1 == content2 && elements1_count <= elements2_count ) )
                 {
                     insert_into_group1 = true;
                 }
@@ -194,13 +194,13 @@
             {
                 elements1.push_back(elem);
                 geometry::expand(box1, indexable);
- area1 = index::area(box1);
+ content1 = index::content(box1);
             }
             else
             {
                 elements2.push_back(elem);
                 geometry::expand(box2, indexable);
- area2 = index::area(box2);
+ content2 = index::content(box2);
             }
 
                         BOOST_GEOMETRY_INDEX_ASSERT(!elements_copy.empty(), "expected more elements");
@@ -217,17 +217,17 @@
     template <typename It>
     static inline It pick_next(It first, It last,
                                Box const& box1, Box const& box2,
- area_type const& area1, area_type const& area2,
+ content_type const& content1, content_type const& content2,
                                Translator const& tr,
- area_type & out_area_increase1, area_type & out_area_increase2)
+ content_type & out_content_increase1, content_type & out_content_increase2)
     {
         typedef typename boost::iterator_value<It>::type element_type;
         typedef typename rtree::element_indexable_type<element_type, Translator>::type indexable_type;
 
- area_type greatest_area_incrase_diff = 0;
+ content_type greatest_content_incrase_diff = 0;
         It out_it = first;
- out_area_increase1 = 0;
- out_area_increase2 = 0;
+ out_content_increase1 = 0;
+ out_content_increase2 = 0;
         
         // find element with greatest difference between increased group's boxes areas
         for ( It el_it = first ; el_it != last ; ++el_it )
@@ -239,21 +239,21 @@
             Box enlarged_box2(box2);
             geometry::expand(enlarged_box1, indexable);
             geometry::expand(enlarged_box2, indexable);
- area_type enlarged_area1 = index::area(enlarged_box1);
- area_type enlarged_area2 = index::area(enlarged_box2);
+ content_type enlarged_content1 = index::content(enlarged_box1);
+ content_type enlarged_content2 = index::content(enlarged_box2);
 
- area_type area_incrase1 = (enlarged_area1 - area1);
- area_type area_incrase2 = (enlarged_area2 - area2);
+ content_type content_incrase1 = (enlarged_content1 - content1);
+ content_type content_incrase2 = (enlarged_content2 - content2);
 
- area_type area_incrase_diff = area_incrase1 < area_incrase2 ?
- area_incrase2 - area_incrase1 : area_incrase1 - area_incrase2;
+ content_type content_incrase_diff = content_incrase1 < content_incrase2 ?
+ content_incrase2 - content_incrase1 : content_incrase1 - content_incrase2;
 
- if ( greatest_area_incrase_diff < area_incrase_diff )
+ if ( greatest_content_incrase_diff < content_incrase_diff )
             {
- greatest_area_incrase_diff = area_incrase_diff;
+ greatest_content_incrase_diff = content_incrase_diff;
                 out_it = el_it;
- out_area_increase1 = area_incrase1;
- out_area_increase2 = area_incrase2;
+ out_content_increase1 = content_incrase1;
+ out_content_increase2 = content_incrase2;
             }
         }
 

Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp 2011-07-12 21:27:30 EDT (Tue, 12 Jul 2011)
@@ -14,9 +14,9 @@
 
 #include <boost/geometry/algorithms/expand.hpp>
 
-#include <boost/geometry/extensions/index/algorithms/area.hpp>
+#include <boost/geometry/extensions/index/algorithms/content.hpp>
 #include <boost/geometry/extensions/index/algorithms/overlap.hpp>
-#include <boost/geometry/extensions/index/algorithms/union_area.hpp>
+#include <boost/geometry/extensions/index/algorithms/union_content.hpp>
 
 #include <boost/geometry/extensions/index/rtree/node/node.hpp>
 #include <boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp>
@@ -39,7 +39,7 @@
 
         typedef typename Options::parameters_type parameters_type;
 
- typedef typename index::default_area_result<Box>::type area_type;
+ typedef typename index::default_content_result<Box>::type content_type;
     typedef typename index::default_overlap_result<Box>::type overlap_type;
 
 public:
@@ -59,7 +59,7 @@
                 }
         // children are internal nodes
         else
- return choose_by_minimum_area_cost(children, indexable);
+ return choose_by_minimum_content_cost(children, indexable);
     }
 
 private:
@@ -68,11 +68,11 @@
     {
         size_t children_count = children.size();
 
- // choose index with smallest overlap change value, or area change or smallest area
+ // choose index with smallest overlap change value, or content change or smallest content
         size_t choosen_index = 0;
         overlap_type smallest_overlap_diff = std::numeric_limits<overlap_type>::max();
- area_type smallest_area_diff = std::numeric_limits<area_type>::max();
- area_type smallest_area = std::numeric_limits<area_type>::max();
+ content_type smallest_content_diff = std::numeric_limits<content_type>::max();
+ content_type smallest_content = std::numeric_limits<content_type>::max();
 
         // for each child node
         for (size_t i = 0 ; i < children_count ; ++i )
@@ -83,9 +83,9 @@
             // calculate expanded box of child node ch_i
             geometry::expand(box_exp, indexable);
 
- // calculate area and area diff
- area_type area = index::area(ch_i.first);
- area_type area_diff = index::area(box_exp) - area;
+ // calculate content and content diff
+ content_type content = index::content(ch_i.first);
+ content_type content_diff = index::content(box_exp) - content;
 
             overlap_type overlap = 0;
             overlap_type overlap_exp = 0;
@@ -106,12 +106,12 @@
 
             // update result
             if ( overlap_diff < smallest_overlap_diff ||
- ( overlap_diff == smallest_overlap_diff && area_diff < smallest_area_diff ) ||
- ( area_diff == smallest_area_diff && area < smallest_area ) )
+ ( overlap_diff == smallest_overlap_diff && content_diff < smallest_content_diff ) ||
+ ( content_diff == smallest_content_diff && content < smallest_content ) )
             {
                 smallest_overlap_diff = overlap_diff;
- smallest_area_diff = area_diff;
- smallest_area = area;
+ smallest_content_diff = content_diff;
+ smallest_content = content;
                 choosen_index = i;
             }
         }
@@ -124,8 +124,8 @@
         {
                 const size_t children_count = children.size();
 
- // create container of children sorted by area enlargement needed to include the new value
- std::vector< boost::tuple<size_t, area_type, area_type> > sorted_children(children_count);
+ // create container of children sorted by content enlargement needed to include the new value
+ std::vector< boost::tuple<size_t, content_type, content_type> > sorted_children(children_count);
                 for ( size_t i = 0 ; i < children_count ; ++i )
                 {
                         child_type const& ch_i = children[i];
@@ -135,14 +135,14 @@
                         geometry::expand(box_exp, indexable);
 
                         // areas difference
- area_type area = index::area(box_exp);
- area_type area_diff = area - index::area(ch_i.first);
+ content_type content = index::content(box_exp);
+ content_type content_diff = content - index::content(ch_i.first);
 
- sorted_children[i] = boost::make_tuple(i, area_diff, area);
+ sorted_children[i] = boost::make_tuple(i, content_diff, content);
                 }
 
- // sort by area_diff
- std::sort(sorted_children.begin(), sorted_children.end(), area_diff_less);
+ // sort by content_diff
+ std::sort(sorted_children.begin(), sorted_children.end(), content_diff_less);
 
                 BOOST_GEOMETRY_INDEX_ASSERT(parameters_type::overlap_cost_threshold <= children_count, "there are not enough children");
 
@@ -190,21 +190,21 @@
                 return choosen_index;
         }
 
- static inline bool area_diff_less(boost::tuple<size_t, area_type, area_type> const& p1, boost::tuple<size_t, area_type, area_type> const& p2)
+ static inline bool content_diff_less(boost::tuple<size_t, content_type, content_type> const& p1, boost::tuple<size_t, content_type, content_type> const& p2)
         {
                 return boost::get<1>(p1) < boost::get<1>(p2) ||
                            (boost::get<1>(p1) == boost::get<1>(p2) && boost::get<2>(p1) < boost::get<2>(p2));
         }
 
         template <typename Indexable>
- static inline size_t choose_by_minimum_area_cost(children_type const& children, Indexable const& indexable)
+ static inline size_t choose_by_minimum_content_cost(children_type const& children, Indexable const& indexable)
     {
         size_t children_count = children.size();
 
- // choose index with smallest area change or smallest area
+ // choose index with smallest content change or smallest content
         size_t choosen_index = 0;
- area_type smallest_area_diff = std::numeric_limits<area_type>::max();
- area_type smallest_area = std::numeric_limits<area_type>::max();
+ content_type smallest_content_diff = std::numeric_limits<content_type>::max();
+ content_type smallest_content = std::numeric_limits<content_type>::max();
 
         // choose the child which requires smallest box expansion to store the indexable
         for ( size_t i = 0 ; i < children_count ; ++i )
@@ -216,15 +216,15 @@
             geometry::expand(box_exp, indexable);
 
             // areas difference
- area_type area = index::area(box_exp);
- area_type area_diff = area - index::area(ch_i.first);
+ content_type content = index::content(box_exp);
+ content_type content_diff = content - index::content(ch_i.first);
 
             // update the result
- if ( area_diff < smallest_area_diff ||
- ( area_diff == smallest_area_diff && area < smallest_area ) )
+ if ( content_diff < smallest_content_diff ||
+ ( content_diff == smallest_content_diff && content < smallest_content ) )
             {
- smallest_area_diff = area_diff;
- smallest_area = area;
+ smallest_content_diff = content_diff;
+ smallest_content = content;
                 choosen_index = i;
             }
         }

Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/insert.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/insert.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/insert.hpp 2011-07-12 21:27:30 EDT (Tue, 12 Jul 2011)
@@ -10,10 +10,7 @@
 #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_INSERT_HPP
 #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_INSERT_HPP
 
-#include <boost/geometry/algorithms/centroid.hpp>
-
-#include <boost/geometry/extensions/index/algorithms/area.hpp>
-#include <boost/geometry/extensions/index/algorithms/distance_sqr.hpp>
+#include <boost/geometry/extensions/index/algorithms/content.hpp>
 
 namespace boost { namespace geometry { namespace index {
 
@@ -44,7 +41,7 @@
         typedef typename elements_type::value_type element_type;
         typedef typename geometry::point_type<Box>::type point_type;
         // TODO: awulkiew - change second point_type to the point type of the Indexable?
- typedef typename index::default_distance_sqr_result<point_type, point_type>::type distance_sqr_type;
+ typedef typename geometry::default_distance_result<point_type>::type distance_type;
 
                 elements_type & elements = rtree::elements(n);
 
@@ -60,13 +57,13 @@
         geometry::centroid(rtree::elements(*parent)[current_child_index].first, node_center);
 
         // fill the container of centers' distances of children from current node's center
- boost::array<std::pair<distance_sqr_type, element_type>, elements_count> sorted_elements;
+ boost::array<std::pair<distance_type, element_type>, elements_count> sorted_elements;
                 for ( size_t i = 0 ; i < elements_count ; ++i )
         {
             point_type element_center;
             geometry::centroid( rtree::element_indexable(elements[i], tr),
                 element_center);
- sorted_elements[i].first = index::distance_sqr(node_center, element_center);
+ sorted_elements[i].first = geometry::comparable_distance(node_center, element_center);
             sorted_elements[i].second = elements[i];
         }
 
@@ -75,7 +72,7 @@
             sorted_elements.begin(),
             sorted_elements.begin() + reinserted_elements_count,
             sorted_elements.end(),
- distances_dsc<distance_sqr_type, element_type>);
+ distances_dsc<distance_type, element_type>);
 
         // copy elements which will be reinserted
         result_elements.resize(reinserted_elements_count);

Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp 2011-07-12 21:27:30 EDT (Tue, 12 Jul 2011)
@@ -12,8 +12,8 @@
 
 #include <algorithm>
 
-#include <boost/geometry/extensions/index/algorithms/intersection_area.hpp>
-#include <boost/geometry/extensions/index/algorithms/union_area.hpp>
+#include <boost/geometry/extensions/index/algorithms/intersection_content.hpp>
+#include <boost/geometry/extensions/index/algorithms/union_content.hpp>
 #include <boost/geometry/extensions/index/algorithms/margin.hpp>
 
 #include <boost/geometry/algorithms/intersection.hpp>
@@ -52,14 +52,14 @@
 struct choose_split_axis_and_index_for_corner
 {
         typedef typename index::default_margin_result<Box>::type margin_type;
- typedef typename index::default_area_result<Box>::type area_type;
+ typedef typename index::default_content_result<Box>::type content_type;
 
         template <typename Elements, typename Translator>
         static inline void apply(Elements const& elements,
                                                      size_t & choosen_index,
                                                          margin_type & sum_of_margins,
- area_type & smallest_overlap,
- area_type & smallest_area,
+ content_type & smallest_overlap,
+ content_type & smallest_content,
                                                          Translator const& tr)
         {
                 typedef typename Elements::value_type element_type;
@@ -77,8 +77,8 @@
                 // init outputs
                 choosen_index = Parameters::min_elements;
                 sum_of_margins = 0;
- smallest_overlap = std::numeric_limits<area_type>::max();
- smallest_area = std::numeric_limits<area_type>::max();
+ smallest_overlap = std::numeric_limits<content_type>::max();
+ smallest_content = std::numeric_limits<content_type>::max();
 
                 // calculate sum of margins for all distributions
                 size_t index_last = Parameters::max_elements - Parameters::min_elements + 2;
@@ -92,14 +92,14 @@
                         
                         sum_of_margins += index::margin(box1) + index::margin(box2);
 
- area_type ovl = index::intersection_area(box1, box2);
- area_type ar = index::area(box1) + index::area(box2);
+ content_type ovl = index::intersection_content(box1, box2);
+ content_type con = index::content(box1) + index::content(box2);
 
- if ( ovl < smallest_overlap || (ovl == smallest_overlap && ar <= smallest_area) )
+ if ( ovl < smallest_overlap || (ovl == smallest_overlap && con <= smallest_content) )
                         {
                                 choosen_index = i;
                                 smallest_overlap = ovl;
- smallest_area = ar;
+ smallest_content = con;
                         }
                 }
         }
@@ -115,52 +115,52 @@
 struct choose_split_axis_and_index_for_axis<Parameters, Box, AxisIndex, box_tag>
 {
         typedef typename index::default_margin_result<Box>::type margin_type;
- typedef typename index::default_area_result<Box>::type area_type;
+ typedef typename index::default_content_result<Box>::type content_type;
 
         template <typename Elements, typename Translator>
         static inline void apply(Elements const& elements,
                                                          size_t & choosen_corner,
                                                          size_t & choosen_index,
                                                          margin_type & sum_of_margins,
- area_type & smallest_overlap,
- area_type & smallest_area,
+ content_type & smallest_overlap,
+ content_type & smallest_content,
                                                          Translator const& tr)
         {
                 size_t index1 = 0;
                 margin_type som1 = 0;
- area_type ovl1 = std::numeric_limits<area_type>::max();
- area_type ar1 = std::numeric_limits<area_type>::max();
+ content_type ovl1 = std::numeric_limits<content_type>::max();
+ content_type con1 = std::numeric_limits<content_type>::max();
 
                 choose_split_axis_and_index_for_corner<Parameters, Box, min_corner, AxisIndex>::
                         apply(elements, index1,
- som1, ovl1, ar1,
+ som1, ovl1, con1,
                                   tr);
 
                 size_t index2 = 0;
                 margin_type som2 = 0;
- area_type ovl2 = std::numeric_limits<area_type>::max();
- area_type ar2 = std::numeric_limits<area_type>::max();
+ content_type ovl2 = std::numeric_limits<content_type>::max();
+ content_type con2 = std::numeric_limits<content_type>::max();
 
                 choose_split_axis_and_index_for_corner<Parameters, Box, max_corner, AxisIndex>::
                         apply(elements, index2,
- som2, ovl2, ar2,
+ som2, ovl2, con2,
                                   tr);
 
                 sum_of_margins = som1 + som2;
 
- if ( ovl1 < ovl2 || (ovl1 == ovl2 && ar1 <= ar2) )
+ if ( ovl1 < ovl2 || (ovl1 == ovl2 && con1 <= con2) )
                 {
                         choosen_corner = min_corner;
                         choosen_index = index1;
                         smallest_overlap = ovl1;
- smallest_area = ar1;
+ smallest_content = con1;
                 }
                 else
                 {
                         choosen_corner = max_corner;
                         choosen_index = index2;
                         smallest_overlap = ovl2;
- smallest_area = ar2;
+ smallest_content = con2;
                 }
         }
 };
@@ -169,20 +169,20 @@
 struct choose_split_axis_and_index_for_axis<Parameters, Box, AxisIndex, point_tag>
 {
         typedef typename index::default_margin_result<Box>::type margin_type;
- typedef typename index::default_area_result<Box>::type area_type;
+ typedef typename index::default_content_result<Box>::type content_type;
 
         template <typename Elements, typename Translator>
         static inline void apply(Elements const& elements,
                                                          size_t & choosen_corner,
                                                          size_t & choosen_index,
                                                          margin_type & sum_of_margins,
- area_type & smallest_overlap,
- area_type & smallest_area,
+ content_type & smallest_overlap,
+ content_type & smallest_content,
                                                          Translator const& tr)
         {
                 choose_split_axis_and_index_for_corner<Parameters, Box, min_corner, AxisIndex>::
                         apply(elements, choosen_index,
- sum_of_margins, smallest_overlap, smallest_area,
+ sum_of_margins, smallest_overlap, smallest_content,
                                   tr);
 
                 choosen_corner = min_corner;
@@ -195,7 +195,7 @@
         BOOST_STATIC_ASSERT(0 < Dimension);
 
         typedef typename index::default_margin_result<Box>::type margin_type;
- typedef typename index::default_area_result<Box>::type area_type;
+ typedef typename index::default_content_result<Box>::type content_type;
 
         template <typename Elements, typename Translator>
         static inline void apply(Elements const& elements,
@@ -203,15 +203,15 @@
                                                          size_t & choosen_corner,
                                                          size_t & choosen_index,
                                                          margin_type & smallest_sum_of_margins,
- area_type & smallest_overlap,
- area_type & smallest_area,
+ content_type & smallest_overlap,
+ content_type & smallest_content,
                                                          Translator const& tr)
         {
                 typedef typename rtree::element_indexable_type<typename Elements::value_type, Translator>::type element_indexable_type;
 
                 choose_split_axis_and_index<Parameters, Box, Dimension - 1>::
                         apply(elements, choosen_axis, choosen_corner, choosen_index,
- smallest_sum_of_margins, smallest_overlap, smallest_area,
+ smallest_sum_of_margins, smallest_overlap, smallest_content,
                                   tr);
 
                 margin_type sum_of_margins = 0;
@@ -219,15 +219,15 @@
                 size_t corner = min_corner;
                 size_t index = 0;
 
- area_type overlap_val = std::numeric_limits<area_type>::max();
- area_type area_val = std::numeric_limits<area_type>::max();
+ content_type overlap_val = std::numeric_limits<content_type>::max();
+ content_type content_val = std::numeric_limits<content_type>::max();
 
                 choose_split_axis_and_index_for_axis<
                         Parameters,
                         Box,
                         Dimension - 1,
                         typename index::traits::tag<element_indexable_type>::type
- >::apply(elements, corner, index, sum_of_margins, overlap_val, area_val, tr);
+ >::apply(elements, corner, index, sum_of_margins, overlap_val, content_val, tr);
 
                 if ( sum_of_margins < smallest_sum_of_margins )
                 {
@@ -236,7 +236,7 @@
                         choosen_index = index;
                         smallest_sum_of_margins = sum_of_margins;
                         smallest_overlap = overlap_val;
- smallest_area = area_val;
+ smallest_content = content_val;
                 }
         }
 };
@@ -245,7 +245,7 @@
 struct choose_split_axis_and_index<Parameters, Box, 1>
 {
         typedef typename index::default_margin_result<Box>::type margin_type;
- typedef typename index::default_area_result<Box>::type area_type;
+ typedef typename index::default_content_result<Box>::type content_type;
 
         template <typename Elements, typename Translator>
         static inline void apply(Elements const& elements,
@@ -253,8 +253,8 @@
                                                          size_t & choosen_corner,
                                                          size_t & choosen_index,
                                                          margin_type & smallest_sum_of_margins,
- area_type & smallest_overlap,
- area_type & smallest_area,
+ content_type & smallest_overlap,
+ content_type & smallest_content,
                                                          Translator const& tr)
         {
                 typedef typename rtree::element_indexable_type<typename Elements::value_type, Translator>::type element_indexable_type;
@@ -266,7 +266,7 @@
                         Box,
                         0,
                         typename index::traits::tag<element_indexable_type>::type
- >::apply(elements, choosen_corner, choosen_index, smallest_sum_of_margins, smallest_overlap, smallest_area, tr);
+ >::apply(elements, choosen_corner, choosen_index, smallest_sum_of_margins, smallest_overlap, smallest_content, tr);
         }
 };
 
@@ -321,7 +321,7 @@
         static const size_t dimension = index::traits::dimension<Box>::value;
 
         typedef typename index::default_margin_result<Box>::type margin_type;
- typedef typename index::default_area_result<Box>::type area_type;
+ typedef typename index::default_content_result<Box>::type content_type;
 
     template <typename Node>
     static inline void apply(
@@ -340,13 +340,13 @@
                 size_t split_corner = 0;
                 size_t split_index = parameters_type::min_elements;
                 margin_type smallest_sum_of_margins = std::numeric_limits<margin_type>::max();
- area_type smallest_overlap = std::numeric_limits<area_type>::max();
- area_type smallest_area = std::numeric_limits<area_type>::max();
+ content_type smallest_overlap = std::numeric_limits<content_type>::max();
+ content_type smallest_content = std::numeric_limits<content_type>::max();
 
                 rstar::choose_split_axis_and_index<typename Options::parameters_type, Box, index::traits::dimension<Box>::value>::
                         apply(elements1,
                                   split_axis, split_corner, split_index,
- smallest_sum_of_margins, smallest_overlap, smallest_area,
+ smallest_sum_of_margins, smallest_overlap, smallest_content,
                                   tr);
 
                 // TODO: awulkiew - get rid of following static_casts?

Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rtree.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rtree.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rtree.hpp 2011-07-12 21:27:30 EDT (Tue, 12 Jul 2011)
@@ -11,8 +11,10 @@
 #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RTREE_HPP
 #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RTREE_HPP
 
-#include <boost/geometry/geometries/point.hpp>
-#include <boost/geometry/geometries/box.hpp>
+#include <algorithm>
+#include <boost/tuple/tuple.hpp>
+
+#include <boost/geometry/geometry.hpp>
 
 #include <boost/geometry/extensions/index/assert.hpp>
 

Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/find.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/find.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/find.hpp 2011-07-12 21:27:30 EDT (Tue, 12 Jul 2011)
@@ -10,8 +10,6 @@
 #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_FIND_HPP
 #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_FIND_HPP
 
-#include <boost/geometry/algorithms/intersects.hpp>
-
 #include <boost/geometry/extensions/index/rtree/node/node.hpp>
 
 //#include <boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp>

Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/insert.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/insert.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/insert.hpp 2011-07-12 21:27:30 EDT (Tue, 12 Jul 2011)
@@ -10,7 +10,7 @@
 #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_INSERT_HPP
 #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_INSERT_HPP
 
-#include <boost/geometry/extensions/index/algorithms/area.hpp>
+#include <boost/geometry/extensions/index/algorithms/content.hpp>
 
 #include <boost/geometry/extensions/index/rtree/node/node.hpp>
 
@@ -25,7 +25,7 @@
 struct choose_next_node;
 
 template <typename Value, typename Options, typename Box>
-struct choose_next_node<Value, Options, Box, choose_by_area_diff_tag>
+struct choose_next_node<Value, Options, Box, choose_by_content_diff_tag>
 {
     typedef typename rtree::node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type node;
     typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, typename Options::node_tag>::type internal_node;
@@ -33,7 +33,7 @@
 
     typedef typename rtree::elements_type<internal_node>::type children_type;
 
- typedef typename index::default_area_result<Box>::type area_type;
+ typedef typename index::default_content_result<Box>::type content_type;
 
     template <typename Indexable>
     static inline size_t apply(internal_node & n, Indexable const& indexable, size_t /*node_relative_level*/)
@@ -44,10 +44,10 @@
 
         size_t children_count = children.size();
 
- // choose index with smallest area change or smallest area
+ // choose index with smallest content change or smallest content
         size_t choosen_index = 0;
- area_type smallest_area_diff = std::numeric_limits<area_type>::max();
- area_type smallest_area = std::numeric_limits<area_type>::max();
+ content_type smallest_content_diff = std::numeric_limits<content_type>::max();
+ content_type smallest_content = std::numeric_limits<content_type>::max();
 
         // caculate areas and areas of all nodes' boxes
         for ( size_t i = 0 ; i < children_count ; ++i )
@@ -60,15 +60,15 @@
             geometry::expand(box_exp, indexable);
 
             // areas difference
- area_type area = index::area(box_exp);
- area_type area_diff = area - index::area(ch_i.first);
+ content_type content = index::content(box_exp);
+ content_type content_diff = content - index::content(ch_i.first);
 
             // update the result
- if ( area_diff < smallest_area_diff ||
- ( area_diff == smallest_area_diff && area < smallest_area ) )
+ if ( content_diff < smallest_content_diff ||
+ ( content_diff == smallest_content_diff && content < smallest_content ) )
             {
- smallest_area_diff = area_diff;
- smallest_area = area;
+ smallest_content_diff = content_diff;
+ smallest_content = content;
                 choosen_index = i;
             }
         }

Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/remove.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/remove.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/remove.hpp 2011-07-12 21:27:30 EDT (Tue, 12 Jul 2011)
@@ -58,7 +58,7 @@
         size_t child_node_index = 0;
         for ( ; child_node_index < children.size() ; ++child_node_index )
         {
- if ( index::within(children[child_node_index].first, m_tr(m_value)) )
+ if ( index::within(m_tr(m_value), children[child_node_index].first) )
             {
                 // next traversing step
                 traverse_apply_visitor(n, child_node_index);

Modified: sandbox-branches/geometry/index/tests/additional_sizes_and_times.cpp
==============================================================================
--- sandbox-branches/geometry/index/tests/additional_sizes_and_times.cpp (original)
+++ sandbox-branches/geometry/index/tests/additional_sizes_and_times.cpp 2011-07-12 21:27:30 EDT (Tue, 12 Jul 2011)
@@ -26,7 +26,8 @@
     namespace bg = boost::geometry;
     namespace bgi = bg::index;
 
- typedef bg::model::point<float, 2, bg::cs::cartesian> P;
+ //typedef bg::model::d2::point_xy<double> P;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> P;
     typedef bg::model::box<P> B;
     //typedef bgi::rtree<std::pair<B, size_t>, bgi::linear<32, 8> > RT;
     //typedef bgi::rtree<std::pair<B, size_t>, bgi::quadratic<32, 8> > RT;
@@ -121,25 +122,6 @@
             float y = coords[i].second;
             B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f));
 
- //if ( 341700 <= i )
- // std::cout << i << "\n";
-
- // Czy mozliwe, ze w czasie powtornego reinserta
- // nagle drzewo sie powieksza o jeden poziom?
- // Tak, drzewo sie rozrasta, powinno sie wstawiac w poziomie liczac od lisci
- // TODO: relative_level zamiast level
-
- // TODO: asserty w operator(leaf)
- // current_level == leaf_level
-
- // Swoja droga to dziwne ze przy drzewie 4,2
- // dzieje sie to samo dopiero dla obiektow o indeksie 300k a nie wczesniej
- // Dlaczego?
- // Przy 32 obiektach powtornie wstawianych jest 9 a przy 4 tylko 1
-
- // TODO: Zrobic kolejnego visitora sprawdzajacego czy odpowiednie wezly zostaly wstawione w dobrym miejscu
- // Np sprawdzajacego czy wszystkie liscie sa na tym samym poziomie
-
             t.insert(std::make_pair(b, i));
         }
         std::cout << "time: " << tim.elapsed() << "s\n";


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