Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r82546 - in sandbox-branches/geometry/index: boost/geometry/extensions boost/geometry/index boost/geometry/index/adaptors boost/geometry/index/detail boost/geometry/index/detail/algorithms boost/geometry/index/detail/rtree boost/geometry/index/detail/rtree/kmeans boost/geometry/index/detail/rtree/linear boost/geometry/index/detail/rtree/node boost/geometry/index/detail/rtree/quadratic boost/geometry/index/detail/rtree/rstar boost/geometry/index/detail/rtree/visitors boost/geometry/index/translator doc doc/generated doc/html doc/html/geometry_index doc/html/geometry_index/r_tree test test/algorithms test/rtree tests
From: adam.wulkiewicz_at_[hidden]
Date: 2013-01-18 21:26:45


Author: awulkiew
Date: 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
New Revision: 82546
URL: http://svn.boost.org/trac/boost/changeset/82546

Log:
boost/geometry/extensions/index/* moved to boost/geometry/index/*
rtree::box() renamed to rtree::envelope()
index::box() renamed to index::envelope()
some unneeded tests removed
docs updated
Added:
   sandbox-branches/geometry/index/boost/geometry/index/
   sandbox-branches/geometry/index/boost/geometry/index/adaptors/
   sandbox-branches/geometry/index/boost/geometry/index/adaptors/nearest_query.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/adaptors/spatial_query.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/
   sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/
   sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/comparable_distance_centroid.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/comparable_distance_far.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/comparable_distance_near.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/content.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/diff_abs.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/intersection_content.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/is_valid.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/margin.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/minmaxdist.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/smallest_for_indexable.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/sum_for_indexable.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/union_content.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/assert.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/distance_predicates.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/indexable.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/nonassignable.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/predicates.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/pushable_array.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/adaptors.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/kmeans/
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/kmeans/kmeans.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/kmeans/split.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/linear/
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/linear/linear.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/linear/redistribute_elements.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/concept.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/dynamic_visitor.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node_auto_ptr.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/static_visitor.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/options.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/quadratic/
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/quadratic/quadratic.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/quadratic/redistribute_elements.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/rstar/
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/rstar/choose_next_node.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/rstar/insert.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/rstar/redistribute_elements.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/rstar/rstar.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/are_boxes_ok.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/are_levels_ok.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/children_box.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/copy.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/count.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/destroy.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/gl_draw.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/insert.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/is_leaf.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/print.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/remove.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/static_vector.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/tags.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/detail/tuples.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/distance_predicates.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/inserter.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/parameters.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/predicates.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/rtree.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/translator/
   sandbox-branches/geometry/index/boost/geometry/index/translator/def.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/translator/helpers.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/translator/index.hpp (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/index/translator/translator.hpp (contents, props changed)
Removed:
   sandbox-branches/geometry/index/boost/geometry/extensions/
   sandbox-branches/geometry/index/tests/main.cpp
   sandbox-branches/geometry/index/tests/rtree_filters.hpp
   sandbox-branches/geometry/index/tests/rtree_function.hpp
   sandbox-branches/geometry/index/tests/static_vector.cpp
   sandbox-branches/geometry/index/tests/t1.cpp
   sandbox-branches/geometry/index/tests/t2.cpp
   sandbox-branches/geometry/index/tests/translators.hpp
Text files modified:
   sandbox-branches/geometry/index/doc/Doxyfile | 7
   sandbox-branches/geometry/index/doc/generated/rtree.qbk | 104 ++-
   sandbox-branches/geometry/index/doc/generated/rtree_functions.qbk | 10
   sandbox-branches/geometry/index/doc/generated/rtree_linear.qbk | 2
   sandbox-branches/geometry/index/doc/generated/rtree_quadratic.qbk | 2
   sandbox-branches/geometry/index/doc/generated/rtree_rstar.qbk | 2
   sandbox-branches/geometry/index/doc/generated/rtree_runtime_linear.qbk | 2
   sandbox-branches/geometry/index/doc/generated/rtree_runtime_quadratic.qbk | 2
   sandbox-branches/geometry/index/doc/generated/rtree_runtime_rstar.qbk | 2
   sandbox-branches/geometry/index/doc/generated/translator_def.qbk | 2
   sandbox-branches/geometry/index/doc/generated/translator_index.qbk | 5
   sandbox-branches/geometry/index/doc/html/geometry_index/introduction.html | 2
   sandbox-branches/geometry/index/doc/html/geometry_index/r_tree.html | 2
   sandbox-branches/geometry/index/doc/html/geometry_index/r_tree/creation_and_modification.html | 10
   sandbox-branches/geometry/index/doc/html/geometry_index/r_tree/introduction.html | 26
   sandbox-branches/geometry/index/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html | 2
   sandbox-branches/geometry/index/doc/html/geometry_index/r_tree/reference.html | 971 ++++++++++++++++++++++++---------------
   sandbox-branches/geometry/index/doc/html/geometry_index/r_tree/rtree_quickstart.html | 4
   sandbox-branches/geometry/index/doc/html/geometry_index/r_tree/spatial_queries.html | 2
   sandbox-branches/geometry/index/doc/html/index.html | 4
   sandbox-branches/geometry/index/test/Jamfile.v2 | 2
   sandbox-branches/geometry/index/test/algorithms/Jamfile.v2 | 2
   sandbox-branches/geometry/index/test/algorithms/content.cpp | 6
   sandbox-branches/geometry/index/test/algorithms/intersection_content.cpp | 6
   sandbox-branches/geometry/index/test/algorithms/is_valid.cpp | 10
   sandbox-branches/geometry/index/test/algorithms/margin.cpp | 6
   sandbox-branches/geometry/index/test/algorithms/minmaxdist.cpp | 8
   sandbox-branches/geometry/index/test/algorithms/test_content.hpp | 16
   sandbox-branches/geometry/index/test/algorithms/test_intersection_content.hpp | 16
   sandbox-branches/geometry/index/test/algorithms/test_margin.hpp | 16
   sandbox-branches/geometry/index/test/algorithms/test_union_content.hpp | 16
   sandbox-branches/geometry/index/test/algorithms/union_content.cpp | 6
   sandbox-branches/geometry/index/test/geometry_index_test_common.hpp | 4
   sandbox-branches/geometry/index/test/rtree/Jamfile.v2 | 2
   sandbox-branches/geometry/index/test/rtree/rtree_exceptions.cpp | 2
   sandbox-branches/geometry/index/test/rtree/test_rtree.hpp | 36
   sandbox-branches/geometry/index/test/rtree/test_rtree_exceptions.hpp | 10
   sandbox-branches/geometry/index/test/rtree/test_throwing.hpp | 10
   sandbox-branches/geometry/index/test/static_vector.cpp | 6
   sandbox-branches/geometry/index/tests/additional_glut_vis.cpp | 24
   sandbox-branches/geometry/index/tests/additional_sizes_and_times.cpp | 45
   sandbox-branches/geometry/index/tests/additional_speed.cpp | 9
   sandbox-branches/geometry/index/tests/rtree_test_generator.cpp | 6
   43 files changed, 832 insertions(+), 595 deletions(-)

Added: sandbox-branches/geometry/index/boost/geometry/index/adaptors/nearest_query.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/adaptors/nearest_query.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,122 @@
+// Boost.Geometry Index
+//
+// Nearest neighbour query range adaptor
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_ADAPTORS_NEAREST_QUERY_HPP
+#define BOOST_GEOMETRY_INDEX_ADAPTORS_NEAREST_QUERY_HPP
+
+/*!
+\defgroup adaptors Adaptors (boost::geometry::index::adaptors::)
+*/
+
+namespace boost { namespace geometry { namespace index {
+
+namespace adaptors {
+
+template <typename Index>
+class nearest_query_range
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_INDEX,
+ (nearest_query_range));
+
+ typedef int* iterator;
+ typedef const int* const_iterator;
+
+ template <typename DistancesPredicates, typename Predicates>
+ inline nearest_query_range(
+ Index const&,
+ DistancesPredicates const&,
+ size_t,
+ Predicates const&
+ )
+ {}
+
+ inline iterator begin() { return 0; }
+ inline iterator end() { return 0; }
+ inline const_iterator begin() const { return 0; }
+ inline const_iterator end() const { return 0; }
+};
+
+namespace detail {
+
+// TODO: awulkiew - consider removing references from predicates
+
+template<typename DistancesPredicates, typename Predicates>
+struct nearest_query
+{
+ inline nearest_query(
+ DistancesPredicates const& dpred,
+ size_t k,
+ Predicates const& pred
+ )
+ : distances_predicates(dpred)
+ , count(k)
+ , predicates(pred)
+ {}
+
+ DistancesPredicates const& distances_predicates;
+ size_t count;
+ Predicates const& predicates;
+};
+
+} // namespace detail
+
+/*!
+\brief The nearest query index adaptor generator.
+
+\ingroup adaptors
+
+\param dpred Distance predicates.
+\param k The number of values to find.
+\param pred Spatial predicates.
+*/
+template <typename DistancesPredicates, typename Predicates>
+detail::nearest_query<DistancesPredicates, Predicates>
+nearest_queried(
+ DistancesPredicates const& dpred,
+ size_t k,
+ Predicates const& pred)
+{
+ return detail::nearest_query<DistancesPredicates, Predicates>(dpred, k, pred);
+}
+
+/*!
+\brief The nearest query index adaptor generator.
+
+\ingroup adaptors
+
+\param dpred Distance predicates.
+\param k The number of values to find.
+*/
+template <typename DistancesPredicates>
+detail::nearest_query<DistancesPredicates, index::detail::empty>
+nearest_queried(
+ DistancesPredicates const& dpred,
+ size_t k)
+{
+ return detail::nearest_query<DistancesPredicates, index::detail::empty>(dpred, k, index::detail::empty());
+}
+
+} // namespace adaptors
+
+template<typename Index, typename DistancesPredicates, typename Predicates>
+index::adaptors::nearest_query_range<Index>
+operator|(
+ Index const& si,
+ index::adaptors::detail::nearest_query<DistancesPredicates, Predicates> const& f)
+{
+ return index::adaptors::nearest_query_range<Index>(
+ si, f.distances_predicates, f.count, f.predicates);
+}
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_ADAPTORS_NEAREST_QUERY_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/adaptors/spatial_query.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/adaptors/spatial_query.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,88 @@
+// Boost.Geometry Index
+//
+// Spatial query range adaptor
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_ADAPTORS_SPATIAL_QUERY_HPP
+#define BOOST_GEOMETRY_INDEX_ADAPTORS_SPATIAL_QUERY_HPP
+
+/*!
+\defgroup adaptors Adaptors (boost::geometry::index::adaptors::)
+*/
+
+namespace boost { namespace geometry { namespace index {
+
+namespace adaptors {
+
+template <typename Index>
+class spatial_query_range
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_INDEX,
+ (spatial_query_range));
+
+ typedef int* iterator;
+ typedef const int* const_iterator;
+
+ template <typename Predicates>
+ inline spatial_query_range(
+ Index const&,
+ Predicates const&)
+ {}
+
+ inline iterator begin() { return 0; }
+ inline iterator end() { return 0; }
+ inline const_iterator begin() const { return 0; }
+ inline const_iterator end() const { return 0; }
+};
+
+namespace detail {
+
+// TODO: awulkiew - consider removing reference from predicates
+
+template<typename Predicates>
+struct spatial_query
+{
+ inline explicit spatial_query(Predicates const& pred)
+ : predicates(pred)
+ {}
+
+ Predicates const& predicates;
+};
+
+} // namespace detail
+
+/*!
+\brief The spatial query index adaptor generator.
+
+\ingroup adaptors
+
+\param pred Spatial predicates.
+*/
+template <typename Predicates>
+detail::spatial_query<Predicates>
+spatial_queried(Predicates const& pred)
+{
+ return detail::spatial_query<Predicates>(pred);
+}
+
+} // namespace adaptors
+
+template<typename Index, typename Predicates>
+index::adaptors::spatial_query_range<Index>
+operator|(
+ Index const& si,
+ index::adaptors::detail::spatial_query<Predicates> const& f)
+{
+ return index::adaptors::spatial_query_range<Index>(si, f.predicates);
+}
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_ADAPTORS_SPATIAL_QUERY_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/comparable_distance_centroid.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/comparable_distance_centroid.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,77 @@
+// Boost.Geometry Index
+//
+// squared distance between point and centroid of the box or point
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP
+
+#include <boost/geometry/index/detail/algorithms/sum_for_indexable.hpp>
+#include <boost/geometry/index/detail/algorithms/diff_abs.hpp>
+
+namespace boost { namespace geometry { namespace index { namespace detail {
+
+struct comparable_distance_centroid_tag {};
+
+template <
+ typename Point,
+ typename PointIndexable,
+ size_t N>
+struct sum_for_indexable<Point, PointIndexable, point_tag, comparable_distance_centroid_tag, N>
+{
+ typedef typename geometry::default_distance_result<Point, PointIndexable>::type result_type;
+
+ inline static result_type apply(Point const& pt, PointIndexable const& i)
+ {
+ return geometry::comparable_distance(pt, i);
+ }
+};
+
+template <
+ typename Point,
+ typename BoxIndexable,
+ size_t DimensionIndex>
+struct sum_for_indexable_dimension<Point, BoxIndexable, box_tag, comparable_distance_centroid_tag, DimensionIndex>
+{
+ typedef typename geometry::default_distance_result<Point, BoxIndexable>::type result_type;
+
+ inline static result_type apply(Point const& pt, BoxIndexable const& i)
+ {
+ typedef typename index::detail::traits::coordinate_type<Point>::type point_coord_t;
+ typedef typename index::detail::traits::coordinate_type<BoxIndexable>::type indexable_coord_t;
+
+ point_coord_t pt_c = geometry::get<DimensionIndex>(pt);
+ indexable_coord_t ind_c_min = geometry::get<geometry::min_corner, DimensionIndex>(i);
+ indexable_coord_t ind_c_max = geometry::get<geometry::max_corner, DimensionIndex>(i);
+
+ indexable_coord_t ind_c_avg = ind_c_min + (ind_c_max - ind_c_min) / 2;
+ // TODO: awulkiew - is (ind_c_min + ind_c_max) / 2 safe?
+
+ result_type diff = detail::diff_abs(ind_c_avg, pt_c);
+
+ return diff * diff;
+ }
+};
+
+template <typename Point, typename Indexable>
+typename geometry::default_distance_result<Point, Indexable>::type
+comparable_distance_centroid(Point const& pt, Indexable const& i)
+{
+ return detail::sum_for_indexable<
+ Point,
+ Indexable,
+ typename index::detail::traits::tag<Indexable>::type,
+ detail::comparable_distance_centroid_tag,
+ index::detail::traits::dimension<Indexable>::value
+ >::apply(pt, i);
+}
+
+}}}} // namespace boost::geometry::index::detail
+
+#endif // #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP
+

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/comparable_distance_far.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/comparable_distance_far.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,66 @@
+// Boost.Geometry Index
+//
+// squared distance between point and furthest point of the box or point
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP
+
+#include <boost/geometry/index/detail/algorithms/diff_abs.hpp>
+#include <boost/geometry/index/detail/algorithms/sum_for_indexable.hpp>
+
+namespace boost { namespace geometry { namespace index { namespace detail {
+
+// minmaxdist component
+
+struct comparable_distance_far_tag {};
+
+template <
+ typename Point,
+ typename BoxIndexable,
+ size_t DimensionIndex>
+struct sum_for_indexable_dimension<Point, BoxIndexable, box_tag, comparable_distance_far_tag, DimensionIndex>
+{
+ typedef typename geometry::default_distance_result<Point, BoxIndexable>::type result_type;
+
+ inline static result_type apply(Point const& pt, BoxIndexable const& i)
+ {
+ typedef typename index::detail::traits::coordinate_type<Point>::type point_coord_t;
+ typedef typename index::detail::traits::coordinate_type<BoxIndexable>::type indexable_coord_t;
+
+ point_coord_t pt_c = geometry::get<DimensionIndex>(pt);
+ indexable_coord_t ind_c_min = geometry::get<geometry::min_corner, DimensionIndex>(i);
+ indexable_coord_t ind_c_max = geometry::get<geometry::max_corner, DimensionIndex>(i);
+
+ result_type further_diff = 0;
+
+ if ( (ind_c_min + ind_c_max) / 2 <= pt_c )
+ further_diff = pt_c - ind_c_min;
+ else
+ further_diff = detail::diff_abs(pt_c, ind_c_max); // unsigned values protection
+
+ return further_diff * further_diff;
+ }
+};
+
+template <typename Point, typename Indexable>
+typename geometry::default_distance_result<Point, Indexable>::type
+comparable_distance_far(Point const& pt, Indexable const& i)
+{
+ return detail::sum_for_indexable<
+ Point,
+ Indexable,
+ typename index::detail::traits::tag<Indexable>::type,
+ detail::comparable_distance_far_tag,
+ index::detail::traits::dimension<Indexable>::value
+ >::apply(pt, i);
+}
+
+}}}} // namespace boost::geometry::index::detail
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/comparable_distance_near.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/comparable_distance_near.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,77 @@
+// Boost.Geometry Index
+//
+// squared distance between point and nearest point of the box or point
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP
+
+#include <boost/geometry/index/detail/algorithms/sum_for_indexable.hpp>
+
+namespace boost { namespace geometry { namespace index { namespace detail {
+
+struct comparable_distance_near_tag {};
+
+template <
+ typename Point,
+ typename PointIndexable,
+ size_t N>
+struct sum_for_indexable<Point, PointIndexable, point_tag, comparable_distance_near_tag, N>
+{
+ typedef typename geometry::default_distance_result<Point, PointIndexable>::type result_type;
+
+ inline static result_type apply(Point const& pt, PointIndexable const& i)
+ {
+ return geometry::comparable_distance(pt, i);
+ }
+};
+
+template <
+ typename Point,
+ typename BoxIndexable,
+ size_t DimensionIndex>
+struct sum_for_indexable_dimension<Point, BoxIndexable, box_tag, comparable_distance_near_tag, DimensionIndex>
+{
+ typedef typename geometry::default_distance_result<Point, BoxIndexable>::type result_type;
+
+ inline static result_type apply(Point const& pt, BoxIndexable const& i)
+ {
+ typedef typename index::detail::traits::coordinate_type<Point>::type point_coord_t;
+ typedef typename index::detail::traits::coordinate_type<BoxIndexable>::type indexable_coord_t;
+
+ point_coord_t pt_c = geometry::get<DimensionIndex>(pt);
+ indexable_coord_t ind_c_min = geometry::get<geometry::min_corner, DimensionIndex>(i);
+ indexable_coord_t ind_c_max = geometry::get<geometry::max_corner, DimensionIndex>(i);
+
+ result_type diff = 0;
+
+ if ( pt_c < ind_c_min )
+ diff = ind_c_min - pt_c;
+ else if ( ind_c_max < pt_c )
+ diff = pt_c - ind_c_max;
+
+ return diff * diff;
+ }
+};
+
+template <typename Point, typename Indexable>
+typename geometry::default_distance_result<Point, Indexable>::type
+comparable_distance_near(Point const& pt, Indexable const& i)
+{
+ return detail::sum_for_indexable<
+ Point,
+ Indexable,
+ typename index::detail::traits::tag<Indexable>::type,
+ detail::comparable_distance_near_tag,
+ index::detail::traits::dimension<Indexable>::value
+ >::apply(pt, i);
+}
+
+}}}} // namespace boost::geometry::index::detail
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/content.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/content.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,85 @@
+// Boost.Geometry Index
+//
+// n-dimensional box's content (hypervolume) - 2d area, 3d volume, ...
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP
+
+namespace boost { namespace geometry { namespace index { namespace detail {
+
+template <typename Indexable>
+struct default_content_result
+{
+ typedef typename select_most_precise<
+ typename detail::traits::coordinate_type<Indexable>::type,
+ long double
+ >::type type;
+};
+
+namespace dispatch {
+
+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 detail::default_content_result<Box>::type apply(Box const& b)
+ {
+ return content_for_each_dimension<Box, CurrentDimension - 1>::apply(b) *
+ ( detail::get<max_corner, CurrentDimension - 1>(b) - detail::get<min_corner, CurrentDimension - 1>(b) );
+ }
+};
+
+template <typename Box>
+struct content_for_each_dimension<Box, 1>
+{
+ static inline typename detail::default_content_result<Box>::type apply(Box const& b)
+ {
+ return detail::get<max_corner, 0>(b) - detail::get<min_corner, 0>(b);
+ }
+};
+
+template <typename Indexable, typename Tag>
+struct content
+{
+ // TODO: awulkiew - static assert?
+};
+
+template <typename Indexable>
+struct content<Indexable, point_tag>
+{
+ static typename detail::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 dispatch::content_for_each_dimension<Indexable, detail::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 detail::traits::tag<Indexable>::type
+ >::apply(b);
+}
+
+}}}} // namespace boost::geometry::index::detail
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/diff_abs.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/diff_abs.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,24 @@
+// Boost.Geometry Index
+//
+// Abs of difference
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_ALGORITHMS_DIFF_ABS_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_DIFF_ABS_HPP
+
+namespace boost { namespace geometry { namespace index { namespace detail {
+
+template <typename T>
+inline T diff_abs(T const& v1, T const& v2)
+{
+ return v1 < v2 ? v2 - v1 : v1 - v2;
+}
+
+}}}} // namespace boost::geometry::index::detail
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_DIFF_ABS_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/intersection_content.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/intersection_content.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,36 @@
+// Boost.Geometry Index
+//
+// boxes union/intersection area/volume
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_ALGORITHMS_INTERSECTION_CONTENT_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_INTERSECTION_CONTENT_HPP
+
+#include <boost/geometry/algorithms/intersection.hpp>
+#include <boost/geometry/index/detail/algorithms/content.hpp>
+
+namespace boost { namespace geometry { namespace index { namespace detail {
+
+/**
+ * \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)
+{
+ if ( geometry::intersects(box1, box2) )
+ {
+ Box box_intersection;
+ geometry::intersection(box1, box2, box_intersection);
+ return detail::content(box_intersection);
+ }
+ return 0;
+}
+
+}}}} // namespace boost::geometry::index::detail
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_INTERSECTION_CONTENT_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/is_valid.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/is_valid.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,79 @@
+// Boost.Geometry Index
+//
+// n-dimensional box's / point validity check
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_ALGORITHMS_IS_VALID_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_IS_VALID_HPP
+
+namespace boost { namespace geometry { namespace index { namespace detail {
+
+namespace dispatch {
+
+template <typename Box, size_t Dimension>
+struct is_valid_box
+{
+ BOOST_MPL_ASSERT_MSG(
+ (0 < Dimension && Dimension <= detail::traits::dimension<Box>::value),
+ INVALID_DIMENSION_PARAMETER,
+ (is_valid_box));
+
+ static inline bool apply(Box const& b)
+ {
+ return is_valid_box<Box, Dimension - 1>::apply(b) &&
+ ( detail::get<min_corner, Dimension - 1>(b) <= detail::get<max_corner, Dimension - 1>(b) );
+ }
+};
+
+template <typename Box>
+struct is_valid_box<Box, 1>
+{
+ static inline bool apply(Box const& b)
+ {
+ return detail::get<min_corner, 0>(b) <= detail::get<max_corner, 0>(b);
+ }
+};
+
+template <typename Indexable, typename Tag>
+struct is_valid
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_INDEXABLE,
+ (is_valid));
+};
+
+template <typename Indexable>
+struct is_valid<Indexable, point_tag>
+{
+ static inline bool apply(Indexable const&)
+ {
+ return true;
+ }
+};
+
+template <typename Indexable>
+struct is_valid<Indexable, box_tag>
+{
+ static inline bool apply(Indexable const& b)
+ {
+ return dispatch::is_valid_box<Indexable, detail::traits::dimension<Indexable>::value>::apply(b);
+ }
+};
+
+} // namespace dispatch
+
+template <typename Indexable>
+inline bool is_valid(Indexable const& b)
+{
+ return dispatch::is_valid<Indexable, typename detail::traits::tag<Indexable>::type>::apply(b);
+}
+
+}}}} // namespace boost::geometry::index::detail
+
+#endif // BOOST_GEOMETRY_DETAIL_INDEX_ALGORITHMS_IS_VALID_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/margin.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/margin.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,99 @@
+// Boost.Geometry Index
+//
+// n-dimensional box's margin value (hypersurface), 2d perimeter, 3d surface, etc...
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_ALGORITHMS_MARGIN_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_MARGIN_HPP
+
+namespace boost { namespace geometry { namespace index { namespace detail {
+
+template <typename Box>
+struct default_margin_result
+{
+ typedef typename select_most_precise<
+ typename coordinate_type<Box>::type,
+ long double
+ >::type type;
+};
+
+template <typename Box, size_t CurrentDimension, size_t EdgeDimension>
+struct margin_for_each_edge
+{
+ BOOST_STATIC_ASSERT(0 < CurrentDimension);
+ BOOST_STATIC_ASSERT(0 < EdgeDimension);
+
+ static inline typename default_margin_result<Box>::type apply(Box const& b)
+ {
+ return margin_for_each_edge<Box, CurrentDimension, EdgeDimension - 1>::apply(b) *
+ ( geometry::get<max_corner, EdgeDimension - 1>(b) - geometry::get<min_corner, EdgeDimension - 1>(b) );
+ }
+};
+
+template <typename Box, size_t CurrentDimension>
+struct margin_for_each_edge<Box, CurrentDimension, CurrentDimension>
+{
+ BOOST_STATIC_ASSERT(0 < CurrentDimension);
+
+ static inline typename default_margin_result<Box>::type apply(Box const& b)
+ {
+ return margin_for_each_edge<Box, CurrentDimension, CurrentDimension - 1>::apply(b);
+ }
+};
+
+template <typename Box, size_t CurrentDimension>
+struct margin_for_each_edge<Box, CurrentDimension, 1>
+{
+ BOOST_STATIC_ASSERT(0 < CurrentDimension);
+
+ static inline typename default_margin_result<Box>::type apply(Box const& b)
+ {
+ return geometry::get<max_corner, 0>(b) - geometry::get<min_corner, 0>(b);
+ }
+};
+
+template <typename Box>
+struct margin_for_each_edge<Box, 1, 1>
+{
+ static inline typename default_margin_result<Box>::type apply(Box const& /*b*/)
+ {
+ return 1;
+ }
+};
+
+template <typename Box, size_t CurrentDimension>
+struct margin_for_each_dimension
+{
+ BOOST_STATIC_ASSERT(0 < CurrentDimension);
+ BOOST_STATIC_ASSERT(CurrentDimension <= detail::traits::dimension<Box>::value);
+
+ static inline typename default_margin_result<Box>::type apply(Box const& b)
+ {
+ return margin_for_each_dimension<Box, CurrentDimension - 1>::apply(b) +
+ margin_for_each_edge<Box, CurrentDimension, detail::traits::dimension<Box>::value>::apply(b);
+ }
+};
+
+template <typename Box>
+struct margin_for_each_dimension<Box, 1>
+{
+ static inline typename default_margin_result<Box>::type apply(Box const& b)
+ {
+ return margin_for_each_edge<Box, 1, detail::traits::dimension<Box>::value>::apply(b);
+ }
+};
+
+template <typename Box>
+typename default_margin_result<Box>::type margin(Box const& b)
+{
+ return 2 * detail::margin_for_each_dimension<Box, detail::traits::dimension<Box>::value>::apply(b);
+}
+
+}}}} // namespace boost::geometry::index::detail
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_MARGIN_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/minmaxdist.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/minmaxdist.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,119 @@
+// Boost.Geometry Index
+//
+// minmaxdist used in R-tree k nearest neighbors query
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_ALGORITHMS_MINMAXDIST_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_MINMAXDIST_HPP
+
+#include <boost/geometry/algorithms/distance.hpp>
+#include <boost/geometry/algorithms/comparable_distance.hpp>
+
+#include <boost/geometry/index/detail/algorithms/diff_abs.hpp>
+#include <boost/geometry/index/detail/algorithms/sum_for_indexable.hpp>
+#include <boost/geometry/index/detail/algorithms/smallest_for_indexable.hpp>
+
+namespace boost { namespace geometry { namespace index { namespace detail {
+
+struct minmaxdist_tag {};
+
+template <
+ typename Point,
+ typename BoxIndexable,
+ size_t DimensionIndex>
+struct smallest_for_indexable_dimension<Point, BoxIndexable, box_tag, minmaxdist_tag, DimensionIndex>
+{
+ typedef typename geometry::default_distance_result<Point, BoxIndexable>::type result_type;
+
+ inline static result_type apply(Point const& pt, BoxIndexable const& i, result_type const& maxd)
+ {
+ typedef typename index::traits::coordinate_type<Point>::type point_coord_t;
+ typedef typename index::traits::coordinate_type<BoxIndexable>::type indexable_coord_t;
+
+ point_coord_t pt_c = geometry::get<DimensionIndex>(pt);
+ indexable_coord_t ind_c_min = geometry::get<geometry::min_corner, DimensionIndex>(i);
+ indexable_coord_t ind_c_max = geometry::get<geometry::max_corner, DimensionIndex>(i);
+
+ indexable_coord_t ind_c_avg = ind_c_min + (ind_c_max - ind_c_min) / 2;
+ // TODO: awulkiew - is (ind_c_min + ind_c_max) / 2 safe?
+
+ // TODO: awulkiew - optimize! don't calculate 2x pt_c <= ind_c_avg
+ // take particular case pt_c == ind_c_avg into account
+
+ result_type closer_comp = 0;
+ if ( pt_c <= ind_c_avg )
+ closer_comp = detail::diff_abs(pt_c, ind_c_min); // unsigned values protection
+ else
+ closer_comp = ind_c_max - pt_c;
+
+ result_type further_comp = 0;
+ if ( ind_c_avg <= pt_c )
+ further_comp = pt_c - ind_c_min;
+ else
+ further_comp = detail::diff_abs(pt_c, ind_c_max); // unsigned values protection
+
+ return (maxd + closer_comp * closer_comp) - further_comp * further_comp;
+ }
+};
+
+template <typename Point, typename Indexable, typename IndexableTag>
+struct minmaxdist_impl
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_INDEXABLE_TAG_TYPE,
+ (minmaxdist_impl));
+};
+
+template <typename Point, typename Indexable>
+struct minmaxdist_impl<Point, Indexable, point_tag>
+{
+ typedef typename geometry::default_distance_result<Point, Indexable>::type result_type;
+
+ inline static result_type apply(Point const& pt, Indexable const& i)
+ {
+ return geometry::comparable_distance(pt, i);
+ }
+};
+
+template <typename Point, typename Indexable>
+struct minmaxdist_impl<Point, Indexable, box_tag>
+{
+ typedef typename geometry::default_distance_result<Point, Indexable>::type result_type;
+
+ inline static result_type apply(Point const& pt, Indexable const& i)
+ {
+ result_type maxd = geometry::comparable_distance(pt, i);
+
+ return smallest_for_indexable<
+ Point,
+ Indexable,
+ box_tag,
+ minmaxdist_tag,
+ index::traits::dimension<Indexable>::value
+ >::apply(pt, i, maxd);
+ }
+};
+
+/**
+ * This is comparable distace.
+ */
+template <typename Point, typename Indexable>
+typename geometry::default_distance_result<Point, Indexable>::type
+minmaxdist(Point const& pt, Indexable const& i)
+{
+ return detail::minmaxdist_impl<
+ Point,
+ Indexable,
+ typename index::traits::tag<Indexable>::type
+ >::apply(pt, i);
+}
+
+}}}} // namespace boost::geometry::index::detail
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_MINMAXDIST_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/smallest_for_indexable.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/smallest_for_indexable.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,80 @@
+// Boost.Geometry Index
+//
+// Get smallest value calculated for indexable's dimensions, used in R-tree k nearest neighbors query
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_ALGORITHMS_SMALLEST_FOR_INDEXABLE_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_SMALLEST_FOR_INDEXABLE_HPP
+
+namespace boost { namespace geometry { namespace index { namespace detail {
+
+template <
+ typename Geometry,
+ typename Indexable,
+ typename IndexableTag,
+ typename AlgoTag,
+ size_t DimensionIndex>
+struct smallest_for_indexable_dimension
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_INDEXABLE_TAG_TYPE,
+ (smallest_for_indexable_dimension));
+};
+
+template <
+ typename Geometry,
+ typename Indexable,
+ typename IndexableTag,
+ typename AlgoTag,
+ size_t N>
+struct smallest_for_indexable
+{
+ typedef typename smallest_for_indexable_dimension<
+ Geometry, Indexable, IndexableTag, AlgoTag, N - 1
+ >::result_type result_type;
+
+ template <typename Data>
+ inline static result_type apply(Geometry const& g, Indexable const& i, Data const& data)
+ {
+ result_type r1 = smallest_for_indexable<
+ Geometry, Indexable, IndexableTag, AlgoTag, N - 1
+ >::apply(g, i, data);
+
+ result_type r2 = smallest_for_indexable_dimension<
+ Geometry, Indexable, IndexableTag, AlgoTag, N - 1
+ >::apply(g, i, data);
+
+ return r1 < r2 ? r1 : r2;
+ }
+};
+
+template <
+ typename Geometry,
+ typename Indexable,
+ typename IndexableTag,
+ typename AlgoTag>
+struct smallest_for_indexable<Geometry, Indexable, IndexableTag, AlgoTag, 1>
+{
+ typedef typename smallest_for_indexable_dimension<
+ Geometry, Indexable, IndexableTag, AlgoTag, 0
+ >::result_type result_type;
+
+ template <typename Data>
+ inline static result_type apply(Geometry const& g, Indexable const& i, Data const& data)
+ {
+ return
+ smallest_for_indexable_dimension<
+ Geometry, Indexable, IndexableTag, AlgoTag, 0
+ >::apply(g, i, data);
+ }
+};
+
+}}}} // namespace boost::geometry::index::detail
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_SMALLEST_FOR_INDEXABLE_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/sum_for_indexable.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/sum_for_indexable.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,76 @@
+// Boost.Geometry Index
+//
+// Sum values calculated for indexable's dimensions, used e.g. in R-tree k nearest neighbors query
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_ALGORITHMS_SUM_FOR_INDEXABLE_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_SUM_FOR_INDEXABLE_HPP
+
+namespace boost { namespace geometry { namespace index { namespace detail {
+
+template <
+ typename Geometry,
+ typename Indexable,
+ typename IndexableTag,
+ typename AlgoTag,
+ size_t DimensionIndex>
+struct sum_for_indexable_dimension
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_INDEXABLE_TAG_TYPE,
+ (sum_for_indexable_dimension));
+};
+
+template <
+ typename Geometry,
+ typename Indexable,
+ typename IndexableTag,
+ typename AlgoTag,
+ size_t N>
+struct sum_for_indexable
+{
+ typedef typename sum_for_indexable_dimension<
+ Geometry, Indexable, IndexableTag, AlgoTag, N - 1
+ >::result_type result_type;
+
+ inline static result_type apply(Geometry const& g, Indexable const& i)
+ {
+ return
+ sum_for_indexable<
+ Geometry, Indexable, IndexableTag, AlgoTag, N - 1
+ >::apply(g, i) +
+ sum_for_indexable_dimension<
+ Geometry, Indexable, IndexableTag, AlgoTag, N - 1
+ >::apply(g, i);
+ }
+};
+
+template <
+ typename Geometry,
+ typename Indexable,
+ typename IndexableTag,
+ typename AlgoTag>
+struct sum_for_indexable<Geometry, Indexable, IndexableTag, AlgoTag, 1>
+{
+ typedef typename sum_for_indexable_dimension<
+ Geometry, Indexable, IndexableTag, AlgoTag, 0
+ >::result_type result_type;
+
+ inline static result_type apply(Geometry const& g, Indexable const& i)
+ {
+ return
+ sum_for_indexable_dimension<
+ Geometry, Indexable, IndexableTag, AlgoTag, 0
+ >::apply(g, i);
+ }
+};
+
+}}}} // namespace boost::geometry::index::detail
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_SUM_FOR_INDEXABLE_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/union_content.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/algorithms/union_content.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,33 @@
+// Boost.Geometry Index
+//
+// boxes union/sum area/volume
+//
+// Copyright (c) 2008 Federico J. Fernandez.
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_ALGORITHMS_UNION_CONTENT_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_UNION_CONTENT_HPP
+
+#include <boost/geometry/algorithms/expand.hpp>
+#include <boost/geometry/index/detail/algorithms/content.hpp>
+
+namespace boost { namespace geometry { namespace index { namespace detail {
+
+/**
+ * \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 detail::content(expanded_box);
+}
+
+}}}} // namespace boost::geometry::index::detail
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_UNION_CONTENT_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/assert.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/assert.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,27 @@
+// Boost.Geometry Index
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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)
+
+#include <boost/assert.hpp>
+
+#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ASSERT_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_ASSERT_HPP
+
+#define BOOST_GEOMETRY_INDEX_ASSERT(CONDITION, TEXT_MSG) \
+ BOOST_ASSERT_MSG(CONDITION, TEXT_MSG)
+
+#if defined(BOOST_DISABLE_ASSERTS) || defined(NDEBUG)
+
+#define BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(PARAM)
+
+#else
+
+#define BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(PARAM) PARAM
+
+#endif
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_ASSERT_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/distance_predicates.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/distance_predicates.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,866 @@
+// Boost.Geometry Index
+//
+// Spatial index distance predicates, calculators and checkers
+// used in nearest query - specialized for envelopes
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_DISTANCE_PREDICATES_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_DISTANCE_PREDICATES_HPP
+
+#include <boost/geometry/index/detail/algorithms/comparable_distance_near.hpp>
+#include <boost/geometry/index/detail/algorithms/comparable_distance_far.hpp>
+#include <boost/geometry/index/detail/algorithms/comparable_distance_centroid.hpp>
+
+#include <boost/geometry/index/detail/tuples.hpp>
+
+#include <boost/geometry/index/detail/tags.hpp>
+
+// TODO - optimization
+// For Boxes and Points all types of distances may be calculated
+// - near, far and centroid. For points those are the same distance
+// calculate them for Boxes only!
+// for Points calculate only 1 distance
+
+namespace boost { namespace geometry { namespace index { namespace detail {
+
+// ------------------------------------------------------------------ //
+// relations
+// ------------------------------------------------------------------ //
+
+template <typename T>
+struct to_nearest
+{
+ to_nearest(T const& v) : value(v) {}
+ T value;
+};
+
+template <typename T>
+struct to_centroid
+{
+ to_centroid(T const& v) : value(v) {}
+ T value;
+};
+
+template <typename T>
+struct to_furthest
+{
+ to_furthest(T const& v) : value(v) {}
+ T value;
+};
+
+// tags
+
+struct to_nearest_tag {};
+struct to_centroid_tag {};
+struct to_furthest_tag {};
+
+// ------------------------------------------------------------------ //
+// relation traits and access
+// ------------------------------------------------------------------ //
+
+template <typename T>
+struct relation
+{
+ typedef T value_type;
+ typedef to_nearest_tag tag;
+ static inline T const& value(T const& v) { return v; }
+ static inline T & value(T & v) { return v; }
+};
+
+template <typename T>
+struct relation< to_nearest<T> >
+{
+ typedef T value_type;
+ typedef to_nearest_tag tag;
+ static inline T const& value(to_nearest<T> const& r) { return r.value; }
+ static inline T & value(to_nearest<T> & r) { return r.value; }
+};
+
+template <typename T>
+struct relation< to_centroid<T> >
+{
+ typedef T value_type;
+ typedef to_centroid_tag tag;
+ static inline T const& value(to_centroid<T> const& r) { return r.value; }
+ static inline T & value(to_centroid<T> & r) { return r.value; }
+};
+
+template <typename T>
+struct relation< to_furthest<T> >
+{
+ typedef T value_type;
+ typedef to_furthest_tag tag;
+ static inline T const& value(to_furthest<T> const& r) { return r.value; }
+ static inline T & value(to_furthest<T> & r) { return r.value; }
+};
+
+// ------------------------------------------------------------------ //
+// distance predicates
+// ------------------------------------------------------------------ //
+
+template <typename PointRelation>
+struct unbounded
+ : nonassignable
+{
+ inline explicit unbounded(PointRelation const& pr)
+ : point_relation(pr)
+ {}
+
+ PointRelation point_relation;
+};
+
+template <typename PointRelation, typename MinRelation>
+struct min_bounded
+ : nonassignable
+{
+ typedef typename detail::relation<PointRelation>::value_type point_type;
+ typedef typename geometry::default_distance_result<point_type, point_type>::type distance_type;
+
+ inline min_bounded(PointRelation const& pr, MinRelation const& min_rel)
+ : point_relation(pr)
+ , comparable_min(
+ relation<MinRelation>::value(min_rel) *
+ relation<MinRelation>::value(min_rel) )
+ {}
+
+ PointRelation point_relation;
+ distance_type comparable_min;
+};
+
+template <typename PointRelation, typename MaxRelation>
+struct max_bounded
+ : nonassignable
+{
+ typedef typename detail::relation<PointRelation>::value_type point_type;
+ typedef typename geometry::default_distance_result<point_type, point_type>::type distance_type;
+
+ inline max_bounded(PointRelation const& pr, MaxRelation const& max_rel)
+ : point_relation(pr)
+ , comparable_max(
+ relation<MaxRelation>::value(max_rel) *
+ relation<MaxRelation>::value(max_rel) )
+ {}
+
+ PointRelation point_relation;
+ distance_type comparable_max;
+};
+
+template <typename PointRelation, typename MinRelation, typename MaxRelation>
+struct bounded
+ : nonassignable
+{
+ typedef typename detail::relation<PointRelation>::value_type point_type;
+ typedef typename geometry::default_distance_result<point_type, point_type>::type distance_type;
+
+ inline bounded(PointRelation const& pr, MinRelation const& min_rel, MaxRelation const& max_rel)
+ : point_relation(pr)
+ , comparable_min(
+ relation<MinRelation>::value(min_rel) *
+ relation<MinRelation>::value(min_rel) )
+ , comparable_max(
+ relation<MaxRelation>::value(max_rel) *
+ relation<MaxRelation>::value(max_rel) )
+ {}
+
+ PointRelation point_relation;
+ distance_type comparable_min;
+ distance_type comparable_max;
+};
+
+// ------------------------------------------------------------------ //
+// point_relation trait
+// ------------------------------------------------------------------ //
+
+template <typename PointRelation>
+struct point_relation
+{
+ typedef PointRelation type;
+};
+
+template <typename PointRelation>
+struct point_relation< detail::unbounded<PointRelation> >
+{
+ typedef PointRelation type;
+};
+
+template <typename PointRelation, typename MinRelation>
+struct point_relation< detail::min_bounded<PointRelation, MinRelation> >
+{
+ typedef PointRelation type;
+};
+
+template <typename PointRelation, typename MaxRelation>
+struct point_relation< detail::max_bounded<PointRelation, MaxRelation> >
+{
+ typedef PointRelation type;
+};
+
+template <typename PointRelation, typename MinRelation, typename MaxRelation>
+struct point_relation< detail::bounded<PointRelation, MinRelation, MaxRelation> >
+{
+ typedef PointRelation type;
+};
+
+// ------------------------------------------------------------------ //
+// helpers
+// ------------------------------------------------------------------ //
+
+// algorithms
+
+// cdist
+
+template <typename T, typename Tag>
+struct cdist
+{
+ T value;
+};
+
+// cdist_merge
+
+template <typename CDistTuple, typename CDist>
+struct cdist_merge
+{
+ typedef typename detail::tuples::add_unique<
+ CDistTuple,
+ CDist
+ >::type type;
+};
+
+template <typename T, typename Tag, typename OtherTag>
+struct cdist_merge<
+ cdist<T, Tag>,
+ cdist<T, OtherTag> >
+{
+ typedef boost::tuple<
+ cdist<T, Tag>,
+ cdist<T, OtherTag>
+ > type;
+};
+
+template <typename T, typename Tag>
+struct cdist_merge<
+ cdist<T, Tag>,
+ cdist<T, Tag> >
+{
+ typedef cdist<T, Tag> type;
+};
+
+// cdist_value_type
+
+template <typename CDistTuple>
+struct cdist_value
+{
+ typedef typename cdist_value<
+ typename boost::tuples::element<0, CDistTuple>::type
+ >::type type;
+
+ template <typename Tag>
+ static inline type & get(CDistTuple & cdtup)
+ {
+ return boost::get<
+ tuples::find_index<
+ CDistTuple,
+ cdist<type, Tag>
+ >::value
+ >(cdtup).value;
+ }
+
+ template <typename Tag>
+ static inline type const& get(CDistTuple const& cdtup)
+ {
+ return boost::get<
+ tuples::find_index<
+ CDistTuple,
+ cdist<type, Tag>
+ >::value
+ >(cdtup).value;
+ }
+};
+
+template <typename T, typename Tag>
+struct cdist_value<
+ cdist<T, Tag>
+>
+{
+ typedef T type;
+
+ template <typename Tag2>
+ static inline type & get(cdist<T, Tag> & cd)
+ {
+ BOOST_MPL_ASSERT_MSG(
+ (boost::is_same< cdist<T, Tag2>, cdist<T, Tag> >::value),
+ TAGS_DO_NOT_MATCH,
+ (cdist_value));
+
+ return cd.value;
+ }
+
+ template <typename Tag2>
+ static inline type const& get(cdist<T, Tag> const& cd)
+ {
+ BOOST_MPL_ASSERT_MSG(
+ (boost::is_same< cdist<T, Tag2>, cdist<T, Tag> >::value),
+ TAGS_DO_NOT_MATCH,
+ (cdist_value));
+
+ return cd.value;
+ }
+};
+
+// distances_calc_impl_rel
+
+template <typename RelDist>
+struct distances_calc_impl_rel
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_RELATION,
+ (distances_calc_impl_rel));
+};
+
+template <typename T>
+struct distances_calc_impl_rel<
+ cdist<T, detail::to_nearest_tag>
+>
+{
+ template <typename Point, typename Indexable>
+ typename geometry::default_distance_result<Point, Indexable>::type
+ static inline apply(Point const& p, Indexable const& i)
+ {
+ return index::detail::comparable_distance_near(p, i);
+ }
+};
+
+template <typename T>
+struct distances_calc_impl_rel<
+ cdist<T, detail::to_centroid_tag>
+>
+{
+ template <typename Point, typename Indexable>
+ typename geometry::default_distance_result<Point, Indexable>::type
+ static inline apply(Point const& p, Indexable const& i)
+ {
+ return index::detail::comparable_distance_centroid(p, i);
+ }
+};
+
+template <typename T>
+struct distances_calc_impl_rel<
+ cdist<T, detail::to_furthest_tag>
+>
+{
+ template <typename Point, typename Indexable>
+ typename geometry::default_distance_result<Point, Indexable>::type
+ static inline apply(Point const& p, Indexable const& i)
+ {
+ return index::detail::comparable_distance_far(p, i);
+ }
+};
+
+// distances_calc_impl_tuple
+
+template <typename Distances, typename Point, typename Indexable, size_t N>
+struct distances_calc_impl_tuple
+{
+ // TODO MPL ASSERT 0 < N
+ static inline void apply(Distances & d, Point const& p, Indexable const&i)
+ {
+ boost::get<N - 1>(d).value =
+ distances_calc_impl_rel<
+ typename boost::tuples::element<N - 1, Distances>::type
+ >::apply(p, i);
+
+ distances_calc_impl_tuple<
+ Distances,
+ Point,
+ Indexable,
+ N - 1
+ >::apply(d, p, i);
+ }
+};
+
+template <typename Distances, typename Point, typename Indexable>
+struct distances_calc_impl_tuple<Distances, Point, Indexable, 1>
+{
+ static inline void apply(Distances & d, Point const& p, Indexable const&i)
+ {
+ boost::get<0>(d).value =
+ distances_calc_impl_rel<
+ typename boost::tuples::element<0, Distances>::type
+ >::apply(p, i);
+ }
+};
+
+// distances_calc_impl
+
+template <typename Distances, typename Point, typename Indexable>
+struct distances_calc_impl
+{
+ static inline void apply(Distances & d, Point const& p, Indexable const&i)
+ {
+ distances_calc_impl_tuple<
+ Distances,
+ Point,
+ Indexable,
+ boost::tuples::length<Distances>::value
+ >::apply(d, p, i);
+ }
+};
+
+template <typename T, typename Tag, typename Point, typename Indexable>
+struct distances_calc_impl<
+ cdist<T, Tag>,
+ Point,
+ Indexable
+>
+{
+ static inline void apply(cdist<T, Tag> & d, Point const& p, Indexable const&i)
+ {
+ d.value = distances_calc_impl_rel<
+ cdist<T, Tag>
+ >::apply(p, i);
+ }
+};
+
+// ------------------------------------------------------------------ //
+// distance_calc and distances_predicates_check
+// ------------------------------------------------------------------ //
+
+template <typename PointRelation, typename Indexable, typename Tag>
+struct distances_calc
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_TAG,
+ (distances_calc));
+};
+
+template <typename PointRelation, typename Indexable, typename Tag>
+struct distances_predicates_check
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_TAG,
+ (distances_predicates_check));
+};
+
+// ------------------------------------------------------------------ //
+// distance_calc for value_tag
+// ------------------------------------------------------------------ //
+
+template <typename PointRelation, typename Indexable>
+struct distances_calc<PointRelation, Indexable, value_tag>
+{
+ typedef typename detail::relation<PointRelation>::value_type point_type;
+ typedef typename detail::relation<PointRelation>::tag point_relation_tag;
+ typedef typename geometry::default_distance_result<point_type, Indexable>::type distance_type;
+
+ typedef detail::cdist<distance_type, point_relation_tag> result_type;
+
+ static inline result_type apply(PointRelation const& p, Indexable const& i)
+ {
+ result_type res;
+ distances_calc_impl<result_type, point_type, Indexable>
+ ::apply(res, relation<PointRelation>::value(p), i);
+ return res;
+ }
+};
+
+template <typename PointRelation, typename Indexable>
+struct distances_calc<
+ detail::unbounded<PointRelation>,
+ Indexable,
+ value_tag
+>
+{
+ typedef typename detail::relation<PointRelation>::value_type point_type;
+ typedef typename detail::relation<PointRelation>::tag point_relation_tag;
+ typedef typename geometry::default_distance_result<point_type, Indexable>::type distance_type;
+
+ typedef detail::cdist<distance_type, point_relation_tag> result_type;
+
+ static inline result_type apply(detail::unbounded<PointRelation> const& pp, Indexable const& i)
+ {
+ result_type res;
+ distances_calc_impl<result_type, point_type, Indexable>
+ ::apply(res, relation<PointRelation>::value(pp.point_relation), i);
+ return res;
+ }
+};
+
+template <typename PointRelation, typename MinRelation, typename Indexable>
+struct distances_calc<
+ detail::min_bounded<PointRelation, MinRelation>,
+ Indexable,
+ value_tag
+>
+{
+ typedef typename detail::relation<PointRelation>::value_type point_type;
+ typedef typename detail::relation<PointRelation>::tag point_relation_tag;
+ typedef typename geometry::default_distance_result<point_type, Indexable>::type distance_type;
+ typedef typename detail::relation<MinRelation>::tag min_relation_tag;
+
+ typedef typename detail::cdist_merge<
+ cdist<distance_type, point_relation_tag>,
+ cdist<distance_type, min_relation_tag>
+ >::type result_type;
+
+ static inline result_type apply(detail::min_bounded<PointRelation, MinRelation> const& pp, Indexable const& i)
+ {
+ result_type res;
+ distances_calc_impl<result_type, point_type, Indexable>
+ ::apply(res, relation<PointRelation>::value(pp.point_relation), i);
+ return res;
+ }
+};
+
+template <typename PointRelation, typename MaxRelation, typename Indexable>
+struct distances_calc<
+ detail::max_bounded<PointRelation, MaxRelation>,
+ Indexable,
+ value_tag
+>
+{
+ typedef typename detail::relation<PointRelation>::value_type point_type;
+ typedef typename detail::relation<PointRelation>::tag point_relation_tag;
+ typedef typename geometry::default_distance_result<point_type, Indexable>::type distance_type;
+ typedef typename detail::relation<MaxRelation>::tag max_relation_tag;
+
+ typedef typename detail::cdist_merge<
+ cdist<distance_type, point_relation_tag>,
+ cdist<distance_type, max_relation_tag>
+ >::type result_type;
+
+ static inline result_type apply(detail::max_bounded<PointRelation, MaxRelation> const& pp, Indexable const& i)
+ {
+ result_type res;
+ distances_calc_impl<result_type, point_type, Indexable>
+ ::apply(res, relation<PointRelation>::value(pp.point_relation), i);
+ return res;
+ }
+};
+
+template <typename PointRelation, typename MinRelation, typename MaxRelation, typename Indexable>
+struct distances_calc<
+ detail::bounded<PointRelation, MinRelation, MaxRelation>,
+ Indexable,
+ value_tag
+>
+{
+ typedef typename detail::relation<PointRelation>::value_type point_type;
+ typedef typename detail::relation<PointRelation>::tag point_relation_tag;
+ typedef typename geometry::default_distance_result<point_type, Indexable>::type distance_type;
+ typedef typename detail::relation<MinRelation>::tag min_relation_tag;
+ typedef typename detail::relation<MaxRelation>::tag max_relation_tag;
+
+ typedef typename detail::cdist_merge<
+ typename detail::cdist_merge<
+ cdist<distance_type, point_relation_tag>,
+ cdist<distance_type, min_relation_tag>
+ >::type,
+ cdist<distance_type, max_relation_tag>
+ >::type result_type;
+
+ static inline result_type apply(
+ detail::bounded<PointRelation, MinRelation, MaxRelation> const& pp,
+ Indexable const& i)
+ {
+ result_type res;
+ distances_calc_impl<result_type, point_type, Indexable>
+ ::apply(res, relation<PointRelation>::value(pp.point_relation), i);
+ return res;
+ }
+};
+
+// ------------------------------------------------------------------ //
+// distance_predicates_check for value_tag
+// ------------------------------------------------------------------ //
+
+template <typename PointRelation, typename Indexable>
+struct distances_predicates_check<PointRelation, Indexable, value_tag>
+{
+ template <typename Distances>
+ static inline bool apply(PointRelation const&, Distances const&)
+ {
+ return true;
+ }
+};
+
+template <typename PointRelation, typename Indexable>
+struct distances_predicates_check<
+ detail::unbounded<PointRelation>,
+ Indexable,
+ value_tag
+>
+{
+ template <typename Distances>
+ static inline bool apply(detail::unbounded<PointRelation> const&, Distances const&)
+ {
+ return true;
+ }
+};
+
+template <typename PointRelation, typename MinRelation, typename Indexable>
+struct distances_predicates_check<
+ detail::min_bounded<PointRelation, MinRelation>,
+ Indexable,
+ value_tag
+>
+{
+ typedef typename detail::relation<MinRelation>::tag min_relation_tag;
+
+ template <typename Distances>
+ static inline bool apply(
+ detail::min_bounded<PointRelation, MinRelation> const& pred,
+ Distances const& d)
+ {
+ return pred.comparable_min <=
+ detail::cdist_value<Distances>::template get<min_relation_tag>(d);
+ }
+};
+
+template <typename PointRelation, typename MaxRelation, typename Indexable>
+struct distances_predicates_check<
+ detail::max_bounded<PointRelation, MaxRelation>,
+ Indexable,
+ value_tag
+>
+{
+ typedef typename detail::relation<MaxRelation>::tag max_relation_tag;
+
+ template <typename Distances>
+ static inline bool apply(
+ detail::max_bounded<PointRelation, MaxRelation> const& pred,
+ Distances const& d)
+ {
+ return pred.comparable_max <=
+ detail::cdist_value<Distances>::template get<max_relation_tag>(d);
+ }
+};
+
+template <typename PointRelation, typename MinRelation, typename MaxRelation, typename Indexable>
+struct distances_predicates_check<
+ detail::bounded<PointRelation, MinRelation, MaxRelation>,
+ Indexable,
+ value_tag
+>
+{
+ typedef typename detail::relation<MinRelation>::tag min_relation_tag;
+ typedef typename detail::relation<MaxRelation>::tag max_relation_tag;
+
+ template <typename Distances>
+ static inline bool apply(
+ detail::bounded<PointRelation, MinRelation, MaxRelation> const& pred,
+ Distances const& d)
+ {
+ return pred.comparable_min
+ <= detail::cdist_value<Distances>::template get<min_relation_tag>(d)
+ && detail::cdist_value<Distances>::template get<max_relation_tag>(d)
+ <= pred.comparable_max;
+ }
+};
+
+// ------------------------------------------------------------------ //
+// distance_calc for envelope_tag
+// ------------------------------------------------------------------ //
+
+template <typename PointRelation, typename Box>
+struct distances_calc<
+ PointRelation,
+ Box,
+ envelope_tag>
+{
+ typedef typename detail::relation<PointRelation>::value_type point_type;
+ typedef typename geometry::default_distance_result<point_type, Box>::type distance_type;
+
+ typedef detail::cdist<distance_type, detail::to_nearest_tag> result_type;
+
+ static inline result_type apply(PointRelation const& p, Box const& i)
+ {
+ result_type res;
+ distances_calc_impl<result_type, point_type, Box>
+ ::apply(res, relation<PointRelation>::value(p), i);
+ return res;
+ }
+};
+
+template <typename PointRelation, typename Box>
+struct distances_calc<
+ detail::unbounded<PointRelation>,
+ Box,
+ envelope_tag
+>
+{
+ typedef typename detail::relation<PointRelation>::value_type point_type;
+ typedef typename geometry::default_distance_result<point_type, Box>::type distance_type;
+
+ typedef detail::cdist<distance_type, detail::to_nearest_tag> result_type;
+
+ static inline result_type apply(detail::unbounded<PointRelation> const& pp, Box const& i)
+ {
+ result_type res;
+ distances_calc_impl<result_type, point_type, Box>
+ ::apply(res, relation<PointRelation>::value(pp.point_relation), i);
+ return res;
+ }
+};
+
+template <typename PointRelation, typename MinRelation, typename Box>
+struct distances_calc<
+ detail::min_bounded<PointRelation, MinRelation>,
+ Box,
+ envelope_tag
+>
+{
+ typedef typename detail::relation<PointRelation>::value_type point_type;
+ typedef typename geometry::default_distance_result<point_type, Box>::type distance_type;
+
+ typedef typename detail::cdist_merge<
+ cdist<distance_type, detail::to_nearest_tag>,
+ cdist<distance_type, detail::to_furthest_tag>
+ >::type result_type;
+
+ static inline result_type apply(detail::min_bounded<PointRelation, MinRelation> const& pp, Box const& i)
+ {
+ result_type res;
+ distances_calc_impl<result_type, point_type, Box>
+ ::apply(res, relation<PointRelation>::value(pp.point_relation), i);
+ return res;
+ }
+};
+
+template <typename PointRelation, typename MaxRelation, typename Box>
+struct distances_calc<
+ detail::max_bounded<PointRelation, MaxRelation>,
+ Box,
+ envelope_tag
+>
+{
+ typedef typename detail::relation<PointRelation>::value_type point_type;
+ typedef typename geometry::default_distance_result<point_type, Box>::type distance_type;
+
+ typedef cdist<distance_type, detail::to_nearest_tag> result_type;
+
+ static inline result_type apply(detail::max_bounded<PointRelation, MaxRelation> const& pp, Box const& i)
+ {
+ result_type res;
+ distances_calc_impl<result_type, point_type, Box>
+ ::apply(res, relation<PointRelation>::value(pp.point_relation), i);
+ return res;
+ }
+};
+
+template <typename PointRelation, typename MinRelation, typename MaxRelation, typename Box>
+struct distances_calc<
+ detail::bounded<PointRelation, MinRelation, MaxRelation>,
+ Box,
+ envelope_tag
+>
+{
+ typedef typename detail::relation<PointRelation>::value_type point_type;
+ typedef typename geometry::default_distance_result<point_type, Box>::type distance_type;
+
+ typedef typename detail::cdist_merge<
+ cdist<distance_type, detail::to_nearest_tag>,
+ cdist<distance_type, detail::to_furthest_tag>
+ >::type result_type;
+
+ static inline result_type apply(detail::bounded<PointRelation, MinRelation, MaxRelation> const& pp, Box const& i)
+ {
+ result_type res;
+ distances_calc_impl<result_type, point_type, Box>
+ ::apply(res, relation<PointRelation>::value(pp.point_relation), i);
+ return res;
+ }
+};
+
+// ------------------------------------------------------------------ //
+// distance_predicates_check for envelope_tag
+// ------------------------------------------------------------------ //
+
+template <typename PointRelation, typename Box>
+struct distances_predicates_check<
+ PointRelation,
+ Box,
+ envelope_tag>
+{
+ template <typename Distances>
+ static inline bool apply(PointRelation const&, Distances const&)
+ {
+ return true;
+ }
+};
+
+template <typename PointRelation, typename Box>
+struct distances_predicates_check<
+ detail::unbounded<PointRelation>,
+ Box,
+ envelope_tag>
+{
+ template <typename Distances>
+ static inline bool apply(
+ detail::unbounded<PointRelation> const&,
+ Distances const&)
+ {
+ return true;
+ }
+};
+
+template <typename PointRelation, typename MinRelation, typename Box>
+struct distances_predicates_check<
+ detail::min_bounded<PointRelation, MinRelation>,
+ Box,
+ envelope_tag>
+{
+ template <typename Distances>
+ static inline bool apply(
+ detail::min_bounded<PointRelation, MinRelation> const& pred,
+ Distances const& d)
+ {
+ return pred.comparable_min
+ <= cdist_value<Distances>::template get<detail::to_furthest_tag>(d);
+ }
+};
+
+template <typename PointRelation, typename MaxRelation, typename Box>
+struct distances_predicates_check<
+ detail::max_bounded<PointRelation, MaxRelation>,
+ Box,
+ envelope_tag>
+{
+ template <typename Distances>
+ static inline bool apply(
+ detail::max_bounded<PointRelation, MaxRelation> const& pred,
+ Distances const& d)
+ {
+ return cdist_value<Distances>::template get<detail::to_nearest_tag>(d)
+ <= pred.comparable_max;
+ }
+};
+
+template <typename PointRelation, typename MinRelation, typename MaxRelation, typename Box>
+struct distances_predicates_check<
+ detail::bounded<PointRelation, MinRelation, MaxRelation>,
+ Box,
+ envelope_tag>
+{
+ template <typename Distances>
+ static inline bool apply(
+ detail::bounded<PointRelation, MinRelation, MaxRelation> const& pred,
+ Distances const& d)
+ {
+ return pred.comparable_min
+ <= cdist_value<Distances>::template get<detail::to_furthest_tag>(d)
+ && cdist_value<Distances>::template get<detail::to_nearest_tag>(d)
+ <= pred.comparable_max;
+ }
+};
+
+}}}} // namespace boost::geometry::index::detail
+
+#endif // BOOST_GEOMETRY_INDEX_RTREE_DISTANCE_PREDICATES_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/indexable.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/indexable.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,177 @@
+// Boost.Geometry Index
+//
+// Indexable's traits and related functions
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_INDEXABLE_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_INDEXABLE_HPP
+
+namespace boost { namespace geometry { namespace index { namespace detail {
+
+namespace dispatch {
+
+// Distinguish between indexables and other geometries
+
+template <typename Geometry, typename GeometryTag>
+struct indexable_type
+{
+ typedef void type;
+};
+
+template <typename Point>
+struct indexable_type<Point, geometry::point_tag>
+{
+ typedef Point type;
+};
+
+template <typename Box>
+struct indexable_type<Box, geometry::box_tag>
+{
+ typedef Box type;
+};
+
+} // namespace dispatch
+
+namespace traits
+{
+
+template <typename Indexable>
+struct indexable_type
+{
+ typedef typename dispatch::indexable_type<
+ Indexable,
+ typename geometry::traits::tag<Indexable>::type
+ >::type type;
+};
+
+} // namespace traits
+
+namespace dispatch {
+
+template <typename Indexable, typename IndexableTag>
+struct point_type
+{
+ typedef void type;
+};
+
+template <typename Indexable>
+struct point_type<Indexable, geometry::box_tag>
+{
+ typedef typename geometry::traits::point_type<Indexable>::type type;
+};
+
+template <typename Indexable>
+struct point_type<Indexable, geometry::point_tag>
+{
+ typedef Indexable type;
+};
+
+} // namespace dispatch
+
+namespace traits {
+
+template <typename Indexable>
+struct point_type
+{
+ typedef typename dispatch::point_type<
+ Indexable,
+ typename geometry::traits::tag<Indexable>::type
+ >::type type;
+};
+
+template <typename Indexable>
+struct coordinate_system
+{
+ typedef typename geometry::traits::coordinate_system<
+ typename point_type<Indexable>::type
+ >::type type;
+};
+
+template <typename Indexable>
+struct coordinate_type
+{
+ typedef typename geometry::traits::coordinate_type<
+ typename point_type<Indexable>::type
+ >::type type;
+};
+
+template <typename Indexable>
+struct dimension
+{
+ static const size_t value =
+ geometry::traits::dimension<
+ typename point_type<Indexable>::type
+ >::value;
+};
+
+template <typename Indexable>
+struct tag
+{
+ typedef typename geometry::traits::tag<
+ Indexable
+ >::type type;
+};
+
+} // namespace traits
+
+namespace dispatch {
+
+template <size_t Corner, size_t DimensionIndex, typename Indexable, typename IndexableTag>
+struct indexable_indexed_access {};
+
+template <size_t Corner, size_t DimensionIndex, typename Indexable>
+struct indexable_indexed_access<Corner, DimensionIndex, Indexable, box_tag>
+{
+ typedef typename traits::point_type<Indexable>::type point_type;
+ typedef typename traits::coordinate_type<point_type>::type coordinate_type;
+
+ static inline coordinate_type get(Indexable const& i)
+ {
+ return geometry::get<Corner, DimensionIndex>(i);
+ }
+};
+
+template <size_t Corner, size_t DimensionIndex, typename Indexable>
+struct indexable_indexed_access<Corner, DimensionIndex, Indexable, point_tag>
+{
+ typedef typename traits::coordinate_type<Indexable>::type coordinate_type;
+
+ static inline coordinate_type get(Indexable const& i)
+ {
+ return geometry::get<DimensionIndex>(i);
+ }
+};
+
+} // namespace dispatch
+
+template <size_t Corner, size_t DimensionIndex, typename Indexable>
+typename traits::coordinate_type<Indexable>::type get(Indexable const& i)
+{
+ return dispatch::indexable_indexed_access<
+ Corner,
+ DimensionIndex,
+ Indexable,
+ typename geometry::traits::tag<Indexable>::type
+ >::get(i);
+}
+
+template <typename Indexable>
+struct default_box_type
+{
+ typedef geometry::model::box<
+ geometry::model::point<
+ typename traits::coordinate_type<Indexable>::type,
+ traits::dimension<Indexable>::value,
+ typename traits::coordinate_system<Indexable>::type
+ >
+ > type;
+};
+
+}}}} // namespace boost::geometry::index::detail
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_INDEXABLE_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/nonassignable.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/nonassignable.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,23 @@
+// Boost.Geometry Index
+//
+// Nonassignable base class.
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_NONASSIGNABLE_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_NONASSIGNABLE_HPP
+
+namespace boost { namespace geometry { namespace index { namespace detail {
+
+class nonassignable
+{
+ nonassignable & operator=(nonassignable const&);
+};
+
+}}}} // namespace boost::geometry::index::detail
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_NONASSIGNABLE_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/predicates.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/predicates.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,525 @@
+// Boost.Geometry Index
+//
+// Spatial query predicates definition and checks.
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_PREDICATES_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_PREDICATES_HPP
+
+#include <boost/geometry/index/predicates.hpp>
+#include <boost/geometry/index/detail/tags.hpp>
+
+namespace boost { namespace geometry { namespace index { namespace detail {
+
+// ------------------------------------------------------------------ //
+// predicates
+// ------------------------------------------------------------------ //
+
+struct empty {};
+
+template <typename ValuePredicate>
+struct value
+{
+ value(ValuePredicate const& vpred) : value_predicate(vpred) {}
+ ValuePredicate value_predicate;
+};
+
+template <typename Geometry>
+struct covered_by
+{
+ covered_by(Geometry const& g) : geometry(g) {}
+ Geometry geometry;
+};
+
+template <typename Geometry>
+struct disjoint
+{
+ disjoint(Geometry const& g) : geometry(g) {}
+ Geometry geometry;
+};
+
+template <typename Geometry>
+struct intersects
+{
+ intersects(Geometry const& g) : geometry(g) {}
+ Geometry geometry;
+};
+
+template <typename Geometry>
+struct overlaps
+{
+ overlaps(Geometry const& g) : geometry(g) {}
+ Geometry geometry;
+};
+
+//template <typename Geometry>
+//struct touches
+//{
+// touches(Geometry const& g) : geometry(g) {}
+// Geometry geometry;
+//};
+
+template <typename Geometry>
+struct within
+{
+ within(Geometry const& g) : geometry(g) {}
+ Geometry geometry;
+};
+
+template <typename Geometry>
+struct not_covered_by
+{
+ not_covered_by(Geometry const& g) : geometry(g) {}
+ Geometry geometry;
+};
+
+template <typename Geometry>
+struct not_disjoint
+{
+ not_disjoint(Geometry const& g) : geometry(g) {}
+ Geometry geometry;
+};
+
+template <typename Geometry>
+struct not_intersects
+{
+ not_intersects(Geometry const& g) : geometry(g) {}
+ Geometry geometry;
+};
+
+template <typename Geometry>
+struct not_overlaps
+{
+ not_overlaps(Geometry const& g) : geometry(g) {}
+ Geometry geometry;
+};
+
+//template <typename Geometry>
+//struct not_touches
+//{
+// not_touches(Geometry const& g) : geometry(g) {}
+// Geometry geometry;
+//};
+
+template <typename Geometry>
+struct not_within
+{
+ not_within(Geometry const& g) : geometry(g) {}
+ Geometry geometry;
+};
+
+// ------------------------------------------------------------------ //
+// predicate_check
+// ------------------------------------------------------------------ //
+
+template <typename Geometry, typename Tag>
+struct predicate_check
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_TAG,
+ (predicate_check));
+};
+
+// ------------------------------------------------------------------ //
+// predicate_check for value
+// ------------------------------------------------------------------ //
+
+template <typename Geometry>
+struct predicate_check<Geometry, value_tag>
+{
+ template <typename Value, typename Indexable>
+ static inline bool apply(Geometry const& g, Value const&, Indexable const& i)
+ {
+ return geometry::intersects(i, g);
+ }
+};
+
+template <>
+struct predicate_check<empty, value_tag>
+{
+ template <typename Value, typename Indexable>
+ static inline bool apply(empty const&, Value const&, Indexable const&)
+ {
+ return true;
+ }
+};
+
+template <typename ValuePredicate>
+struct predicate_check<value<ValuePredicate>, value_tag>
+{
+ template <typename Value, typename Indexable>
+ static inline bool apply(value<ValuePredicate> const& p, Value const& v, Indexable const&)
+ {
+ return p.value_predicate(v);
+ }
+};
+
+template <typename Geometry>
+struct predicate_check<covered_by<Geometry>, value_tag>
+{
+ template <typename Value, typename Indexable>
+ static inline bool apply(covered_by<Geometry> const& p, Value const&, Indexable const& i)
+ {
+ return geometry::covered_by(i, p.geometry);
+ }
+};
+
+template <typename Geometry>
+struct predicate_check<disjoint<Geometry>, value_tag>
+{
+ template <typename Value, typename Indexable>
+ static inline bool apply(disjoint<Geometry> const& p, Value const&, Indexable const& i)
+ {
+ return geometry::disjoint(i, p.geometry);
+ }
+};
+
+template <typename Geometry>
+struct predicate_check<intersects<Geometry>, value_tag>
+{
+ template <typename Value, typename Indexable>
+ static inline bool apply(intersects<Geometry> const& p, Value const&, Indexable const& i)
+ {
+ return geometry::intersects(i, p.geometry);
+ }
+};
+
+template <typename Geometry>
+struct predicate_check<overlaps<Geometry>, value_tag>
+{
+ template <typename Value, typename Indexable>
+ static inline bool apply(overlaps<Geometry> const& p, Value const&, Indexable const& i)
+ {
+ return geometry::overlaps(i, p.geometry);
+ }
+};
+
+//template <typename Geometry>
+//struct predicate_check<touches<Geometry>, value_tag>
+//{
+// template <typename Value, typename Indexable>
+// static inline bool apply(touches<Geometry> const& p, Value const&, Indexable const& i)
+// {
+// return geometry::touches(i, p.geometry);
+// }
+//};
+
+template <typename Geometry>
+struct predicate_check<within<Geometry>, value_tag>
+{
+ template <typename Value, typename Indexable>
+ static inline bool apply(within<Geometry> const& p, Value const&, Indexable const& i)
+ {
+ return geometry::within(i, p.geometry);
+ }
+};
+
+template <typename Geometry>
+struct predicate_check<not_covered_by<Geometry>, value_tag>
+{
+ template <typename Value, typename Indexable>
+ static inline bool apply(not_covered_by<Geometry> const& p, Value const&, Indexable const& i)
+ {
+ return !geometry::covered_by(i, p.geometry);
+ }
+};
+
+template <typename Geometry>
+struct predicate_check<not_disjoint<Geometry>, value_tag>
+{
+ template <typename Value, typename Indexable>
+ static inline bool apply(not_disjoint<Geometry> const& p, Value const&, Indexable const& i)
+ {
+ return !geometry::disjoint(i, p.geometry);
+ }
+};
+
+template <typename Geometry>
+struct predicate_check<not_intersects<Geometry>, value_tag>
+{
+ template <typename Value, typename Indexable>
+ static inline bool apply(not_intersects<Geometry> const& p, Value const&, Indexable const& i)
+ {
+ return !geometry::intersects(i, p.geometry);
+ }
+};
+
+template <typename Geometry>
+struct predicate_check<not_overlaps<Geometry>, value_tag>
+{
+ template <typename Value, typename Indexable>
+ static inline bool apply(not_overlaps<Geometry> const& p, Value const&, Indexable const& i)
+ {
+ return !geometry::overlaps(i, p.geometry);
+ }
+};
+
+//template <typename Geometry>
+//struct predicate_check<not_touches<Geometry>, value_tag>
+//{
+// template <typename Value, typename Indexable>
+// static inline bool apply(not_touches<Geometry> const& p, Value const&, Indexable const& i)
+// {
+// return !geometry::touches(i, p.geometry);
+// }
+//};
+
+template <typename Geometry>
+struct predicate_check<not_within<Geometry>, value_tag>
+{
+ template <typename Value, typename Indexable>
+ static inline bool apply(not_within<Geometry> const& p, Value const&, Indexable const& i)
+ {
+ return !geometry::within(i, p.geometry);
+ }
+};
+
+// ------------------------------------------------------------------ //
+// predicates_chec for envelope
+// ------------------------------------------------------------------ //
+
+template <typename Geometry>
+struct predicate_check<Geometry, envelope_tag>
+{
+ template <typename Value, typename Indexable>
+ static inline bool apply(Geometry const& g, Value const&, Indexable const& i)
+ {
+ return geometry::intersects(i, g);
+ }
+};
+
+template <>
+struct predicate_check<empty, envelope_tag>
+{
+ template <typename Geometry, typename Value, typename Indexable>
+ static inline bool apply(Geometry const&, Value const&, Indexable const&)
+ {
+ return true;
+ }
+};
+
+template <typename ValuePredicate>
+struct predicate_check<value<ValuePredicate>, envelope_tag>
+{
+ template <typename Value, typename Box>
+ static bool apply(value<ValuePredicate> const&, Value const&, Box const&)
+ {
+ return true;
+ }
+};
+
+template <typename Geometry>
+struct predicate_check<covered_by<Geometry>, envelope_tag>
+{
+ template <typename Value, typename Box>
+ static bool apply(covered_by<Geometry> const& p, Value const&, Box const& i)
+ {
+ return geometry::intersects(i, p.geometry);
+ }
+};
+
+template <typename Geometry>
+struct predicate_check<disjoint<Geometry>, envelope_tag>
+{
+ template <typename Value, typename Box>
+ static bool apply(disjoint<Geometry> const& p, Value const&, Box const& i)
+ {
+ return !geometry::covered_by(i, p.geometry);
+ }
+};
+
+template <typename Geometry>
+struct predicate_check<intersects<Geometry>, envelope_tag>
+{
+ template <typename Value, typename Indexable>
+ static inline bool apply(intersects<Geometry> const& p, Value const&, Indexable const& i)
+ {
+ return geometry::intersects(i, p.geometry);
+ }
+};
+
+template <typename Geometry>
+struct predicate_check<overlaps<Geometry>, envelope_tag>
+{
+ template <typename Value, typename Box>
+ static inline bool apply(overlaps<Geometry> const& p, Value const&, Box const& i)
+ {
+ // TODO: awulkiew - possibly change to the version without border case
+ // e.g. intersects_without_border(0,0x1,1, 1,1x2,2) should give false
+ return geometry::intersects(i, p.geometry);
+ }
+};
+
+//template <typename Geometry>
+//struct predicate_check<touches<Geometry>, envelope_tag>
+//{
+// template <typename Value, typename Box>
+// static bool apply(touches<Geometry> const& p, Value const&, Box const& i)
+// {
+// return geometry::intersects(i, p.geometry);
+// }
+//};
+
+template <typename Geometry>
+struct predicate_check<within<Geometry>, envelope_tag>
+{
+ template <typename Value, typename Box>
+ static bool apply(within<Geometry> const& p, Value const&, Box const& i)
+ {
+ // TODO: awulkiew - possibly change to the version without border case
+ // e.g. intersects_without_border(0,0x1,1, 1,1x2,2) should give false
+ return geometry::intersects(i, p.geometry);
+ }
+};
+
+template <typename Geometry>
+struct predicate_check<not_covered_by<Geometry>, envelope_tag>
+{
+ template <typename Value, typename Box>
+ static bool apply(not_covered_by<Geometry> const& p, Value const&, Box const& i)
+ {
+ return !geometry::covered_by(i, p.geometry);
+ }
+};
+
+template <typename Geometry>
+struct predicate_check<not_disjoint<Geometry>, envelope_tag>
+{
+ template <typename Value, typename Box>
+ static bool apply(not_disjoint<Geometry> const& p, Value const&, Box const& i)
+ {
+ return !geometry::disjoint(i, p.geometry);
+ }
+};
+
+template <typename Geometry>
+struct predicate_check<not_intersects<Geometry>, envelope_tag>
+{
+ template <typename Value, typename Box>
+ static bool apply(not_intersects<Geometry> const& p, Value const&, Box const& i)
+ {
+ return !geometry::covered_by(i, p.geometry);
+ }
+};
+
+template <typename Geometry>
+struct predicate_check<not_overlaps<Geometry>, envelope_tag>
+{
+ template <typename Value, typename Box>
+ static bool apply(not_overlaps<Geometry> const& p, Value const&, Box const& i)
+ {
+ return true;
+ }
+};
+
+//template <typename Geometry>
+//struct predicate_check<not_touches<Geometry>, envelope_tag>
+//{
+// template <typename Value, typename Box>
+// static bool apply(not_touches<Geometry> const& p, Value const&, Box const& i)
+// {
+// return !geometry::intersects(i, p.geometry);
+// }
+//};
+
+template <typename Geometry>
+struct predicate_check<not_within<Geometry>, envelope_tag>
+{
+ template <typename Value, typename Box>
+ static bool apply(not_within<Geometry> const& p, Value const&, Box const& i)
+ {
+ return !geometry::within(i, p.geometry);
+ }
+};
+
+// ------------------------------------------------------------------ //
+// predicates_check
+// ------------------------------------------------------------------ //
+
+template <typename TuplePredicates, typename Tag, unsigned int N>
+struct predicates_check_tuple
+{
+ template <typename Value, typename Indexable>
+ static inline bool apply(TuplePredicates const& p, Value const& v, Indexable const& i)
+ {
+ return predicates_check_tuple<TuplePredicates, Tag, N - 1>::apply(p, v, i)
+ && predicate_check<
+ typename boost::tuples::element<N - 1, TuplePredicates>::type,
+ Tag
+ >::apply(boost::get<N - 1>(p), v, i);
+ }
+};
+
+template <typename TuplePredicates, typename Tag>
+struct predicates_check_tuple<TuplePredicates, Tag, 1>
+{
+ template <typename Value, typename Indexable>
+ static inline bool apply(TuplePredicates const& p, Value const& v, Indexable const& i)
+ {
+ return predicate_check<
+ typename boost::tuples::element<0, TuplePredicates>::type,
+ Tag
+ >::apply(boost::get<0>(p), v, i);
+ }
+};
+
+template <typename Predicate, typename Tag>
+struct predicates_check_impl
+{
+ template <typename Value, typename Indexable>
+ static inline bool apply(Predicate const& p, Value const& v, Indexable const& i)
+ {
+ return predicate_check<Predicate, Tag>::apply(p, v, i);
+ }
+};
+
+template <typename Predicate1, typename Predicate2, typename Tag>
+struct predicates_check_impl<std::pair<Predicate1, Predicate2>, Tag>
+{
+ template <typename Value, typename Indexable>
+ static inline bool apply(std::pair<Predicate1, Predicate2> const& p, Value const& v, Indexable const& i)
+ {
+ return predicate_check<Predicate1, Tag>::apply(p.first, v, i)
+ && predicate_check<Predicate2, Tag>::apply(p.second, v, i);
+ }
+};
+
+template <
+ typename T0, typename T1, typename T2, typename T3, typename T4,
+ typename T5, typename T6, typename T7, typename T8, typename T9,
+ typename Tag
+>
+struct predicates_check_impl<
+ boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>,
+ Tag
+>
+{
+ typedef boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> predicates_type;
+
+ template <typename Value, typename Indexable>
+ static inline bool apply(predicates_type const& p, Value const& v, Indexable const& i)
+ {
+ return predicates_check_tuple<
+ predicates_type,
+ Tag,
+ boost::tuples::length<predicates_type>::value
+ >::apply(p, v, i);
+ }
+};
+
+template <typename Tag, typename Predicates, typename Value, typename Indexable>
+inline bool predicates_check(Predicates const& p, Value const& v, Indexable const& i)
+{
+ return detail::predicates_check_impl<Predicates, Tag>
+ ::apply(p, v, i);
+}
+
+}}}} // namespace boost::geometry::index::detail
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_PREDICATES_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/pushable_array.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/pushable_array.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,171 @@
+// Boost.Geometry Index
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_PUSHABLE_ARRAY_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_PUSHABLE_ARRAY_HPP
+
+#include <boost/array.hpp>
+
+#include <boost/geometry/index/detail/assert.hpp>
+
+namespace boost { namespace geometry { namespace index { namespace detail {
+
+template <typename Element, size_t Capacity>
+class pushable_array
+{
+ typedef typename boost::array<Element, Capacity> array_type;
+
+public:
+ typedef typename array_type::value_type value_type;
+ typedef typename array_type::size_type size_type;
+ typedef typename array_type::iterator iterator;
+ typedef typename array_type::const_iterator const_iterator;
+ typedef typename array_type::reverse_iterator reverse_iterator;
+ typedef typename array_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename array_type::reference reference;
+ typedef typename array_type::const_reference const_reference;
+
+ inline pushable_array()
+ : m_size(0)
+ {}
+
+ inline explicit pushable_array(size_type s)
+ : m_size(s)
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(s <= Capacity, "size too big");
+ }
+
+ inline void resize(size_type s)
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(s <= Capacity, "size too big");
+ m_size = s;
+ }
+
+ inline void reserve(size_type /*s*/)
+ {
+ //BOOST_GEOMETRY_INDEX_ASSERT(s <= Capacity, "size too big");
+ // do nothing
+ }
+
+ inline Element & operator[](size_type i)
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(i < m_size, "index of the element outside the container");
+ return m_array[i];
+ }
+
+ inline Element const& operator[](size_type i) const
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(i < m_size, "index of the element outside the container");
+ return m_array[i];
+ }
+
+ inline Element const& front() const
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container");
+ return m_array.front();
+ }
+
+ inline Element & front()
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container");
+ return m_array.front();
+ }
+
+ inline Element const& back() const
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container");
+ return *(begin() + (m_size - 1));
+ }
+
+ inline Element & back()
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container");
+ return *(begin() + (m_size - 1));
+ }
+
+ inline iterator begin()
+ {
+ return m_array.begin();
+ }
+
+ inline iterator end()
+ {
+ return m_array.begin() + m_size;
+ }
+
+ inline const_iterator begin() const
+ {
+ return m_array.begin();
+ }
+
+ inline const_iterator end() const
+ {
+ return m_array.begin() + m_size;
+ }
+
+ inline reverse_iterator rbegin()
+ {
+ return reverse_iterator(end());
+ }
+
+ inline reverse_iterator rend()
+ {
+ return reverse_iterator(begin());
+ }
+
+ inline const_reverse_iterator rbegin() const
+ {
+ return const_reverse_iterator(end());
+ }
+
+ inline const_reverse_iterator rend() const
+ {
+ return const_reverse_iterator(begin());
+ }
+
+ inline void clear()
+ {
+ m_size = 0;
+ }
+
+ inline void push_back(Element const& v)
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(m_size < Capacity, "can't further increase the size of the container");
+ m_array[m_size] = v;
+ ++m_size;
+ }
+
+ inline void pop_back()
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container");
+ --m_size;
+ }
+
+ inline bool empty() const
+ {
+ return m_size == 0;
+ }
+
+ inline size_t size() const
+ {
+ return m_size;
+ }
+
+ inline size_t capacity() const
+ {
+ return Capacity;
+ }
+
+private:
+ boost::array<Element, Capacity> m_array;
+ size_type m_size;
+};
+
+}}}} // namespace boost::geometry::index::detail
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_PUSHABLE_ARRAY_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/adaptors.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/adaptors.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,85 @@
+// Boost.Geometry Index
+//
+// R-tree queries range adaptors
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_ADAPTORS_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_ADAPTORS_HPP
+
+#include <deque>
+#include <boost/static_assert.hpp>
+
+#include <boost/geometry/index/adaptors/spatial_query.hpp>
+#include <boost/geometry/index/adaptors/nearest_query.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+template <typename Value, typename Options, typename Translator, typename Allocator>
+class rtree;
+
+namespace adaptors {
+
+template <typename Value, typename Options, typename Translator, typename Allocator>
+class spatial_query_range< index::rtree<Value, Options, Translator, Allocator> >
+{
+public:
+ typedef std::vector<Value> result_type;
+ typedef typename result_type::iterator iterator;
+ typedef typename result_type::const_iterator const_iterator;
+
+ template <typename Predicates>
+ inline spatial_query_range(
+ index::rtree<Value, Options, Translator, Allocator> const& rtree,
+ Predicates const& pred
+ )
+ {
+ rtree.spatial_query(pred, std::back_inserter(m_result));
+ }
+
+ inline iterator begin() { return m_result.begin(); }
+ inline iterator end() { return m_result.end(); }
+ inline const_iterator begin() const { return m_result.begin(); }
+ inline const_iterator end() const { return m_result.end(); }
+
+private:
+ result_type m_result;
+};
+
+template <typename Value, typename Options, typename Translator, typename Allocator>
+class nearest_query_range< index::rtree<Value, Options, Translator, Allocator> >
+{
+public:
+ typedef std::vector<Value> result_type;
+ typedef typename result_type::iterator iterator;
+ typedef typename result_type::const_iterator const_iterator;
+
+ template <typename DistancesPredicates, typename Predicates>
+ inline nearest_query_range(
+ index::rtree<Value, Options, Translator, Allocator> const& rtree,
+ DistancesPredicates const& dpred,
+ size_t k,
+ Predicates const& pred
+ )
+ {
+ rtree.nearest_query(dpred, k, pred, std::back_inserter(m_result));
+ }
+
+ inline iterator begin() { return m_result.begin(); }
+ inline iterator end() { return m_result.end(); }
+ inline const_iterator begin() const { return m_result.begin(); }
+ inline const_iterator end() const { return m_result.end(); }
+
+private:
+ result_type m_result;
+};
+
+} // namespace adaptors
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_ADAPTORS_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/kmeans/kmeans.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/kmeans/kmeans.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,16 @@
+// Boost.Geometry Index
+//
+// R-tree kmeans algorithm implementation
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_KMEANS_KMEANS_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_KMEANS_HPP
+
+#include <boost/geometry/index/rtree/kmeans/split.hpp>
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_KMEANS_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/kmeans/split.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/kmeans/split.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,87 @@
+// Boost.Geometry Index
+//
+// R-tree kmeans split algorithm implementation
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_KMEANS_SPLIT_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_SPLIT_HPP
+
+#include <boost/geometry/index/rtree/node/node.hpp>
+#include <boost/geometry/index/rtree/visitors/insert.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+namespace kmeans {
+
+// some details
+
+} // namespace kmeans
+
+// split_kmeans_tag
+// OR
+// split_clusters_tag and redistribute_kmeans_tag - then redistribute will probably slightly different interface
+// or some other than "redistribute"
+
+// 1. for this algorithm one probably MUST USE NON-STATIC NODES with node_default_tag
+// or the algorithm must be changed somehow - to not store additional nodes in the current node
+// but return excessive element/elements container instead (possibly pushable_array<1> or std::vector)
+// this would also cause building of smaller trees since +1 element in nodes wouldn't be needed in different redistributing algorithms
+// 2. it is probably possible to add e.g. 2 levels of tree in one insert
+
+// Edge case is that every node split generates M + 1 children, in parent containing M nodes
+// result is 2M + 1 nodes in parent on this level
+// On next level the same, next the same and so on.
+// We have Depth*M+1 nodes in the root
+// The tree may then gain some > 1 levels in one insert
+// split::apply() manages this but special attention is required
+
+// which algorithm should be used to choose current node in traversing while inserting?
+// some of the currently used ones or some using mean values as well?
+
+// TODO
+// 1. Zmienic troche algorytm zeby przekazywal nadmiarowe elementy do split
+// i pobieral ze split nadmiarowe elementy rodzica
+// W zaleznosci od algorytmu w rozny sposob - l/q/r* powinny zwracac np pushable_array<1>
+// wtedy tez is_overerflow (z R* insert?) bedzie nieportrzebne
+// Dla kmeans zapewne std::vector, jednak w wezlach nadal moglaby byc pushable_array
+// 2. Fajnie byloby tez uproscic te wszystkie parametry root,parent,index itd. Mozliwe ze okazalyby sie zbedne
+// 3. Sprawdzyc czasy wykonywania i zajetosc pamieci
+// 4. Pamietac o parametryzacji kontenera z nadmiarowymi elementami
+// PS. Z R* reinsertami moze byc masakra
+
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+class split<Value, Options, Translator, Box, Allocators, split_kmeans_tag>
+{
+protected:
+ typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+ typedef typename Options::parameters_type parameters_type;
+
+public:
+ template <typename Node>
+ static inline void apply(node* & root_node,
+ size_t & leafs_level,
+ Node & n,
+ internal_node *parent_node,
+ size_t current_child_index,
+ Translator const& tr,
+ Allocators & allocators)
+ {
+
+ }
+};
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_SPLIT_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/linear/linear.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/linear/linear.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,16 @@
+// Boost.Geometry Index
+//
+// R-tree linear algorithm implementation
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_LINEAR_LINEAR_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_LINEAR_LINEAR_HPP
+
+#include <boost/geometry/index/detail/rtree/linear/redistribute_elements.hpp>
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_LINEAR_LINEAR_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/linear/redistribute_elements.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/linear/redistribute_elements.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,331 @@
+// Boost.Geometry Index
+//
+// R-tree linear split algorithm implementation
+//
+// Copyright (c) 2008 Federico J. Fernandez.
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_LINEAR_REDISTRIBUTE_ELEMENTS_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_LINEAR_REDISTRIBUTE_ELEMENTS_HPP
+
+#include <boost/type_traits/is_unsigned.hpp>
+
+#include <boost/geometry/index/detail/algorithms/content.hpp>
+
+#include <boost/geometry/index/detail/rtree/node/node.hpp>
+#include <boost/geometry/index/detail/rtree/visitors/insert.hpp>
+#include <boost/geometry/index/detail/rtree/visitors/is_leaf.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+namespace linear {
+
+// TODO: awulkiew - there are loops inside find_greatest_normalized_separation::apply()
+// iteration is done for each DimensionIndex.
+// Separations and seeds for all DimensionIndex(es) could be calculated at once, stored, then the greatest would be choosen.
+
+// TODO: Implement separate version for Points
+
+// What if width calculated inside find_greatest_normalized_separation::apply() is near 0?
+// What epsilon should be taken to calculation and what would be the value of resulting separation?
+
+// from void find_normalized_separations(std::vector<Box> const& boxes, T& separation, unsigned int& first, unsigned int& second) const
+
+template <typename Elements, typename Parameters, typename Translator, size_t DimensionIndex>
+struct find_greatest_normalized_separation
+{
+ typedef typename Elements::value_type element_type;
+ typedef typename rtree::element_indexable_type<element_type, Translator>::type indexable_type;
+ typedef typename index::detail::traits::coordinate_type<indexable_type>::type coordinate_type;
+
+ static inline void apply(Elements const& elements,
+ Parameters const& parameters,
+ Translator const& translator,
+ coordinate_type & separation,
+ size_t & seed1,
+ size_t & seed2)
+ {
+ const size_t elements_count = parameters.get_max_elements() + 1;
+ BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == elements_count, "unexpected number of elements");
+ BOOST_GEOMETRY_INDEX_ASSERT(2 <= elements_count, "unexpected number of elements");
+
+ // find the lowest low, highest high
+ coordinate_type lowest_low = index::detail::get<min_corner, DimensionIndex>(rtree::element_indexable(elements[0], translator));
+ coordinate_type highest_high = index::detail::get<max_corner, DimensionIndex>(rtree::element_indexable(elements[0], translator));
+ // and the lowest high
+ coordinate_type lowest_high = highest_high;
+ size_t lowest_high_index = 0;
+ for ( size_t i = 1 ; i < elements_count ; ++i )
+ {
+ coordinate_type min_coord = index::detail::get<min_corner, DimensionIndex>(rtree::element_indexable(elements[i], translator));
+ coordinate_type max_coord = index::detail::get<max_corner, DimensionIndex>(rtree::element_indexable(elements[i], translator));
+
+ if ( max_coord < lowest_high )
+ {
+ lowest_high = max_coord;
+ lowest_high_index = i;
+ }
+
+ if ( min_coord < lowest_low )
+ lowest_low = min_coord;
+
+ if ( highest_high < max_coord )
+ highest_high = max_coord;
+ }
+
+ // find the highest low
+ size_t highest_low_index = lowest_high_index == 0 ? 1 : 0;
+ coordinate_type highest_low = index::detail::get<min_corner, DimensionIndex>(rtree::element_indexable(elements[highest_low_index], translator));
+ for ( size_t i = highest_low_index ; i < elements_count ; ++i )
+ {
+ coordinate_type min_coord = index::detail::get<min_corner, DimensionIndex>(rtree::element_indexable(elements[i], translator));
+ if ( highest_low < min_coord &&
+ i != lowest_high_index )
+ {
+ highest_low = min_coord;
+ highest_low_index = i;
+ }
+ }
+
+ coordinate_type const width = highest_high - lowest_low;
+
+ // TODO: awulkiew - following separation calculation has two flaws:
+ // 1. for floating point numbers width should be compared witn some EPS
+ // 2. separation calculation won't work for unsigned numbers
+ // but there should be possible to calculate negative value (cast to some floating point type?)
+
+ // Temporary workaround
+ BOOST_STATIC_ASSERT(!boost::is_unsigned<coordinate_type>::value);
+
+ if ( width == 0 )
+ separation = 0;
+ // (highest_low - lowest_high) == 0
+ else
+ separation = (highest_low - lowest_high) / width;
+
+ seed1 = highest_low_index;
+ seed2 = lowest_high_index;
+ }
+};
+
+template <typename Elements, typename Parameters, typename Translator, size_t Dimension>
+struct pick_seeds_impl
+{
+ BOOST_STATIC_ASSERT(0 < Dimension);
+
+ typedef typename Elements::value_type element_type;
+ typedef typename rtree::element_indexable_type<element_type, Translator>::type indexable_type;
+ typedef typename index::detail::traits::coordinate_type<indexable_type>::type coordinate_type;
+
+ static inline void apply(Elements const& elements,
+ Parameters const& parameters,
+ Translator const& tr,
+ coordinate_type & separation,
+ size_t & seed1,
+ size_t & seed2)
+ {
+ pick_seeds_impl<Elements, Parameters, Translator, Dimension - 1>::apply(elements, parameters, tr, separation, seed1, seed2);
+
+ coordinate_type current_separation;
+ size_t s1, s2;
+ find_greatest_normalized_separation<Elements, Parameters, Translator, Dimension - 1>::apply(elements, parameters, tr, current_separation, s1, s2);
+
+ // in the old implementation different operator was used: <= (y axis prefered)
+ if ( separation < current_separation )
+ {
+ separation = current_separation;
+ seed1 = s1;
+ seed2 = s2;
+ }
+ }
+};
+
+template <typename Elements, typename Parameters, typename Translator>
+struct pick_seeds_impl<Elements, Parameters, Translator, 1>
+{
+ typedef typename Elements::value_type element_type;
+ typedef typename rtree::element_indexable_type<element_type, Translator>::type indexable_type;
+ typedef typename index::detail::traits::coordinate_type<indexable_type>::type coordinate_type;
+
+ static inline void apply(Elements const& elements,
+ Parameters const& parameters,
+ Translator const& tr,
+ coordinate_type & separation,
+ size_t & seed1,
+ size_t & seed2)
+ {
+ find_greatest_normalized_separation<Elements, Parameters, Translator, 0>::apply(elements, parameters, tr, separation, seed1, seed2);
+ }
+};
+
+// from void linear_pick_seeds(node_pointer const& n, unsigned int &seed1, unsigned int &seed2) const
+
+template <typename Elements, typename Parameters, typename Translator>
+struct pick_seeds
+{
+ typedef typename Elements::value_type element_type;
+ typedef typename rtree::element_indexable_type<element_type, Translator>::type indexable_type;
+ typedef typename index::detail::traits::coordinate_type<indexable_type>::type coordinate_type;
+
+ static const size_t dimension = index::detail::traits::dimension<indexable_type>::value;
+
+ static inline void apply(Elements const& elements,
+ Parameters const& parameters,
+ Translator const& tr,
+ size_t & seed1,
+ size_t & seed2)
+ {
+ coordinate_type separation = 0;
+ pick_seeds_impl<Elements, Parameters, Translator, dimension>::apply(elements, parameters, tr, separation, seed1, seed2);
+ }
+};
+
+} // namespace linear
+
+// from void split_node(node_pointer const& n, node_pointer& n1, node_pointer& n2) const
+
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+struct redistribute_elements<Value, Options, Translator, Box, Allocators, linear_tag>
+{
+ typedef typename Options::parameters_type parameters_type;
+
+ typedef typename rtree::node<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+ template <typename Node>
+ static inline void apply(Node & n,
+ Node & second_node,
+ Box & box1,
+ Box & box2,
+ parameters_type const& parameters,
+ Translator const& translator,
+ Allocators & allocators)
+ {
+ typedef typename rtree::elements_type<Node>::type elements_type;
+ typedef typename elements_type::value_type element_type;
+ typedef typename rtree::element_indexable_type<element_type, Translator>::type indexable_type;
+ typedef typename index::detail::traits::coordinate_type<indexable_type>::type coordinate_type;
+ typedef typename index::detail::default_content_result<Box>::type content_type;
+
+ elements_type & elements1 = rtree::elements(n);
+ elements_type & elements2 = rtree::elements(second_node);
+ const size_t elements1_count = parameters.get_max_elements() + 1;
+
+ BOOST_GEOMETRY_INDEX_ASSERT(elements1.size() == elements1_count, "unexpected number of elements");
+
+ // copy original elements
+ elements_type elements_copy(elements1); // MAY THROW, STRONG (alloc, copy)
+
+ // calculate initial seeds
+ size_t seed1 = 0;
+ size_t seed2 = 0;
+ linear::pick_seeds<
+ elements_type,
+ parameters_type,
+ Translator
+ >::apply(elements_copy, parameters, translator, seed1, seed2);
+
+ // prepare nodes' elements containers
+ elements1.clear();
+ BOOST_GEOMETRY_INDEX_ASSERT(elements2.empty(), "unexpected container state");
+
+ try
+ {
+ // add seeds
+ elements1.push_back(elements_copy[seed1]); // MAY THROW, STRONG (copy)
+ elements2.push_back(elements_copy[seed2]); // MAY THROW, STRONG (alloc, copy)
+
+ // calculate boxes
+ geometry::convert(rtree::element_indexable(elements_copy[seed1], translator), box1);
+ geometry::convert(rtree::element_indexable(elements_copy[seed2], translator), box2);
+
+ // initialize areas
+ content_type content1 = index::detail::content(box1);
+ content_type content2 = index::detail::content(box2);
+
+ BOOST_GEOMETRY_INDEX_ASSERT(2 <= elements1_count, "unexpected elements number");
+ size_t remaining = elements1_count - 2;
+
+ // redistribute the rest of the elements
+ for ( size_t i = 0 ; i < elements1_count ; ++i )
+ {
+ if (i != seed1 && i != seed2)
+ {
+ element_type const& elem = elements_copy[i];
+ indexable_type const& indexable = rtree::element_indexable(elem, translator);
+
+ // if there is small number of elements left and the number of elements in node is lesser than min_elems
+ // just insert them to this node
+ if ( elements1.size() + remaining <= parameters.get_min_elements() )
+ {
+ elements1.push_back(elem); // MAY THROW, STRONG (copy)
+ geometry::expand(box1, indexable);
+ content1 = index::detail::content(box1);
+ }
+ else if ( elements2.size() + remaining <= parameters.get_min_elements() )
+ {
+ elements2.push_back(elem); // MAY THROW, STRONG (alloc, copy)
+ geometry::expand(box2, indexable);
+ content2 = index::detail::content(box2);
+ }
+ // choose better node and insert element
+ else
+ {
+ // calculate enlarged boxes and areas
+ Box enlarged_box1(box1);
+ Box enlarged_box2(box2);
+ geometry::expand(enlarged_box1, indexable);
+ geometry::expand(enlarged_box2, indexable);
+ content_type enlarged_content1 = index::detail::content(enlarged_box1);
+ content_type enlarged_content2 = index::detail::content(enlarged_box2);
+
+ content_type content_increase1 = enlarged_content1 - content1;
+ content_type content_increase2 = enlarged_content2 - content2;
+
+ // 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); // MAY THROW, STRONG (copy)
+ box1 = enlarged_box1;
+ content1 = enlarged_content1;
+ }
+ else
+ {
+ elements2.push_back(elem); // MAY THROW, STRONG (alloc, copy)
+ box2 = enlarged_box2;
+ content2 = enlarged_content2;
+ }
+ }
+
+ BOOST_GEOMETRY_INDEX_ASSERT(0 < remaining, "unexpected value");
+ --remaining;
+ }
+ }
+ }
+ catch (...)
+ {
+ elements1.clear();
+ elements2.clear();
+
+ rtree::destroy_elements<Value, Options, Translator, Box, Allocators>::apply(elements_copy, allocators);
+ //elements_copy.clear();
+
+ throw; // RETHROW, BASIC
+ }
+ }
+};
+
+}} // namespace detail::rtree::visitors
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_LINEAR_REDISTRIBUTE_ELEMENTS_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/concept.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/concept.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,85 @@
+// Boost.Geometry Index
+//
+// R-tree node concept
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_NODE_CONCEPT_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_CONCEPT_HPP
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct node
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_TAG_TYPE,
+ (node));
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct internal_node
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_TAG_TYPE,
+ (internal_node));
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct leaf
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_TAG_TYPE,
+ (leaf));
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, bool IsVisitableConst>
+struct visitor
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_TAG_TYPE,
+ (visitor));
+};
+
+template <typename Allocator, typename Value, typename Parameters, typename Box, typename Tag>
+class allocators
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_TAG_TYPE,
+ (allocators));
+};
+
+template <typename Allocators, typename Node>
+struct create_node
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_NODE_TYPE,
+ (create_node));
+};
+
+template <typename Allocators, typename Node>
+struct destroy_node
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_NODE_TYPE,
+ (destroy_node));
+};
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_CONCEPT_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/dynamic_visitor.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/dynamic_visitor.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,95 @@
+// Boost.Geometry Index
+//
+// R-tree nodes dynamic visitor and nodes base type
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_NODE_DYNAMIC_VISITOR_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_DYNAMIC_VISITOR_HPP
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+// visitor forward declaration
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, bool IsVisitableConst>
+struct dynamic_visitor;
+
+// node
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct dynamic_node
+{
+ virtual ~dynamic_node() {}
+ virtual void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, Tag, false> &) = 0;
+ virtual void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, Tag, true> &) const = 0;
+};
+
+// nodes variants forward declarations
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct dynamic_internal_node;
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct dynamic_leaf;
+
+// visitor
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct dynamic_visitor<Value, Parameters, Box, Allocators, Tag, true>
+{
+ typedef dynamic_internal_node<Value, Parameters, Box, Allocators, Tag> internal_node;
+ typedef dynamic_leaf<Value, Parameters, Box, Allocators, Tag> leaf;
+
+ virtual ~dynamic_visitor() {}
+
+ virtual void operator()(internal_node const&) = 0;
+ virtual void operator()(leaf const&) = 0;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct dynamic_visitor<Value, Parameters, Box, Allocators, Tag, false>
+{
+ typedef dynamic_internal_node<Value, Parameters, Box, Allocators, Tag> internal_node;
+ typedef dynamic_leaf<Value, Parameters, Box, Allocators, Tag> leaf;
+
+ virtual ~dynamic_visitor() {}
+
+ virtual void operator()(internal_node &) = 0;
+ virtual void operator()(leaf &) = 0;
+};
+
+// nodes conversion
+
+template <typename Derived, typename Parameters, typename Value, typename Box, typename Allocators, typename Tag>
+inline Derived & get(dynamic_node<Value, Parameters, Box, Allocators, Tag> & n)
+{
+ BOOST_GEOMETRY_INDEX_ASSERT(dynamic_cast<Derived*>(&n), "can't cast to a Derived type");
+ return static_cast<Derived&>(n);
+}
+
+template <typename Derived, typename Parameters, typename Value, typename Box, typename Allocators, typename Tag>
+inline Derived * get(dynamic_node<Value, Parameters, Box, Allocators, Tag> * n)
+{
+ BOOST_GEOMETRY_INDEX_ASSERT(dynamic_cast<Derived*>(n), "can't cast to a Derived type");
+ return static_cast<Derived*>(n);
+}
+
+// apply visitor
+
+template <typename Visitor, typename Visitable>
+inline void apply_visitor(Visitor & v, Visitable & n)
+{
+ BOOST_GEOMETRY_INDEX_ASSERT(&n, "null ptr");
+ n.apply_visitor(v);
+}
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_DYNAMIC_VISITOR_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,162 @@
+// Boost.Geometry Index
+//
+// R-tree nodes
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_NODE_NODE_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_HPP
+
+#include <boost/geometry/index/detail/rtree/node/concept.hpp>
+
+#include <boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp>
+#include <boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp>
+
+#include <boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp>
+#include <boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp>
+
+#include <boost/geometry/index/detail/rtree/node/node_auto_ptr.hpp>
+
+#include <boost/geometry/algorithms/expand.hpp>
+
+#include <boost/geometry/index/detail/rtree/visitors/is_leaf.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+// elements box
+
+template <typename Box, typename FwdIter, typename Translator>
+inline Box elements_box(FwdIter first, FwdIter last, Translator const& tr)
+{
+ BOOST_GEOMETRY_INDEX_ASSERT(first != last, "Can't calculate element's box");
+
+ Box result;
+
+ geometry::convert(element_indexable(*first, tr), result);
+ ++first;
+
+ for ( ; first != last ; ++first )
+ geometry::expand(result, element_indexable(*first, tr));
+
+ return result;
+}
+
+// destroys subtree if the element is internal node's element
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+struct destroy_element
+{
+ typedef typename Options::parameters_type parameters_type;
+
+ typedef typename rtree::internal_node<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+ typedef rtree::node_auto_ptr<Value, Options, Translator, Box, Allocators> node_auto_ptr;
+
+ inline static void apply(typename internal_node::elements_type::value_type & element, Allocators & allocators)
+ {
+ node_auto_ptr dummy(element.second, allocators);
+ element.second = 0;
+ }
+
+ inline static void apply(typename leaf::elements_type::value_type &, Allocators &) {}
+};
+
+// destroys stored subtrees if internal node's elements are passed
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+struct destroy_elements
+{
+ typedef typename Options::parameters_type parameters_type;
+
+ typedef typename rtree::internal_node<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+ typedef rtree::node_auto_ptr<Value, Options, Translator, Box, Allocators> node_auto_ptr;
+
+ inline static void apply(typename internal_node::elements_type & elements, Allocators & allocators)
+ {
+ for ( size_t i = 0 ; i < elements.size() ; ++i )
+ {
+ node_auto_ptr dummy(elements[i].second, allocators);
+ elements[i].second = 0;
+ }
+ }
+
+ inline static void apply(typename leaf::elements_type &, Allocators &)
+ {}
+
+ inline static void apply(typename internal_node::elements_type::iterator first,
+ typename internal_node::elements_type::iterator last,
+ Allocators & allocators)
+ {
+ for ( ; first != last ; ++first )
+ {
+ node_auto_ptr dummy(first->second, allocators);
+ first->second = 0;
+ }
+ }
+
+ inline static void apply(typename leaf::elements_type::iterator /*first*/,
+ typename leaf::elements_type::iterator /*last*/,
+ Allocators & /*allocators*/)
+ {}
+};
+
+// clears node, deletes all subtrees stored in node
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+struct clear_node
+{
+ typedef typename Options::parameters_type parameters_type;
+
+ typedef typename rtree::node<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+ inline static void apply(node & node, Allocators & allocators)
+ {
+ rtree::visitors::is_leaf<Value, Options, Box, Allocators> ilv;
+ rtree::apply_visitor(ilv, node);
+ if ( ilv.result )
+ {
+ apply(rtree::get<leaf>(node), allocators);
+ }
+ else
+ {
+ apply(rtree::get<internal_node>(node), allocators);
+ }
+ }
+
+ inline static void apply(internal_node & internal_node, Allocators & allocators)
+ {
+ destroy_elements<Value, Options, Translator, Box, Allocators>::apply(rtree::elements(internal_node), allocators);
+ rtree::elements(internal_node).clear();
+ }
+
+ inline static void apply(leaf & leaf, Allocators &)
+ {
+ rtree::elements(leaf).clear();
+ }
+};
+
+template <typename Container, typename Iterator>
+void copy_from_back(Container & container, Iterator it)
+{
+ BOOST_GEOMETRY_INDEX_ASSERT(!container.empty(), "cannot copy from empty container");
+ Iterator back_it = container.end();
+ --back_it;
+ if ( it != back_it )
+ {
+ *it = *back_it; // MAY THROW (copy)
+ }
+}
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node_auto_ptr.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node_auto_ptr.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,78 @@
+// Boost.Geometry Index
+//
+// R-tree node auto ptr
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_NODE_NODE_AUTO_PTR_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_AUTO_PTR_HPP
+
+#include <boost/noncopyable.hpp>
+
+#include <boost/geometry/index/detail/rtree/visitors/destroy.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+class node_auto_ptr
+ : boost::noncopyable
+{
+ typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+
+public:
+ node_auto_ptr(node * ptr, Allocators & allocators)
+ : m_ptr(ptr)
+ , m_allocators(allocators)
+ {}
+
+ ~node_auto_ptr()
+ {
+ reset();
+ }
+
+ void reset(node * ptr = 0)
+ {
+ if ( m_ptr )
+ {
+ detail::rtree::visitors::destroy<Value, Options, Translator, Box, Allocators> del_v(m_ptr, m_allocators);
+ detail::rtree::apply_visitor(del_v, *m_ptr);
+ }
+ m_ptr = ptr;
+ }
+
+ void release()
+ {
+ m_ptr = 0;
+ }
+
+ node * get() const
+ {
+ return m_ptr;
+ }
+
+ node & operator*() const
+ {
+ return *m_ptr;
+ }
+
+ node * operator->() const
+ {
+ return m_ptr;
+ }
+
+private:
+ node * m_ptr;
+ Allocators & m_allocators;
+};
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_AUTO_PTR_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,339 @@
+// Boost.Geometry Index
+//
+// R-tree nodes based on run-time polymorphism, storing std::vectors
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_HPP
+
+#include <vector>
+
+#include <boost/geometry/index/detail/rtree/node/dynamic_visitor.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct dynamic_internal_node<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag>
+ : public dynamic_node<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag>
+{
+ typedef std::vector<
+ std::pair<Box, dynamic_node<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag> *>,
+ typename Allocators::internal_node_elements_allocator_type
+ > elements_type;
+
+ inline dynamic_internal_node(typename Allocators::internal_node_elements_allocator_type & al)
+ : elements(al)
+ {}
+
+ void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag, false> & v) { v(*this); }
+ void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag, true> & v) const { v(*this); }
+
+ elements_type elements;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct dynamic_leaf<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag>
+ : public dynamic_node<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag>
+{
+ typedef std::vector<
+ Value,
+ typename Allocators::leaf_elements_allocator_type
+ > elements_type;
+
+ inline dynamic_leaf(typename Allocators::leaf_elements_allocator_type & al)
+ : elements(al)
+ {}
+
+ void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag, false> & v) { v(*this); }
+ void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag, true> & v) const { v(*this); }
+
+ elements_type elements;
+};
+
+// nodes traits
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct node<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag>
+{
+ typedef dynamic_node<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag> type;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct internal_node<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag>
+{
+ typedef dynamic_internal_node<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag> type;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct leaf<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag>
+{
+ typedef dynamic_leaf<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag> type;
+};
+
+// visitor traits
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, bool IsVisitableConst>
+struct visitor<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag, IsVisitableConst>
+{
+ typedef dynamic_visitor<Value, Parameters, Box, Allocators, node_d_mem_dynamic_tag, IsVisitableConst> type;
+};
+
+// element's indexable type
+
+template <typename Value, typename Translator>
+struct element_indexable_type
+{
+ typedef typename translator::indexable_type<Translator>::type type;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, typename Translator>
+struct element_indexable_type<
+ std::pair<Box, dynamic_node<Value, Parameters, Box, Allocators, Tag> *>,
+ Translator
+>
+{
+ typedef Box type;
+};
+
+// element's indexable getter
+
+template <typename Value, typename Translator>
+inline typename Translator::result_type
+element_indexable(Value const& el, Translator const& tr)
+{
+ return tr(el);
+}
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, typename Translator>
+inline Box const&
+element_indexable(
+ std::pair< Box, dynamic_node<Value, Parameters, Box, Allocators, Tag> *> const& el,
+ Translator const&)
+{
+ return el.first;
+}
+
+// nodes elements
+
+template <typename Node>
+struct elements_type
+{
+ typedef typename Node::elements_type type;
+};
+
+template <typename Node>
+inline typename elements_type<Node>::type &
+elements(Node & n)
+{
+ return n.elements;
+}
+
+template <typename Node>
+inline typename elements_type<Node>::type const&
+elements(Node const& n)
+{
+ return n.elements;
+}
+
+// elements derived type
+template <typename Elements, typename NewValue>
+struct container_from_elements_type
+{
+ typedef std::vector<NewValue> type;
+};
+
+// allocators
+
+template <typename Allocator, typename Value, typename Parameters, typename Box>
+class allocators<Allocator, Value, Parameters, Box, node_d_mem_dynamic_tag>
+ : nonassignable
+{
+ BOOST_COPYABLE_AND_MOVABLE_ALT(allocators)
+
+public:
+ typedef Allocator allocator_type;
+ typedef typename allocator_type::size_type size_type;
+
+ typedef typename allocator_type::template rebind<
+ typename internal_node<Value, Parameters, Box, allocators, node_d_mem_dynamic_tag>::type
+ >::other internal_node_allocator_type;
+
+ typedef typename allocator_type::template rebind<
+ typename leaf<Value, Parameters, Box, allocators, node_d_mem_dynamic_tag>::type
+ >::other leaf_allocator_type;
+
+ typedef typename allocator_type::template rebind<
+ std::pair<Box, typename node<Value, Parameters, Box, allocators, node_d_mem_dynamic_tag>::type *>
+ >::other internal_node_elements_allocator_type;
+
+ typedef typename allocator_type::template rebind<
+ Value
+ >::other leaf_elements_allocator_type;
+
+ inline allocators()
+ : allocator()
+ , internal_node_allocator()
+ , leaf_allocator()
+ , internal_node_elements_allocator()
+ , leaf_elements_allocator()
+ {}
+
+ inline explicit allocators(Allocator alloc)
+ : allocator(alloc)
+ , internal_node_allocator(allocator)
+ , leaf_allocator(allocator)
+ , internal_node_elements_allocator(allocator)
+ , leaf_elements_allocator(allocator)
+ {}
+
+ inline allocators(allocators const& a)
+ : allocator(a.allocator)
+ , internal_node_allocator(a.internal_node_allocator)
+ , leaf_allocator(a.leaf_allocator)
+ , internal_node_elements_allocator(a.internal_node_elements_allocator)
+ , leaf_elements_allocator(a.leaf_elements_allocator)
+ {}
+
+ inline allocators(BOOST_RV_REF(allocators) a)
+ : allocator(boost::move(a.allocator))
+ , internal_node_allocator(boost::move(a.internal_node_allocator))
+ , leaf_allocator(boost::move(a.leaf_allocator))
+ , internal_node_elements_allocator(boost::move(a.internal_node_elements_allocator))
+ , leaf_elements_allocator(boost::move(a.leaf_elements_allocator))
+ {}
+
+ void swap(allocators & a)
+ {
+ boost::swap(allocator, a.allocator);
+ boost::swap(internal_node_allocator, a.internal_node_allocator);
+ boost::swap(leaf_allocator, a.leaf_allocator);
+ boost::swap(internal_node_elements_allocator, a.internal_node_elements_allocator);
+ boost::swap(leaf_elements_allocator, a.leaf_elements_allocator);
+ }
+
+ allocator_type allocator;
+ internal_node_allocator_type internal_node_allocator;
+ leaf_allocator_type leaf_allocator;
+ internal_node_elements_allocator_type internal_node_elements_allocator;
+ leaf_elements_allocator_type leaf_elements_allocator;
+};
+
+// create_node_impl
+
+template <typename BaseNode, typename Node>
+struct create_dynamic_node
+{
+ template <typename AllocNode, typename AllocElems>
+ static inline BaseNode * apply(AllocNode & alloc_node, AllocElems & alloc_elems)
+ {
+ Node * p = alloc_node.allocate(1);
+
+ if ( 0 == p )
+ throw std::bad_alloc();
+
+ try
+ {
+ // NOTE/TODO
+ // Here the whole node may be copied
+ alloc_node.construct(p, Node(alloc_elems));
+ }
+ catch(...)
+ {
+ alloc_node.deallocate(p, 1);
+ throw;
+ }
+
+ return p;
+ }
+};
+
+// destroy_node_impl
+
+template <typename Node>
+struct destroy_dynamic_node
+{
+ template <typename AllocNode, typename BaseNode>
+ static inline void apply(AllocNode & alloc_node, BaseNode * n)
+ {
+ Node * p = rtree::get<Node>(n);
+ alloc_node.destroy(p);
+ alloc_node.deallocate(p, 1);
+ }
+};
+
+// create_node
+
+template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
+struct create_node<
+ Allocators,
+ dynamic_internal_node<Value, Parameters, Box, Allocators, Tag>
+>
+{
+ static inline dynamic_node<Value, Parameters, Box, Allocators, Tag> *
+ apply(Allocators & allocators)
+ {
+ return create_dynamic_node<
+ dynamic_node<Value, Parameters, Box, Allocators, Tag>,
+ dynamic_internal_node<Value, Parameters, Box, Allocators, Tag>
+ >::apply(allocators.internal_node_allocator, allocators.internal_node_elements_allocator);
+ }
+};
+
+template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
+struct create_node<
+ Allocators,
+ dynamic_leaf<Value, Parameters, Box, Allocators, Tag>
+>
+{
+ static inline dynamic_node<Value, Parameters, Box, Allocators, Tag> *
+ apply(Allocators & allocators)
+ {
+ return create_dynamic_node<
+ dynamic_node<Value, Parameters, Box, Allocators, Tag>,
+ dynamic_leaf<Value, Parameters, Box, Allocators, Tag>
+ >::template apply(allocators.leaf_allocator, allocators.leaf_elements_allocator);
+ }
+};
+
+// destroy_node
+
+template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
+struct destroy_node<
+ Allocators,
+ dynamic_internal_node<Value, Parameters, Box, Allocators, Tag>
+>
+{
+ static inline void apply(Allocators & allocators, dynamic_node<Value, Parameters, Box, Allocators, Tag> * n)
+ {
+ destroy_dynamic_node<
+ dynamic_internal_node<Value, Parameters, Box, Allocators, Tag>
+ >::apply(allocators.internal_node_allocator, n);
+ }
+};
+
+template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
+struct destroy_node<
+ Allocators,
+ dynamic_leaf<Value, Parameters, Box, Allocators, Tag>
+>
+{
+ static inline void apply(Allocators & allocators, dynamic_node<Value, Parameters, Box, Allocators, Tag> * n)
+ {
+ destroy_dynamic_node<
+ dynamic_leaf<Value, Parameters, Box, Allocators, Tag>
+ >::apply(allocators.leaf_allocator, n);
+ }
+};
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,184 @@
+// Boost.Geometry Index
+//
+// R-tree nodes based on runtime-polymorphism, storing static-size containers
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_STATIC_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_STATIC_HPP
+
+#include <boost/geometry/index/detail/rtree/node/dynamic_visitor.hpp>
+#include <boost/geometry/index/detail/static_vector.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct dynamic_internal_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
+ : public dynamic_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
+{
+ typedef detail::static_vector<
+ std::pair<
+ Box,
+ dynamic_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag> *
+ >,
+ Parameters::max_elements + 1
+ > elements_type;
+
+ template <typename Dummy>
+ inline dynamic_internal_node(Dummy) {}
+
+ void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_d_mem_static_tag, false> & v) { v(*this); }
+ void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_d_mem_static_tag, true> & v) const { v(*this); }
+
+ elements_type elements;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct dynamic_leaf<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
+ : public dynamic_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
+{
+ typedef detail::static_vector<Value, Parameters::max_elements + 1> elements_type;
+
+ template <typename Dummy>
+ inline dynamic_leaf(Dummy) {}
+
+ void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_d_mem_static_tag, false> & v) { v(*this); }
+ void apply_visitor(dynamic_visitor<Value, Parameters, Box, Allocators, node_d_mem_static_tag, true> & v) const { v(*this); }
+
+ elements_type elements;
+};
+
+// nodes traits
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct node<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
+{
+ typedef dynamic_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag> type;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct internal_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
+{
+ typedef dynamic_internal_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag> type;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct leaf<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
+{
+ typedef dynamic_leaf<Value, Parameters, Box, Allocators, node_d_mem_static_tag> type;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, bool IsVisitableConst>
+struct visitor<Value, Parameters, Box, Allocators, node_d_mem_static_tag, IsVisitableConst>
+{
+ typedef dynamic_visitor<Value, Parameters, Box, Allocators, node_d_mem_static_tag, IsVisitableConst> type;
+};
+
+// elements derived type
+template <typename OldValue, size_t N, typename NewValue>
+struct container_from_elements_type<detail::static_vector<OldValue, N>, NewValue>
+{
+ typedef detail::static_vector<NewValue, N> type;
+};
+
+// allocators
+
+template <typename Allocator, typename Value, typename Parameters, typename Box>
+class allocators<Allocator, Value, Parameters, Box, node_d_mem_static_tag>
+ : detail::nonassignable
+{
+ BOOST_COPYABLE_AND_MOVABLE_ALT(allocators)
+
+public:
+ typedef Allocator allocator_type;
+ typedef typename allocator_type::size_type size_type;
+
+ typedef typename allocator_type::template rebind<
+ typename internal_node<Value, Parameters, Box, allocators, node_d_mem_static_tag>::type
+ >::other internal_node_allocator_type;
+
+ typedef typename allocator_type::template rebind<
+ typename leaf<Value, Parameters, Box, allocators, node_d_mem_static_tag>::type
+ >::other leaf_allocator_type;
+
+ inline allocators()
+ : allocator()
+ , internal_node_allocator()
+ , leaf_allocator()
+ {}
+
+ inline explicit allocators(Allocator alloc)
+ : allocator(alloc)
+ , internal_node_allocator(allocator)
+ , leaf_allocator(allocator)
+ {}
+
+ inline allocators(allocators const& a)
+ : allocator(a.allocator)
+ , internal_node_allocator(a.internal_node_allocator)
+ , leaf_allocator(a.leaf_allocator)
+ {}
+
+ inline allocators(BOOST_RV_REF(allocators) a)
+ : allocator(boost::move(a.allocator))
+ , internal_node_allocator(boost::move(a.internal_node_allocator))
+ , leaf_allocator(boost::move(a.leaf_allocator))
+ {}
+
+ void swap(allocators & a)
+ {
+ boost::swap(allocator, a.allocator);
+ boost::swap(internal_node_allocator, a.internal_node_allocator);
+ boost::swap(leaf_allocator, a.leaf_allocator);
+ }
+
+ allocator_type allocator;
+ internal_node_allocator_type internal_node_allocator;
+ leaf_allocator_type leaf_allocator;
+};
+
+// create_node
+
+template <typename Allocators, typename Value, typename Parameters, typename Box>
+struct create_node<
+ Allocators,
+ dynamic_internal_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
+>
+{
+ static inline dynamic_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag> *
+ apply(Allocators & allocators)
+ {
+ return create_dynamic_node<
+ dynamic_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag>,
+ dynamic_internal_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
+ >::template apply(allocators.internal_node_allocator, allocators.internal_node_allocator);
+ }
+};
+
+template <typename Allocators, typename Value, typename Parameters, typename Box>
+struct create_node<
+ Allocators,
+ dynamic_leaf<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
+>
+{
+ static inline typename node<Value, Parameters, Box, Allocators, node_d_mem_static_tag>::type *
+ apply(Allocators & allocators)
+ {
+ return create_dynamic_node<
+ dynamic_node<Value, Parameters, Box, Allocators, node_d_mem_static_tag>,
+ dynamic_leaf<Value, Parameters, Box, Allocators, node_d_mem_static_tag>
+ >::template apply(allocators.leaf_allocator, allocators.leaf_allocator);
+ }
+};
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_STATIC_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,297 @@
+// Boost.Geometry Index
+//
+// R-tree nodes based on Boost.Variant, storing std::vectors
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP
+
+#include <vector>
+
+#include <boost/geometry/index/detail/rtree/node/static_visitor.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+// nodes default types
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct static_internal_node
+{
+ typedef std::vector<
+ std::pair<
+ Box,
+ typename node<Value, Parameters, Box, Allocators, Tag>::type *
+ >,
+ typename Allocators::internal_node_elements_allocator_type
+ > elements_type;
+
+ inline static_internal_node(typename Allocators::internal_node_elements_allocator_type & al)
+ : elements(al)
+ {}
+
+ elements_type elements;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct static_leaf
+{
+ typedef std::vector<
+ Value,
+ typename Allocators::leaf_elements_allocator_type
+ > elements_type;
+
+ inline static_leaf(typename Allocators::leaf_elements_allocator_type & al)
+ : elements(al)
+ {}
+
+ elements_type elements;
+};
+
+// nodes traits
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct node<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag>
+{
+ typedef boost::variant<
+ static_leaf<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag>,
+ static_internal_node<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag>
+ > type;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct internal_node<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag>
+{
+ typedef static_internal_node<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag> type;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct leaf<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag>
+{
+ typedef static_leaf<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag> type;
+};
+
+// visitor traits
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, bool IsVisitableConst>
+struct visitor<Value, Parameters, Box, Allocators, node_s_mem_dynamic_tag, IsVisitableConst>
+{
+ typedef static_visitor<> type;
+};
+
+// element's indexable type
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, typename Translator>
+struct element_indexable_type<
+ std::pair<
+ Box,
+ boost::variant<
+ static_leaf<Value, Parameters, Box, Allocators, Tag>,
+ static_internal_node<Value, Parameters, Box, Allocators, Tag>
+ > *
+ >,
+ Translator
+>
+{
+ typedef Box type;
+};
+
+// element's indexable getter
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag, typename Translator>
+inline Box const&
+element_indexable(std::pair<
+ Box,
+ boost::variant<
+ static_leaf<Value, Parameters, Box, Allocators, Tag>,
+ static_internal_node<Value, Parameters, Box, Allocators, Tag>
+ > *
+ > const& el,
+ Translator const&)
+{
+ return el.first;
+}
+
+// allocators
+
+template <typename Allocator, typename Value, typename Parameters, typename Box>
+class allocators<Allocator, Value, Parameters, Box, node_s_mem_dynamic_tag>
+ : nonassignable
+{
+ BOOST_COPYABLE_AND_MOVABLE_ALT(allocators)
+
+public:
+ typedef Allocator allocator_type;
+ typedef typename allocator_type::size_type size_type;
+
+ typedef typename allocator_type::template rebind<
+ typename node<Value, Parameters, Box, allocators, node_s_mem_dynamic_tag>::type
+ >::other node_allocator_type;
+
+ typedef typename allocator_type::template rebind<
+ std::pair<Box, typename node<Value, Parameters, Box, allocators, node_s_mem_dynamic_tag>::type *>
+ >::other internal_node_elements_allocator_type;
+
+ typedef typename allocator_type::template rebind<
+ Value
+ >::other leaf_elements_allocator_type;
+
+ inline allocators()
+ : allocator()
+ , node_allocator()
+ , internal_node_elements_allocator()
+ , leaf_elements_allocator()
+ {}
+
+ inline explicit allocators(Allocator alloc)
+ : allocator(alloc)
+ , node_allocator(allocator)
+ , internal_node_elements_allocator(allocator)
+ , leaf_elements_allocator(allocator)
+ {}
+
+ inline allocators(allocators const& a)
+ : allocator(a.allocator)
+ , node_allocator(a.node_allocator)
+ , internal_node_elements_allocator(a.internal_node_elements_allocator)
+ , leaf_elements_allocator(a.leaf_elements_allocator)
+ {}
+
+ inline allocators(BOOST_RV_REF(allocators) a)
+ : allocator(boost::move(a.allocator))
+ , node_allocator(boost::move(a.node_allocator))
+ , internal_node_elements_allocator(boost::move(a.internal_node_elements_allocator))
+ , leaf_elements_allocator(boost::move(a.leaf_elements_allocator))
+ {}
+
+ void swap(allocators & a)
+ {
+ boost::swap(allocator, a.allocator);
+ boost::swap(node_allocator, a.node_allocator);
+ boost::swap(internal_node_elements_allocator, a.internal_node_elements_allocator);
+ boost::swap(leaf_elements_allocator, a.leaf_elements_allocator);
+ }
+
+ allocator_type allocator;
+ node_allocator_type node_allocator;
+ internal_node_elements_allocator_type internal_node_elements_allocator;
+ leaf_elements_allocator_type leaf_elements_allocator;
+};
+
+// create_node_variant
+
+template <typename Variant, typename Node>
+struct create_static_node
+{
+ template <typename AllocNode, typename AllocElems>
+ static inline Variant * apply(AllocNode & alloc_node, AllocElems & alloc_elems)
+ {
+ Variant * p = alloc_node.allocate(1);
+
+ if ( 0 == p )
+ throw std::bad_alloc();
+
+ try
+ {
+ // NOTE/TODO
+ // Here the whole node may be copied
+ alloc_node.construct(p, Node(alloc_elems)); // implicit cast to Variant
+ }
+ catch(...)
+ {
+ alloc_node.deallocate(p, 1);
+ throw;
+ }
+
+ return p;
+ }
+};
+
+// destroy_node_variant
+
+template <typename Node>
+struct destroy_static_node
+{
+ template <typename AllocNode, typename Variant>
+ static inline void apply(AllocNode & alloc_node, Variant * n)
+ {
+ alloc_node.destroy(n);
+ alloc_node.deallocate(n, 1);
+ }
+};
+
+// create_node
+
+template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
+struct create_node<
+ Allocators,
+ static_internal_node<Value, Parameters, Box, Allocators, Tag>
+>
+{
+ static inline typename node<Value, Parameters, Box, Allocators, Tag>::type *
+ apply(Allocators & allocators)
+ {
+ return create_static_node<
+ typename node<Value, Parameters, Box, Allocators, Tag>::type,
+ static_internal_node<Value, Parameters, Box, Allocators, Tag>
+ >::template apply(allocators.node_allocator, allocators.internal_node_elements_allocator);
+ }
+};
+
+template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
+struct create_node<
+ Allocators,
+ static_leaf<Value, Parameters, Box, Allocators, Tag>
+>
+{
+ static inline typename node<Value, Parameters, Box, Allocators, Tag>::type *
+ apply(Allocators & allocators)
+ {
+ return create_static_node<
+ typename node<Value, Parameters, Box, Allocators, Tag>::type,
+ static_leaf<Value, Parameters, Box, Allocators, Tag>
+ >::template apply(allocators.node_allocator, allocators.leaf_elements_allocator);
+ }
+};
+
+// destroy_node
+
+template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
+struct destroy_node<
+ Allocators,
+ static_internal_node<Value, Parameters, Box, Allocators, Tag>
+>
+{
+ static inline void apply(Allocators & allocators, typename node<Value, Parameters, Box, Allocators, Tag>::type * n)
+ {
+ destroy_static_node<
+ static_internal_node<Value, Parameters, Box, Allocators, Tag>
+ >::apply(allocators.node_allocator, n);
+ }
+};
+
+template <typename Allocators, typename Value, typename Parameters, typename Box, typename Tag>
+struct destroy_node<
+ Allocators,
+ static_leaf<Value, Parameters, Box, Allocators, Tag>
+>
+{
+ static inline void apply(Allocators & allocators, typename node<Value, Parameters, Box, Allocators, Tag>::type * n)
+ {
+ destroy_static_node<
+ static_leaf<Value, Parameters, Box, Allocators, Tag>
+ >::apply(allocators.node_allocator, n);
+ }
+};
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,175 @@
+// Boost.Geometry Index
+//
+// R-tree nodes based on Boost.Variant, storing static-size containers
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP
+
+#include <boost/geometry/index/detail/static_vector.hpp>
+
+#include <boost/geometry/index/detail/rtree/node/static_visitor.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+// nodes default types
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct static_internal_node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+{
+ typedef detail::static_vector<
+ std::pair<
+ Box,
+ typename node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>::type *
+ >,
+ Parameters::max_elements + 1
+ > elements_type;
+
+ template <typename Dummy>
+ inline static_internal_node(Dummy) {}
+
+ elements_type elements;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct static_leaf<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+{
+ typedef detail::static_vector<Value, Parameters::max_elements + 1> elements_type;
+
+ template <typename Dummy>
+ inline static_leaf(Dummy) {}
+
+ elements_type elements;
+};
+
+// nodes traits
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+{
+ typedef boost::variant<
+ static_leaf<Value, Parameters, Box, Allocators, node_s_mem_static_tag>,
+ static_internal_node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+ > type;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct internal_node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+{
+ typedef static_internal_node<Value, Parameters, Box, Allocators, node_s_mem_static_tag> type;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct leaf<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+{
+ typedef static_leaf<Value, Parameters, Box, Allocators, node_s_mem_static_tag> type;
+};
+
+// visitor traits
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, bool IsVisitableConst>
+struct visitor<Value, Parameters, Box, Allocators, node_s_mem_static_tag, IsVisitableConst>
+{
+ typedef static_visitor<> type;
+};
+
+// allocators
+
+template <typename Allocator, typename Value, typename Parameters, typename Box>
+struct allocators<Allocator, Value, Parameters, Box, node_s_mem_static_tag>
+ : nonassignable
+{
+ BOOST_COPYABLE_AND_MOVABLE_ALT(allocators)
+
+public:
+ typedef Allocator allocator_type;
+ typedef typename allocator_type::size_type size_type;
+
+ typedef typename allocator_type::template rebind<
+ typename node<Value, Parameters, Box, allocators, node_s_mem_static_tag>::type
+ >::other node_allocator_type;
+
+ typedef typename allocator_type::template rebind<
+ std::pair<Box, typename node<Value, Parameters, Box, allocators, node_s_mem_static_tag>::type *>
+ >::other internal_node_elements_allocator_type;
+
+ typedef typename allocator_type::template rebind<
+ Value
+ >::other leaf_elements_allocator_type;
+
+ inline allocators()
+ : allocator()
+ , node_allocator()
+ {}
+
+ inline explicit allocators(Allocator alloc)
+ : allocator(alloc)
+ , node_allocator(allocator)
+ {}
+
+ inline allocators(allocators const& a)
+ : allocator(a.allocator)
+ , node_allocator(a.node_allocator)
+ {}
+
+ inline allocators(BOOST_RV_REF(allocators) a)
+ : allocator(boost::move(a.allocator))
+ , node_allocator(boost::move(a.node_allocator))
+ {}
+
+ void swap(allocators & a)
+ {
+ boost::swap(allocator, a.allocator);
+ boost::swap(node_allocator, a.node_allocator);
+ }
+
+ allocator_type allocator;
+ node_allocator_type node_allocator;
+};
+
+// create_node
+
+template <typename Allocators, typename Value, typename Parameters, typename Box>
+struct create_node<
+ Allocators,
+ static_internal_node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+>
+{
+ static inline typename node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>::type *
+ apply(Allocators & allocators)
+ {
+ return create_static_node<
+ typename node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>::type,
+ static_internal_node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+ >::template apply(allocators.node_allocator, allocators.node_allocator);
+ }
+};
+
+template <typename Allocators, typename Value, typename Parameters, typename Box>
+struct create_node<
+ Allocators,
+ static_leaf<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+>
+{
+ static inline typename node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>::type *
+ apply(Allocators & allocators)
+ {
+ return create_static_node<
+ typename node<Value, Parameters, Box, Allocators, node_s_mem_static_tag>::type,
+ static_leaf<Value, Parameters, Box, Allocators, node_s_mem_static_tag>
+ >::template apply(allocators.node_allocator, allocators.node_allocator);
+ }
+};
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/static_visitor.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/node/static_visitor.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,76 @@
+// Boost.Geometry Index
+//
+// R-tree nodes static visitor related code
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_NODE_STATIC_VISITOR_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_STATIC_VISITOR_HPP
+
+#include <boost/variant.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+// nodes variants forward declarations
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct static_internal_node;
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+struct static_leaf;
+
+// nodes conversion
+
+template <typename V, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+inline V & get(
+ boost::variant<
+ static_leaf<Value, Parameters, Box, Allocators, Tag>,
+ static_internal_node<Value, Parameters, Box, Allocators, Tag>
+ > & v)
+{
+ return boost::get<V>(v);
+}
+
+template <typename V, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+inline V * get(
+ boost::variant<
+ static_leaf<Value, Parameters, Box, Allocators, Tag>,
+ static_internal_node<Value, Parameters, Box, Allocators, Tag>
+ > *v)
+{
+ return boost::get<V>(v);
+}
+
+// apply visitor
+
+template <typename Visitor, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+inline void apply_visitor(Visitor & v,
+ boost::variant<
+ static_leaf<Value, Parameters, Box, Allocators, Tag>,
+ static_internal_node<Value, Parameters, Box, Allocators, Tag>
+ > & n)
+{
+ boost::apply_visitor(v, n);
+}
+
+template <typename Visitor, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
+inline void apply_visitor(Visitor & v,
+ boost::variant<
+ static_leaf<Value, Parameters, Box, Allocators, Tag>,
+ static_internal_node<Value, Parameters, Box, Allocators, Tag>
+ > const& n)
+{
+ boost::apply_visitor(v, n);
+}
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_STATIC_VISITOR_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/options.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/options.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,155 @@
+// Boost.Geometry Index
+//
+// R-tree options, algorithms, parameters
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_OPTIONS_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_OPTIONS_HPP
+
+#include <boost/geometry/index/parameters.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+// InsertTag
+struct insert_default_tag {};
+struct insert_reinsert_tag {};
+
+// ChooseNextNodeTag
+struct choose_by_content_diff_tag {};
+struct choose_by_overlap_diff_tag {};
+
+// SplitTag
+struct split_default_tag {};
+//struct split_kmeans_tag {};
+
+// RedistributeTag
+struct linear_tag {};
+struct quadratic_tag {};
+struct rstar_tag {};
+
+// NodeTag
+struct node_d_mem_dynamic_tag {};
+struct node_d_mem_static_tag {};
+struct node_s_mem_dynamic_tag {};
+struct node_s_mem_static_tag {};
+
+template <typename Parameters, typename InsertTag, typename ChooseNextNodeTag, typename SplitTag, typename RedistributeTag, typename NodeTag>
+struct options
+{
+ typedef Parameters parameters_type;
+ typedef InsertTag insert_tag;
+ typedef ChooseNextNodeTag choose_next_node_tag;
+ typedef SplitTag split_tag;
+ typedef RedistributeTag redistribute_tag;
+ typedef NodeTag node_tag;
+};
+
+template <typename Parameters>
+struct options_type
+{
+ // TODO: awulkiew - use static assert
+};
+
+template <size_t MaxElements, size_t MinElements>
+struct options_type< index::linear<MaxElements, MinElements> >
+{
+ typedef options<
+ index::linear<MaxElements, MinElements>,
+ insert_default_tag,
+ choose_by_content_diff_tag,
+ split_default_tag,
+ linear_tag,
+ node_d_mem_static_tag
+ > type;
+};
+
+template <size_t MaxElements, size_t MinElements>
+struct options_type< index::quadratic<MaxElements, MinElements> >
+{
+ typedef options<
+ index::quadratic<MaxElements, MinElements>,
+ insert_default_tag,
+ choose_by_content_diff_tag,
+ split_default_tag,
+ quadratic_tag,
+ node_d_mem_static_tag
+ > type;
+};
+
+template <size_t MaxElements, size_t MinElements, size_t OverlapCostThreshold, size_t ReinsertedElements>
+struct options_type< index::rstar<MaxElements, MinElements, OverlapCostThreshold, ReinsertedElements> >
+{
+ typedef options<
+ index::rstar<MaxElements, MinElements, OverlapCostThreshold, ReinsertedElements>,
+ insert_reinsert_tag,
+ choose_by_overlap_diff_tag,
+ split_default_tag,
+ rstar_tag,
+ node_d_mem_static_tag
+ > type;
+};
+
+//template <size_t MaxElements, size_t MinElements>
+//struct options_type< kmeans<MaxElements, MinElements> >
+//{
+// typedef options<
+// kmeans<MaxElements, MinElements>,
+// insert_default_tag,
+// choose_by_content_diff_tag, // change it?
+// split_kmeans_tag,
+// int, // dummy tag - not used for now
+// node_d_mem_static_tag
+// > type;
+//};
+
+template <>
+struct options_type< index::runtime::linear >
+{
+ typedef options<
+ index::runtime::linear,
+ insert_default_tag,
+ choose_by_content_diff_tag,
+ split_default_tag,
+ linear_tag,
+ node_d_mem_dynamic_tag
+ > type;
+};
+
+template <>
+struct options_type< index::runtime::quadratic >
+{
+ typedef options<
+ index::runtime::quadratic,
+ insert_default_tag,
+ choose_by_content_diff_tag,
+ split_default_tag,
+ quadratic_tag,
+ node_d_mem_dynamic_tag
+ > type;
+};
+
+template <>
+struct options_type< index::runtime::rstar >
+{
+ typedef options<
+ index::runtime::rstar,
+ insert_reinsert_tag,
+ choose_by_overlap_diff_tag,
+ split_default_tag,
+ rstar_tag,
+ node_d_mem_dynamic_tag
+ > type;
+};
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_OPTIONS_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/quadratic/quadratic.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/quadratic/quadratic.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,16 @@
+// Boost.Geometry Index
+//
+// R-tree quadratic algorithm implementation
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_QUADRATIC_QUADRATIC_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_QUADRATIC_QUADRATIC_HPP
+
+#include <boost/geometry/index/detail/rtree/quadratic/redistribute_elements.hpp>
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_QUADRATIC_QUADRATIC_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/quadratic/redistribute_elements.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/quadratic/redistribute_elements.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,292 @@
+// Boost.Geometry Index
+//
+// R-tree quadratic split algorithm implementation
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_QUADRATIC_REDISTRIBUTE_ELEMENTS_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_QUADRATIC_REDISTRIBUTE_ELEMENTS_HPP
+
+#include <algorithm>
+
+#include <boost/geometry/index/detail/algorithms/content.hpp>
+#include <boost/geometry/index/detail/algorithms/union_content.hpp>
+
+#include <boost/geometry/index/detail/rtree/node/node.hpp>
+#include <boost/geometry/index/detail/rtree/visitors/insert.hpp>
+#include <boost/geometry/index/detail/rtree/visitors/is_leaf.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+namespace quadratic {
+
+template <typename Elements, typename Parameters, typename Translator, typename Box>
+struct pick_seeds
+{
+ typedef typename Elements::value_type element_type;
+ typedef typename rtree::element_indexable_type<element_type, Translator>::type indexable_type;
+ typedef typename index::detail::traits::coordinate_type<indexable_type>::type coordinate_type;
+ typedef Box box_type;
+ typedef typename index::detail::default_content_result<box_type>::type content_type;
+
+ static inline void apply(Elements const& elements,
+ Parameters const& parameters,
+ Translator const& tr,
+ size_t & seed1,
+ size_t & seed2)
+ {
+ const size_t elements_count = parameters.get_max_elements() + 1;
+ BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == elements_count, "wrong number of elements");
+ BOOST_GEOMETRY_INDEX_ASSERT(2 <= elements_count, "unexpected number of elements");
+
+ content_type greatest_free_content = 0;
+ seed1 = 0;
+ seed2 = 1;
+
+ for ( size_t i = 0 ; i < elements_count - 1 ; ++i )
+ {
+ for ( size_t j = i + 1 ; j < elements_count ; ++j )
+ {
+ indexable_type const& ind1 = rtree::element_indexable(elements[i], tr);
+ indexable_type const& ind2 = rtree::element_indexable(elements[j], tr);
+
+ box_type enlarged_box;
+ geometry::convert(ind1, enlarged_box);
+ geometry::expand(enlarged_box, ind2);
+
+ content_type free_content = (index::detail::content(enlarged_box) - index::detail::content(ind1)) - index::detail::content(ind2);
+
+ if ( greatest_free_content < free_content )
+ {
+ greatest_free_content = free_content;
+ seed1 = i;
+ seed2 = j;
+ }
+ }
+ }
+ }
+};
+
+} // namespace quadratic
+
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+struct redistribute_elements<Value, Options, Translator, Box, Allocators, quadratic_tag>
+{
+ typedef typename Options::parameters_type parameters_type;
+
+ typedef typename rtree::node<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+ typedef typename index::detail::default_content_result<Box>::type content_type;
+
+ template <typename Node>
+ static inline void apply(Node & n,
+ Node & second_node,
+ Box & box1,
+ Box & box2,
+ parameters_type const& parameters,
+ Translator const& translator,
+ Allocators & allocators)
+ {
+ typedef typename rtree::elements_type<Node>::type elements_type;
+ typedef typename elements_type::value_type element_type;
+ typedef typename rtree::element_indexable_type<element_type, Translator>::type indexable_type;
+ typedef typename index::detail::traits::coordinate_type<indexable_type>::type coordinate_type;
+
+ elements_type & elements1 = rtree::elements(n);
+ elements_type & elements2 = rtree::elements(second_node);
+ const size_t elements1_count = parameters.get_max_elements() + 1;
+
+ BOOST_GEOMETRY_INDEX_ASSERT(elements1.size() == elements1_count, "unexpected elements number");
+
+ // copy original elements
+ elements_type elements_copy(elements1); // MAY THROW, STRONG (alloc, copy)
+ elements_type elements_backup(elements1); // MAY THROW, STRONG (alloc, copy)
+
+ // calculate initial seeds
+ size_t seed1 = 0;
+ size_t seed2 = 0;
+ quadratic::pick_seeds<
+ elements_type,
+ parameters_type,
+ Translator,
+ Box
+ >::apply(elements_copy, parameters, translator, seed1, seed2);
+
+ // prepare nodes' elements containers
+ elements1.clear();
+ BOOST_GEOMETRY_INDEX_ASSERT(elements2.empty(), "second node's elements container should be empty");
+
+ try
+ {
+ // add seeds
+ elements1.push_back(elements_copy[seed1]); // MAY THROW, STRONG (copy)
+ elements2.push_back(elements_copy[seed2]); // MAY THROW, STRONG (alloc, copy)
+
+ // calculate boxes
+ geometry::convert(rtree::element_indexable(elements_copy[seed1], translator), box1);
+ geometry::convert(rtree::element_indexable(elements_copy[seed2], translator), box2);
+
+ // remove seeds
+ if (seed1 < seed2)
+ {
+ rtree::copy_from_back(elements_copy, elements_copy.begin() + seed2); // MAY THROW, STRONG (copy)
+ elements_copy.pop_back();
+ rtree::copy_from_back(elements_copy, elements_copy.begin() + seed1); // MAY THROW, STRONG (copy)
+ elements_copy.pop_back();
+ }
+ else
+ {
+ rtree::copy_from_back(elements_copy, elements_copy.begin() + seed1); // MAY THROW, STRONG (copy)
+ elements_copy.pop_back();
+ rtree::copy_from_back(elements_copy, elements_copy.begin() + seed2); // MAY THROW, STRONG (copy)
+ elements_copy.pop_back();
+ }
+
+ // initialize areas
+ content_type content1 = index::detail::content(box1);
+ content_type content2 = index::detail::content(box2);
+
+ size_t remaining = elements_copy.size();
+
+ // redistribute the rest of the elements
+ while ( !elements_copy.empty() )
+ {
+ typename elements_type::reverse_iterator el_it = elements_copy.rbegin();
+ bool insert_into_group1 = false;
+
+ size_t elements1_count = elements1.size();
+ size_t elements2_count = elements2.size();
+
+ // if there is small number of elements left and the number of elements in node is lesser than min_elems
+ // just insert them to this node
+ if ( elements1_count + remaining <= parameters.get_min_elements() )
+ {
+ insert_into_group1 = true;
+ }
+ else if ( elements2_count + remaining <= parameters.get_min_elements() )
+ {
+ insert_into_group1 = false;
+ }
+ // insert the best element
+ else
+ {
+ // find element with minimum groups areas increses differences
+ content_type content_increase1 = 0;
+ content_type content_increase2 = 0;
+ el_it = pick_next(elements_copy.rbegin(), elements_copy.rend(),
+ box1, box2, content1, content2, translator,
+ content_increase1, content_increase2);
+
+ if ( content_increase1 < content_increase2 ||
+ ( content_increase1 == content_increase2 && content1 < content2 ) ||
+ ( content1 == content2 && elements1_count <= elements2_count ) )
+ {
+ insert_into_group1 = true;
+ }
+ else
+ {
+ insert_into_group1 = false;
+ }
+ }
+
+ // move element to the choosen group
+ element_type const& elem = *el_it;
+ indexable_type const& indexable = rtree::element_indexable(elem, translator);
+
+ if ( insert_into_group1 )
+ {
+ elements1.push_back(elem); // MAY THROW, STRONG (copy)
+ geometry::expand(box1, indexable);
+ content1 = index::detail::content(box1);
+ }
+ else
+ {
+ elements2.push_back(elem); // MAY THROW, STRONG (alloc, copy)
+ geometry::expand(box2, indexable);
+ content2 = index::detail::content(box2);
+ }
+
+ BOOST_GEOMETRY_INDEX_ASSERT(!elements_copy.empty(), "expected more elements");
+ typename elements_type::iterator el_it_base = el_it.base();
+ rtree::copy_from_back(elements_copy, --el_it_base); // MAY THROW, STRONG (copy)
+ elements_copy.pop_back();
+
+ BOOST_GEOMETRY_INDEX_ASSERT(0 < remaining, "expected more remaining elements");
+ --remaining;
+ }
+ }
+ catch(...)
+ {
+ //elements_copy.clear();
+ elements1.clear();
+ elements2.clear();
+
+ rtree::destroy_elements<Value, Options, Translator, Box, Allocators>::apply(elements_backup, allocators);
+ //elements_backup.clear();
+
+ throw; // RETHROW, BASIC
+ }
+ }
+
+ // TODO: awulkiew - change following function to static member of the pick_next class?
+
+ template <typename It>
+ static inline It pick_next(It first, It last,
+ Box const& box1, Box const& box2,
+ content_type const& content1, content_type const& content2,
+ Translator const& translator,
+ 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;
+
+ content_type greatest_content_incrase_diff = 0;
+ It out_it = first;
+ 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 )
+ {
+ indexable_type const& indexable = rtree::element_indexable(*el_it, translator);
+
+ // calculate enlarged boxes and areas
+ Box enlarged_box1(box1);
+ Box enlarged_box2(box2);
+ geometry::expand(enlarged_box1, indexable);
+ geometry::expand(enlarged_box2, indexable);
+ content_type enlarged_content1 = index::detail::content(enlarged_box1);
+ content_type enlarged_content2 = index::detail::content(enlarged_box2);
+
+ content_type content_incrase1 = (enlarged_content1 - content1);
+ content_type content_incrase2 = (enlarged_content2 - content2);
+
+ content_type content_incrase_diff = content_incrase1 < content_incrase2 ?
+ content_incrase2 - content_incrase1 : content_incrase1 - content_incrase2;
+
+ if ( greatest_content_incrase_diff < content_incrase_diff )
+ {
+ greatest_content_incrase_diff = content_incrase_diff;
+ out_it = el_it;
+ out_content_increase1 = content_incrase1;
+ out_content_increase2 = content_incrase2;
+ }
+ }
+
+ return out_it;
+ }
+};
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_QUADRATIC_REDISTRIBUTE_ELEMENTS_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/rstar/choose_next_node.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/rstar/choose_next_node.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,244 @@
+// Boost.Geometry Index
+//
+// R-tree R*-tree next node choosing algorithm implementation
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_RSTAR_CHOOSE_NEXT_NODE_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_RSTAR_CHOOSE_NEXT_NODE_HPP
+
+#include <algorithm>
+
+#include <boost/geometry/algorithms/expand.hpp>
+
+#include <boost/geometry/index/detail/algorithms/content.hpp>
+#include <boost/geometry/index/detail/algorithms/intersection_content.hpp>
+#include <boost/geometry/index/detail/algorithms/union_content.hpp>
+
+#include <boost/geometry/index/detail/rtree/node/node.hpp>
+#include <boost/geometry/index/detail/rtree/visitors/is_leaf.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+template <typename Value, typename Options, typename Box, typename Allocators>
+class choose_next_node<Value, Options, Box, Allocators, choose_by_overlap_diff_tag>
+{
+ typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+ typedef typename rtree::elements_type<internal_node>::type children_type;
+ typedef typename children_type::value_type child_type;
+
+ typedef typename Options::parameters_type parameters_type;
+
+ typedef typename index::detail::default_content_result<Box>::type content_type;
+
+public:
+ template <typename Indexable>
+ static inline size_t apply(internal_node & n,
+ Indexable const& indexable,
+ parameters_type const& parameters,
+ size_t node_relative_level)
+ {
+ children_type & children = rtree::elements(n);
+
+ // children are leafs
+ if ( node_relative_level <= 1 )
+ {
+ if ( 0 < parameters.get_overlap_cost_threshold() &&
+ parameters.get_overlap_cost_threshold() < children.size() )
+ return choose_by_nearly_minimum_overlap_cost(children, indexable, parameters.get_overlap_cost_threshold());
+ else
+ return choose_by_minimum_overlap_cost(children, indexable);
+ }
+ // children are internal nodes
+ else
+ return choose_by_minimum_content_cost(children, indexable);
+ }
+
+private:
+ template <typename Indexable>
+ static inline size_t choose_by_minimum_overlap_cost(children_type const& children,
+ Indexable const& indexable)
+ {
+ size_t children_count = children.size();
+
+ // choose index with smallest overlap change value, or content change or smallest content
+ size_t choosen_index = 0;
+ content_type smallest_overlap_diff = (std::numeric_limits<content_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 )
+ {
+ child_type const& ch_i = children[i];
+
+ Box box_exp(ch_i.first);
+ // calculate expanded box of child node ch_i
+ geometry::expand(box_exp, indexable);
+
+ // calculate content and content diff
+ content_type content = index::detail::content(ch_i.first);
+ content_type content_diff = index::detail::content(box_exp) - content;
+
+ content_type overlap = 0;
+ content_type overlap_exp = 0;
+
+ // calculate overlap
+ for ( size_t j = 0 ; j < children_count ; ++j )
+ {
+ if ( i != j )
+ {
+ child_type const& ch_j = children[j];
+
+ overlap += index::detail::intersection_content(ch_i.first, ch_j.first);
+ overlap_exp += index::detail::intersection_content(box_exp, ch_j.first);
+ }
+ }
+
+ content_type overlap_diff = overlap_exp - overlap;
+
+ // update result
+ if ( overlap_diff < smallest_overlap_diff ||
+ ( overlap_diff == smallest_overlap_diff && content_diff < smallest_content_diff ) ||
+ ( content_diff == smallest_content_diff && content < smallest_content ) )
+ {
+ smallest_overlap_diff = overlap_diff;
+ smallest_content_diff = content_diff;
+ smallest_content = content;
+ choosen_index = i;
+ }
+ }
+
+ return choosen_index;
+ }
+
+ template <typename Indexable>
+ static inline size_t choose_by_nearly_minimum_overlap_cost(children_type const& children,
+ Indexable const& indexable,
+ size_t overlap_cost_threshold)
+ {
+ const size_t children_count = children.size();
+
+ // 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];
+
+ // expanded child node's box
+ Box box_exp(ch_i.first);
+ geometry::expand(box_exp, indexable);
+
+ // areas difference
+ content_type content = index::detail::content(box_exp);
+ content_type content_diff = content - index::detail::content(ch_i.first);
+
+ sorted_children[i] = boost::make_tuple(i, content_diff, content);
+ }
+
+ // sort by content_diff
+ std::sort(sorted_children.begin(), sorted_children.end(), content_diff_less);
+
+ BOOST_GEOMETRY_INDEX_ASSERT(overlap_cost_threshold <= children_count, "there are not enough children");
+
+ // for overlap_cost_threshold child nodes find the one with smallest overlap value
+ size_t choosen_index = 0;
+ content_type smallest_overlap_diff = (std::numeric_limits<content_type>::max)();
+
+ // for each node
+ for (size_t i = 0 ; i < overlap_cost_threshold ; ++i )
+ {
+ size_t child_index = boost::get<0>(sorted_children[i]);
+
+ typedef typename children_type::value_type child_type;
+ child_type const& ch_i = children[child_index];
+
+ Box box_exp(ch_i.first);
+ // calculate expanded box of child node ch_i
+ geometry::expand(box_exp, indexable);
+
+ content_type overlap = 0;
+ content_type overlap_exp = 0;
+
+ // calculate overlap
+ for ( size_t j = 0 ; j < children_count ; ++j )
+ {
+ if ( child_index != j )
+ {
+ child_type const& ch_j = children[j];
+
+ overlap += index::detail::intersection_content(ch_i.first, ch_j.first);
+ overlap_exp += index::detail::intersection_content(box_exp, ch_j.first);
+ }
+ }
+
+ content_type overlap_diff = overlap_exp - overlap;
+
+ // update result
+ if ( overlap_diff < smallest_overlap_diff )
+ {
+ smallest_overlap_diff = overlap_diff;
+ choosen_index = child_index;
+ }
+ }
+
+ return choosen_index;
+ }
+
+ 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_content_cost(children_type const& children, Indexable const& indexable)
+ {
+ size_t children_count = children.size();
+
+ // choose index with smallest content change or smallest content
+ size_t choosen_index = 0;
+ 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 )
+ {
+ child_type const& ch_i = children[i];
+
+ // expanded child node's box
+ Box box_exp(ch_i.first);
+ geometry::expand(box_exp, indexable);
+
+ // areas difference
+ content_type content = index::detail::content(box_exp);
+ content_type content_diff = content - index::detail::content(ch_i.first);
+
+ // update the result
+ if ( content_diff < smallest_content_diff ||
+ ( content_diff == smallest_content_diff && content < smallest_content ) )
+ {
+ smallest_content_diff = content_diff;
+ smallest_content = content;
+ choosen_index = i;
+ }
+ }
+
+ return choosen_index;
+ }
+};
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_RSTAR_CHOOSE_NEXT_NODE_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/rstar/insert.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/rstar/insert.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,525 @@
+// Boost.Geometry Index
+//
+// R-tree R*-tree insert algorithm implementation
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_RSTAR_INSERT_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_RSTAR_INSERT_HPP
+
+#include <boost/geometry/index/detail/algorithms/content.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree { namespace visitors {
+
+namespace rstar {
+
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+class remove_elements_to_reinsert
+{
+public:
+ typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+ typedef typename Options::parameters_type parameters_type;
+
+ template <typename Node>
+ static inline void apply(typename rtree::elements_type<Node>::type & result_elements,
+ Node & n,
+ internal_node *parent,
+ size_t current_child_index,
+ parameters_type const& parameters,
+ Translator const& translator,
+ Allocators & allocators)
+ {
+ typedef typename rtree::elements_type<Node>::type elements_type;
+ 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 geometry::default_distance_result<point_type>::type distance_type;
+
+ elements_type & elements = rtree::elements(n);
+
+ const size_t elements_count = parameters.get_max_elements() + 1;
+ const size_t reinserted_elements_count = parameters.get_reinserted_elements();
+
+ BOOST_GEOMETRY_INDEX_ASSERT(parent, "node shouldn't be the root node");
+ BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == elements_count, "unexpected elements number");
+ BOOST_GEOMETRY_INDEX_ASSERT(0 < reinserted_elements_count, "wrong value of elements to reinsert");
+
+ // calculate current node's center
+ point_type node_center;
+ geometry::centroid(rtree::elements(*parent)[current_child_index].first, node_center);
+
+ // fill the container of centers' distances of children from current node's center
+ typedef typename index::detail::rtree::container_from_elements_type<
+ elements_type,
+ std::pair<distance_type, element_type>
+ >::type sorted_elements_type;
+ sorted_elements_type sorted_elements;
+ // If constructor is used instead of resize() MS implementation leaks here
+ sorted_elements.reserve(elements_count); // MAY THROW, STRONG (V, E: alloc, copy)
+
+ for ( typename elements_type::const_iterator it = elements.begin() ;
+ it != elements.end() ; ++it )
+ {
+ point_type element_center;
+ geometry::centroid( rtree::element_indexable(*it, translator), element_center);
+ sorted_elements.push_back(std::make_pair(
+ geometry::comparable_distance(node_center, element_center),
+ *it)); // MAY THROW (V, E: copy)
+ }
+
+ // sort elements by distances from center
+ std::partial_sort(
+ sorted_elements.begin(),
+ sorted_elements.begin() + reinserted_elements_count,
+ sorted_elements.end(),
+ distances_dsc<distance_type, element_type>); // MAY THROW, BASIC (V, E: copy)
+
+ // copy elements which will be reinserted
+ result_elements.clear();
+ result_elements.reserve(reinserted_elements_count); // MAY THROW, STRONG (V, E: alloc, copy)
+ for ( typename sorted_elements_type::const_iterator it = sorted_elements.begin() ;
+ it != sorted_elements.begin() + reinserted_elements_count ; ++it )
+ {
+ result_elements.push_back(it->second); // MAY THROW (V, E: copy)
+ }
+
+ try
+ {
+ // copy remaining elements to the current node
+ elements.clear();
+ elements.reserve(elements_count - reinserted_elements_count); // SHOULDN'T THROW (new_size <= old size)
+ for ( typename sorted_elements_type::const_iterator it = sorted_elements.begin() + reinserted_elements_count;
+ it != sorted_elements.end() ; ++it )
+ {
+ elements.push_back(it->second); // MAY THROW (V, E: copy)
+ }
+ }
+ catch(...)
+ {
+ elements.clear();
+
+ for ( typename sorted_elements_type::iterator it = sorted_elements.begin() ;
+ it != sorted_elements.end() ; ++it )
+ {
+ destroy_element<Value, Options, Translator, Box, Allocators>::apply(it->second, allocators);
+ }
+
+ throw; // RETHROW
+ }
+ }
+
+private:
+ template <typename Distance, typename El>
+ static inline bool distances_asc(
+ std::pair<Distance, El> const& d1,
+ std::pair<Distance, El> const& d2)
+ {
+ return d1.first < d2.first;
+ }
+
+ template <typename Distance, typename El>
+ static inline bool distances_dsc(
+ std::pair<Distance, El> const& d1,
+ std::pair<Distance, El> const& d2)
+ {
+ return d1.first > d2.first;
+ }
+};
+
+template <size_t InsertIndex, typename Element, typename Value, typename Options, typename Box, typename Allocators>
+struct level_insert_elements_type
+{
+ typedef typename rtree::elements_type<
+ typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type
+ >::type type;
+};
+
+template <typename Value, typename Options, typename Box, typename Allocators>
+struct level_insert_elements_type<0, Value, Value, Options, Box, Allocators>
+{
+ typedef typename rtree::elements_type<
+ typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type
+ >::type type;
+};
+
+template <size_t InsertIndex, typename Element, typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+struct level_insert_base
+ : public detail::insert<Element, Value, Options, Translator, Box, Allocators>
+{
+ typedef detail::insert<Element, Value, Options, Translator, Box, Allocators> base;
+ typedef typename base::node node;
+ typedef typename base::internal_node internal_node;
+ typedef typename base::leaf leaf;
+
+ typedef typename level_insert_elements_type<InsertIndex, Element, Value, Options, Box, Allocators>::type elements_type;
+ typedef typename Options::parameters_type parameters_type;
+
+ inline level_insert_base(node* & root,
+ size_t & leafs_level,
+ Element const& element,
+ parameters_type const& parameters,
+ Translator const& translator,
+ Allocators & allocators,
+ size_t relative_level)
+ : base(root, leafs_level, element, parameters, translator, allocators, relative_level)
+ , result_relative_level(0)
+ {}
+
+ template <typename Node>
+ inline void handle_possible_reinsert_or_split_of_root(Node &n)
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(result_elements.empty(), "reinsert should be handled only once for level");
+
+ result_relative_level = base::m_leafs_level - base::m_traverse_data.current_level;
+
+ // overflow
+ if ( base::m_parameters.get_max_elements() < rtree::elements(n).size() )
+ {
+ // node isn't root node
+ if ( !base::m_traverse_data.current_is_root() )
+ {
+ // NOTE: exception-safety
+ // After an exception result_elements may contain garbage, don't use it
+ rstar::remove_elements_to_reinsert<Value, Options, Translator, Box, Allocators>::apply(
+ result_elements, n,
+ base::m_traverse_data.parent, base::m_traverse_data.current_child_index,
+ base::m_parameters, base::m_translator, base::m_allocators); // MAY THROW, BASIC (V, E: alloc, copy)
+ }
+ // node is root node
+ else
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get<Node>(base::m_root_node), "node should be the root node");
+ base::split(n); // MAY THROW (V, E: alloc, copy, N: alloc)
+ }
+ }
+ }
+
+ template <typename Node>
+ inline void handle_possible_split(Node &n) const
+ {
+ // overflow
+ if ( base::m_parameters.get_max_elements() < rtree::elements(n).size() )
+ {
+ base::split(n); // MAY THROW (V, E: alloc, copy, N: alloc)
+ }
+ }
+
+ template <typename Node>
+ inline void recalculate_aabb_if_necessary(Node &n) const
+ {
+ if ( !result_elements.empty() && !base::m_traverse_data.current_is_root() )
+ {
+ // calulate node's new box
+ base::m_traverse_data.current_element().first =
+ elements_box<Box>(rtree::elements(n).begin(), rtree::elements(n).end(), base::m_translator);
+ }
+ }
+
+ size_t result_relative_level;
+ elements_type result_elements;
+};
+
+template <size_t InsertIndex, typename Element, typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+struct level_insert
+ : public level_insert_base<InsertIndex, Element, Value, Options, Translator, Box, Allocators>
+{
+ typedef level_insert_base<InsertIndex, Element, Value, Options, Translator, Box, Allocators> base;
+ typedef typename base::node node;
+ typedef typename base::internal_node internal_node;
+ typedef typename base::leaf leaf;
+
+ typedef typename Options::parameters_type parameters_type;
+
+ inline level_insert(node* & root,
+ size_t & leafs_level,
+ Element const& element,
+ parameters_type const& parameters,
+ Translator const& translator,
+ Allocators & allocators,
+ size_t relative_level)
+ : base(root, leafs_level, element, parameters, translator, allocators, relative_level)
+ {}
+
+ inline void operator()(internal_node & n)
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level < base::m_leafs_level, "unexpected level");
+
+ if ( base::m_traverse_data.current_level < base::m_level )
+ {
+ // next traversing step
+ base::traverse(*this, n); // MAY THROW (E: alloc, copy, N: alloc)
+
+ // further insert
+ if ( 0 < InsertIndex )
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(0 < base::m_level, "illegal level value, level shouldn't be the root level for 0 < InsertIndex");
+
+ if ( base::m_traverse_data.current_level == base::m_level - 1 )
+ {
+ base::handle_possible_reinsert_or_split_of_root(n); // MAY THROW (E: alloc, copy, N: alloc)
+ }
+ }
+ }
+ else
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_traverse_data.current_level, "unexpected level");
+
+ try
+ {
+ // push new child node
+ rtree::elements(n).push_back(base::m_element); // MAY THROW, STRONG (E: alloc, copy)
+ }
+ catch(...)
+ {
+ // NOTE: exception-safety
+ // if the insert fails above, the element won't be stored in the tree, so delete it
+
+ rtree::visitors::destroy<Value, Options, Translator, Box, Allocators> del_v(base::m_element.second, base::m_allocators);
+ rtree::apply_visitor(del_v, *base::m_element.second);
+
+ throw; // RETHROW
+ }
+
+ // first insert
+ if ( 0 == InsertIndex )
+ {
+ base::handle_possible_reinsert_or_split_of_root(n); // MAY THROW (E: alloc, copy, N: alloc)
+ }
+ // not the first insert
+ else
+ {
+ base::handle_possible_split(n); // MAY THROW (E: alloc, N: alloc)
+ }
+ }
+
+ base::recalculate_aabb_if_necessary(n);
+ }
+
+ inline void operator()(leaf &)
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(false, "this visitor can't be used for a leaf");
+ }
+};
+
+template <size_t InsertIndex, typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+struct level_insert<InsertIndex, Value, Value, Options, Translator, Box, Allocators>
+ : public level_insert_base<InsertIndex, Value, Value, Options, Translator, Box, Allocators>
+{
+ typedef level_insert_base<InsertIndex, Value, Value, Options, Translator, Box, Allocators> base;
+ typedef typename base::node node;
+ typedef typename base::internal_node internal_node;
+ typedef typename base::leaf leaf;
+
+ typedef typename Options::parameters_type parameters_type;
+
+ inline level_insert(node* & root,
+ size_t & leafs_level,
+ Value const& v,
+ parameters_type const& parameters,
+ Translator const& translator,
+ Allocators & allocators,
+ size_t relative_level)
+ : base(root, leafs_level, v, parameters, translator, allocators, relative_level)
+ {}
+
+ inline void operator()(internal_node & n)
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level < base::m_leafs_level, "unexpected level");
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level < base::m_level, "unexpected level");
+
+ // next traversing step
+ base::traverse(*this, n); // MAY THROW (V, E: alloc, copy, N: alloc)
+
+ BOOST_GEOMETRY_INDEX_ASSERT(0 < base::m_level, "illegal level value, level shouldn't be the root level for 0 < InsertIndex");
+
+ if ( base::m_traverse_data.current_level == base::m_level - 1 )
+ {
+ base::handle_possible_reinsert_or_split_of_root(n); // MAY THROW (E: alloc, copy, N: alloc)
+ }
+
+ base::recalculate_aabb_if_necessary(n);
+ }
+
+ inline void operator()(leaf & n)
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level == base::m_leafs_level,
+ "unexpected level");
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_traverse_data.current_level ||
+ base::m_level == (std::numeric_limits<size_t>::max)(),
+ "unexpected level");
+
+ rtree::elements(n).push_back(base::m_element); // MAY THROW, STRONG (V: alloc, copy)
+
+ base::handle_possible_split(n); // MAY THROW (V: alloc, copy, N: alloc)
+ }
+};
+
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+struct level_insert<0, Value, Value, Options, Translator, Box, Allocators>
+ : public level_insert_base<0, Value, Value, Options, Translator, Box, Allocators>
+{
+ typedef level_insert_base<0, Value, Value, Options, Translator, Box, Allocators> base;
+ typedef typename base::node node;
+ typedef typename base::internal_node internal_node;
+ typedef typename base::leaf leaf;
+
+ typedef typename Options::parameters_type parameters_type;
+
+ inline level_insert(node* & root,
+ size_t & leafs_level,
+ Value const& v,
+ parameters_type const& parameters,
+ Translator const& translator,
+ Allocators & allocators,
+ size_t relative_level)
+ : base(root, leafs_level, v, parameters, translator, allocators, relative_level)
+ {}
+
+ inline void operator()(internal_node & n)
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level < base::m_leafs_level,
+ "unexpected level");
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level < base::m_level,
+ "unexpected level");
+
+ // next traversing step
+ base::traverse(*this, n); // MAY THROW (V: alloc, copy, N: alloc)
+
+ base::recalculate_aabb_if_necessary(n);
+ }
+
+ inline void operator()(leaf & n)
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level == base::m_leafs_level,
+ "unexpected level");
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_traverse_data.current_level ||
+ base::m_level == (std::numeric_limits<size_t>::max)(),
+ "unexpected level");
+
+ rtree::elements(n).push_back(base::m_element); // MAY THROW, STRONG (V: alloc, copy)
+
+ base::handle_possible_reinsert_or_split_of_root(n); // MAY THROW (V: alloc, copy, N: alloc)
+
+ base::recalculate_aabb_if_necessary(n);
+ }
+};
+
+} // namespace rstar
+
+// R*-tree insert visitor
+// After passing the Element to insert visitor the Element is managed by the tree
+// I.e. one should not delete the node passed to the insert visitor after exception is thrown
+// because this visitor may delete it
+template <typename Element, typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+class insert<Element, Value, Options, Translator, Box, Allocators, insert_reinsert_tag>
+ : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, false>::type
+ , index::detail::nonassignable
+{
+ typedef typename Options::parameters_type parameters_type;
+
+ typedef typename rtree::node<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+public:
+ inline insert(node* & root,
+ size_t & leafs_level,
+ Element const& element,
+ parameters_type const& parameters,
+ Translator const& translator,
+ Allocators & allocators,
+ size_t relative_level = 0)
+ : m_root(root), m_leafs_level(leafs_level), m_element(element)
+ , m_parameters(parameters), m_translator(translator)
+ , m_relative_level(relative_level), m_allocators(allocators)
+ {}
+
+ inline void operator()(internal_node & BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(n))
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get<internal_node>(m_root), "current node should be the root");
+
+ rstar::level_insert<0, Element, Value, Options, Translator, Box, Allocators> lins_v(
+ m_root, m_leafs_level, m_element, m_parameters, m_translator, m_allocators, m_relative_level);
+
+ rtree::apply_visitor(lins_v, *m_root); // MAY THROW (V, E: alloc, copy, N: alloc)
+
+ if ( !lins_v.result_elements.empty() )
+ {
+ recursive_reinsert(lins_v.result_elements, lins_v.result_relative_level); // MAY THROW (V, E: alloc, copy, N: alloc)
+ }
+ }
+
+ inline void operator()(leaf & BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(n))
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get<leaf>(m_root), "current node should be the root");
+
+ rstar::level_insert<0, Element, Value, Options, Translator, Box, Allocators> lins_v(
+ m_root, m_leafs_level, m_element, m_parameters, m_translator, m_allocators, m_relative_level);
+
+ rtree::apply_visitor(lins_v, *m_root); // MAY THROW (V, E: alloc, copy, N: alloc)
+
+ // we're in the root, so root should be split and there should be no elements to reinsert
+ BOOST_GEOMETRY_INDEX_ASSERT(lins_v.result_elements.empty(), "unexpected state");
+ }
+
+private:
+ template <typename Elements>
+ inline void recursive_reinsert(Elements & elements, size_t relative_level)
+ {
+ typedef typename Elements::value_type element_type;
+
+ // reinsert children starting from the minimum distance
+ typename Elements::reverse_iterator it = elements.rbegin();
+ for ( ; it != elements.rend() ; ++it)
+ {
+ rstar::level_insert<1, element_type, Value, Options, Translator, Box, Allocators> lins_v(
+ m_root, m_leafs_level, *it, m_parameters, m_translator, m_allocators, relative_level);
+
+ try
+ {
+ rtree::apply_visitor(lins_v, *m_root); // MAY THROW (V, E: alloc, copy, N: alloc)
+ }
+ catch(...)
+ {
+ ++it;
+ for ( ; it != elements.rend() ; ++it)
+ rtree::destroy_element<Value, Options, Translator, Box, Allocators>::apply(*it, m_allocators);
+ throw; // RETHROW
+ }
+
+ BOOST_GEOMETRY_INDEX_ASSERT(relative_level + 1 == lins_v.result_relative_level, "unexpected level");
+
+ // non-root relative level
+ if ( lins_v.result_relative_level < m_leafs_level && !lins_v.result_elements.empty())
+ {
+ recursive_reinsert(lins_v.result_elements, lins_v.result_relative_level); // MAY THROW (V, E: alloc, copy, N: alloc)
+ }
+ }
+ }
+
+ node* & m_root;
+ size_t & m_leafs_level;
+ Element const& m_element;
+
+ parameters_type const& m_parameters;
+ Translator const& m_translator;
+
+ size_t m_relative_level;
+
+ Allocators m_allocators;
+};
+
+}}} // namespace detail::rtree::visitors
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_RSTAR_INSERT_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/rstar/redistribute_elements.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/rstar/redistribute_elements.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,408 @@
+// Boost.Geometry Index
+//
+// R-tree R*-tree split algorithm implementation
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_RSTAR_REDISTRIBUTE_ELEMENTS_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_RSTAR_REDISTRIBUTE_ELEMENTS_HPP
+
+#include <boost/geometry/index/detail/nonassignable.hpp>
+
+#include <boost/geometry/index/detail/algorithms/intersection_content.hpp>
+#include <boost/geometry/index/detail/algorithms/union_content.hpp>
+#include <boost/geometry/index/detail/algorithms/margin.hpp>
+
+#include <boost/geometry/index/detail/rtree/node/node.hpp>
+#include <boost/geometry/index/detail/rtree/visitors/insert.hpp>
+#include <boost/geometry/index/detail/rtree/visitors/is_leaf.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+namespace rstar {
+
+template <typename Element, typename Translator, size_t Corner, size_t AxisIndex>
+class element_axis_corner_less
+ : index::detail::nonassignable
+{
+public:
+ element_axis_corner_less(Translator const& tr)
+ : m_tr(tr)
+ {}
+
+ bool operator()(Element const& e1, Element const& e2) const
+ {
+ return index::detail::get<Corner, AxisIndex>(rtree::element_indexable(e1, m_tr))
+ < index::detail::get<Corner, AxisIndex>(rtree::element_indexable(e2, m_tr));
+ }
+
+private:
+ Translator const& m_tr;
+};
+
+template <typename Parameters, typename Box, size_t Corner, size_t AxisIndex>
+struct choose_split_axis_and_index_for_corner
+{
+ typedef typename index::detail::default_margin_result<Box>::type margin_type;
+ typedef typename index::detail::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,
+ content_type & smallest_overlap,
+ content_type & smallest_content,
+ Parameters const& parameters,
+ Translator const& translator)
+ {
+ typedef typename Elements::value_type element_type;
+
+ BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == parameters.get_max_elements() + 1, "wrong number of elements");
+
+ // copy elements
+ Elements elements_copy(elements); // MAY THROW, STRONG (alloc, copy)
+
+ // sort elements
+ element_axis_corner_less<element_type, Translator, Corner, AxisIndex> elements_less(translator);
+ std::sort(elements_copy.begin(), elements_copy.end(), elements_less); // MAY THROW, BASIC (copy)
+
+ // init outputs
+ choosen_index = parameters.get_min_elements();
+ sum_of_margins = 0;
+ 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.get_max_elements() - parameters.get_min_elements() + 2;
+ for ( size_t i = parameters.get_min_elements() ; i < index_last ; ++i )
+ {
+ // TODO - awulkiew: may be optimized - box of group 1 may be initialized with
+ // box of min_elems number of elements and expanded for each iteration by another element
+
+ Box box1 = rtree::elements_box<Box>(elements_copy.begin(), elements_copy.begin() + i, translator);
+ Box box2 = rtree::elements_box<Box>(elements_copy.begin() + i, elements_copy.end(), translator);
+
+ sum_of_margins += index::detail::margin(box1) + index::detail::margin(box2);
+
+ content_type ovl = index::detail::intersection_content(box1, box2);
+ content_type con = index::detail::content(box1) + index::detail::content(box2);
+
+ if ( ovl < smallest_overlap || (ovl == smallest_overlap && con <= smallest_content) )
+ {
+ choosen_index = i;
+ smallest_overlap = ovl;
+ smallest_content = con;
+ }
+ }
+ }
+};
+
+template <typename Parameters, typename Box, size_t AxisIndex, typename ElementIndexableTag>
+struct choose_split_axis_and_index_for_axis
+{
+ //BOOST_STATIC_ASSERT(0);
+};
+
+template <typename Parameters, typename Box, size_t AxisIndex>
+struct choose_split_axis_and_index_for_axis<Parameters, Box, AxisIndex, box_tag>
+{
+ typedef typename index::detail::default_margin_result<Box>::type margin_type;
+ typedef typename index::detail::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,
+ content_type & smallest_overlap,
+ content_type & smallest_content,
+ Parameters const& parameters,
+ Translator const& translator)
+ {
+ size_t index1 = 0;
+ margin_type som1 = 0;
+ 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, con1,
+ parameters, translator); // MAY THROW, STRONG
+
+ size_t index2 = 0;
+ margin_type som2 = 0;
+ 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, con2,
+ parameters, translator); // MAY THROW, STRONG
+
+ sum_of_margins = som1 + som2;
+
+ if ( ovl1 < ovl2 || (ovl1 == ovl2 && con1 <= con2) )
+ {
+ choosen_corner = min_corner;
+ choosen_index = index1;
+ smallest_overlap = ovl1;
+ smallest_content = con1;
+ }
+ else
+ {
+ choosen_corner = max_corner;
+ choosen_index = index2;
+ smallest_overlap = ovl2;
+ smallest_content = con2;
+ }
+ }
+};
+
+template <typename Parameters, typename Box, size_t AxisIndex>
+struct choose_split_axis_and_index_for_axis<Parameters, Box, AxisIndex, point_tag>
+{
+ typedef typename index::detail::default_margin_result<Box>::type margin_type;
+ typedef typename index::detail::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,
+ content_type & smallest_overlap,
+ content_type & smallest_content,
+ Parameters const& parameters,
+ Translator const& translator)
+ {
+ choose_split_axis_and_index_for_corner<Parameters, Box, min_corner, AxisIndex>::
+ apply(elements, choosen_index,
+ sum_of_margins, smallest_overlap, smallest_content,
+ parameters, translator); // MAY THROW, STRONG
+
+ choosen_corner = min_corner;
+ }
+};
+
+template <typename Parameters, typename Box, size_t Dimension>
+struct choose_split_axis_and_index
+{
+ BOOST_STATIC_ASSERT(0 < Dimension);
+
+ typedef typename index::detail::default_margin_result<Box>::type margin_type;
+ typedef typename index::detail::default_content_result<Box>::type content_type;
+
+ template <typename Elements, typename Translator>
+ static inline void apply(Elements const& elements,
+ size_t & choosen_axis,
+ size_t & choosen_corner,
+ size_t & choosen_index,
+ margin_type & smallest_sum_of_margins,
+ content_type & smallest_overlap,
+ content_type & smallest_content,
+ Parameters const& parameters,
+ Translator const& translator)
+ {
+ 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_content,
+ parameters, translator); // MAY THROW, STRONG
+
+ margin_type sum_of_margins = 0;
+
+ size_t corner = min_corner;
+ size_t index = 0;
+
+ 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::detail::traits::tag<element_indexable_type>::type
+ >::apply(elements, corner, index, sum_of_margins, overlap_val, content_val, parameters, translator); // MAY THROW, STRONG
+
+ if ( sum_of_margins < smallest_sum_of_margins )
+ {
+ choosen_axis = Dimension - 1;
+ choosen_corner = corner;
+ choosen_index = index;
+ smallest_sum_of_margins = sum_of_margins;
+ smallest_overlap = overlap_val;
+ smallest_content = content_val;
+ }
+ }
+};
+
+template <typename Parameters, typename Box>
+struct choose_split_axis_and_index<Parameters, Box, 1>
+{
+ typedef typename index::detail::default_margin_result<Box>::type margin_type;
+ typedef typename index::detail::default_content_result<Box>::type content_type;
+
+ template <typename Elements, typename Translator>
+ static inline void apply(Elements const& elements,
+ size_t & choosen_axis,
+ size_t & choosen_corner,
+ size_t & choosen_index,
+ margin_type & smallest_sum_of_margins,
+ content_type & smallest_overlap,
+ content_type & smallest_content,
+ Parameters const& parameters,
+ Translator const& translator)
+ {
+ typedef typename rtree::element_indexable_type<typename Elements::value_type, Translator>::type element_indexable_type;
+
+ choosen_axis = 0;
+
+ choose_split_axis_and_index_for_axis<
+ Parameters,
+ Box,
+ 0,
+ typename index::detail::traits::tag<element_indexable_type>::type
+ >::apply(elements, choosen_corner, choosen_index, smallest_sum_of_margins, smallest_overlap, smallest_content, parameters, translator); // MAY THROW
+ }
+};
+
+template <size_t Corner, size_t Dimension>
+struct partial_sort
+{
+ BOOST_STATIC_ASSERT(0 < Dimension);
+
+ template <typename Elements, typename Translator>
+ static inline void apply(Elements & elements, const size_t axis, const size_t index, Translator const& tr)
+ {
+ if ( axis < Dimension - 1 )
+ {
+ partial_sort<Corner, Dimension - 1>::apply(elements, axis, index, tr); // MAY THROW, BASIC (copy)
+ }
+ else
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(axis == Dimension - 1, "unexpected axis value");
+
+ typedef typename Elements::value_type element_type;
+ element_axis_corner_less<element_type, Translator, Corner, Dimension - 1> less(tr);
+ std::partial_sort(elements.begin(), elements.begin() + index, elements.end(), less); // MAY THROW, BASIC (copy)
+ }
+ }
+};
+
+template <size_t Corner>
+struct partial_sort<Corner, 1>
+{
+ template <typename Elements, typename Translator>
+ static inline void apply(Elements & elements,
+ const size_t BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(axis),
+ const size_t index,
+ Translator const& tr)
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(axis == 0, "unexpected axis value");
+
+ typedef typename Elements::value_type element_type;
+ element_axis_corner_less<element_type, Translator, Corner, 0> less(tr);
+ std::partial_sort(elements.begin(), elements.begin() + index, elements.end(), less); // MAY THROW, BASIC (copy)
+ }
+};
+
+} // namespace rstar
+
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+struct redistribute_elements<Value, Options, Translator, Box, Allocators, rstar_tag>
+{
+ typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+ typedef typename Options::parameters_type parameters_type;
+
+ static const size_t dimension = index::detail::traits::dimension<Box>::value;
+
+ typedef typename index::detail::default_margin_result<Box>::type margin_type;
+ typedef typename index::detail::default_content_result<Box>::type content_type;
+
+ template <typename Node>
+ static inline void apply(
+ Node & n,
+ Node & second_node,
+ Box & box1,
+ Box & box2,
+ parameters_type const& parameters,
+ Translator const& translator,
+ Allocators & allocators)
+ {
+ typedef typename rtree::elements_type<Node>::type elements_type;
+
+ elements_type & elements1 = rtree::elements(n);
+ elements_type & elements2 = rtree::elements(second_node);
+
+ size_t split_axis = 0;
+ size_t split_corner = 0;
+ size_t split_index = parameters.get_min_elements();
+ margin_type smallest_sum_of_margins = (std::numeric_limits<margin_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::detail::traits::dimension<Box>::value
+ >::apply(elements1,
+ split_axis, split_corner, split_index,
+ smallest_sum_of_margins, smallest_overlap, smallest_content,
+ parameters, translator); // MAY THROW, STRONG
+
+ // TODO: awulkiew - get rid of following static_casts?
+
+ BOOST_GEOMETRY_INDEX_ASSERT(split_axis < index::detail::traits::dimension<Box>::value, "unexpected value");
+ BOOST_GEOMETRY_INDEX_ASSERT(split_corner == static_cast<size_t>(min_corner) || split_corner == static_cast<size_t>(max_corner), "unexpected value");
+ BOOST_GEOMETRY_INDEX_ASSERT(parameters.get_min_elements() <= split_index && split_index <= parameters.get_max_elements() - parameters.get_min_elements() + 1, "unexpected value");
+
+ // copy original elements
+ elements_type elements_copy(elements1); // MAY THROW, STRONG
+ elements_type elements_backup(elements1); // MAY THROW, STRONG
+
+ // TODO: awulkiew - check if std::partial_sort produces the same result as std::sort
+ if ( split_corner == static_cast<size_t>(min_corner) )
+ rstar::partial_sort<min_corner, dimension>
+ ::apply(elements_copy, split_axis, split_index, translator); // MAY THROW, BASIC (copy)
+ else
+ rstar::partial_sort<max_corner, dimension>
+ ::apply(elements_copy, split_axis, split_index, translator); // MAY THROW, BASIC (copy)
+
+ try
+ {
+ // copy elements to nodes
+ elements1.assign(elements_copy.begin(), elements_copy.begin() + split_index); // MAY THROW, BASIC
+ elements2.assign(elements_copy.begin() + split_index, elements_copy.end()); // MAY THROW, BASIC
+
+ // calculate boxes
+ box1 = rtree::elements_box<Box>(elements1.begin(), elements1.end(), translator);
+ box2 = rtree::elements_box<Box>(elements2.begin(), elements2.end(), translator);
+ }
+ catch(...)
+ {
+ //elements_copy.clear();
+ elements1.clear();
+ elements2.clear();
+
+ rtree::destroy_elements<Value, Options, Translator, Box, Allocators>::apply(elements_backup, allocators);
+ //elements_backup.clear();
+
+ throw; // RETHROW, BASIC
+ }
+ }
+};
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_RSTAR_REDISTRIBUTE_ELEMENTS_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/rstar/rstar.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/rstar/rstar.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,18 @@
+// Boost.Geometry Index
+//
+// R-tree R*-tree algorithm implementation
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_RSTAR_RSTAR_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_RSTAR_RSTAR_HPP
+
+#include <boost/geometry/index/detail/rtree/rstar/insert.hpp>
+#include <boost/geometry/index/detail/rtree/rstar/choose_next_node.hpp>
+#include <boost/geometry/index/detail/rtree/rstar/redistribute_elements.hpp>
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_RSTAR_RSTAR_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/are_boxes_ok.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/are_boxes_ok.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,145 @@
+// Boost.Geometry Index
+//
+// R-tree boxes validating visitor implementation
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_VISITORS_ARE_BOXES_OK_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_ARE_BOXES_OK_HPP
+
+#include <boost/geometry/algorithms/equals.hpp>
+#include <boost/geometry/index/detail/rtree/node/node.hpp>
+
+namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree {
+
+namespace visitors {
+
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+class are_boxes_ok
+ : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
+ , index::detail::nonassignable
+{
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+public:
+ are_boxes_ok(Translator const& tr, bool exact_match)
+ : result(false), m_tr(tr), m_is_root(true), m_exact_match(exact_match)
+ {}
+
+ void operator()(internal_node const& n)
+ {
+ typedef typename rtree::elements_type<internal_node>::type elements_type;
+ elements_type const& elements = rtree::elements(n);
+
+ if (elements.empty())
+ {
+ result = false;
+ return;
+ }
+
+ Box box_bckup = m_box;
+ bool is_root_bckup = m_is_root;
+
+ m_is_root = false;
+
+ for ( typename elements_type::const_iterator it = elements.begin();
+ it != elements.end() ; ++it)
+ {
+ m_box = it->first;
+
+ rtree::apply_visitor(*this, *it->second);
+
+ if ( result == false )
+ return;
+ }
+
+ m_box = box_bckup;
+ m_is_root = is_root_bckup;
+
+ Box box_exp;
+ geometry::convert(elements.front().first, box_exp);
+ for( typename elements_type::const_iterator it = elements.begin() + 1;
+ it != elements.end() ; ++it)
+ {
+ geometry::expand(box_exp, it->first);
+ }
+
+ if ( m_exact_match )
+ result = m_is_root || geometry::equals(box_exp, m_box);
+ else
+ result = m_is_root || geometry::covered_by(box_exp, m_box);
+ }
+
+ void operator()(leaf const& n)
+ {
+ typedef typename rtree::elements_type<leaf>::type elements_type;
+ elements_type const& elements = rtree::elements(n);
+
+ // non-root node
+ if (!m_is_root)
+ {
+ if ( elements.empty() )
+ {
+ result = false;
+ return;
+ }
+
+ Box box_exp;
+ geometry::convert(m_tr(elements.front()), box_exp);
+ for(typename elements_type::const_iterator it = elements.begin() + 1;
+ it != elements.end() ; ++it)
+ {
+ geometry::expand(box_exp, m_tr(*it));
+ }
+
+ if ( m_exact_match )
+ result = geometry::equals(box_exp, m_box);
+ else
+ result = geometry::covered_by(box_exp, m_box);
+ }
+ else
+ result = true;
+ }
+
+ bool result;
+
+private:
+ Translator const& m_tr;
+ Box m_box;
+ bool m_is_root;
+ bool m_exact_match;
+};
+
+} // namespace visitors
+
+#ifndef BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE
+#error "To use are_boxes_ok BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE should be defined before including the rtree"
+#endif
+
+template <typename Value, typename Parameters, typename Translator, typename Allocator>
+bool are_boxes_ok(index::rtree<Value, Parameters, Translator, Allocator> const& tree,
+ bool exact_match = true)
+{
+ typedef index::rtree<Value, Parameters, Translator, Allocator> rt;
+
+ detail::rtree::visitors::are_boxes_ok<
+ typename rt::value_type,
+ typename rt::options_type,
+ typename rt::translator_type,
+ typename rt::box_type,
+ typename rt::allocators_type
+ > v(tree.translator(), exact_match);
+
+ tree.apply_visitor(v);
+
+ return v.result;
+}
+
+}}}}} // namespace boost::geometry::index::detail::rtree
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_ARE_BOXES_OK_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/are_levels_ok.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/are_levels_ok.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,115 @@
+// Boost.Geometry Index
+//
+// R-tree levels validating visitor implementation
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_VISITORS_ARE_LEVELS_OK_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_ARE_LEVELS_OK_HPP
+
+#include <boost/geometry/index/detail/rtree/node/node.hpp>
+
+namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree {
+
+namespace visitors {
+
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+class are_levels_ok
+ : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
+ , index::detail::nonassignable
+{
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+public:
+ inline are_levels_ok(Translator const& tr)
+ : result(true), m_tr(tr), m_leafs_level((std::numeric_limits<size_t>::max)()), m_current_level(0)
+ {}
+
+ inline void operator()(internal_node const& n)
+ {
+ typedef typename rtree::elements_type<internal_node>::type elements_type;
+ elements_type const& elements = rtree::elements(n);
+
+ if (elements.empty())
+ {
+ result = false;
+ return;
+ }
+
+ size_t current_level_backup = m_current_level;
+ ++m_current_level;
+
+ for ( typename elements_type::const_iterator it = elements.begin();
+ it != elements.end() ; ++it)
+ {
+ rtree::apply_visitor(*this, *it->second);
+
+ if ( result == false )
+ return;
+ }
+
+ m_current_level = current_level_backup;
+ }
+
+ inline void operator()(leaf const& n)
+ {
+ typedef typename rtree::elements_type<leaf>::type elements_type;
+ elements_type const& elements = rtree::elements(n);
+
+ // empty leaf in non-root node
+ if (0 < m_current_level && elements.empty())
+ {
+ result = false;
+ return;
+ }
+
+ if ( m_leafs_level == (std::numeric_limits<size_t>::max)() )
+ {
+ m_leafs_level = m_current_level;
+ }
+ else if ( m_leafs_level != m_current_level )
+ {
+ result = false;
+ }
+ }
+
+ bool result;
+
+private:
+ Translator const& m_tr;
+ size_t m_leafs_level;
+ size_t m_current_level;
+};
+
+} // namespace visitors
+
+#ifndef BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE
+#error "To use are_levels_ok() BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE should be defined before including the rtree"
+#endif
+
+template <typename Value, typename Parameters, typename Translator, typename Allocator>
+bool are_levels_ok(index::rtree<Value, Parameters, Translator, Allocator> const& tree)
+{
+ typedef index::rtree<Value, Parameters, Translator, Allocator> rt;
+
+ detail::rtree::visitors::are_levels_ok<
+ typename rt::value_type,
+ typename rt::options_type,
+ typename rt::translator_type,
+ typename rt::box_type,
+ typename rt::allocators_type
+ > v(tree.translator());
+
+ tree.apply_visitor(v);
+
+ return v.result;
+}
+
+}}}}} // namespace boost::geometry::index::detail::rtree
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_ARE_LEVELS_OK_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/children_box.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/children_box.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,58 @@
+// Boost.Geometry Index
+//
+// R-tree node children box calculating visitor implementation
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_VISITORS_CHILDREN_BOX_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_CHILDREN_BOX_HPP
+
+#include <boost/geometry/index/rtree/node/node.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree { namespace visitors {
+
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+class children_box
+ : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
+ , index::nonassignable
+{
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+public:
+ inline children_box(Box & result, Translator const& tr)
+ : m_result(result), m_tr(tr)
+ {}
+
+ inline void operator()(internal_node const& n)
+ {
+ typedef typename rtree::elements_type<internal_node>::type elements_type;
+ elements_type const& elements = rtree::elements(n);
+
+ m_result = rtree::elements_box<Box>(elements.begin(), elements.end(), m_tr);
+ }
+
+ inline void operator()(leaf const& n)
+ {
+ typedef typename rtree::elements_type<leaf>::type elements_type;
+ elements_type const& elements = rtree::elements(n);
+
+ m_result = rtree::elements_box<Box>(elements.begin(), elements.end(), m_tr);
+ }
+
+private:
+ Box & m_result;
+ Translator const& m_tr;
+};
+
+}}} // namespace detail::rtree::visitors
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_CHILDREN_BOX_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/copy.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/copy.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,94 @@
+// Boost.Geometry Index
+//
+// R-tree deep copying visitor implementation
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_VISITORS_COPY_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_COPY_HPP
+
+#include <boost/geometry/index/detail/rtree/node/node.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree { namespace visitors {
+
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+class copy
+ : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, false>::type
+ , boost::noncopyable
+{
+public:
+ typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+ typedef rtree::node_auto_ptr<Value, Options, Translator, Box, Allocators> node_auto_ptr;
+
+ explicit inline copy(Allocators & allocators)
+ : result(0)
+ , m_allocators(allocators)
+ {}
+
+ inline void operator()(internal_node & n)
+ {
+ node * raw_new_node = rtree::create_node<Allocators, internal_node>::apply(m_allocators); // MAY THROW, STRONG (N: alloc)
+ node_auto_ptr new_node(raw_new_node, m_allocators);
+
+ typedef typename rtree::elements_type<internal_node>::type elements_type;
+ elements_type & elements = rtree::elements(n);
+
+ elements_type & elements_dst = rtree::elements(rtree::get<internal_node>(*new_node));
+
+ for (typename elements_type::iterator it = elements.begin();
+ it != elements.end(); ++it)
+ {
+ rtree::apply_visitor(*this, *it->second); // MAY THROW (V, E: alloc, copy, N: alloc)
+
+ // for exception safety
+ node_auto_ptr auto_result(result, m_allocators);
+
+ elements_dst.push_back( std::make_pair(it->first, result) ); // MAY THROW, STRONG (E: alloc, copy)
+
+ auto_result.release();
+ }
+
+ result = new_node.get();
+ new_node.release();
+ }
+
+ inline void operator()(leaf & l)
+ {
+ node * raw_new_node = rtree::create_node<Allocators, leaf>::apply(m_allocators); // MAY THROW, STRONG (N: alloc)
+ node_auto_ptr new_node(raw_new_node, m_allocators);
+
+ typedef typename rtree::elements_type<leaf>::type elements_type;
+ elements_type & elements = rtree::elements(l);
+
+ elements_type & elements_dst = rtree::elements(rtree::get<leaf>(*new_node));
+
+ for (typename elements_type::iterator it = elements.begin();
+ it != elements.end(); ++it)
+ {
+ elements_dst.push_back(*it); // MAY THROW, STRONG (V: alloc, copy)
+ }
+
+ result = new_node.get();
+ new_node.release();
+ }
+
+ node * result;
+
+private:
+ Allocators & m_allocators;
+};
+
+}}} // namespace detail::rtree::visitors
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_COPY_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/count.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/count.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,122 @@
+// Boost.Geometry Index
+//
+// R-tree count visitor implementation
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_VISITORS_COUNT_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_COUNT_HPP
+
+#include <boost/geometry/index/detail/rtree/node/node.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree { namespace visitors {
+
+template <typename Indexable, typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+struct count
+ : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
+ , index::detail::nonassignable
+{
+ typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+ inline count(Indexable const& i, Translator const& t)
+ : indexable(i), tr(t), found_count(0)
+ {}
+
+ inline void operator()(internal_node const& n)
+ {
+ typedef typename rtree::elements_type<internal_node>::type elements_type;
+ elements_type const& elements = rtree::elements(n);
+
+ // traverse nodes meeting predicates
+ for (typename elements_type::const_iterator it = elements.begin();
+ it != elements.end(); ++it)
+ {
+ if ( geometry::covered_by(indexable, it->first) )
+ rtree::apply_visitor(*this, *it->second);
+ }
+ }
+
+ inline void operator()(leaf const& n)
+ {
+ typedef typename rtree::elements_type<leaf>::type elements_type;
+ elements_type const& elements = rtree::elements(n);
+
+ // get all values meeting predicates
+ for (typename elements_type::const_iterator it = elements.begin();
+ it != elements.end(); ++it)
+ {
+ // if value meets predicates
+ if ( geometry::equals(indexable, tr(*it)) )
+ {
+ ++found_count;
+ }
+ }
+ }
+
+ Indexable const& indexable;
+ Translator const& tr;
+ typename Allocators::size_type found_count;
+};
+
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+struct count<Value, Value, Options, Translator, Box, Allocators>
+ : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
+ , index::detail::nonassignable
+{
+ typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+ inline count(Value const& v, Translator const& t)
+ : value(v), tr(t), found_count(0)
+ {}
+
+ inline void operator()(internal_node const& n)
+ {
+ typedef typename rtree::elements_type<internal_node>::type elements_type;
+ elements_type const& elements = rtree::elements(n);
+
+ // traverse nodes meeting predicates
+ for (typename elements_type::const_iterator it = elements.begin();
+ it != elements.end(); ++it)
+ {
+ if ( geometry::covered_by(tr(value), it->first) )
+ rtree::apply_visitor(*this, *it->second);
+ }
+ }
+
+ inline void operator()(leaf const& n)
+ {
+ typedef typename rtree::elements_type<leaf>::type elements_type;
+ elements_type const& elements = rtree::elements(n);
+
+ // get all values meeting predicates
+ for (typename elements_type::const_iterator it = elements.begin();
+ it != elements.end(); ++it)
+ {
+ // if value meets predicates
+ if ( tr.equals(value, *it) )
+ {
+ ++found_count;
+ }
+ }
+ }
+
+ Value const& value;
+ Translator const& tr;
+ typename Allocators::size_type found_count;
+};
+
+}}} // namespace detail::rtree::visitors
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_COUNT_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/destroy.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/destroy.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,71 @@
+// Boost.Geometry Index
+//
+// R-tree destroying visitor implementation
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_VISITORS_DELETE_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_DELETE_HPP
+
+#include <boost/geometry/index/detail/rtree/node/node.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree { namespace visitors {
+
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+class destroy
+ : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, false>::type
+ , boost::noncopyable
+{
+public:
+ typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+ inline destroy(node * root_node, Allocators & allocators)
+ : m_current_node(root_node)
+ , m_allocators(allocators)
+ {}
+
+ inline void operator()(internal_node & n)
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get<internal_node>(m_current_node), "invalid pointers");
+
+ node * node_to_destroy = m_current_node;
+
+ typedef typename rtree::elements_type<internal_node>::type elements_type;
+ elements_type & elements = rtree::elements(n);
+
+ for (typename elements_type::iterator it = elements.begin();
+ it != elements.end(); ++it)
+ {
+ m_current_node = it->second;
+ rtree::apply_visitor(*this, *m_current_node);
+ it->second = 0;
+ }
+
+ rtree::destroy_node<Allocators, internal_node>::apply(m_allocators, node_to_destroy);
+ }
+
+ inline void operator()(leaf & BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(l))
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(&l == rtree::get<leaf>(m_current_node), "invalid pointers");
+
+ rtree::destroy_node<Allocators, leaf>::apply(m_allocators, m_current_node);
+ }
+
+private:
+ node * m_current_node;
+ Allocators & m_allocators;
+};
+
+}}} // namespace detail::rtree::visitors
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_DELETE_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/gl_draw.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/gl_draw.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,221 @@
+// Boost.Geometry Index
+//
+// R-tree OpenGL drawing visitor implementation
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_VISITORS_GL_DRAW_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_GL_DRAW_HPP
+
+#include <boost/geometry/index/detail/indexable.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree { namespace visitors {
+
+namespace dispatch {
+
+template <typename Point, size_t Dimension>
+struct gl_draw_point
+{};
+
+template <typename Point>
+struct gl_draw_point<Point, 2>
+{
+ static inline void apply(Point const& p, typename index::detail::traits::coordinate_type<Point>::type z)
+ {
+ glBegin(GL_POINT);
+ glVertex3f(geometry::get<0>(p), geometry::get<1>(p), z);
+ glEnd();
+ }
+};
+
+template <typename Box, size_t Dimension>
+struct gl_draw_box
+{};
+
+template <typename Box>
+struct gl_draw_box<Box, 2>
+{
+ static inline void apply(Box const& b, typename index::detail::traits::coordinate_type<Box>::type z)
+ {
+ glBegin(GL_LINE_LOOP);
+ glVertex3f(geometry::get<min_corner, 0>(b), geometry::get<min_corner, 1>(b), z);
+ glVertex3f(geometry::get<max_corner, 0>(b), geometry::get<min_corner, 1>(b), z);
+ glVertex3f(geometry::get<max_corner, 0>(b), geometry::get<max_corner, 1>(b), z);
+ glVertex3f(geometry::get<min_corner, 0>(b), geometry::get<max_corner, 1>(b), z);
+ glEnd();
+ }
+};
+
+template <typename Indexable, typename Tag>
+struct gl_draw_indexable
+{
+};
+
+template <typename Indexable>
+struct gl_draw_indexable<Indexable, box_tag>
+{
+ static const size_t dimension = index::detail::traits::dimension<Indexable>::value;
+
+ static inline void apply(Indexable const& i, typename index::detail::traits::coordinate_type<Indexable>::type z)
+ {
+ gl_draw_box<Indexable, dimension>::apply(i, z);
+ }
+};
+
+template <typename Indexable>
+struct gl_draw_indexable<Indexable, point_tag>
+{
+ static const size_t dimension = index::detail::traits::dimension<Indexable>::value;
+
+ static inline void apply(Indexable const& i, typename index::detail::traits::coordinate_type<Indexable>::type z)
+ {
+ gl_draw_point<Indexable, dimension>::apply(i, z);
+ }
+};
+
+} // namespace dispatch
+
+namespace detail {
+
+template <typename Indexable>
+inline void gl_draw_indexable(Indexable const& i, typename index::detail::traits::coordinate_type<Indexable>::type z)
+{
+ dispatch::gl_draw_indexable<
+ Indexable,
+ typename index::detail::traits::tag<Indexable>::type
+ >::apply(i, z);
+}
+
+} // namespace detail
+
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+struct gl_draw : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
+{
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+ inline gl_draw(Translator const& t,
+ size_t level_first = 0,
+ size_t level_last = (std::numeric_limits<size_t>::max)(),
+ typename index::detail::traits::coordinate_type<Box>::type z_coord_level_multiplier = 1
+ )
+ : tr(t)
+ , level_f(level_first)
+ , level_l(level_last)
+ , z_mul(z_coord_level_multiplier)
+ , level(0)
+ {}
+
+ inline void operator()(internal_node const& n)
+ {
+ typedef typename rtree::elements_type<internal_node>::type elements_type;
+ elements_type const& elements = rtree::elements(n);
+
+ if ( level_f <= level )
+ {
+ size_t level_rel = level - level_f;
+
+ if ( level_rel == 0 )
+ glColor3f(0.75f, 0.0f, 0.0f);
+ else if ( level_rel == 1 )
+ glColor3f(0.0f, 0.75f, 0.0f);
+ else if ( level_rel == 2 )
+ glColor3f(0.0f, 0.0f, 0.75f);
+ else if ( level_rel == 3 )
+ glColor3f(0.75f, 0.75f, 0.0f);
+ else if ( level_rel == 4 )
+ glColor3f(0.75f, 0.0f, 0.75f);
+ else if ( level_rel == 5 )
+ glColor3f(0.0f, 0.75f, 0.75f);
+ else
+ glColor3f(0.5f, 0.5f, 0.5f);
+
+ for (typename elements_type::const_iterator it = elements.begin();
+ it != elements.end(); ++it)
+ {
+ detail::gl_draw_indexable(it->first, level_rel * z_mul);
+ }
+ }
+
+ size_t level_backup = level;
+ ++level;
+
+ if ( level < level_l )
+ {
+ for (typename elements_type::const_iterator it = elements.begin();
+ it != elements.end(); ++it)
+ {
+ rtree::apply_visitor(*this, *it->second);
+ }
+ }
+
+ level = level_backup;
+ }
+
+ inline void operator()(leaf const& n)
+ {
+ typedef typename rtree::elements_type<leaf>::type elements_type;
+ elements_type const& elements = rtree::elements(n);
+
+ if ( level_f <= level )
+ {
+ size_t level_rel = level - level_f;
+
+ glColor3f(0.25f, 0.25f, 0.25f);
+
+ for (typename elements_type::const_iterator it = elements.begin();
+ it != elements.end(); ++it)
+ {
+ detail::gl_draw_indexable(tr(*it), level_rel * z_mul);
+ }
+ }
+ }
+
+ Translator const& tr;
+ size_t level_f;
+ size_t level_l;
+ typename index::detail::traits::coordinate_type<Box>::type z_mul;
+
+ size_t level;
+};
+
+}}} // namespace detail::rtree::visitors
+
+template <typename Value, typename Options, typename Translator, typename Allocator>
+void gl_draw(rtree<Value, Options, Translator, Allocator> const& tree,
+ size_t level_first = 0,
+ size_t level_last = (std::numeric_limits<size_t>::max)(),
+ typename index::detail::traits::coordinate_type<
+ typename rtree<Value, Options, Translator, Allocator>::box_type
+ >::type z_coord_level_multiplier = 1
+ )
+{
+ typedef rtree<Value, Options, Translator, Allocator> rtree_type;
+
+ typedef typename rtree_type::value_type value_type;
+ typedef typename rtree_type::options_type options_type;
+ typedef typename rtree_type::translator_type translator_type;
+ typedef typename rtree_type::box_type box_type;
+ typedef typename rtree_type::allocators_type allocators_type;
+
+ if ( !tree.empty() )
+ {
+ glColor3f(0.75f, 0.75f, 0.75f);
+ detail::rtree::visitors::detail::gl_draw_indexable(tree.box(), 0);
+ }
+
+ detail::rtree::visitors::gl_draw<value_type, options_type, translator_type, box_type, allocators_type>
+ gl_draw_v(tree.translator(), level_first, level_last, z_coord_level_multiplier);
+
+ tree.apply_visitor(gl_draw_v);
+}
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_GL_DRAW_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/insert.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/insert.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,507 @@
+// Boost.Geometry Index
+//
+// R-tree inserting visitor implementation
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_VISITORS_INSERT_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_INSERT_HPP
+
+#include <boost/geometry/index/detail/algorithms/content.hpp>
+
+#include <boost/geometry/index/detail/rtree/node/node.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+// Default choose_next_node
+template <typename Value, typename Options, typename Box, typename Allocators, typename ChooseNextNodeTag>
+class choose_next_node;
+
+template <typename Value, typename Options, typename Box, typename Allocators>
+class choose_next_node<Value, Options, Box, Allocators, choose_by_content_diff_tag>
+{
+public:
+ typedef typename Options::parameters_type parameters_type;
+
+ typedef typename rtree::node<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+ typedef typename rtree::elements_type<internal_node>::type children_type;
+
+ typedef typename index::detail::default_content_result<Box>::type content_type;
+
+ template <typename Indexable>
+ static inline size_t apply(internal_node & n,
+ Indexable const& indexable,
+ parameters_type const& /*parameters*/,
+ size_t /*node_relative_level*/)
+ {
+ children_type & children = rtree::elements(n);
+
+ BOOST_GEOMETRY_INDEX_ASSERT(!children.empty(), "can't choose the next node if children are empty");
+
+ size_t children_count = children.size();
+
+ // choose index with smallest content change or smallest content
+ size_t choosen_index = 0;
+ 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 )
+ {
+ typedef typename children_type::value_type child_type;
+ child_type const& ch_i = children[i];
+
+ // expanded child node's box
+ Box box_exp(ch_i.first);
+ geometry::expand(box_exp, indexable);
+
+ // areas difference
+ content_type content = index::detail::content(box_exp);
+ content_type content_diff = content - index::detail::content(ch_i.first);
+
+ // update the result
+ if ( content_diff < smallest_content_diff ||
+ ( content_diff == smallest_content_diff && content < smallest_content ) )
+ {
+ smallest_content_diff = content_diff;
+ smallest_content = content;
+ choosen_index = i;
+ }
+ }
+
+ return choosen_index;
+ }
+};
+
+// ----------------------------------------------------------------------- //
+
+// Not implemented here
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators, typename RedistributeTag>
+struct redistribute_elements
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_REDISTRIBUTE_TAG_TYPE,
+ (redistribute_elements));
+};
+
+// ----------------------------------------------------------------------- //
+
+// Split algorithm
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators, typename SplitTag>
+class split
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_SPLIT_TAG_TYPE,
+ (split));
+};
+
+// Default split algorithm
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+class split<Value, Options, Translator, Box, Allocators, split_default_tag>
+{
+protected:
+ typedef typename Options::parameters_type parameters_type;
+
+ typedef typename rtree::node<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+ typedef rtree::node_auto_ptr<Value, Options, Translator, Box, Allocators> node_auto_ptr;
+
+public:
+ typedef index::detail::static_vector<std::pair<Box, node*>, 1> nodes_container_type;
+
+ template <typename Node>
+ static inline void apply(nodes_container_type & additional_nodes,
+ Node & n,
+ Box & n_box,
+ parameters_type const& parameters,
+ Translator const& translator,
+ Allocators & allocators)
+ {
+ // TODO - consider creating nodes always with sufficient memory allocated
+
+ // create additional node, use auto ptr for automatic destruction on exception
+ node_auto_ptr second_node(rtree::create_node<Allocators, Node>::apply(allocators), allocators); // MAY THROW, STRONG (N: alloc)
+ // create reference to the newly created node
+ Node & n2 = rtree::get<Node>(*second_node);
+
+ // NOTE: thread-safety
+ // After throwing an exception by redistribute_elements the original node may be not changed or
+ // both nodes may be empty. In both cases the tree won't be valid r-tree.
+ // The alternative is to create 2 (or more) additional nodes here and store backup info
+ // in the original node, then, if exception was thrown, the node would always have more than max
+ // elements.
+ // The alternative is to use moving semantics in the implementations of redistribute_elements,
+ // it will be possible to throw from boost::move() in the case of e.g. static size nodes.
+
+ // redistribute elements
+ Box box2;
+ redistribute_elements<
+ Value,
+ Options,
+ Translator,
+ Box,
+ Allocators,
+ typename Options::redistribute_tag
+ >::apply(n, n2, n_box, box2, parameters, translator, allocators); // MAY THROW (V, E: alloc, copy, copy)
+
+ // check numbers of elements
+ BOOST_GEOMETRY_INDEX_ASSERT(parameters.get_min_elements() <= rtree::elements(n).size() &&
+ rtree::elements(n).size() <= parameters.get_max_elements(),
+ "unexpected number of elements");
+ BOOST_GEOMETRY_INDEX_ASSERT(parameters.get_min_elements() <= rtree::elements(n2).size() &&
+ rtree::elements(n2).size() <= parameters.get_max_elements(),
+ "unexpected number of elements");
+
+ // return the list of newly created nodes (this algorithm returns one)
+ additional_nodes.push_back(std::make_pair(box2, second_node.get())); // MAY THROW, STRONG (alloc, copy)
+
+ // release the ptr
+ second_node.release();
+ }
+};
+
+// ----------------------------------------------------------------------- //
+
+namespace visitors { namespace detail {
+
+template <typename InternalNode>
+struct insert_traverse_data
+{
+ typedef typename rtree::elements_type<InternalNode>::type elements_type;
+ typedef typename elements_type::value_type element_type;
+
+ insert_traverse_data()
+ : parent(0), current_child_index(0), current_level(0)
+ {}
+
+ void move_to_next_level(InternalNode * new_parent, size_t new_child_index)
+ {
+ parent = new_parent;
+ current_child_index = new_child_index;
+ ++current_level;
+ }
+
+ bool current_is_root() const
+ {
+ return 0 == parent;
+ }
+
+ elements_type & parent_elements() const
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(parent, "null pointer");
+ return rtree::elements(*parent);
+ }
+
+ element_type & current_element() const
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(parent, "null pointer");
+ return rtree::elements(*parent)[current_child_index];
+ }
+
+ InternalNode * parent;
+ size_t current_child_index;
+ size_t current_level;
+};
+
+// Default insert visitor
+template <typename Element, typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+class insert
+ : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, false>::type
+ , index::detail::nonassignable
+{
+protected:
+ typedef typename Options::parameters_type parameters_type;
+
+ typedef typename rtree::node<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+ typedef rtree::node_auto_ptr<Value, Options, Translator, Box, Allocators> node_auto_ptr;
+
+ inline insert(node* & root,
+ size_t & leafs_level,
+ Element const& element,
+ parameters_type const& parameters,
+ Translator const& translator,
+ Allocators & allocators,
+ size_t relative_level = 0
+ )
+ : m_element(element)
+ , m_parameters(parameters)
+ , m_translator(translator)
+ , m_relative_level(relative_level)
+ , m_level(leafs_level - relative_level)
+ , m_root_node(root)
+ , m_leafs_level(leafs_level)
+ , m_traverse_data()
+ , m_allocators(allocators)
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(m_relative_level <= leafs_level, "unexpected level value");
+ BOOST_GEOMETRY_INDEX_ASSERT(m_level <= m_leafs_level, "unexpected level value");
+ BOOST_GEOMETRY_INDEX_ASSERT(0 != m_root_node, "there is no root node");
+ // TODO
+ // assert - check if Box is correct
+ }
+
+ template <typename Visitor>
+ inline void traverse(Visitor & visitor, internal_node & n)
+ {
+ // choose next node
+ size_t choosen_node_index = rtree::choose_next_node<Value, Options, Box, Allocators, typename Options::choose_next_node_tag>::
+ apply(n, rtree::element_indexable(m_element, m_translator), m_parameters, m_leafs_level - m_traverse_data.current_level);
+
+ // expand the node to contain value
+ geometry::expand(
+ rtree::elements(n)[choosen_node_index].first,
+ rtree::element_indexable(m_element, m_translator));
+
+ // next traversing step
+ traverse_apply_visitor(visitor, n, choosen_node_index); // MAY THROW (V, E: alloc, copy, N:alloc)
+ }
+
+ // TODO: awulkiew - change post_traverse name to handle_overflow or overflow_treatment?
+
+ template <typename Node>
+ inline void post_traverse(Node &n)
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(m_traverse_data.current_is_root() ||
+ &n == rtree::get<Node>(m_traverse_data.current_element().second),
+ "if node isn't the root current_child_index should be valid");
+
+ // handle overflow
+ if ( m_parameters.get_max_elements() < rtree::elements(n).size() )
+ {
+ split(n); // MAY THROW (V, E: alloc, copy, N:alloc)
+ }
+ }
+
+ template <typename Visitor>
+ inline void traverse_apply_visitor(Visitor & visitor, internal_node &n, size_t choosen_node_index)
+ {
+ // save previous traverse inputs and set new ones
+ insert_traverse_data<internal_node> backup_traverse_data = m_traverse_data;
+
+ // calculate new traverse inputs
+ m_traverse_data.move_to_next_level(&n, choosen_node_index);
+
+ // next traversing step
+ rtree::apply_visitor(visitor, *rtree::elements(n)[choosen_node_index].second); // MAY THROW (V, E: alloc, copy, N:alloc)
+
+ // restore previous traverse inputs
+ m_traverse_data = backup_traverse_data;
+ }
+
+ // TODO: consider - split result returned as OutIter is faster than reference to the container. Why?
+
+ template <typename Node>
+ inline void split(Node & n) const
+ {
+ typedef rtree::split<Value, Options, Translator, Box, Allocators, typename Options::split_tag> split_algo;
+
+ typename split_algo::nodes_container_type additional_nodes;
+ Box n_box;
+
+ split_algo::apply(additional_nodes, n, n_box, m_parameters, m_translator, m_allocators); // MAY THROW (V, E: alloc, copy, N:alloc)
+
+ BOOST_GEOMETRY_INDEX_ASSERT(additional_nodes.size() == 1, "unexpected number of additional nodes");
+
+ // TODO add all additional nodes
+ // For kmeans algorithm:
+ // elements number may be greater than node max elements count
+ // split and reinsert must take node with some elements count
+ // and container of additional elements (std::pair<Box, node*>s or Values)
+ // and translator + allocators
+ // where node_elements_count + additional_elements > node_max_elements_count
+ // What with elements other than std::pair<Box, node*> ?
+ // Implement template <node_tag> struct node_element_type or something like that
+
+ // for exception safety
+ node_auto_ptr additional_node_ptr(additional_nodes[0].second, m_allocators);
+
+ // node is not the root - just add the new node
+ if ( !m_traverse_data.current_is_root() )
+ {
+ // update old node's box
+ m_traverse_data.current_element().first = n_box;
+ // add new node to parent's children
+ m_traverse_data.parent_elements().push_back(additional_nodes[0]); // MAY THROW, STRONG (V, E: alloc, copy)
+ }
+ // node is the root - add level
+ else
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get<Node>(m_root_node), "node should be the root");
+
+ // create new root and add nodes
+ node_auto_ptr new_root(rtree::create_node<Allocators, internal_node>::apply(m_allocators), m_allocators); // MAY THROW, STRONG (N:alloc)
+
+ try {
+ rtree::elements(rtree::get<internal_node>(*new_root)).push_back(std::make_pair(n_box, m_root_node)); // MAY THROW, STRONG (E:alloc, copy)
+ rtree::elements(rtree::get<internal_node>(*new_root)).push_back(additional_nodes[0]); // MAY THROW, STRONG (E:alloc, copy)
+ } catch (...) {
+ // clear new root to not delete in the ~node_auto_ptr() potentially stored old root node
+ rtree::elements(rtree::get<internal_node>(*new_root)).clear();
+ throw; // RETHROW
+ }
+
+ m_root_node = new_root.get();
+ ++m_leafs_level;
+
+ new_root.release();
+ }
+
+ additional_node_ptr.release();
+ }
+
+ // TODO: awulkiew - implement dispatchable split::apply to enable additional nodes creation
+
+ Element const& m_element;
+ parameters_type const& m_parameters;
+ Translator const& m_translator;
+ const size_t m_relative_level;
+ const size_t m_level;
+
+ node* & m_root_node;
+ size_t & m_leafs_level;
+
+ // traversing input parameters
+ insert_traverse_data<internal_node> m_traverse_data;
+
+ Allocators & m_allocators;
+};
+
+} // namespace detail
+
+// Insert visitor forward declaration
+template <typename Element, typename Value, typename Options, typename Translator, typename Box, typename Allocators, typename InsertTag>
+class insert;
+
+// Default insert visitor used for nodes elements
+// After passing the Element to insert visitor the Element is managed by the tree
+// I.e. one should not delete the node passed to the insert visitor after exception is thrown
+// because this visitor may delete it
+template <typename Element, typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+class insert<Element, Value, Options, Translator, Box, Allocators, insert_default_tag>
+ : public detail::insert<Element, Value, Options, Translator, Box, Allocators>
+{
+public:
+ typedef detail::insert<Element, Value, Options, Translator, Box, Allocators> base;
+ typedef typename base::node node;
+ typedef typename base::internal_node internal_node;
+ typedef typename base::leaf leaf;
+
+ typedef typename Options::parameters_type parameters_type;
+
+ inline insert(node* & root,
+ size_t & leafs_level,
+ Element & element,
+ parameters_type const& parameters,
+ Translator const& translator,
+ Allocators & allocators,
+ size_t relative_level = 0
+ )
+ : base(root, leafs_level, element, parameters, translator, allocators, relative_level)
+ {}
+
+ inline void operator()(internal_node & n)
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level < base::m_leafs_level, "unexpected level");
+
+ if ( base::m_traverse_data.current_level < base::m_level )
+ {
+ // next traversing step
+ base::traverse(*this, n); // MAY THROW (E: alloc, copy, N: alloc)
+ }
+ else
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_traverse_data.current_level, "unexpected level");
+
+ try
+ {
+ // push new child node
+ rtree::elements(n).push_back(base::m_element); // MAY THROW, STRONG (E: alloc, copy)
+ }
+ catch(...)
+ {
+ // if the insert fails above, the element won't be stored in the tree
+
+ rtree::visitors::destroy<Value, Options, Translator, Box, Allocators> del_v(base::m_element.second, base::m_allocators);
+ rtree::apply_visitor(del_v, *base::m_element.second);
+
+ throw; // RETHROW
+ }
+ }
+
+ base::post_traverse(n); // MAY THROW (E: alloc, copy, N: alloc)
+ }
+
+ inline void operator()(leaf &)
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(false, "this visitor can't be used for a leaf");
+ }
+};
+
+// Default insert visitor specialized for Values elements
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+class insert<Value, Value, Options, Translator, Box, Allocators, insert_default_tag>
+ : public detail::insert<Value, Value, Options, Translator, Box, Allocators>
+{
+public:
+ typedef detail::insert<Value, Value, Options, Translator, Box, Allocators> base;
+ typedef typename base::node node;
+ typedef typename base::internal_node internal_node;
+ typedef typename base::leaf leaf;
+
+ typedef typename Options::parameters_type parameters_type;
+
+ inline insert(node* & root,
+ size_t & leafs_level,
+ Value const& value,
+ parameters_type const& parameters,
+ Translator const& translator,
+ Allocators & allocators,
+ size_t relative_level = 0
+ )
+ : base(root, leafs_level, value, parameters, translator, allocators, relative_level)
+ {}
+
+ inline void operator()(internal_node & n)
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level < base::m_leafs_level, "unexpected level");
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level < base::m_level, "unexpected level");
+
+ // next traversing step
+ base::traverse(*this, n); // MAY THROW (V, E: alloc, copy, N: alloc)
+
+ base::post_traverse(n); // MAY THROW (E: alloc, copy, N: alloc)
+ }
+
+ inline void operator()(leaf & n)
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level == base::m_leafs_level, "unexpected level");
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_traverse_data.current_level ||
+ base::m_level == (std::numeric_limits<size_t>::max)(), "unexpected level");
+
+ rtree::elements(n).push_back(base::m_element); // MAY THROW, STRONG (V: alloc, copy)
+
+ base::post_traverse(n); // MAY THROW (V: alloc, copy, N: alloc)
+ }
+};
+
+}}} // namespace detail::rtree::visitors
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_INSERT_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/is_leaf.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/is_leaf.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,43 @@
+// Boost.Geometry Index
+//
+// R-tree leaf node checking visitor implementation
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_VISITORS_IS_LEAF_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_IS_LEAF_HPP
+
+#include <boost/geometry/index/detail/rtree/node/node.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree { namespace visitors {
+
+template <typename Value, typename Options, typename Box, typename Allocators>
+struct is_leaf : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
+{
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+ inline void operator()(internal_node const&)
+ {
+ result = false;
+ }
+
+ inline void operator()(leaf const&)
+ {
+ result = true;
+ }
+
+ bool result;
+};
+
+}}} // namespace detail::rtree::visitors
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_IS_LEAF_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,341 @@
+// Boost.Geometry Index
+//
+// R-tree k nearest neighbour query visitor implementation
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_VISITORS_NEAREST_QUERY_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_NEAREST_QUERY_HPP
+
+#include <boost/geometry/index/detail/distance_predicates.hpp>
+
+#include <boost/geometry/index/detail/rtree/node/node.hpp>
+#include <boost/geometry/index/translator/translator.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree { namespace visitors {
+
+// TODO: awulkiew - maby it's a good idea to check if curr_mindist < comp_mindist and then check predicates
+// in store() or break store to 2 functions e.g. should_store() and store()
+// - well not with this algorithm of storing k-th neighbor
+
+template <typename Value, typename Translator, typename Point>
+struct nearest_query_result_one
+{
+public:
+ typedef typename geometry::default_distance_result<
+ Point,
+ typename translator::indexable_type<Translator>::type
+ >::type distance_type;
+
+ inline nearest_query_result_one(Value & value)
+ : m_value(value)
+ , m_comp_dist((std::numeric_limits<distance_type>::max)())
+ {}
+
+ inline void store(Value const& val, distance_type const& curr_comp_dist)
+ {
+ if ( curr_comp_dist < m_comp_dist )
+ {
+ m_comp_dist = curr_comp_dist;
+ m_value = val;
+ }
+ }
+
+ inline bool is_comparable_distance_valid() const
+ {
+ return m_comp_dist < (std::numeric_limits<distance_type>::max)();
+ }
+
+ inline distance_type comparable_distance() const
+ {
+ return m_comp_dist;
+ }
+
+ inline size_t finish()
+ {
+ return is_comparable_distance_valid() ? 1 : 0;
+ }
+
+private:
+ Value & m_value;
+ distance_type m_comp_dist;
+};
+
+template <typename Value, typename Translator, typename Point, typename OutIt>
+struct nearest_query_result_k
+{
+public:
+ typedef typename geometry::default_distance_result<
+ Point,
+ typename translator::indexable_type<Translator>::type
+ >::type distance_type;
+
+ inline explicit nearest_query_result_k(size_t k, OutIt out_it)
+ : m_count(k), m_out_it(out_it)
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(0 < m_count, "Number of neighbors should be greater than 0");
+
+ m_neighbors.reserve(m_count);
+ }
+
+ inline void store(Value const& val, distance_type const& curr_comp_dist)
+ {
+ if ( m_neighbors.size() < m_count )
+ {
+ m_neighbors.push_back(std::make_pair(curr_comp_dist, val));
+
+ if ( m_neighbors.size() == m_count )
+ std::make_heap(m_neighbors.begin(), m_neighbors.end(), neighbors_less);
+ }
+ else
+ {
+ if ( curr_comp_dist < m_neighbors.front().first )
+ {
+ std::pop_heap(m_neighbors.begin(), m_neighbors.end(), neighbors_less);
+ m_neighbors.back().first = curr_comp_dist;
+ m_neighbors.back().second = val;
+ std::push_heap(m_neighbors.begin(), m_neighbors.end(), neighbors_less);
+ }
+ }
+ }
+
+ inline bool is_comparable_distance_valid() const
+ {
+ return m_neighbors.size() == m_count;
+ }
+
+ inline distance_type comparable_distance() const
+ {
+ // smallest distance is in the first neighbor only
+ // if there is at least m_count values found
+ // this is just for safety reasons since is_comparable_distance_valid() is checked earlier
+ // TODO - may be replaced by ASSERT
+ return m_neighbors.size() < m_count
+ ? (std::numeric_limits<distance_type>::max)()
+ : m_neighbors.front().first;
+ }
+
+ inline size_t finish()
+ {
+ typedef typename std::vector< std::pair<distance_type, Value> >::const_iterator neighbors_iterator;
+ for ( neighbors_iterator it = m_neighbors.begin() ; it != m_neighbors.end() ; ++it, ++m_out_it )
+ *m_out_it = it->second;
+
+ return m_neighbors.size();
+ }
+
+private:
+ inline static bool neighbors_less(
+ std::pair<distance_type, Value> const& p1,
+ std::pair<distance_type, Value> const& p2)
+ {
+ return p1.first < p2.first;
+ }
+
+ size_t m_count;
+ OutIt m_out_it;
+
+ std::vector< std::pair<distance_type, Value> > m_neighbors;
+ distance_type m_biggest_comp_dist;
+};
+
+// TODO: awulkiew - add additional pruning before adding nodes to the ABL
+
+template <
+ typename Value,
+ typename Options,
+ typename Translator,
+ typename Box,
+ typename Allocators,
+ typename DistancesPredicates,
+ typename Predicates,
+ typename Result
+>
+class nearest_query
+ : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
+ , index::detail::nonassignable
+{
+public:
+ typedef typename Options::parameters_type parameters_type;
+
+ typedef typename rtree::node<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+ typedef index::detail::distances_calc<DistancesPredicates, Box, index::detail::envelope_tag> node_distances_calc;
+ typedef typename node_distances_calc::result_type node_distances_type;
+ typedef index::detail::distances_predicates_check<DistancesPredicates, Box, index::detail::envelope_tag> node_distances_predicates_check;
+
+ typedef index::detail::distances_calc<
+ DistancesPredicates,
+ typename translator::indexable_type<Translator>::type,
+ index::detail::value_tag
+ > value_distances_calc;
+ typedef typename value_distances_calc::result_type value_distances_type;
+ typedef index::detail::distances_predicates_check<
+ DistancesPredicates,
+ typename translator::indexable_type<Translator>::type,
+ index::detail::value_tag
+ > value_distances_predicates_check;
+
+ inline nearest_query(parameters_type const& parameters, Translator const& translator, DistancesPredicates const& dist_pred, Predicates const& pred, Result & r)
+ : m_parameters(parameters), m_translator(translator)
+ , m_dist_pred(dist_pred), m_pred(pred)
+ , m_result(r)
+ {}
+
+ //TODO: awulkiew - consider this approach: store one, global vector of active branches, add branches only if mindist is ok
+
+ inline void operator()(internal_node const& n)
+ {
+ typedef typename rtree::elements_type<internal_node>::type elements_type;
+
+ // array of active nodes
+ typename index::detail::rtree::container_from_elements_type<
+ elements_type,
+ std::pair<node_distances_type, const node *>
+ >::type active_branch_list;
+ active_branch_list.reserve(m_parameters.get_max_elements());
+
+ elements_type const& elements = rtree::elements(n);
+
+ // fill array of nodes meeting predicates
+ for (typename elements_type::const_iterator it = elements.begin();
+ it != elements.end(); ++it)
+ {
+ // if current node meets predicates
+ // 0 - dummy value
+ if ( index::detail::predicates_check<index::detail::envelope_tag>(m_pred, 0, it->first) )
+ {
+ // calculate node's distance(s) for distance predicate
+ node_distances_type node_dist_data = node_distances_calc::apply(m_dist_pred, it->first);
+
+ // TODO: awulkiew - consider at first calculating near distance only,
+ // comparing it with m_result.comparable_distance if it's valid,
+ // after that calculate the rest of distances and check predicates
+
+ // if current node is further than found neighbors - don't analyze it
+ if ( m_result.is_comparable_distance_valid() &&
+ is_node_prunable(m_result.comparable_distance(), node_dist_data) )
+ {
+ continue;
+ }
+
+ // if current node distance(s) meets distance predicate
+ if ( node_distances_predicates_check::apply(m_dist_pred, node_dist_data) )
+ {
+ // add current node's data into the list
+ active_branch_list.push_back( std::make_pair(node_dist_data, it->second) );
+ }
+ }
+ }
+
+ // if there aren't any nodes in ABL - return
+ if ( active_branch_list.empty() )
+ return;
+
+ // sort array
+ std::sort(active_branch_list.begin(), active_branch_list.end(), abl_less);
+
+ // recursively visit nodes
+ for ( size_t i = 0 ;; ++i )
+ {
+ // prune nodes
+ prune_nodes(active_branch_list);
+
+ if ( active_branch_list.size() <= i )
+ break;
+
+ rtree::apply_visitor(*this, *active_branch_list[i].second);
+ }
+ }
+
+ inline void operator()(leaf const& n)
+ {
+ typedef typename rtree::elements_type<leaf>::type elements_type;
+ elements_type const& elements = rtree::elements(n);
+
+ // search leaf for closest value meeting predicates
+ for (typename elements_type::const_iterator it = elements.begin();
+ it != elements.end(); ++it)
+ {
+ // if value meets predicates
+ if ( index::detail::predicates_check<index::detail::value_tag>(m_pred, *it, m_translator(*it)) )
+ {
+ // calculate values distance for distance predicate
+ value_distances_type distances = value_distances_calc::apply(m_dist_pred, m_translator(*it));
+
+ // TODO: awulkiew - consider at first calculating point relation distance only,
+ // comparing it with m_result.comparable_distance if it's valid,
+ // after that calculate the rest of distances and check predicates
+
+ // if distance meets distance predicate
+ if ( value_distances_predicates_check::apply(m_dist_pred, distances) )
+ {
+ typedef typename index::detail::point_relation<DistancesPredicates>::type point_relation_type;
+ typedef typename index::detail::relation<point_relation_type>::tag point_relation_tag;
+
+ // store value
+ m_result.store(
+ *it,
+ index::detail::cdist_value<value_distances_type>
+ ::template get<point_relation_tag>(distances)
+ );
+ }
+ }
+ }
+ }
+
+private:
+ template <typename ActiveBranchList>
+ inline void prune_nodes(ActiveBranchList & abl) const
+ {
+ // if some value were found
+ if ( m_result.is_comparable_distance_valid() )
+ {
+ // prune if box's mindist is further than value's mindist
+ while ( !abl.empty() &&
+ is_node_prunable(m_result.comparable_distance(), abl.back().first) )
+ {
+ abl.pop_back();
+ }
+ }
+ }
+
+ static inline bool abl_less(
+ std::pair<node_distances_type, const node *> const& p1,
+ std::pair<node_distances_type, const node *> const& p2)
+ {
+ return index::detail::cdist_value<node_distances_type>
+ ::template get<index::detail::to_nearest_tag>(p1.first)
+ < index::detail::cdist_value<node_distances_type>
+ ::template get<index::detail::to_nearest_tag>(p2.first);
+ }
+
+ template <typename Distance>
+ static inline bool is_node_prunable(Distance const& smallest_dist, node_distances_type const& d)
+ {
+ return smallest_dist
+ < index::detail::cdist_value<node_distances_type>
+ ::template get<index::detail::to_nearest_tag>(d);
+ }
+
+ parameters_type const& m_parameters;
+ Translator const& m_translator;
+ DistancesPredicates const& m_dist_pred;
+ Predicates const& m_pred;
+
+ Result & m_result;
+};
+
+}}} // namespace detail::rtree::visitors
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_NEAREST_QUERY_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/print.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/print.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,197 @@
+// Boost.Geometry Index
+//
+// R-tree ostreaming visitor implementation
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_VISITORS_PRINT_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_PRINT_HPP
+
+#include <iostream>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree { namespace visitors {
+
+namespace dispatch {
+
+template <typename Point, size_t Dimension>
+struct print_point
+{
+ BOOST_STATIC_ASSERT(0 < Dimension);
+
+ static inline void apply(std::ostream & os, Point const& p)
+ {
+ print_point<Point, Dimension - 1>::apply(os, p);
+
+ os << ", " << geometry::get<Dimension - 1>(p);
+ }
+};
+
+template <typename Point>
+struct print_point<Point, 1>
+{
+ static inline void apply(std::ostream & os, Point const& p)
+ {
+ os << geometry::get<0>(p);
+ }
+};
+
+template <typename Box, size_t Corner, size_t Dimension>
+struct print_corner
+{
+ BOOST_STATIC_ASSERT(0 < Dimension);
+
+ static inline void apply(std::ostream & os, Box const& b)
+ {
+ print_corner<Box, Corner, Dimension - 1>::apply(os, b);
+
+ os << ", " << geometry::get<Corner, Dimension - 1>(b);
+ }
+};
+
+template <typename Box, size_t Corner>
+struct print_corner<Box, Corner, 1>
+{
+ static inline void apply(std::ostream & os, Box const& b)
+ {
+ os << geometry::get<Corner, 0>(b);
+ }
+};
+
+template <typename Indexable, typename Tag>
+struct print_indexable
+{
+};
+
+template <typename Indexable>
+struct print_indexable<Indexable, box_tag>
+{
+ static const size_t dimension = index::detail::traits::dimension<Indexable>::value;
+
+ static inline void apply(std::ostream &os, Indexable const& i)
+ {
+ os << '(';
+ print_corner<Indexable, min_corner, dimension>::apply(os, i);
+ os << ")x(";
+ print_corner<Indexable, max_corner, dimension>::apply(os, i);
+ os << ')';
+ }
+};
+
+template <typename Indexable>
+struct print_indexable<Indexable, point_tag>
+{
+ static const size_t dimension = index::detail::traits::dimension<Indexable>::value;
+
+ static inline void apply(std::ostream &os, Indexable const& i)
+ {
+ os << '(';
+ print_point<Indexable, dimension>::apply(os, i);
+ os << ')';
+ }
+};
+
+} // namespace dispatch
+
+namespace detail {
+
+template <typename Indexable>
+inline void print_indexable(std::ostream & os, Indexable const& i)
+{
+ dispatch::print_indexable<
+ Indexable,
+ typename geometry::traits::tag<Indexable>::type
+ >::apply(os, i);
+}
+
+} // namespace detail
+
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+struct print : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
+{
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+ inline print(std::ostream & o, Translator const& t)
+ : os(o), tr(t), level(0)
+ {}
+
+ inline void operator()(internal_node const& n)
+ {
+ typedef typename rtree::elements_type<internal_node>::type elements_type;
+ elements_type const& elements = rtree::elements(n);
+
+ spaces(level) << "INTERNAL NODE - L:" << level << " Ch:" << elements.size() << " @:" << &n << '\n';
+
+ for (typename elements_type::const_iterator it = elements.begin();
+ it != elements.end(); ++it)
+ {
+ spaces(level);
+ detail::print_indexable(os, it->first);
+ os << " ->" << it->second << '\n';
+ }
+
+ size_t level_backup = level;
+ ++level;
+
+ for (typename elements_type::const_iterator it = elements.begin();
+ it != elements.end(); ++it)
+ {
+ rtree::apply_visitor(*this, *it->second);
+ }
+
+ level = level_backup;
+ }
+
+ inline void operator()(leaf const& n)
+ {
+ typedef typename rtree::elements_type<leaf>::type elements_type;
+ elements_type const& elements = rtree::elements(n);
+
+ spaces(level) << "LEAF - L:" << level << " V:" << elements.size() << " @:" << &n << '\n';
+ for (typename elements_type::const_iterator it = elements.begin();
+ it != elements.end(); ++it)
+ {
+ spaces(level);
+ detail::print_indexable(os, tr(*it));
+ os << '\n';
+ }
+ }
+
+ inline std::ostream & spaces(size_t level)
+ {
+ for ( size_t i = 0 ; i < 2 * level ; ++i )
+ os << ' ';
+ return os;
+ }
+
+ std::ostream & os;
+ Translator const& tr;
+
+ size_t level;
+};
+
+}}} // namespace detail::rtree::visitors
+
+template <typename Value, typename Options, typename Translator, typename Allocator>
+std::ostream & operator<<(std::ostream & os, rtree<Value, Options, Translator, Allocator> const& tree)
+{
+ typedef rtree<Value, Options, Translator, Allocator> rtree_type;
+ typedef typename rtree_type::value_type value_type;
+ typedef typename rtree_type::options_type options_type;
+ typedef typename rtree_type::translator_type translator_type;
+ typedef typename rtree_type::box_type box_type;
+ typedef typename rtree_type::allocators_type allocators_type;
+ detail::rtree::visitors::print<value_type, options_type, translator_type, box_type, allocators_type> print_v(os, tree.translator());
+ tree.apply_visitor(print_v);
+ return os;
+}
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_PRINT_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/remove.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/remove.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,331 @@
+// Boost.Geometry Index
+//
+// R-tree removing visitor implementation
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_VISITORS_REMOVE_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_REMOVE_HPP
+
+#include <boost/geometry/index/detail/rtree/node/node.hpp>
+
+#include <boost/geometry/index/detail/rtree/visitors/is_leaf.hpp>
+
+#include <boost/geometry/algorithms/covered_by.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree { namespace visitors {
+
+// Default remove algorithm
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
+class remove
+ : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, false>::type
+ , index::detail::nonassignable
+{
+ typedef typename Options::parameters_type parameters_type;
+
+ typedef typename rtree::node<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+ typedef rtree::node_auto_ptr<Value, Options, Translator, Box, Allocators> node_auto_ptr;
+
+public:
+ inline remove(node* & root,
+ size_t & leafs_level,
+ Box & root_box,
+ Value const& value,
+ parameters_type const& parameters,
+ Translator const& translator,
+ Allocators & allocators)
+ : m_value(value)
+ , m_parameters(parameters)
+ , m_translator(translator)
+ , m_allocators(allocators)
+ , m_root_node(root)
+ , m_root_box(root_box)
+ , m_leafs_level(leafs_level)
+ , m_is_value_removed(false)
+ , m_parent(0)
+ , m_current_child_index(0)
+ , m_current_level(0)
+ , m_is_underflow(false)
+ {
+ // TODO
+ // assert - check if Value/Box is correct
+ }
+
+ inline void operator()(internal_node & n)
+ {
+ typedef typename rtree::elements_type<internal_node>::type children_type;
+ children_type & children = rtree::elements(n);
+
+ // traverse children which boxes intersects value's box
+ size_t child_node_index = 0;
+ for ( ; child_node_index < children.size() ; ++child_node_index )
+ {
+ if ( geometry::covered_by(m_translator(m_value), children[child_node_index].first) )
+ {
+ // next traversing step
+ traverse_apply_visitor(n, child_node_index); // MAY THROW
+
+ if ( m_is_value_removed )
+ break;
+ }
+ }
+
+ // value was found and removed
+ if ( m_is_value_removed )
+ {
+ typedef typename rtree::elements_type<internal_node>::type elements_type;
+ typedef typename elements_type::iterator element_iterator;
+ elements_type & elements = rtree::elements(n);
+
+ // underflow occured - child node should be removed
+ if ( m_is_underflow )
+ {
+ element_iterator underfl_el_it = elements.begin() + child_node_index;
+ size_t relative_level = m_leafs_level - m_current_level;
+
+ // move node to the container - store node's relative level as well and return new underflow state
+ m_is_underflow = store_underflowed_node(elements, underfl_el_it, relative_level); // MAY THROW (E: alloc, copy)
+ }
+
+ // n is not root - adjust aabb
+ if ( 0 != m_parent )
+ {
+ // underflow state should be ok here
+ // note that there may be less than min_elems elements in root
+ // so this condition should be checked only here
+ BOOST_GEOMETRY_INDEX_ASSERT((elements.size() < m_parameters.get_min_elements()) == m_is_underflow, "unexpected state");
+
+ rtree::elements(*m_parent)[m_current_child_index].first
+ = rtree::elements_box<Box>(elements.begin(), elements.end(), m_translator);
+ }
+ // n is root node
+ else
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get<internal_node>(m_root_node), "node must be the root");
+
+ // assign new root's box
+ assign_root_box(elements);
+
+ // reinsert elements from removed nodes (underflows)
+ reinsert_removed_nodes_elements(); // MAY THROW (V, E: alloc, copy, N: alloc)
+
+ // shorten the tree
+ if ( rtree::elements(n).size() == 1 )
+ {
+ node * root_to_destroy = m_root_node;
+ m_root_node = rtree::elements(n)[0].second;
+ --m_leafs_level;
+
+ rtree::destroy_node<Allocators, internal_node>::apply(m_allocators, root_to_destroy);
+ }
+ }
+ }
+ }
+
+ inline void operator()(leaf & n)
+ {
+ typedef typename rtree::elements_type<leaf>::type elements_type;
+ elements_type & elements = rtree::elements(n);
+
+ // find value and remove it
+ for ( typename elements_type::iterator it = elements.begin() ; it != elements.end() ; ++it )
+ {
+ if ( m_translator.equals(*it, m_value) )
+ {
+ rtree::copy_from_back(elements, it); // MAY THROW (V: copy)
+ elements.pop_back();
+ m_is_value_removed = true;
+ break;
+ }
+ }
+
+ // if value was removed
+ if ( m_is_value_removed )
+ {
+ // calc underflow
+ m_is_underflow = elements.size() < m_parameters.get_min_elements();
+
+ // n is not root - adjust aabb
+ if ( 0 != m_parent )
+ {
+ rtree::elements(*m_parent)[m_current_child_index].first
+ = rtree::elements_box<Box>(elements.begin(), elements.end(), m_translator);
+ }
+ else
+ {
+ assign_root_box(elements);
+ }
+ }
+ }
+
+ bool is_value_removed() const
+ {
+ return m_is_value_removed;
+ }
+
+private:
+
+ typedef std::vector< std::pair<size_t, node*> > UnderflowNodes;
+
+ void traverse_apply_visitor(internal_node &n, size_t choosen_node_index)
+ {
+ // save previous traverse inputs and set new ones
+ internal_node * parent_bckup = m_parent;
+ size_t current_child_index_bckup = m_current_child_index;
+ size_t current_level_bckup = m_current_level;
+
+ m_parent = &n;
+ m_current_child_index = choosen_node_index;
+ ++m_current_level;
+
+ // next traversing step
+ rtree::apply_visitor(*this, *rtree::elements(n)[choosen_node_index].second); // MAY THROW (V, E: alloc, copy, N: alloc)
+
+ // restore previous traverse inputs
+ m_parent = parent_bckup;
+ m_current_child_index = current_child_index_bckup;
+ m_current_level = current_level_bckup;
+ }
+
+ bool store_underflowed_node(
+ typename rtree::elements_type<internal_node>::type & elements,
+ typename rtree::elements_type<internal_node>::type::iterator underfl_el_it,
+ size_t relative_level)
+ {
+ // move node to the container - store node's relative level as well
+ m_underflowed_nodes.push_back(std::make_pair(relative_level, underfl_el_it->second)); // MAY THROW (E: alloc, copy)
+
+ try
+ {
+ rtree::copy_from_back(elements, underfl_el_it); // MAY THROW (E: copy)
+ elements.pop_back();
+ }
+ catch(...)
+ {
+ m_underflowed_nodes.pop_back();
+ throw; // RETHROW
+ }
+
+ // calc underflow
+ return elements.size() < m_parameters.get_min_elements();
+ }
+
+ void reinsert_removed_nodes_elements()
+ {
+ typename UnderflowNodes::reverse_iterator it = m_underflowed_nodes.rbegin();
+
+ try
+ {
+ // reinsert elements from removed nodes
+ // begin with levels closer to the root
+ for ( ; it != m_underflowed_nodes.rend() ; ++it )
+ {
+ is_leaf<Value, Options, Box, Allocators> ilv;
+ rtree::apply_visitor(ilv, *it->second);
+ if ( ilv.result )
+ {
+ reinsert_node_elements(rtree::get<leaf>(*it->second), it->first); // MAY THROW (V, E: alloc, copy, N: alloc)
+
+ rtree::destroy_node<Allocators, leaf>::apply(m_allocators, it->second);
+ }
+ else
+ {
+ reinsert_node_elements(rtree::get<internal_node>(*it->second), it->first); // MAY THROW (V, E: alloc, copy, N: alloc)
+
+ rtree::destroy_node<Allocators, internal_node>::apply(m_allocators, it->second);
+ }
+ }
+
+ //m_underflowed_nodes.clear();
+ }
+ catch(...)
+ {
+ // destroy current and remaining nodes
+ for ( ; it != m_underflowed_nodes.rend() ; ++it )
+ {
+ node_auto_ptr dummy(it->second, m_allocators);
+ }
+
+ //m_underflowed_nodes.clear();
+
+ throw; // RETHROW
+ }
+ }
+
+ template <typename Node>
+ void reinsert_node_elements(Node &n, size_t node_relative_level)
+ {
+ typedef typename rtree::elements_type<Node>::type elements_type;
+ elements_type & elements = rtree::elements(n);
+
+ typename elements_type::iterator it = elements.begin();
+ try
+ {
+ for ( ; it != elements.end() ; ++it )
+ {
+ visitors::insert<
+ typename elements_type::value_type,
+ Value, Options, Translator, Box, Allocators,
+ typename Options::insert_tag
+ > insert_v(
+ m_root_node, m_leafs_level, *it,
+ m_parameters, m_translator, m_allocators,
+ node_relative_level - 1);
+
+ rtree::apply_visitor(insert_v, *m_root_node); // MAY THROW (V, E: alloc, copy, N: alloc)
+ }
+ }
+ catch(...)
+ {
+ ++it;
+ rtree::destroy_elements<Value, Options, Translator, Box, Allocators>
+ ::apply(it, elements.end(), m_allocators);
+ elements.clear();
+ throw; // RETHROW
+ }
+ }
+
+ template <typename Elements>
+ void assign_root_box(Elements const& elements)
+ {
+ if ( elements.empty() )
+ geometry::assign_inverse(m_root_box);
+ else
+ m_root_box = rtree::elements_box<Box>(elements.begin(), elements.end(), m_translator);
+ }
+
+ Value const& m_value;
+ parameters_type const& m_parameters;
+ Translator const& m_translator;
+ Allocators & m_allocators;
+
+ node* & m_root_node;
+ Box & m_root_box;
+ size_t & m_leafs_level;
+
+ bool m_is_value_removed;
+ UnderflowNodes m_underflowed_nodes;
+
+ // traversing input parameters
+ internal_node *m_parent;
+ size_t m_current_child_index;
+ size_t m_current_level;
+
+ // traversing output parameters
+ bool m_is_underflow;
+};
+
+}}} // namespace detail::rtree::visitors
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_REMOVE_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,81 @@
+// Boost.Geometry Index
+//
+// R-tree spatial query visitor implementation
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_RTREE_VISITORS_SPATIAL_QUERY_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_SPATIAL_QUERY_HPP
+
+#include <boost/geometry/index/detail/predicates.hpp>
+
+#include <boost/geometry/index/detail/rtree/node/node.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree { namespace visitors {
+
+template <typename Value, typename Options, typename Translator, typename Box, typename Allocators, typename Predicates, typename OutIter>
+struct spatial_query
+ : public rtree::visitor<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag, true>::type
+ , index::detail::nonassignable
+{
+ typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
+ typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
+ typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
+
+ inline spatial_query(Translator const& t, Predicates const& p, OutIter out_it)
+ : tr(t), pred(p), out_iter(out_it), found_count(0)
+ {}
+
+ inline void operator()(internal_node const& n)
+ {
+ typedef typename rtree::elements_type<internal_node>::type elements_type;
+ elements_type const& elements = rtree::elements(n);
+
+ // traverse nodes meeting predicates
+ for (typename elements_type::const_iterator it = elements.begin();
+ it != elements.end(); ++it)
+ {
+ // if node meets predicates
+ // 0 - dummy value
+ if ( index::detail::predicates_check<index::detail::envelope_tag>(pred, 0, it->first) )
+ rtree::apply_visitor(*this, *it->second);
+ }
+ }
+
+ inline void operator()(leaf const& n)
+ {
+ typedef typename rtree::elements_type<leaf>::type elements_type;
+ elements_type const& elements = rtree::elements(n);
+
+ // get all values meeting predicates
+ for (typename elements_type::const_iterator it = elements.begin();
+ it != elements.end(); ++it)
+ {
+ // if value meets predicates
+ if ( index::detail::predicates_check<index::detail::value_tag>(pred, *it, tr(*it)) )
+ {
+ out_iter = *it;
+ ++out_iter;
+
+ ++found_count;
+ }
+ }
+ }
+
+ Translator const& tr;
+ Predicates const& pred;
+ OutIter out_iter;
+ size_t found_count;
+};
+
+}}} // namespace detail::rtree::visitors
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_SPATIAL_QUERY_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/static_vector.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/static_vector.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,806 @@
+// Boost.Geometry Index
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_STATIC_VECTOR_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_STATIC_VECTOR_HPP
+
+#include <cstddef>
+#include <stdexcept>
+
+#include <boost/aligned_storage.hpp>
+#include <boost/iterator/reverse_iterator.hpp>
+
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/or.hpp>
+
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/alignment_of.hpp>
+#include <boost/type_traits/aligned_storage.hpp>
+#include <boost/type_traits/has_trivial_assign.hpp>
+#include <boost/type_traits/has_trivial_copy.hpp>
+#include <boost/type_traits/has_trivial_constructor.hpp>
+#include <boost/type_traits/has_trivial_destructor.hpp>
+
+#include <boost/geometry/index/detail/assert.hpp>
+
+namespace boost { namespace geometry { namespace index { namespace detail {
+
+template <typename Value, size_t Capacity>
+class static_vector
+{
+ BOOST_MPL_ASSERT_MSG(
+ (0 < Capacity),
+ INVALID_CAPACITY,
+ (static_vector));
+
+public:
+ typedef Value value_type;
+ typedef std::size_t size_type;
+ typedef Value& reference;
+ typedef Value const& const_reference;
+ typedef Value * pointer;
+ typedef const Value* const_pointer;
+ typedef Value* iterator;
+ typedef const Value * const_iterator;
+ typedef boost::reverse_iterator<iterator> reverse_iterator;
+ typedef boost::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef typename boost::iterator_difference<iterator>::type difference_type;
+
+ // nothrow
+ static_vector()
+ : m_size(0)
+ {}
+
+ // strong
+ explicit static_vector(size_type count)
+ : m_size(0)
+ {
+ resize(count); // may throw
+ }
+
+ // strong
+ static_vector(size_type count, value_type const& value)
+ : m_size(0)
+ {
+ resize(count, value); // may throw
+ }
+
+ // strong
+ static_vector(static_vector const& other)
+ : m_size(other.m_size)
+ {
+ this->uninitialized_copy(other.begin(), other.end(), this->begin()); // may throw
+ }
+
+ // strong
+ template <size_t C>
+ static_vector(static_vector<value_type, C> const& other)
+ : m_size(other.m_size)
+ {
+ check_capacity(other.m_size);
+
+ this->uninitialized_copy(other.begin(), other.end(), this->begin()); // may throw
+ }
+
+ // strong
+ template <typename Iterator>
+ static_vector(Iterator first, Iterator last)
+ : m_size(0)
+ {
+ assign(first, last); // may throw
+ }
+
+ // basic
+ static_vector & operator=(static_vector const& other)
+ {
+ assign(other.begin(), other.end()); // may throw
+
+ return *this;
+ }
+
+ // basic
+ template <size_t C>
+ static_vector & operator=(static_vector<value_type, C> const& other)
+ {
+ assign(other.begin(), other.end()); // may throw
+
+ return *this;
+ }
+
+ // nothrow
+ ~static_vector()
+ {
+ this->destroy(this->begin(), this->end());
+ }
+
+ // strong
+ void resize(size_type count)
+ {
+ if ( count < m_size )
+ {
+ this->destroy(this->begin() + count, this->end());
+ }
+ else
+ {
+ check_capacity(count);
+
+ this->construct(this->end(), this->begin() + count); // may throw
+ }
+ m_size = count; // update end
+ }
+
+ // strong
+ void resize(size_type count, value_type const& value)
+ {
+ if ( count < m_size )
+ {
+ this->destroy(this->begin() + count, this->end());
+ }
+ else
+ {
+ check_capacity(count);
+
+ std::uninitialized_fill(this->end(), this->begin() + count, value); // may throw
+ }
+ m_size = count; // update end
+ }
+
+ // nothrow
+ void reserve(size_type count)
+ {
+ check_capacity(count);
+ }
+
+ // strong
+ void push_back(value_type const& value)
+ {
+ check_capacity(m_size + 1);
+
+ this->uninitialized_fill(this->end(), value); // may throw
+ ++m_size; // update end
+ }
+
+ // nothrow
+ void pop_back()
+ {
+ check_empty();
+
+ //--m_size; // update end
+ //this->destroy(this->end());
+
+ // safer and more intuitive version
+ this->destroy(this->end() - 1);
+ --m_size; // update end
+ }
+
+ // basic
+ void insert(iterator position, value_type const& value)
+ {
+ check_iterator_end_eq(position);
+ check_capacity(m_size + 1);
+
+ if ( position == this->end() )
+ {
+ this->uninitialized_fill(position, value); // may throw
+ ++m_size; // update end
+ }
+ else
+ {
+ // TODO - should following lines check for exception and revert to the old size?
+
+ this->uninitialized_fill(this->end(), *(this->end() - 1)); // may throw
+ ++m_size; // update end
+ this->move_backward(position, this->end() - 2, this->end() - 1); // may throw
+ this->fill(position, value); // may throw
+ }
+ }
+
+ // basic
+ void insert(iterator position, size_type count, value_type const& value)
+ {
+ check_iterator_end_eq(position);
+ check_capacity(m_size + count);
+
+ if ( position == this->end() )
+ {
+ std::uninitialized_fill(position, position + count, value); // may throw
+ m_size += count; // update end
+ }
+ else
+ {
+ difference_type to_move = std::distance(position, this->end());
+
+ // TODO - should following lines check for exception and revert to the old size?
+
+ if ( count < static_cast<size_type>(to_move) )
+ {
+ this->uninitialized_copy(this->end() - count, this->end(), this->end()); // may throw
+ m_size += count; // update end
+ this->move_backward(position, position + to_move - count, this->end() - count); // may throw
+ std::fill_n(position, count, value); // may throw
+ }
+ else
+ {
+ std::uninitialized_fill(this->end(), position + count, value); // may throw
+ m_size += count - to_move; // update end
+ this->uninitialized_copy(position, position + to_move, position + count); // may throw
+ m_size += to_move; // update end
+ std::fill_n(position, to_move, value); // may throw
+ }
+ }
+ }
+
+ // basic
+ template <typename Iterator>
+ void insert(iterator position, Iterator first, Iterator last)
+ {
+ typedef typename boost::iterator_traversal<Iterator>::type traversal;
+ this->insert_dispatch(position, first, last, traversal());
+ }
+
+ // basic
+ void erase(iterator position)
+ {
+ check_iterator_end_neq(position);
+
+ this->move(position + 1, this->end(), position); // may throw
+ this->destroy(this->end() - 1);
+ --m_size;
+ }
+
+ // basic
+ void erase(iterator first, iterator last)
+ {
+ check_iterator_end_eq(first);
+ check_iterator_end_eq(last);
+
+ difference_type n = std::distance(first, last);
+ BOOST_ASSERT_MSG(0 <= n, "invalid range");
+
+ this->move(last, this->end(), first); // may throw
+ this->destroy(this->end() - n, this->end());
+ m_size -= n;
+ }
+
+ // basic
+ template <typename Iterator>
+ void assign(Iterator first, Iterator last)
+ {
+ typedef typename boost::iterator_traversal<Iterator>::type traversal;
+ this->assign_dispatch(first, last, traversal()); // may throw
+ }
+
+ // basic
+ void assign(size_type count, value_type const& value)
+ {
+ if ( count < m_size )
+ {
+ std::fill_n(this->begin(), count, value);
+ this->destroy(this->begin() + count, this->end());
+ }
+ else
+ {
+ check_capacity(count);
+
+ std::fill_n(this->begin(), m_size, value);
+ std::uninitialized_fill(this->end(), this->begin() + count, value); // may throw
+ }
+ m_size = count; // update end
+ }
+
+ // nothrow
+ void clear()
+ {
+ this->destroy(this->begin(), this->end());
+ m_size = 0; // update end
+ }
+
+ // strong
+ Value & at(size_type i)
+ {
+ if ( m_size <= i )
+ throw std::out_of_range("index out of bounds");
+ return *(this->begin() + i);
+ }
+
+ // strong
+ Value const& at(size_type i) const
+ {
+ if ( m_size <= i )
+ throw std::out_of_range("index out of bounds");
+ return *(this->begin() + i);
+ }
+
+ // nothrow
+ Value & operator[](size_type i)
+ {
+ BOOST_ASSERT_MSG(i < m_size, "index out of bounds");
+ return *(this->begin() + i);
+ }
+
+ // nothrow
+ Value const& operator[](size_type i) const
+ {
+ BOOST_ASSERT_MSG(i < m_size, "index out of bounds");
+ return *(this->begin() + i);
+ }
+
+ // nothrow
+ Value & front()
+ {
+ check_empty();
+ return *(this->begin());
+ }
+
+ // nothrow
+ Value const& front() const
+ {
+ check_empty();
+ return *(this->begin());
+ }
+
+ // nothrow
+ Value & back()
+ {
+ check_empty();
+ return *(this->end() - 1);
+ }
+
+ // nothrow
+ Value const& back() const
+ {
+ check_empty();
+ return *(this->end() - 1);
+ }
+
+ // nothrow
+ Value * data() { return this->ptr(); }
+ const Value * data() const { return this->ptr(); }
+
+ // nothrow
+ iterator begin() { return this->ptr(); }
+ const_iterator begin() const { return this->ptr(); }
+ const_iterator cbegin() const { return this->ptr(); }
+ iterator end() { return this->begin() + m_size; }
+ const_iterator end() const { return this->begin() + m_size; }
+ const_iterator cend() const { return this->cbegin() + m_size; }
+ // nothrow
+ reverse_iterator rbegin() { return reverse_iterator(this->end()); }
+ const_reverse_iterator rbegin() const { return reverse_iterator(this->end()); }
+ const_reverse_iterator crbegin() const { return reverse_iterator(this->end()); }
+ reverse_iterator rend() { return reverse_iterator(this->begin()); }
+ const_reverse_iterator rend() const { return reverse_iterator(this->begin()); }
+ const_reverse_iterator crend() const { return reverse_iterator(this->begin()); }
+
+ // nothrow
+ size_type capacity() const { return Capacity; }
+ size_type max_size() const { return Capacity; }
+ size_type size() const { return m_size; }
+ bool empty() const { return 0 == m_size; }
+
+private:
+
+ // insert
+
+ template <typename Iterator>
+ void insert_dispatch(iterator position, Iterator first, Iterator last, boost::random_access_traversal_tag const&)
+ {
+ check_iterator_end_eq(position);
+
+ difference_type count = std::distance(first, last);
+
+ check_capacity(m_size + count);
+
+ if ( position == this->end() )
+ {
+ this->uninitialized_copy(first, last, position); // may throw
+ m_size += count; // update end
+ }
+ else
+ {
+ this->insert_in_the_middle(position, first, last, count); // may throw
+ }
+ }
+
+ template <typename Iterator, typename Traversal>
+ void insert_dispatch(iterator position, Iterator first, Iterator last, Traversal const& /*not_random_access*/)
+ {
+ check_iterator_end_eq(position);
+
+ if ( position == this->end() )
+ {
+ std::pair<bool, size_type> copy_data =
+ this->uninitialized_copy_checked(first, last, position, std::distance(position, this->begin() + Capacity)); // may throw
+
+ check_capacity(copy_data.first ? m_size + copy_data.second : Capacity + 1);
+
+ m_size += copy_data.second;
+ }
+ else
+ {
+ difference_type count = std::distance(first, last);
+
+ check_capacity(m_size + count);
+
+ this->insert_in_the_middle(position, first, last, count); // may throw
+ }
+ }
+
+ template <typename Iterator>
+ void insert_in_the_middle(iterator position, Iterator first, Iterator last, difference_type count)
+ {
+ difference_type to_move = std::distance(position, this->end());
+
+ // TODO - should following lines check for exception and revert to the old size?
+
+ if ( count < to_move )
+ {
+ this->uninitialized_copy(this->end() - count, this->end(), this->end()); // may throw
+ m_size += count; // update end
+ this->move_backward(position, position + to_move - count, this->end() - count); // may throw
+ this->copy(first, last, position); // may throw
+ }
+ else
+ {
+ Iterator middle_iter = first;
+ std::advance(middle_iter, to_move);
+
+ this->uninitialized_copy(middle_iter, last, this->end()); // may throw
+ m_size += count - to_move; // update end
+ this->uninitialized_copy(position, position + to_move, position + count); // may throw
+ m_size += to_move; // update end
+ this->copy(first, middle_iter, position) ; // may throw
+ }
+ }
+
+ // assign
+
+ template <typename Iterator>
+ void assign_dispatch(Iterator first, Iterator last, boost::random_access_traversal_tag const& /*not_random_access*/)
+ {
+ size_type s = std::distance(first, last);
+
+ check_capacity(s);
+
+ if ( m_size <= s )
+ {
+ this->copy(first, first + m_size, this->begin()); // may throw
+ // TODO - perform uninitialized_copy first?
+ this->uninitialized_copy(first + m_size, last, this->end()); // may throw
+ }
+ else
+ {
+ this->copy(first, last, this->begin()); // may throw
+ this->destroy(this->begin() + s, this->end());
+ }
+ m_size = s; // update end
+ }
+
+ template <typename Iterator, typename Traversal>
+ void assign_dispatch(Iterator first, Iterator last, Traversal const& /*not_random_access*/)
+ {
+ size_type s = 0;
+ iterator it = this->begin();
+
+ for ( ; it != this->end() && first != last ; ++it, ++first, ++s )
+ *it = *first; // may throw
+
+ this->destroy(it, this->end());
+
+ std::pair<bool, size_type> copy_data =
+ this->uninitialized_copy_checked(first, last, it, std::distance(it, this->begin() + Capacity)); // may throw
+ s += copy_data.second;
+
+ check_capacity(copy_data.first ? s : Capacity + 1);
+
+ m_size = s; // update end
+ }
+
+ // uninitialized_copy_checked
+
+ template <typename Iterator>
+ std::pair<bool, size_type> uninitialized_copy_checked(Iterator first, Iterator last, iterator dest, size_type max_count)
+ {
+ size_type count = 0;
+ iterator it = dest;
+ try
+ {
+ for ( ; first != last ; ++it, ++first, ++count )
+ {
+ if ( max_count <= count )
+ return std::make_pair(false, count);
+
+ this->uninitialized_fill(it, *first); // may throw
+ }
+ }
+ catch(...)
+ {
+ this->destroy(dest, it);
+ throw;
+ }
+ return std::make_pair(true, count);
+ }
+
+ // copy
+
+ template <typename Iterator>
+ void copy(Iterator first, Iterator last, iterator dst)
+ {
+ typedef typename
+ mpl::and_<
+ has_trivial_assign<value_type>,
+ mpl::or_<
+ is_same<Iterator, value_type *>,
+ is_same<Iterator, const value_type *>
+ >
+ >::type
+ use_memcpy;
+
+ this->copy_dispatch(first, last, dst, use_memcpy()); // may throw
+ }
+
+ void copy_dispatch(const value_type * first, const value_type * last, value_type * dst,
+ boost::mpl::bool_<true> const& /*use_memcpy*/)
+ {
+ ::memcpy(dst, first, sizeof(value_type) * std::distance(first, last));
+ }
+
+ template <typename Iterator>
+ void copy_dispatch(Iterator first, Iterator last, value_type * dst,
+ boost::mpl::bool_<false> const& /*use_memcpy*/)
+ {
+ std::copy(first, last, dst); // may throw
+ }
+
+ // uninitialized_copy
+
+ template <typename Iterator>
+ void uninitialized_copy(Iterator first, Iterator last, iterator dst)
+ {
+ typedef typename
+ mpl::and_<
+ has_trivial_copy<value_type>,
+ mpl::or_<
+ is_same<Iterator, value_type *>,
+ is_same<Iterator, const value_type *>
+ >
+ >::type
+ use_memcpy;
+
+ this->uninitialized_copy_dispatch(first, last, dst, use_memcpy()); // may throw
+ }
+
+ void uninitialized_copy_dispatch(const value_type * first, const value_type * last, value_type * dst,
+ boost::mpl::bool_<true> const& /*use_memcpy*/)
+ {
+ ::memcpy(dst, first, sizeof(value_type) * std::distance(first, last));
+ }
+
+ template <typename Iterator>
+ void uninitialized_copy_dispatch(Iterator first, Iterator last, value_type * dst,
+ boost::mpl::bool_<false> const& /*use_memcpy*/)
+ {
+ std::uninitialized_copy(first, last, dst); // may throw
+ }
+
+ // uninitialized_fill
+
+ template <typename V>
+ void uninitialized_fill(iterator dst, V const& v)
+ {
+ typedef typename
+ mpl::and_<
+ has_trivial_copy<value_type>,
+ is_same<Value, value_type>
+ >::type
+ use_memcpy;
+
+ uninitialized_fill_dispatch(dst, v, use_memcpy()); // may throw
+ }
+
+ void uninitialized_fill_dispatch(value_type * ptr, value_type const& v,
+ boost::mpl::bool_<true> const& /*use_memcpy*/)
+ {
+ // TODO - check if value_type has operator& defined and call this version only if it hasn't
+ const value_type * vptr = &v;
+ ::memcpy(ptr, vptr, sizeof(value_type));
+ }
+
+ template <typename V>
+ void uninitialized_fill_dispatch(value_type * ptr, V const& v,
+ boost::mpl::bool_<false> const& /*use_memcpy*/)
+ {
+ new (ptr) value_type(v); // may throw
+ }
+
+ // move
+
+ void move(iterator first, iterator last, iterator dst)
+ {
+ this->move_dispatch(first, last, dst, has_trivial_assign<value_type>()); // may throw
+ }
+
+ void move_dispatch(value_type * first, value_type * last, value_type * dst,
+ boost::true_type const& /*has_trivial_assign*/)
+ {
+ ::memmove(dst, first, sizeof(value_type) * std::distance(first, last));
+ }
+
+ void move_dispatch(value_type * first, value_type * last, value_type * dst,
+ boost::false_type const& /*has_trivial_assign*/)
+ {
+ std::copy(first, last, dst); // may throw
+ }
+
+ // move_backward
+
+ void move_backward(iterator first, iterator last, iterator dst)
+ {
+ this->move_backward_dispatch(first, last, dst, has_trivial_assign<value_type>()); // may throw
+ }
+
+ void move_backward_dispatch(value_type * first, value_type * last, value_type * dst,
+ boost::true_type const& /*has_trivial_assign*/)
+ {
+ difference_type n = std::distance(first, last);
+ ::memmove(dst - n, first, sizeof(value_type) * n);
+ }
+
+ void move_backward_dispatch(value_type * first, value_type * last, value_type * dst,
+ boost::false_type const& /*has_trivial_assign*/)
+ {
+ std::copy_backward(first, last, dst); // may throw
+ }
+
+ // uninitialized_fill
+
+ template <typename V>
+ void fill(iterator dst, V const& v)
+ {
+ fill_dispatch(dst, v, has_trivial_assign<value_type>()); // may throw
+ }
+
+ void fill_dispatch(value_type * ptr, value_type const& v,
+ boost::true_type const& /*has_trivial_assign*/)
+ {
+ // TODO - check if value_type has operator& defined and call this version only if it hasn't
+ const value_type * vptr = &v;
+ ::memcpy(ptr, vptr, sizeof(value_type));
+ }
+
+ template <typename V>
+ void fill_dispatch(value_type * ptr, V const& v,
+ boost::false_type const& /*has_trivial_assign*/)
+ {
+ *ptr = v; // may throw
+ }
+
+ // destroy
+
+ void destroy(iterator first, iterator last)
+ {
+ this->destroy_dispatch(first, last, has_trivial_destructor<value_type>());
+ }
+
+ void destroy_dispatch(value_type * /*first*/, value_type * /*last*/,
+ boost::true_type const& /*has_trivial_destructor*/)
+ {}
+
+ void destroy_dispatch(value_type * first, value_type * last,
+ boost::false_type const& /*has_trivial_destructor*/)
+ {
+ for ( ; first != last ; ++first )
+ first->~value_type();
+ }
+
+ // destroy
+
+ void destroy(iterator it)
+ {
+ this->destroy_dispatch(it, has_trivial_destructor<value_type>());
+ }
+
+ void destroy_dispatch(value_type * /*ptr*/,
+ boost::true_type const& /*has_trivial_destructor*/)
+ {}
+
+ void destroy_dispatch(value_type * ptr,
+ boost::false_type const& /*has_trivial_destructor*/)
+ {
+ ptr->~value_type();
+ }
+
+ // construct
+
+ void construct(iterator first, iterator last)
+ {
+ this->construct_dispatch(first, last, has_trivial_constructor<value_type>()); // may throw
+ }
+
+ void construct_dispatch(value_type * /*first*/, value_type * /*last*/,
+ boost::true_type const& /*has_trivial_constructor*/)
+ {}
+
+ void construct_dispatch(value_type * first, value_type * last,
+ boost::false_type const& /*has_trivial_constructor*/)
+ {
+ value_type * it = first;
+ try
+ {
+ for ( ; it != last ; ++it )
+ new (it) value_type(); // may throw
+ }
+ catch(...)
+ {
+ this->destroy(first, it);
+ throw;
+ }
+ }
+
+ void check_capacity(size_type s) const
+ {
+ BOOST_ASSERT_MSG(s <= Capacity, "size can't exceed the capacity");
+ //if ( Capacity < s ) throw std::bad_alloc();
+ }
+
+ void check_empty() const
+ {
+ BOOST_ASSERT_MSG(0 < m_size, "the container is empty");
+ }
+
+ void check_iterator_end_neq(const_iterator position) const
+ {
+ BOOST_ASSERT_MSG(this->begin() <= position && position < this->end(), "iterator out of bounds");
+
+ /*BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(
+ difference_type dist = std::distance(this->begin(), position);
+ )
+ BOOST_ASSERT_MSG(
+ 0 <= dist &&
+ ( sizeof(dist) <= sizeof(m_size) ?
+ (static_cast<size_type>(dist) < m_size) :
+ ( dist < static_cast<difference_type>(m_size))
+ ), "invalid iterator"
+ );*/
+ }
+
+ void check_iterator_end_eq(const_iterator position) const
+ {
+ BOOST_ASSERT_MSG(this->begin() <= position && position <= this->end(), "iterator out of bounds");
+
+ /*BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(
+ difference_type dist = std::distance(this->begin(), position);
+ )
+ BOOST_ASSERT_MSG(
+ 0 <= dist &&
+ ( sizeof(dist) <= sizeof(m_size) ?
+ (static_cast<size_type>(dist) <= m_size) :
+ ( dist <= static_cast<difference_type>(m_size))
+ ), "invalid iterator"
+ );*/
+ }
+
+ Value * ptr()
+ {
+ return (reinterpret_cast<Value*>(m_storage.address()));
+ }
+
+ const Value * ptr() const
+ {
+ return (reinterpret_cast<const Value*>(m_storage.address()));
+ }
+
+ boost::aligned_storage<sizeof(Value[Capacity]), boost::alignment_of<Value[Capacity]>::value> m_storage;
+ size_type m_size;
+};
+
+}}}} // namespace boost::geometry::index::detail
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_STATIC_VECTOR_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/tags.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/tags.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,25 @@
+// Boost.Geometry Index
+//
+// Tags used by the predicates checks implementation.
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_TAGS_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_TAGS_HPP
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail {
+
+struct value_tag {};
+struct envelope_tag {};
+
+} // namespace detail
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_RTREE_TAGS_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/detail/tuples.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/detail/tuples.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,171 @@
+// Boost.Geometry Index
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DETAIL_TUPLES_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_TUPLES_HPP
+
+#include <boost/tuple/tuple.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+// TODO move this to index/tuples and separate algorithms
+
+namespace boost { namespace geometry { namespace index { namespace detail {
+
+namespace tuples {
+
+// find_index
+
+namespace detail {
+
+template <typename Tuple, typename El, size_t N>
+struct find_index;
+
+template <typename Tuple, typename El, size_t N, typename CurrentEl>
+struct find_index_impl
+{
+ static const size_t value = find_index<Tuple, El, N - 1>::value;
+};
+
+template <typename Tuple, typename El, size_t N>
+struct find_index_impl<Tuple, El, N, El>
+{
+ static const size_t value = N - 1;
+};
+
+template <typename Tuple, typename El, typename CurrentEl>
+struct find_index_impl<Tuple, El, 1, CurrentEl>
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ ELEMENT_NOT_FOUND,
+ (find_index_impl));
+};
+
+template <typename Tuple, typename El>
+struct find_index_impl<Tuple, El, 1, El>
+{
+ static const size_t value = 0;
+};
+
+template <typename Tuple, typename El, size_t N>
+struct find_index
+{
+ static const size_t value =
+ find_index_impl<
+ Tuple,
+ El,
+ N,
+ typename boost::tuples::element<N - 1, Tuple>::type
+ >::value;
+};
+
+} // namespace detail
+
+template <typename Tuple, typename El>
+struct find_index
+{
+ static const size_t value =
+ detail::find_index<
+ Tuple,
+ El,
+ boost::tuples::length<Tuple>::value
+ >::value;
+};
+
+// has
+
+namespace detail {
+
+template <typename Tuple, typename El, size_t N>
+struct has
+{
+ static const bool value
+ = boost::is_same<
+ typename boost::tuples::element<N - 1, Tuple>::type,
+ El
+ >::value
+ || has<Tuple, El, N - 1>::value;
+};
+
+template <typename Tuple, typename El>
+struct has<Tuple, El, 1>
+{
+ static const bool value
+ = boost::is_same<
+ typename boost::tuples::element<0, Tuple>::type,
+ El
+ >::value;
+};
+
+} // namespace detail
+
+template <typename Tuple, typename El>
+struct has
+{
+ static const bool value
+ = detail::has<
+ Tuple,
+ El,
+ boost::tuples::length<Tuple>::value
+ >::value;
+};
+
+// add
+
+template <typename Tuple, typename El>
+struct add
+{
+ BOOST_MPL_ASSERT_MSG(
+ (false),
+ NOT_IMPLEMENTED_FOR_THIS_TUPLE_TYPE,
+ (add));
+};
+
+template <typename T1, typename T>
+struct add<boost::tuple<T1>, T>
+{
+ typedef boost::tuple<T1, T> type;
+};
+
+template <typename T1, typename T2, typename T>
+struct add<boost::tuple<T1, T2>, T>
+{
+ typedef boost::tuple<T1, T2, T> type;
+};
+
+// add_if
+
+template <typename Tuple, typename El, bool Cond>
+struct add_if
+{
+ typedef Tuple type;
+};
+
+template <typename Tuple, typename El>
+struct add_if<Tuple, El, true>
+{
+ typedef typename add<Tuple, El>::type type;
+};
+
+// add_unique
+
+template <typename Tuple, typename El>
+struct add_unique
+{
+ typedef typename add_if<
+ Tuple,
+ El,
+ !has<Tuple, El>::value
+ >::type type;
+};
+
+} // namespace tuples
+
+}}}} // namespace boost::geometry::index::detail
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_TAGS_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/distance_predicates.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/distance_predicates.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,200 @@
+// Boost.Geometry Index
+//
+// Spatial index distance predicates, calculators and checkers used in nearest neighbor query
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_DISTANCE_PREDICATES_HPP
+#define BOOST_GEOMETRY_INDEX_DISTANCE_PREDICATES_HPP
+
+#include <boost/geometry/index/detail/distance_predicates.hpp>
+
+/*!
+\defgroup distance_predicates Distance predicates (boost::geometry::index::)
+*/
+
+namespace boost { namespace geometry { namespace index {
+
+// relations generators
+
+/*!
+\brief Generate to_nearest() Point-Indexable relationship.
+
+Generate a nearest query Point and Value's Indexable relationship while calculating
+distances. This function may be used to define that knn query should calculate distances
+as smallest as possible between query Point and Indexable's points. In other words it
+should be the distance to the nearest Indexable's point. This function may be also used
+to define distances bounds which indicates that Indexable's nearest point should be
+closer or further than value v. This is default relation.
+
+\ingroup distance_predicates
+
+\tparam T Type of wrapped object. This may be a Point for PointRelation or some Value for
+ MinRelation or MaxRelation
+
+\param v Point or bound value.
+*/
+template <typename T>
+detail::to_nearest<T> to_nearest(T const& v)
+{
+ return detail::to_nearest<T>(v);
+}
+
+/*!
+\brief Generate to_centroid() Point-Indexable relationship.
+
+Generate a nearest query Point and Value's Indexable relationship while calculating
+distances. This function may be used to define that knn query should calculate distances
+between query Point and Indexable's centroid. This function may be also used
+to define distances bounds which indicates that Indexable's centroid should be
+closer or further than value v.
+
+\ingroup distance_predicates
+
+\tparam T Type of wrapped object. This may be a Point for PointRelation or some Value for
+ MinRelation or MaxRelation
+
+\param v Point or bound value.
+*/
+template <typename T>
+detail::to_centroid<T> to_centroid(T const& v)
+{
+ return detail::to_centroid<T>(v);
+}
+
+/*!
+\brief Generate to_furthest() Point-Indexable relationship.
+
+Generate a nearest query Point and Value's Indexable relationship while calculating
+distances. This function may be used to define that knn query should calculate distances
+as biggest as possible between query Point and Indexable's points. In other words it
+should be the distance to the furthest Indexable's point. This function may be also used
+to define distances bounds which indicates that Indexable's furthest point should be
+closer or further than value v.
+
+\ingroup distance_predicates
+
+\tparam T Type of wrapped object. This may be a Point for PointRelation or some Value for
+ MinRelation or MaxRelation
+
+\param v Point or bound value.
+*/
+template <typename T>
+detail::to_furthest<T> to_furthest(T const& v)
+{
+ return detail::to_furthest<T>(v);
+}
+
+// distance predicates generators
+
+/*!
+\brief Generate unbounded() distance predicate.
+
+Generate a distance predicate. This defines distances bounds which are used by knn query.
+This function indicates that there is no distance bounds and Values should be returned
+if distances between Point and Indexable are the smallest. Distance calculation is defined
+by PointRelation. This is default nearest predicate.
+
+\ingroup distance_predicates
+
+\tparam PointRelation PointRelation type.
+
+\param pr The point relation. This may be generated by \c index::to_nearest(),
+ \c index::to_centroid() or \c index::to_furthest() with \c Point passed as a parameter.
+*/
+template <typename PointRelation>
+inline detail::unbounded<PointRelation>
+unbounded(PointRelation const& pr)
+{
+ return detail::unbounded<PointRelation>(pr);
+}
+
+/*!
+\brief Generate min_bounded() distance predicate.
+
+Generate a distance predicate. This defines distances bounds which are used by knn query.
+This function indicates that Values should be returned only if distances between Point and
+Indexable are greater or equal to some min_distance passed in MinRelation. Check for closest Value is
+defined by PointRelation. So it is possible e.g. to return Values with centroids closest to some
+Point but only if nearest points are further than some distance.
+
+\ingroup distance_predicates
+
+\tparam PointRelation PointRelation type.
+\tparam MinRelation MinRelation type.
+
+\param pr The point relation. This may be generated by \c to_nearest(),
+ \c to_centroid() or \c to_furthest() with \c Point passed as a parameter.
+\param minr The minimum bound relation. This may be generated by \c to_nearest(),
+ \c to_centroid() or \c to_furthest() with distance value passed as a parameter.
+*/
+template <typename PointRelation, typename MinRelation>
+inline detail::min_bounded<PointRelation, MinRelation>
+min_bounded(PointRelation const& pr, MinRelation const& minr)
+{
+ return detail::min_bounded<PointRelation, MinRelation>(pr, minr);
+}
+
+/*!
+\brief Generate max_bounded() distance predicate.
+
+Generate a distance predicate. This defines distances bounds which are used by knn query.
+This function indicates that Values should be returned only if distances between Point and
+Indexable are lesser or equal to some max_distance passed in MaxRelation. Check for closest Value is
+defined by PointRelation. So it is possible e.g. to return Values with centroids closest to some
+Point but only if nearest points are closer than some distance.
+
+\ingroup distance_predicates
+
+\tparam PointRelation PointRelation type.
+\tparam MaxRelation MaxRelation type.
+
+\param pr The point relation. This may be generated by \c to_nearest(),
+ \c to_centroid() or \c to_furthest() with \c Point passed as a parameter.
+\param maxr The maximum bound relation. This may be generated by \c to_nearest(),
+ \c to_centroid() or \c to_furthest() with distance value passed as a parameter.
+*/
+template <typename PointRelation, typename MaxRelation>
+inline detail::max_bounded<PointRelation, MaxRelation>
+max_bounded(PointRelation const& pr, MaxRelation const& maxr)
+{
+ return detail::max_bounded<PointRelation, MaxRelation>(pr, maxr);
+}
+
+/*!
+\brief Generate bounded() distance predicate.
+
+Generate a distance predicate. This defines distances bounds which are used by knn query.
+This function indicates that Values should be returned only if distances between Point and
+Indexable are greater or equal to some min_distance passed in MinRelation and lesser or equal to
+some max_distance passed in MaxRelation. Check for closest Value is defined by PointRelation.
+So it is possible e.g. to return Values with centroids closest to some Point but only if nearest
+points are further than some distance and closer than some other distance.
+
+\ingroup distance_predicates
+
+\tparam PointRelation PointRelation type.
+\tparam MinRelation MinRelation type.
+\tparam MaxRelation MaxRelation type.
+
+\param pr The point relation. This may be generated by \c to_nearest(),
+ \c to_centroid() or \c to_furthest() with \c Point passed as a parameter.
+\param minr The minimum bound relation. This may be generated by \c to_nearest(),
+ \c to_centroid() or \c to_furthest() with distance value passed as a parameter.
+\param maxr The maximum bound relation. This may be generated by \c to_nearest(),
+ \c to_centroid() or \c to_furthest() with distance value passed as a parameter.
+*/
+template <typename PointRelation, typename MinRelation, typename MaxRelation>
+inline detail::bounded<PointRelation, MinRelation, MaxRelation>
+bounded(PointRelation const& pr, MinRelation const& minr, MaxRelation const& maxr)
+{
+ return detail::bounded<PointRelation, MinRelation, MaxRelation>(pr, minr, maxr);
+}
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_DISTANCE_PREDICATES_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/inserter.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/inserter.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,78 @@
+// Boost.Geometry Index
+//
+// Insert iterator
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_INSERTER_HPP
+#define BOOST_GEOMETRY_INDEX_INSERTER_HPP
+
+#include <iterator>
+
+/*!
+\defgroup inserters Inserters (boost::geometry::index::)
+*/
+
+namespace boost { namespace geometry { namespace index {
+
+template <class Container>
+class insert_iterator :
+ public std::iterator<std::output_iterator_tag, void, void, void, void>
+{
+public:
+ typedef Container container_type;
+
+ inline explicit insert_iterator(Container & c)
+ : container(&c)
+ {}
+
+ insert_iterator & operator=(typename Container::value_type const& value)
+ {
+ container->insert(value);
+ return *this;
+ }
+
+ insert_iterator & operator* ()
+ {
+ return *this;
+ }
+
+ insert_iterator & operator++ ()
+ {
+ return *this;
+ }
+
+ insert_iterator operator++(int)
+ {
+ return *this;
+ }
+
+private:
+ Container * container;
+};
+
+/*!
+\brief Insert iterator generator.
+
+Returns insert iterator capable to insert values to the container
+(spatial index) which has member function insert(value_type const&) defined.
+
+\ingroup inserters
+
+\param c The reference to the container (spatial index) to which values will be inserted.
+
+\return The insert iterator inserting values to the container.
+*/
+template <typename Container>
+insert_iterator<Container> inserter(Container & c)
+{
+ return insert_iterator<Container>(c);
+}
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_INSERTER_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/parameters.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/parameters.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,208 @@
+// Boost.Geometry Index
+//
+// R-tree algorithms parameters
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_PARAMETERS_HPP
+#define BOOST_GEOMETRY_INDEX_PARAMETERS_HPP
+
+#include <limits>
+
+namespace boost { namespace geometry { namespace index {
+
+// TODO: awulkiew - implement those:
+//if ( m_min_elems_per_node < 1 )
+// m_min_elems_per_node = 1;
+//if ( m_max_elems_per_node < 2 )
+// m_max_elems_per_node = 2;
+
+/*!
+\brief Linear r-tree creation algorithm parameters.
+
+\tparam MaxElements Maximum number of elements in nodes.
+\tparam MinElements Minimum number of elements in nodes.
+*/
+template <size_t MaxElements, size_t MinElements>
+struct linear
+{
+ static const size_t max_elements = MaxElements;
+ static const size_t min_elements = MinElements;
+
+ static size_t get_max_elements() { return MaxElements; }
+ static size_t get_min_elements() { return MinElements; }
+};
+
+/*!
+\brief Quadratic r-tree creation algorithm parameters.
+
+\tparam MaxElements Maximum number of elements in nodes.
+\tparam MinElements Minimum number of elements in nodes.
+*/
+template <size_t MaxElements, size_t MinElements>
+struct quadratic
+{
+ static const size_t max_elements = MaxElements;
+ static const size_t min_elements = MinElements;
+
+ static size_t get_max_elements() { return MaxElements; }
+ static size_t get_min_elements() { return MinElements; }
+};
+
+namespace detail {
+
+template <size_t MaxElements>
+struct default_rstar_reinserted_elements_s
+{
+ static const size_t value = (MaxElements * 3) / 10;
+};
+
+} // namespace detail
+
+/*!
+\brief R*-tree creation algorithm parameters.
+
+\tparam MaxElements Maximum number of elements in nodes.
+\tparam MinElements Minimum number of elements in nodes.
+\tparam OverlapCostThreshold The number of leaf node children elements above which
+ nearly minimum overlap cost is calculated instead of minimum
+ overlap cost. If 0 minimum overlap cost is always calculated.
+\tparam ReinsertedElements Number of elements reinserted by forced reinsertions algorithm.
+*/
+template <size_t MaxElements,
+ size_t MinElements,
+ size_t OverlapCostThreshold = 0,
+ size_t ReinsertedElements = detail::default_rstar_reinserted_elements_s<MaxElements>::value
+ >
+struct rstar
+{
+ static const size_t max_elements = MaxElements;
+ static const size_t min_elements = MinElements;
+ static const size_t overlap_cost_threshold = OverlapCostThreshold;
+ static const size_t reinserted_elements = ReinsertedElements;
+
+ static size_t get_max_elements() { return MaxElements; }
+ static size_t get_min_elements() { return MinElements; }
+ static size_t get_overlap_cost_threshold() { return OverlapCostThreshold; }
+ static size_t get_reinserted_elements() { return ReinsertedElements; }
+};
+
+//template <size_t MaxElements, size_t MinElements>
+//struct kmeans
+//{
+// static const size_t max_elements = MaxElements;
+// static const size_t min_elements = MinElements;
+//};
+
+namespace runtime {
+
+/*!
+\brief Linear r-tree creation algorithm parameters.
+*/
+class linear
+{
+public:
+ /*!
+ \brief The constructor.
+
+ \param max_elements Maximum number of elements in nodes.
+ \param min_elements Minimum number of elements in nodes.
+ */
+ linear(size_t max_elements, size_t min_elements)
+ : m_max_elements(max_elements)
+ , m_min_elements(min_elements)
+ {}
+
+ size_t get_max_elements() const { return m_max_elements; }
+ size_t get_min_elements() const { return m_min_elements; }
+
+private:
+ size_t m_max_elements;
+ size_t m_min_elements;
+};
+
+/*!
+\brief Quadratic r-tree creation algorithm parameters.
+*/
+class quadratic
+{
+public:
+ /*!
+ \brief The constructor.
+
+ \param max_elements Maximum number of elements in nodes.
+ \param min_elements Minimum number of elements in nodes.
+ */
+ quadratic(size_t max_elements, size_t min_elements)
+ : m_max_elements(max_elements)
+ , m_min_elements(min_elements)
+ {}
+
+ size_t get_max_elements() const { return m_max_elements; }
+ size_t get_min_elements() const { return m_min_elements; }
+
+private:
+ size_t m_max_elements;
+ size_t m_min_elements;
+};
+
+namespace detail {
+
+inline size_t default_rstar_reinserted_elements_d()
+{
+ return (std::numeric_limits<size_t>::max)();
+};
+
+} // namespace detail
+
+/*!
+\brief R*-tree creation algorithm parameters.
+*/
+class rstar
+{
+public:
+ /*!
+ \brief The constructor.
+
+ \param max_elements Maximum number of elements in nodes.
+ \param min_elements Minimum number of elements in nodes.
+ \param overlap_cost_threshold The number of leaf node children elements above which
+ nearly minimum overlap cost is calculated instead of minimum
+ overlap cost. If 0 minimum overlap cost is always calculated.
+ \param reinserted_elements Number of elements reinserted by forced reinsertions algorithm.
+ */
+ rstar(size_t max_elements,
+ size_t min_elements,
+ size_t overlap_cost_threshold = 0,
+ size_t reinserted_elements = detail::default_rstar_reinserted_elements_d())
+ : m_max_elements(max_elements)
+ , m_min_elements(min_elements)
+ , m_overlap_cost_threshold(overlap_cost_threshold)
+ , m_reinserted_elements(
+ detail::default_rstar_reinserted_elements_d() == reinserted_elements ?
+ (max_elements * 3) / 10 :
+ reinserted_elements
+ )
+ {}
+
+ size_t get_max_elements() const { return m_max_elements; }
+ size_t get_min_elements() const { return m_min_elements; }
+ size_t get_overlap_cost_threshold() const { return m_overlap_cost_threshold; }
+ size_t get_reinserted_elements() const { return m_reinserted_elements; }
+
+private:
+ size_t m_max_elements;
+ size_t m_min_elements;
+ size_t m_overlap_cost_threshold;
+ size_t m_reinserted_elements;
+};
+
+} // namespace runtime
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_PARAMETERS_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/predicates.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/predicates.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,259 @@
+// Boost.Geometry Index
+//
+// Spatial query predicates
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_PREDICATES_HPP
+#define BOOST_GEOMETRY_INDEX_PREDICATES_HPP
+
+#include <utility>
+#include <boost/tuple/tuple.hpp>
+#include <boost/mpl/assert.hpp>
+
+// TODO: awulkiew - temporary
+#include <boost/geometry/algorithms/covered_by.hpp>
+
+#include <boost/geometry/index/detail/predicates.hpp>
+
+/*!
+\defgroup predicates Spatial predicates (boost::geometry::index::)
+*/
+
+namespace boost { namespace geometry { namespace index {
+
+/*!
+\brief Generate empty predicate.
+
+\ingroup predicates
+*/
+inline detail::empty empty()
+{
+ return detail::empty();
+}
+
+/*!
+\brief Generate value predicate.
+
+A wrapper around user-defined functor
+describing if Value should be returned by spatial query.
+
+\ingroup predicates
+
+\tparam ValuePredicate Functor type.
+
+\param vpred The functor.
+*/
+template <typename ValuePredicate>
+inline detail::value<ValuePredicate> value(ValuePredicate const& vpred)
+{
+ return detail::value<ValuePredicate>(vpred);
+}
+
+/*!
+\brief Generate \c covered_by() predicate.
+
+Generate a predicate defining Value and Geometry relationship.
+Value will be returned by the query if <tt>bg::covered_by(Indexable, Geometry)</tt>
+returns true.
+
+\ingroup predicates
+
+\tparam Geometry The Geometry type.
+
+\param g The Geometry object.
+*/
+template <typename Geometry>
+inline detail::covered_by<Geometry> covered_by(Geometry const& g)
+{
+ return detail::covered_by<Geometry>(g);
+}
+
+/*!
+\brief Generate \c disjoint() predicate.
+
+Generate a predicate defining Value and Geometry relationship.
+Value will be returned by the query if <tt>bg::disjoint(Indexable, Geometry)</tt>
+returns true.
+
+\ingroup predicates
+
+\tparam Geometry The Geometry type.
+
+\param g The Geometry object.
+*/
+template <typename Geometry>
+inline detail::disjoint<Geometry> disjoint(Geometry const& g)
+{
+ return detail::disjoint<Geometry>(g);
+}
+
+/*!
+\brief Generate \c intersects() predicate.
+
+Generate a predicate defining Value and Geometry relationship.
+Value will be returned by the query if <tt>bg::intersects(Indexable, Geometry)</tt>
+returns true.
+
+\ingroup predicates
+
+\tparam Geometry The Geometry type.
+
+\param g The Geometry object.
+*/
+template <typename Geometry>
+inline detail::intersects<Geometry> intersects(Geometry const& g)
+{
+ return detail::intersects<Geometry>(g);
+}
+
+/*!
+\brief Generate \c overlaps() predicate.
+
+Generate a predicate defining Value and Geometry relationship.
+Value will be returned by the query if <tt>bg::overlaps(Indexable, Geometry)</tt>
+returns true.
+
+\ingroup predicates
+
+\tparam Geometry The Geometry type.
+
+\param g The Geometry object.
+*/
+template <typename Geometry>
+inline detail::overlaps<Geometry> overlaps(Geometry const& g)
+{
+ return detail::overlaps<Geometry>(g);
+}
+
+//*!
+//\brief Generate \c touches() predicate.
+//
+//Generate a predicate defining Value and Geometry relationship.
+//Value will be returned by the query if <tt>bg::touches(Indexable, Geometry)</tt>
+//returns true.
+//
+//\ingroup predicates
+//
+//\tparam Geometry The Geometry type.
+//
+//\param g The Geometry object.
+//*/
+//template <typename Geometry>
+//inline detail::touches<Geometry> touches(Geometry const& g)
+//{
+// return detail::touches<Geometry>(g);
+//}
+
+/*!
+\brief Generate \c within() predicate.
+
+Generate a predicate defining Value and Geometry relationship.
+Value will be returned by the query if <tt>bg::within(Indexable, Geometry)</tt>
+returns true.
+
+\ingroup predicates
+
+\tparam Geometry The Geometry type.
+
+\param g The Geometry object.
+*/
+template <typename Geometry>
+inline detail::within<Geometry> within(Geometry const& g)
+{
+ return detail::within<Geometry>(g);
+}
+
+}}} // namespace boost::geometry::index
+
+// operator! generators
+
+template <typename Geometry>
+boost::geometry::index::detail::not_covered_by<Geometry>
+operator!(boost::geometry::index::detail::covered_by<Geometry> const& p)
+{
+ return boost::geometry::index::detail::not_covered_by<Geometry>(p.geometry);
+}
+
+template <typename Geometry>
+boost::geometry::index::detail::covered_by<Geometry>
+operator!(boost::geometry::index::detail::not_covered_by<Geometry> const& p)
+{
+ return boost::geometry::index::detail::covered_by<Geometry>(p.geometry);
+}
+
+template <typename Geometry>
+boost::geometry::index::detail::not_disjoint<Geometry>
+operator!(boost::geometry::index::detail::disjoint<Geometry> const& p)
+{
+ return boost::geometry::index::detail::not_disjoint<Geometry>(p.geometry);
+}
+
+template <typename Geometry>
+boost::geometry::index::detail::disjoint<Geometry>
+operator!(boost::geometry::index::detail::not_disjoint<Geometry> const& p)
+{
+ return boost::geometry::index::detail::disjoint<Geometry>(p.geometry);
+}
+
+template <typename Geometry>
+boost::geometry::index::detail::not_intersects<Geometry>
+operator!(boost::geometry::index::detail::intersects<Geometry> const& p)
+{
+ return boost::geometry::index::detail::not_intersects<Geometry>(p.geometry);
+}
+
+template <typename Geometry>
+boost::geometry::index::detail::intersects<Geometry>
+operator!(boost::geometry::index::detail::not_intersects<Geometry> const& p)
+{
+ return boost::geometry::index::detail::intersects<Geometry>(p.geometry);
+}
+
+template <typename Geometry>
+boost::geometry::index::detail::not_overlaps<Geometry>
+operator!(boost::geometry::index::detail::overlaps<Geometry> const& p)
+{
+ return boost::geometry::index::detail::not_overlaps<Geometry>(p.geometry);
+}
+
+template <typename Geometry>
+boost::geometry::index::detail::overlaps<Geometry>
+operator!(boost::geometry::index::detail::not_overlaps<Geometry> const& p)
+{
+ return boost::geometry::index::detail::overlaps<Geometry>(p.geometry);
+}
+
+//template <typename Geometry>
+//boost::geometry::index::detail::not_touches<Geometry>
+//operator!(boost::geometry::index::detail::touches<Geometry> const& p)
+//{
+// return boost::geometry::index::detail::not_touches<Geometry>(p.geometry);
+//}
+//
+//template <typename Geometry>
+//boost::geometry::index::detail::touches<Geometry>
+//operator!(boost::geometry::index::detail::not_touches<Geometry> const& p)
+//{
+// return boost::geometry::index::detail::touches<Geometry>(p.geometry);
+//}
+
+template <typename Geometry>
+boost::geometry::index::detail::not_within<Geometry>
+operator!(boost::geometry::index::detail::within<Geometry> const& p)
+{
+ return boost::geometry::index::detail::not_within<Geometry>(p.geometry);
+}
+
+template <typename Geometry>
+boost::geometry::index::detail::within<Geometry>
+operator!(boost::geometry::index::detail::not_within<Geometry> const& p)
+{
+ return boost::geometry::index::detail::within<Geometry>(p.geometry);
+}
+
+#endif // BOOST_GEOMETRY_INDEX_PREDICATES_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/rtree.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/rtree.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,1633 @@
+// Boost.Geometry Index
+//
+// R-tree implementation
+//
+// Copyright (c) 2008 Federico J. Fernandez.
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_RTREE_HPP
+#define BOOST_GEOMETRY_INDEX_RTREE_HPP
+
+#include <algorithm>
+
+#include <boost/tuple/tuple.hpp>
+#include <boost/move/move.hpp>
+
+#include <boost/geometry/geometry.hpp>
+
+#include <boost/geometry/index/detail/assert.hpp>
+#include <boost/geometry/index/detail/nonassignable.hpp>
+
+#include <boost/geometry/index/translator/translator.hpp>
+#include <boost/geometry/index/detail/rtree/options.hpp>
+
+#include <boost/geometry/index/predicates.hpp>
+#include <boost/geometry/index/distance_predicates.hpp>
+#include <boost/geometry/index/detail/rtree/adaptors.hpp>
+
+#include <boost/geometry/index/detail/rtree/node/node.hpp>
+
+#include <boost/geometry/index/detail/algorithms/is_valid.hpp>
+
+#include <boost/geometry/index/detail/rtree/visitors/insert.hpp>
+#include <boost/geometry/index/detail/rtree/visitors/remove.hpp>
+#include <boost/geometry/index/detail/rtree/visitors/copy.hpp>
+#include <boost/geometry/index/detail/rtree/visitors/destroy.hpp>
+#include <boost/geometry/index/detail/rtree/visitors/spatial_query.hpp>
+#include <boost/geometry/index/detail/rtree/visitors/nearest_query.hpp>
+#include <boost/geometry/index/detail/rtree/visitors/count.hpp>
+
+#include <boost/geometry/index/detail/rtree/linear/linear.hpp>
+#include <boost/geometry/index/detail/rtree/quadratic/quadratic.hpp>
+#include <boost/geometry/index/detail/rtree/rstar/rstar.hpp>
+//#include <boost/geometry/extensions/index/detail/rtree/kmeans/kmeans.hpp>
+
+#include <boost/geometry/index/inserter.hpp>
+
+// TODO change the name to bounding_tree
+
+/*!
+\defgroup rtree_functions Functions related to the rtree
+*/
+
+namespace boost { namespace geometry { namespace index {
+
+/*!
+\brief The R-tree spatial index.
+
+This is self-balancing spatial index capable to store various types of Values and balancing algorithms.
+
+\par Parameters
+The user must pass a type defining the Parameters which will
+be used in rtree creation process. This type is used e.g. to specify balancing algorithm
+with specific parameters like min and max number of elements in node.
+
+\par
+Predefined algorithms with compile-time parameters are:
+\li <tt>boost::geometry::index::linear</tt>,
+ \li <tt>boost::geometry::index::quadratic</tt>,
+ \li <tt>boost::geometry::index::rstar</tt>.
+
+\par
+Predefined algorithms with run-time parameters are:
+ \li \c boost::geometry::index::runtime::linear,
+ \li \c boost::geometry::index::runtime::quadratic,
+ \li \c boost::geometry::index::runtime::rstar.
+
+\par Translator
+The Translator translates from Value to Indexable each time r-tree requires it. Which means that this
+operation is done for each Value access. Therefore the Translator should return the Indexable by
+const reference instead of a value. Default translator can translate all types adapted to Point
+or Box concepts (called Indexables). It also handles <tt>std::pair<Indexable, T></tt> and
+<tt>boost::tuple<Indexable, ...></tt>. For example, if <tt>std::pair<Box, int></tt> is stored in the
+container, the default translator translates from <tt>std::pair<Box, int> const&</tt> to <tt>Box const&</tt>.
+
+\tparam Value The type of objects stored in the container.
+\tparam Parameters Compile-time parameters.
+\tparam Translator The type of the translator which translates from Value to Indexable.
+\tparam Allocator The allocator used to allocate/deallocate memory, construct/destroy nodes and Values.
+*/
+template <
+ typename Value,
+ typename Parameters,
+ typename Translator = translator::def<Value>,
+ typename Allocator = std::allocator<Value>
+>
+class rtree
+{
+ BOOST_COPYABLE_AND_MOVABLE(rtree)
+
+public:
+ /*! \brief The type of Value stored in the container. */
+ typedef Value value_type;
+ /*! \brief R-tree parameters type. */
+ typedef Parameters parameters_type;
+ /*! \brief Value to Indexable Translator type. */
+ typedef Translator translator_type;
+ /*! \brief The type of allocator used by the container. */
+ typedef Allocator allocator_type;
+ /*! \brief Unsigned integral type used by the container. */
+ typedef typename allocator_type::size_type size_type;
+
+ /*! \brief The Indexable type to which Value is translated. */
+ typedef typename translator::indexable_type<Translator>::type indexable_type;
+ /*! \brief The Box type used by the R-tree. */
+ typedef typename index::detail::default_box_type<indexable_type>::type envelope_type;
+
+#if !defined(BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE)
+private:
+#endif
+ typedef envelope_type box_type;
+ typedef typename detail::rtree::options_type<Parameters>::type options_type;
+ typedef typename options_type::node_tag node_tag;
+ typedef detail::rtree::allocators<allocator_type, value_type, typename options_type::parameters_type, box_type, node_tag> allocators_type;
+
+ typedef typename detail::rtree::node<value_type, typename options_type::parameters_type, box_type, allocators_type, node_tag>::type node;
+ typedef typename detail::rtree::internal_node<value_type, typename options_type::parameters_type, box_type, allocators_type, node_tag>::type internal_node;
+ typedef typename detail::rtree::leaf<value_type, typename options_type::parameters_type, box_type, allocators_type, node_tag>::type leaf;
+
+public:
+ /*!
+ \brief The constructor.
+
+ \param parameters The parameters object.
+ \param translator The translator object.
+
+ \par Throws
+ If allocator default constructor throws.
+ */
+ inline explicit rtree(parameters_type parameters = parameters_type(),
+ translator_type const& translator = translator_type())
+ : m_translator(translator) // SHOULDN'T THROW
+ , m_parameters(parameters)
+ , m_allocators()
+ , m_values_count(0)
+ , m_leafs_level(0)
+ , m_root(0)
+ {
+ geometry::assign_inverse(m_box);
+ }
+
+ /*!
+ \brief The constructor.
+
+ \param parameters The parameters object.
+ \param translator The translator object.
+ \param allocator The allocator object.
+
+ \par Throws
+ If allocator copy constructor throws.
+ */
+ inline rtree(parameters_type parameters,
+ translator_type const& translator,
+ allocator_type allocator)
+ : m_translator(translator) // SHOULDN'T THROW
+ , m_parameters(parameters)
+ , m_allocators(allocator)
+ , m_values_count(0)
+ , m_leafs_level(0)
+ , m_root(0)
+ {
+ geometry::assign_inverse(m_box);
+ }
+
+ /*!
+ \brief The constructor.
+
+ \param first The beginning of the range of Values.
+ \param last The end of the range of Values.
+ \param parameters The parameters object.
+ \param translator The translator object.
+ \param allocator The allocator object.
+
+ \par Throws
+ \li If allocator copy constructor throws.
+ \li If Value copy constructor or copy assignment throws.
+ \li If allocation throws.
+ \li When memory allocation for Node fails.
+ */
+ template<typename Iterator>
+ inline rtree(Iterator first, Iterator last,
+ parameters_type parameters = parameters_type(),
+ translator_type const& translator = translator_type(),
+ allocator_type allocator = allocator_type())
+ : m_translator(translator) // SHOULDN'T THROW
+ , m_parameters(parameters)
+ , m_allocators(allocator)
+ , m_values_count(0)
+ , m_leafs_level(0)
+ , m_root(0)
+ {
+ geometry::assign_inverse(m_box);
+
+ try
+ {
+ this->insert(first, last);
+ }
+ catch(...)
+ {
+ this->raw_destroy(*this);
+ throw;
+ }
+ }
+
+ /*!
+ \brief The constructor.
+
+ \param rng The range of Values.
+ \param parameters The parameters object.
+ \param translator The translator object.
+ \param allocator The allocator object.
+
+ \par Throws
+ \li If allocator copy constructor throws.
+ \li If Value copy constructor or copy assignment throws.
+ \li If allocation throws.
+ \li When memory allocation for Node fails.
+ */
+ template<typename Range>
+ inline explicit rtree(Range const& rng,
+ parameters_type parameters = parameters_type(),
+ translator_type const& translator = translator_type(),
+ allocator_type allocator = allocator_type())
+ : m_translator(translator) // SHOULDN'T THROW
+ , m_parameters(parameters)
+ , m_allocators(allocator)
+ , m_values_count(0)
+ , m_leafs_level(0)
+ , m_root(0)
+ {
+ geometry::assign_inverse(m_box);
+
+ try
+ {
+ this->insert(rng);
+ }
+ catch(...)
+ {
+ this->raw_destroy(*this);
+ throw;
+ }
+ }
+
+ /*!
+ \brief The destructor.
+
+ \par Throws
+ Nothing.
+ */
+ inline ~rtree()
+ {
+ this->raw_destroy(*this);
+ }
+
+ /*!
+ \brief The copy constructor.
+
+ It uses parameters, translator and allocator from the source tree.
+
+ \param src The rtree which content will be copied.
+
+ \par Throws
+ \li If allocator copy constructor throws.
+ \li If Value copy constructor throws.
+ \li If allocation throws.
+ \li When memory allocation for Node fails.
+ */
+ inline rtree(rtree const& src)
+ : m_translator(src.m_translator) // SHOULDN'T THROW
+ , m_parameters(src.m_parameters)
+ , m_allocators(src.m_allocators)
+ , m_values_count(0)
+ , m_leafs_level(0)
+ , m_root(0)
+ , m_box(src.m_box)
+ {
+ //TODO use Boost.Container allocator_traits_type::select_on_container_copy_construction()
+ this->raw_copy(src, *this, false);
+ }
+
+ /*!
+ \brief The copy constructor.
+
+ It uses Parameters and translator from the source tree.
+
+ \param src The rtree which content will be copied.
+ \param allocator The allocator which will be used.
+
+ \par Throws
+ \li If allocator copy constructor throws.
+ \li If Value copy constructor throws.
+ \li If allocation throws.
+ \li When memory allocation for Node fails.
+ */
+ inline rtree(rtree const& src, allocator_type const& allocator)
+ : m_translator(src.m_translator) // SHOULDN'T THROW
+ , m_parameters(src.m_parameters)
+ , m_allocators(allocator)
+ , m_values_count(0)
+ , m_leafs_level(0)
+ , m_root(0)
+ , m_box(src.m_box)
+ {
+ this->raw_copy(src, *this, false);
+ }
+
+ /*!
+ \brief The moving constructor.
+
+ It uses parameters, translator and allocator from the source tree.
+
+ \param src The rtree which content will be moved.
+
+ \par Throws
+ Nothing.
+ */
+ inline rtree(BOOST_RV_REF(rtree) src)
+// TODO - use boost::move()
+ : m_translator(src.m_translator) // SHOULDN'T THROW
+ , m_parameters(src.m_parameters)
+ , m_allocators(src.m_allocators)
+ , m_values_count(src.m_values_count)
+ , m_leafs_level(src.m_leafs_level)
+ , m_root(src.m_root)
+ , m_box(src.m_box)
+ {
+ src.m_values_count = 0;
+ src.m_leafs_level = 0;
+ src.m_root = 0;
+ }
+
+ /*!
+ \brief The moving constructor.
+
+ It uses parameters and translator from the source tree.
+
+ \param src The rtree which content will be moved.
+ \param allocator The allocator.
+
+ \par Throws
+ \li If allocator copy constructor throws.
+ \li If Value copy constructor throws (only if allocators aren't equal).
+ \li If allocation throws (only if allocators aren't equal).
+ \li When memory allocation for Node fails (only if allocators aren't equal).
+ */
+ inline rtree(BOOST_RV_REF(rtree) src, allocator_type const& allocator)
+// TODO - use boost::move()
+ : m_translator(src.m_translator) // SHOULDN'T THROW
+ , m_parameters(src.m_parameters)
+ , m_allocators(allocator)
+ , m_values_count(0)
+ , m_leafs_level(0)
+ , m_root(0)
+ , m_box(src.m_box)
+ {
+ if ( src.m_allocators.allocator == allocator )
+ {
+ boost::swap(m_values_count, src.m_values_count);
+ boost::swap(m_leafs_level, src.m_leafs_level);
+ boost::swap(m_root, src.m_root);
+ }
+ else
+ {
+ this->raw_copy(src, *this, false);
+ }
+ }
+
+ /*!
+ \brief The assignment operator.
+
+ It uses parameters and translator from the source tree.
+
+ \param src The rtree which content will be copied.
+
+ \par Throws
+ \li If Value copy constructor throws.
+ \li If allocation throws.
+ \li When nodes allocation fails.
+ */
+ inline rtree & operator=(BOOST_COPY_ASSIGN_REF(rtree) src)
+ {
+ if ( this == &src )
+ return *this;
+
+ //TODO use Boost.Container allocator_traits_type::propagate_on_container_move_assignment
+
+ // It uses m_allocators
+ this->raw_copy(src, *this, true);
+
+ m_box = src.m_box;
+
+ return *this;
+ }
+
+ /*!
+ \brief The moving assignment.
+
+ It uses parameters and translator from the source tree.
+
+ \param src The rtree which content will be moved.
+
+ \par Throws
+ Only if allocators aren't equal.
+ \li If Value copy constructor throws.
+ \li If allocation throws.
+ \li When nodes allocation fails.
+ */
+ inline rtree & operator=(BOOST_RV_REF(rtree) src)
+ {
+ if ( this == &src )
+ return *this;
+
+//TODO use Boost.Container allocator_traits_type::propagate_on_container_move_assignment
+
+ if ( m_allocators.allocator == src.m_allocators.allocator )
+ {
+// TODO - use boost::move()
+ m_translator = src.m_translator; // SHOULDN'T THROW
+ m_parameters = src.m_parameters;
+ //m_allocators = src.m_allocators;
+
+ m_values_count = src.m_values_count;
+ m_leafs_level = src.m_leafs_level;
+ m_root = src.m_root;
+
+ src.m_values_count = 0;
+ src.m_leafs_level = 0;
+ src.m_root = 0;
+ }
+ else
+ {
+ // It uses m_allocators
+ this->raw_copy(src, *this, true);
+ }
+
+ m_box = src.m_box;
+
+ return *this;
+ }
+
+ /*!
+ \brief Swaps contents of two rtrees.
+
+ Parameters, translator and allocators are swapped as well.
+
+ \param other The rtree which content will be swapped with this rtree content.
+
+ \par Throws
+ If allocators swap throws.
+ */
+ void swap(rtree & other)
+ {
+ boost::swap(m_translator, other.m_translator); // SHOULDN'T THROW
+ boost::swap(m_parameters, other.m_parameters);
+ m_allocators.swap(other.m_allocators);
+
+ boost::swap(m_values_count, other.m_values_count);
+ boost::swap(m_leafs_level, other.m_leafs_level);
+ boost::swap(m_root, other.m_root);
+ boost::swap(m_box, other.m_box);
+ }
+
+ /*!
+ \brief Insert a value to the index.
+
+ \param value The value which will be stored in the container.
+
+ \par Throws
+ \li If Value copy constructor or copy assignment throws.
+ \li If allocation throws.
+ \li When nodes allocation fails.
+
+ \warning
+ This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state,
+ elements must not be inserted or removed, methods may return invalid data.
+ */
+ inline void insert(value_type const& value)
+ {
+ if ( !m_root )
+ this->raw_create();
+
+ this->raw_insert(value);
+ }
+
+ /*!
+ \brief Insert a range of values to the index.
+
+ \param first The beginning of the range of values.
+ \param last The end of the range of values.
+
+ \par Throws
+ \li If Value copy constructor or copy assignment throws.
+ \li If allocation throws.
+ \li When nodes allocation fails.
+
+ \warning
+ This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state,
+ elements must not be inserted or removed, methods may return invalid data.
+ */
+ template <typename Iterator>
+ inline void insert(Iterator first, Iterator last)
+ {
+ if ( !m_root )
+ this->raw_create();
+
+ for ( ; first != last ; ++first )
+ this->raw_insert(*first);
+ }
+
+ /*!
+ \brief Insert a range of values to the index.
+
+ \param rng The range of values.
+
+ \par Throws
+ \li If Value copy constructor or copy assignment throws.
+ \li If allocation throws.
+ \li When nodes allocation fails.
+
+ \warning
+ This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state,
+ elements must not be inserted or removed, methods may return invalid data.
+ */
+ template <typename Range>
+ inline void insert(Range const& rng)
+ {
+ if ( !m_root )
+ this->raw_create();
+
+ typedef typename boost::range_const_iterator<Range>::type It;
+ for ( It it = boost::const_begin(rng); it != boost::const_end(rng) ; ++it )
+ this->raw_insert(*it);
+ }
+
+ /*!
+ \brief Remove a value from the container.
+
+ In contrast to the \c std::set or <tt>std::map erase()</tt> method
+ this method removes only one value from the container.
+
+ \param value The value which will be removed from the container.
+
+ \return 1 if the value was removed, 0 otherwise.
+
+ \par Throws
+ \li If Value copy constructor or copy assignment throws.
+ \li If allocation throws.
+ \li When nodes allocation fails.
+
+ \warning
+ This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state,
+ elements must not be inserted or removed, methods may return invalid data.
+ */
+ inline size_type remove(value_type const& value)
+ {
+ return this->raw_remove(value);
+ }
+
+ /*!
+ \brief Remove a range of values from the container.
+
+ In contrast to the \c std::set or <tt>std::map erase()</tt> method
+ it doesn't take iterators pointing to values stored in this container. It removes values equal
+ to these passed as a range. Furthermore this method removes only one value for each one passed
+ in the range, not all equal values.
+
+ \param first The beginning of the range of values.
+ \param last The end of the range of values.
+
+ \return The number of removed values.
+
+ \par Throws
+ \li If Value copy constructor or copy assignment throws.
+ \li If allocation throws.
+ \li When nodes allocation fails.
+
+ \warning
+ This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state,
+ elements must not be inserted or removed, methods may return invalid data.
+ */
+ template <typename Iterator>
+ inline size_type remove(Iterator first, Iterator last)
+ {
+ size_type result = 0;
+ for ( ; first != last ; ++first )
+ result += this->raw_remove(*first);
+ return result;
+ }
+
+ /*!
+ \brief Remove a range of values from the container.
+
+ In contrast to the \c std::set or <tt>std::map erase()</tt> method
+ it removes values equal to these passed as a range. Furthermore, this method removes only
+ one value for each one passed in the range, not all equal values.
+
+ \param rng The range of values.
+
+ \return The number of removed values.
+
+ \par Throws
+ \li If Value copy constructor or copy assignment throws.
+ \li If allocation throws.
+ \li When nodes allocation fails.
+
+ \warning
+ This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state,
+ elements must not be inserted or removed, methods may return invalid data.
+ */
+ template <typename Range>
+ inline size_type remove(Range const& rng)
+ {
+ size_type result = 0;
+ typedef typename boost::range_const_iterator<Range>::type It;
+ for ( It it = boost::const_begin(rng); it != boost::const_end(rng) ; ++it )
+ result += this->raw_remove(*it);
+ return result;
+ }
+
+ /*!
+ \brief Finds values meeting spatial predicates, e.g. intersecting some Box.
+
+ <b>Spatial predicates</b> may be a \c Geometry. In this case Values intersecting the \c Geometry are returned.
+
+ It may be generated by one of the functions listed below:
+ \li \c boost::geometry::index::covered_by(),
+ \li \c boost::geometry::index::disjoint(),
+ \li \c boost::geometry::index::intersects() - default,
+ \li \c boost::geometry::index::overlaps(),
+ \li \c boost::geometry::index::within(),
+ \li <tt>! boost::geometry::index::covered_by()</tt>,
+ \li <tt>! boost::geometry::index::disjoint()</tt>,
+ \li <tt>! boost::geometry::index::intersects()</tt>,
+ \li <tt>! boost::geometry::index::overlaps()</tt>,
+ \li <tt>! boost::geometry::index::within()</tt>
+ \li \c boost::geometry::index::value().
+
+ Those predicates may be passed together in
+ \c std::pair or \c boost::tuple.
+
+ \param pred The spatial predicates or a Geometry.
+ \param out_it The output iterator of the result range. E.g. an iterator generated by
+ std::back_inserter(container)
+
+ \return The number of values found.
+
+ \par Throws
+ \li If Value copy constructor or copy assignment throws.
+ \li If OutIter dereference or increment throws.
+ */
+ template <typename Predicates, typename OutIter>
+ inline size_type spatial_query(Predicates const& pred, OutIter out_it) const
+ {
+ if ( !m_root )
+ return 0;
+
+ detail::rtree::visitors::spatial_query<value_type, options_type, translator_type, box_type, allocators_type, Predicates, OutIter>
+ find_v(m_translator, pred, out_it);
+
+ detail::rtree::apply_visitor(find_v, *m_root);
+
+ return find_v.found_count;
+ }
+
+ /*!
+ \brief Finds one value meeting distances predicates, e.g. nearest to some Point.
+
+ <b>Distances predicates</b> may be a \c Point. In this the case the Value closest to \c Point is returned.
+
+ It is possible to define how distance to Value is calculated. This is done by passing PointRelation.
+ It can be generated by following functions:
+ \li \c boost::geometry::index::to_nearest() - default,
+ \li \c boost::geometry::index::to_centroid(),
+ \li \c boost::geometry::index::to_furthest().
+
+ It is possible to define define distances bounds, for example that some distance must be between
+ min_distance and max_distance. This is done by passing DistancesPredicates which can be generated
+ by following functions:
+ \li \c boost::geometry::index::unbounded() - default,
+ \li \c boost::geometry::index::min_bounded(),
+ \li \c boost::geometry::index::max_bounded(),
+ \li \c boost::geometry::index::bounded().
+
+ MinRelation and MaxRelation describes bounds and can be generated by following functions:
+ \li \c boost::geometry::index::to_nearest(),
+ \li \c boost::geometry::index::to_centroid(),
+ \li \c boost::geometry::index::to_furthest().
+
+ \param dpred The distances predicates or a Point.
+
+ \param v The reference to the object which will contain the result.
+
+ \return The number of values found.
+
+ \par Throws
+ If Value copy constructor or copy assignment throws.
+ */
+ template <typename DistancesPredicates>
+ inline size_type nearest_query(DistancesPredicates const& dpred, value_type & v) const
+ {
+ return raw_nearest_one(dpred, detail::empty(), v);
+ }
+
+ /*!
+ \brief Finds one value meeting distances predicates and spatial predicates,
+ e.g. nearest to some Point and intersecting some Box.
+
+ <b>Distances predicates</b> may be a \c Point. In this the case the Value closest to \c Point is returned.
+
+ It is possible to define how distance to Value is calculated. This is done by passing PointRelation.
+ It can be generated by following functions:
+ \li \c boost::geometry::index::to_nearest() - default,
+ \li \c boost::geometry::index::to_centroid(),
+ \li \c boost::geometry::index::to_furthest().
+
+ It is possible to define define distances bounds, for example that some distance must be between
+ min_distance and max_distance. This is done by passing DistancesPredicates which can be generated
+ by following functions:
+ \li \c boost::geometry::index::unbounded() - default,
+ \li \c boost::geometry::index::min_bounded(),
+ \li \c boost::geometry::index::max_bounded(),
+ \li \c boost::geometry::index::bounded().
+
+ MinRelation and MaxRelation describes bounds and can be generated by following functions:
+ \li \c boost::geometry::index::to_nearest(),
+ \li \c boost::geometry::index::to_centroid(),
+ \li \c boost::geometry::index::to_furthest().
+
+ <b>Spatial predicates</b> may be a \c Geometry. In this case Values intersecting the \c Geometry are returned.
+
+ It may be generated by one of the functions listed below:
+ \li \c boost::geometry::index::covered_by(),
+ \li \c boost::geometry::index::disjoint(),
+ \li \c boost::geometry::index::intersects() - default,
+ \li \c boost::geometry::index::overlaps(),
+ \li \c boost::geometry::index::within(),
+ \li <tt>! boost::geometry::index::covered_by()</tt>,
+ \li <tt>! boost::geometry::index::disjoint()</tt>,
+ \li <tt>! boost::geometry::index::intersects()</tt>,
+ \li <tt>! boost::geometry::index::overlaps()</tt>,
+ \li <tt>! boost::geometry::index::within()</tt>
+ \li \c boost::geometry::index::value().
+
+ Those predicates may be passed together in
+ \c std::pair or \c boost::tuple.
+
+ \param dpred The distances predicates or a Point.
+ \param pred The spatial predicates or a Geometry
+ \param v The reference to the object which will contain the result.
+
+ \return The number of values found.
+
+ \par Throws
+ If Value copy constructor or copy assignment throws.
+ */
+ template <typename DistancesPredicates, typename Predicates>
+ inline size_type nearest_query(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const
+ {
+ return raw_nearest_one(dpred, pred, v);
+ }
+
+ /*!
+ \brief Finds k values meeting distances predicates, e.g. k nearest values to some Point.
+
+ <b>Distances predicates</b> may be a \c Point. In this the case the Value closest to \c Point is returned.
+
+ It is possible to define how distance to Value is calculated. This is done by passing PointRelation.
+ It can be generated by following functions:
+ \li \c boost::geometry::index::to_nearest() - default,
+ \li \c boost::geometry::index::to_centroid(),
+ \li \c boost::geometry::index::to_furthest().
+
+ It is possible to define define distances bounds, for example that some distance must be between
+ min_distance and max_distance. This is done by passing DistancesPredicates which can be generated
+ by following functions:
+ \li \c boost::geometry::index::unbounded() - default,
+ \li \c boost::geometry::index::min_bounded(),
+ \li \c boost::geometry::index::max_bounded(),
+ \li \c boost::geometry::index::bounded().
+
+ MinRelation and MaxRelation describes bounds and can be generated by following functions:
+ \li \c boost::geometry::index::to_nearest(),
+ \li \c boost::geometry::index::to_centroid(),
+ \li \c boost::geometry::index::to_furthest().
+
+ \param dpred The distances predicates or a Point.
+ \param k The max number of values.
+ \param out_it The output iterator of the result range. E.g. a back_insert_iterator.
+
+ \return The number of values found.
+
+ \par Throws
+ If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws.
+ */
+ template <typename DistancesPredicates, typename OutIter>
+ inline size_type nearest_query(DistancesPredicates const& dpred, size_type k, OutIter out_it) const
+ {
+ return raw_nearest_k(dpred, k, detail::empty(), out_it);
+ }
+
+ /*!
+ \brief Finds k values meeting distances predicates and spatial predicates,
+ e.g. k nearest values to some Point and intersecting some Box.
+
+ <b>Distances predicates</b> may be a \c Point. In this the case the Value closest to \c Point is returned.
+
+ It is possible to define how distance to Value is calculated. This is done by passing PointRelation.
+ It can be generated by following functions:
+ \li \c boost::geometry::index::to_nearest() - default,
+ \li \c boost::geometry::index::to_centroid(),
+ \li \c boost::geometry::index::to_furthest().
+
+ It is possible to define define distances bounds, for example that some distance must be between
+ min_distance and max_distance. This is done by passing DistancesPredicates which can be generated
+ by following functions:
+ \li \c boost::geometry::index::unbounded() - default,
+ \li \c boost::geometry::index::min_bounded(),
+ \li \c boost::geometry::index::max_bounded(),
+ \li \c boost::geometry::index::bounded().
+
+ MinRelation and MaxRelation describes bounds and can be generated by following functions:
+ \li \c boost::geometry::index::to_nearest(),
+ \li \c boost::geometry::index::to_centroid(),
+ \li \c boost::geometry::index::to_furthest().
+
+ <b>Spatial predicates</b> may be a \c Geometry. In this case Values intersecting the \c Geometry are returned.
+
+ It may be generated by one of the functions listed below:
+ \li \c boost::geometry::index::covered_by(),
+ \li \c boost::geometry::index::disjoint(),
+ \li \c boost::geometry::index::intersects() - default,
+ \li \c boost::geometry::index::overlaps(),
+ \li \c boost::geometry::index::within(),
+ \li <tt>! boost::geometry::index::covered_by()</tt>,
+ \li <tt>! boost::geometry::index::disjoint()</tt>,
+ \li <tt>! boost::geometry::index::intersects()</tt>,
+ \li <tt>! boost::geometry::index::overlaps()</tt>,
+ \li <tt>! boost::geometry::index::within()</tt>
+ \li \c boost::geometry::index::value().
+
+ Those predicates may be passed together in
+ \c std::pair or \c boost::tuple.
+
+ \param dpred The distances predicates or a Point
+ \param k The max number of values.
+ \param pred The spatial predicates or a Geometry.
+ \param out_it The output iterator of the result range. E.g. a back_insert_iterator.
+
+ \return The number of values found.
+
+ \par Throws
+ If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws.
+ */
+ template <typename DistancesPredicates, typename Predicates, typename OutIter>
+ inline size_type nearest_query(DistancesPredicates const& dpred, size_type k, Predicates const& pred, OutIter out_it) const
+ {
+ return raw_nearest_k(dpred, k, pred, out_it);
+ }
+
+ /*!
+ \brief Returns the number of stored values.
+
+ \return The number of stored values.
+
+ \par Throws
+ Nothing.
+ */
+ inline size_type size() const
+ {
+ return m_values_count;
+ }
+
+ /*!
+ \brief Query if the container is empty.
+
+ \return true if the container is empty.
+
+ \par Throws
+ Nothing.
+ */
+ inline bool empty() const
+ {
+ return 0 == m_values_count;
+ }
+
+ /*!
+ \brief Removes all values stored in the container.
+
+ \par Throws
+ Nothing.
+ */
+ inline void clear()
+ {
+ this->raw_destroy(*this);
+ geometry::assign_inverse(m_box);
+ }
+
+ /*!
+ \brief Returns the box able to contain all values stored in the container.
+
+ Returns the box able to contain all values stored in the container.
+ If the container is empty the result of \c geometry::assign_inverse() is returned.
+
+ \return The box able to contain all values stored in the container or an invalid box if
+ there are no values in the container.
+
+ \par Throws
+ Nothing.
+ */
+ inline envelope_type const& envelope() const
+ {
+ return m_box;
+ }
+
+ /*!
+ \brief Count Values or Indexables stored in the container.
+
+ For indexable_type it returns the number of values which indexables equals the parameter.
+ For value_type it returns the number of values which equals the parameter.
+
+ \param vori The value or indexable which will be counted.
+
+ \return The number of values found.
+
+ \par Throws
+ Nothing.
+ */
+ template <typename ValueOrIndexable>
+ size_type count(ValueOrIndexable const& vori) const
+ {
+ if ( !m_root )
+ return 0;
+
+ detail::rtree::visitors::count<ValueOrIndexable, value_type, options_type, translator_type, box_type, allocators_type>
+ count_v(vori, m_translator);
+
+ detail::rtree::apply_visitor(count_v, *m_root);
+
+ return count_v.found_count;
+ }
+
+ /*!
+ \brief Returns parameters.
+
+ \return The parameters object.
+
+ \par Throws
+ Nothing.
+ */
+ inline parameters_type const& parameters() const
+ {
+ return m_parameters;
+ }
+
+ /*!
+ \brief Returns the translator object.
+
+ \return The translator object.
+
+ \par Throws
+ Nothing.
+ */
+ inline translator_type const& translator() const
+ {
+ return m_translator;
+ }
+
+ /*!
+ \brief Returns allocator used by the rtree.
+
+ \return The allocator.
+
+ \par Throws
+ If allocator copy constructor throws.
+ */
+ allocator_type get_allocator() const
+ {
+ return m_allocators.allocator;
+ }
+
+#if !defined(BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE)
+private:
+#endif
+ /*!
+ \brief Apply a visitor to the nodes structure in order to perform some operator.
+
+ This function is not a part of the 'official' interface. However it makes
+ possible e.g. to pass a visitor drawing the tree structure.
+
+ \param visitor The visitor object.
+
+ \par Throws
+ If Visitor::operator() throws.
+ */
+ template <typename Visitor>
+ inline void apply_visitor(Visitor & visitor) const
+ {
+ if ( m_root )
+ detail::rtree::apply_visitor(visitor, *m_root);
+ }
+
+ /*!
+ \brief Returns the number of stored objects. Same as size().
+
+ This function is not a part of the 'official' interface.
+
+ \return The number of stored objects.
+
+ \par Throws
+ Nothing.
+ */
+ inline size_type values_count() const
+ {
+ return m_values_count;
+ }
+
+ /*!
+ \brief Returns the depth of the R-tree.
+
+ This function is not a part of the 'official' interface.
+
+ \return The depth of the R-tree.
+
+ \par Throws
+ Nothing.
+ */
+ inline size_type depth() const
+ {
+ return m_leafs_level;
+ }
+
+private:
+ /*!
+ \pre Root node must exist - m_root != 0.
+
+ \brief Insert a value to the index.
+
+ \param value The value which will be stored in the container.
+
+ \par Exception-safety
+ basic
+ */
+ inline void raw_insert(value_type const& value)
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(m_root, "The root must exist");
+ BOOST_GEOMETRY_INDEX_ASSERT(detail::is_valid(m_translator(value)), "Indexable is invalid");
+
+ geometry::expand(m_box, m_translator(value));
+
+ detail::rtree::visitors::insert<
+ value_type,
+ value_type, options_type, translator_type, box_type, allocators_type,
+ typename options_type::insert_tag
+ > insert_v(m_root, m_leafs_level, value, m_parameters, m_translator, m_allocators);
+
+ detail::rtree::apply_visitor(insert_v, *m_root);
+
+// TODO
+// Think about this: If exception is thrown, may the root be removed?
+// Or it is just cleared?
+
+// TODO
+// If exception is thrown, m_values_count may be invalid
+ ++m_values_count;
+ }
+
+ /*!
+ \brief Remove the value from the container.
+
+ \param value The value which will be removed from the container.
+
+ \par Exception-safety
+ basic
+ */
+ inline size_type raw_remove(value_type const& value)
+ {
+ // TODO: awulkiew - assert for correct value (indexable) ?
+ BOOST_GEOMETRY_INDEX_ASSERT(m_root, "The root must exist");
+
+ detail::rtree::visitors::remove<
+ value_type, options_type, translator_type, box_type, allocators_type
+ > remove_v(m_root, m_leafs_level, m_box, value, m_parameters, m_translator, m_allocators);
+
+ detail::rtree::apply_visitor(remove_v, *m_root);
+
+ // If exception is thrown, m_values_count may be invalid
+
+ if ( remove_v.is_value_removed() )
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(0 < m_values_count, "unexpected state");
+
+ --m_values_count;
+
+ return 1;
+ }
+
+ return 0;
+ }
+
+ /*!
+ \brief Create an empty R-tree i.e. new empty root node and clear other attributes.
+
+ \par Exception-safety
+ strong
+ */
+ inline void raw_create()
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(0 == m_root, "the tree is already created");
+
+ m_root = detail::rtree::create_node<allocators_type, leaf>::apply(m_allocators); // MAY THROW (N: alloc)
+ m_values_count = 0;
+ m_leafs_level = 0;
+ }
+
+ /*!
+ \brief Destroy the R-tree i.e. all nodes and clear attributes.
+
+ \param t The container which is going to be destroyed.
+
+ \par Exception-safety
+ nothrow
+ */
+ inline void raw_destroy(rtree & t)
+ {
+ if ( t.m_root )
+ {
+ detail::rtree::visitors::destroy<value_type, options_type, translator_type, box_type, allocators_type> del_v(t.m_root, t.m_allocators);
+ detail::rtree::apply_visitor(del_v, *t.m_root);
+
+ t.m_root = 0;
+ }
+ t.m_values_count = 0;
+ t.m_leafs_level = 0;
+ }
+
+ /*!
+ \brief Copy the R-tree i.e. whole nodes structure, values and other attributes.
+ It uses destination's allocators to create the new structure.
+
+ \param src The source R-tree.
+ \param dst The destination R-tree.
+
+ \par Exception-safety
+ strong
+ */
+ inline void raw_copy(rtree const& src, rtree & dst, bool copy_all_internals) const
+ {
+ detail::rtree::visitors::copy<value_type, options_type, translator_type, box_type, allocators_type> copy_v(dst.m_allocators);
+
+ if ( src.m_root )
+ detail::rtree::apply_visitor(copy_v, *src.m_root); // MAY THROW (V, E: alloc, copy, N: alloc)
+
+ if ( copy_all_internals )
+ {
+ dst.m_translator = src.m_translator; // SHOULDN'T THROW
+
+ dst.m_parameters = src.m_parameters;
+ //dst.m_allocators = dst.m_allocators;
+ }
+
+ if ( dst.m_root )
+ {
+ detail::rtree::visitors::destroy<value_type, options_type, translator_type, box_type, allocators_type> del_v(dst.m_root, dst.m_allocators);
+ detail::rtree::apply_visitor(del_v, *dst.m_root);
+ dst.m_root = 0;
+ }
+
+ dst.m_root = copy_v.result;
+ dst.m_values_count = src.m_values_count;
+ dst.m_leafs_level = src.m_leafs_level;
+ }
+
+ /*!
+ \brief Find one value meeting distances and spatial predicates.
+
+ \par Exception-safety
+ strong
+ */
+ template <typename DistancesPredicates, typename Predicates>
+ inline size_type raw_nearest_one(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const
+ {
+ if ( !m_root )
+ return 0;
+
+ typedef typename detail::point_relation<DistancesPredicates>::type point_relation;
+ typedef typename detail::relation<point_relation>::value_type point_type;
+
+ typedef detail::rtree::visitors::nearest_query_result_one<
+ value_type,
+ translator_type,
+ point_type
+ > result_type;
+
+ result_type result(v);
+
+ detail::rtree::visitors::nearest_query<
+ value_type,
+ options_type,
+ translator_type,
+ box_type,
+ allocators_type,
+ DistancesPredicates,
+ Predicates,
+ result_type
+ > nearest_v(m_parameters, m_translator, dpred, pred, result);
+
+ detail::rtree::apply_visitor(nearest_v, *m_root);
+
+ return result.finish();
+ }
+
+ /*!
+ \brief Find k values meeting distances and spatial predicates.
+
+ \par Exception-safety
+ strong
+ */
+ template <typename DistancesPredicates, typename Predicates, typename OutIter>
+ inline size_type raw_nearest_k(DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) const
+ {
+ if ( !m_root )
+ return 0;
+
+ typedef typename detail::point_relation<DistancesPredicates>::type point_relation;
+ typedef typename detail::relation<point_relation>::value_type point_type;
+
+ typedef detail::rtree::visitors::nearest_query_result_k<
+ value_type,
+ translator_type,
+ point_type,
+ OutIter
+ > result_type;
+
+ result_type result(k, out_it);
+
+ detail::rtree::visitors::nearest_query<
+ value_type,
+ options_type,
+ translator_type,
+ box_type,
+ allocators_type,
+ DistancesPredicates,
+ Predicates,
+ result_type
+ > nearest_v(m_parameters, m_translator, dpred, pred, result);
+
+ detail::rtree::apply_visitor(nearest_v, *m_root);
+
+ return result.finish();
+ }
+
+ translator_type m_translator;
+ Parameters m_parameters;
+ allocators_type m_allocators;
+
+ size_type m_values_count;
+ size_type m_leafs_level;
+ node * m_root;
+
+ box_type m_box;
+};
+
+/*!
+\brief Insert a value to the index.
+
+It calls <tt>rtree::insert(value_type const&)</tt>.
+
+\ingroup rtree_functions
+
+\param tree The spatial index.
+\param v The value which will be stored in the index.
+*/
+template <typename Value, typename Options, typename Translator, typename Allocator>
+inline void insert(rtree<Value, Options, Translator, Allocator> & tree, Value const& v)
+{
+ tree.insert(v);
+}
+
+/*!
+\brief Insert a range of values to the index.
+
+It calls <tt>rtree::insert(Iterator, Iterator)</tt>.
+
+\ingroup rtree_functions
+
+\param tree The spatial index.
+\param first The beginning of the range of values.
+\param last The end of the range of values.
+*/
+template<typename Value, typename Options, typename Translator, typename Allocator, typename Iterator>
+inline void insert(rtree<Value, Options, Translator, Allocator> & tree, Iterator first, Iterator last)
+{
+ tree.insert(first, last);
+}
+
+/*!
+\brief Insert a range of values to the index.
+
+It calls <tt>rtree::insert(Range const&)</tt>.
+
+\ingroup rtree_functions
+
+\param tree The spatial index.
+\param rng The range of values.
+*/
+template<typename Value, typename Options, typename Translator, typename Allocator, typename Range>
+inline void insert(rtree<Value, Options, Translator, Allocator> & tree, Range const& rng)
+{
+ tree.insert(rng);
+}
+
+/*!
+\brief Remove a value from the container.
+
+Remove a value from the container. In contrast to the \c std::set or <tt>std::map erase()</tt> method
+this function removes only one value from the container.
+
+It calls <tt>rtree::remove(value_type const&)</tt>.
+
+\ingroup rtree_functions
+
+\param tree The spatial index.
+\param v The value which will be removed from the index.
+
+\return 1 if value was removed, 0 otherwise.
+*/
+template <typename Value, typename Options, typename Translator, typename Allocator>
+inline typename rtree<Value, Options, Translator, Allocator>::size_type
+remove(rtree<Value, Options, Translator, Allocator> & tree, Value const& v)
+{
+ return tree.remove(v);
+}
+
+/*!
+\brief Remove a range of values from the container.
+
+Remove a range of values from the container. In contrast to the \c std::set or <tt>std::map erase()</tt> method
+it doesn't take iterators pointing to values stored in this container. It removes values equal
+to these passed as a range. Furthermore this function removes only one value for each one passed
+in the range, not all equal values.
+
+It calls <tt>rtree::remove(Iterator, Iterator)</tt>.
+
+\ingroup rtree_functions
+
+\param tree The spatial index.
+\param first The beginning of the range of values.
+\param last The end of the range of values.
+
+\return The number of removed values.
+*/
+template<typename Value, typename Options, typename Translator, typename Allocator, typename Iterator>
+inline typename rtree<Value, Options, Translator, Allocator>::size_type
+remove(rtree<Value, Options, Translator, Allocator> & tree, Iterator first, Iterator last)
+{
+ return tree.remove(first, last);
+}
+
+/*!
+\brief Remove a range of values from the container.
+
+Remove a range of values from the container. In contrast to the \c std::set or <tt>std::map erase()</tt> method
+it removes values equal to these passed as a range. Furthermore this method removes only
+one value for each one passed in the range, not all equal values.
+
+It calls <tt>rtree::remove(Range const&)</tt>.
+
+\ingroup rtree_functions
+
+\param tree The spatial index.
+\param rng The range of values.
+
+\return The number of removed values.
+*/
+template<typename Value, typename Options, typename Translator, typename Allocator, typename Range>
+inline typename rtree<Value, Options, Translator, Allocator>::size_type
+remove(rtree<Value, Options, Translator, Allocator> & tree, Range const& rng)
+{
+ return tree.remove(rng);
+}
+
+/*!
+\brief Find values meeting spatial predicates.
+
+It calls \c rtree::spatial_query with parameters <tt>(Predicates const&, OutIter)</tt>.
+
+\ingroup rtree_functions
+
+\param tree The spatial index.
+\param pred The spatial predicates.
+\param out_it The output iterator of the result range.
+
+\return The number of found values.
+*/
+template <typename Value, typename Options, typename Translator, typename Allocator, typename Predicates, typename OutIter>
+inline size_t spatial_query(rtree<Value, Options, Translator, Allocator> const& tree, Predicates const& pred, OutIter out_it)
+{
+ return tree.spatial_query(pred, out_it);
+}
+
+/*!
+\brief Find the value meeting distances predicates.
+
+It calls \c rtree::nearest_query with parameters <tt>(DistancesPredicates const& dpred, value_type & v)</tt>.
+
+\ingroup rtree_functions
+
+\param tree The spatial index.
+\param dpred The distances predicates.
+\param v The result.
+
+\return The number of found values.
+*/
+template <typename Value, typename Options, typename Translator, typename Allocator, typename DistancesPredicates>
+inline size_t nearest_query(rtree<Value, Options, Translator, Allocator> const& tree, DistancesPredicates const& dpred, Value & v)
+{
+ return tree.nearest_query(dpred, v);
+}
+
+/*!
+\brief Find the value meeting distances and spatial predicates.
+
+It calls \c rtree::nearest_query with parameters <tt>(DistancesPredicates const& dpred, Predicates const& pred, value_type & v)</tt>.
+
+\ingroup rtree_functions
+
+\param tree The spatial index.
+\param dpred The distances predicates.
+\param pred The spatial predicates.
+\param v The result.
+
+\return The number of found values.
+*/
+template <typename Value, typename Options, typename Translator, typename Allocator, typename DistancesPredicates, typename Predicates>
+inline size_t nearest_query(rtree<Value, Options, Translator, Allocator> const& tree, DistancesPredicates const& dpred, Predicates const& pred, Value & v)
+{
+ return tree.nearest_query(dpred, pred, v);
+}
+
+/*!
+\brief Find k values meeting distances predicates.
+
+It calls \c rtree::nearest_query with parameters <tt>(DistancesPredicates const & dpred, size_type k, OutIter out_it)</tt>.
+
+\ingroup rtree_functions
+
+\param tree The spatial index.
+\param dpred The distances predicates.
+\param k The max number of values.
+\param out_it The output iterator of the result range.
+
+\return The number of found values.
+*/
+template <typename Value, typename Options, typename Translator, typename Allocator, typename DistancesPredicates, typename OutIter>
+inline size_t nearest_query(rtree<Value, Options, Translator, Allocator> const& tree, DistancesPredicates const& dpred, typename rtree<Value, Options, Translator, Allocator>::size_type k, OutIter out_it)
+{
+ return tree.nearest_query(dpred, k, out_it);
+}
+
+/*!
+\brief Find k values meeting distances and spatial predicates.
+
+It calls \c rtree::nearest_query with parameters <tt>(DistancesPredicates const & dpred, size_type k, Predicates const & pred, OutIter out_it)</tt>.
+
+\ingroup rtree_functions
+
+\param tree The spatial index.
+\param dpred The distances predicates.
+\param k The max number of values.
+\param pred The spatial predicates.
+\param out_it The output iterator of the result range.
+
+\return The number of found values.
+*/
+template <typename Value, typename Options, typename Translator, typename Allocator, typename DistancesPredicates, typename Predicates, typename OutIter>
+inline size_t nearest_query(rtree<Value, Options, Translator, Allocator> const& tree, DistancesPredicates const& dpred, typename rtree<Value, Options, Translator, Allocator>::size_type k, Predicates const& pred, OutIter out_it)
+{
+ return tree.nearest_query(dpred, k, pred, out_it);
+}
+
+/*!
+\brief Remove all values from the index.
+
+It calls \c rtree::clear().
+
+\ingroup rtree_functions
+
+\param tree The spatial index.
+*/
+template <typename Value, typename Options, typename Translator, typename Allocator>
+inline void clear(rtree<Value, Options, Translator, Allocator> & tree)
+{
+ return tree.clear();
+}
+
+/*!
+\brief Get the number of values stored in the index.
+
+It calls \c rtree::size().
+
+\ingroup rtree_functions
+
+\param tree The spatial index.
+
+\return The number of values stored in the index.
+*/
+template <typename Value, typename Options, typename Translator, typename Allocator>
+inline size_t size(rtree<Value, Options, Translator, Allocator> const& tree)
+{
+ return tree.size();
+}
+
+/*!
+\brief Query if there are no values stored in the index.
+
+It calls \c rtree::empty().
+
+\ingroup rtree_functions
+
+\param tree The spatial index.
+
+\return true if there are no values in the index.
+*/
+template <typename Value, typename Options, typename Translator, typename Allocator>
+inline bool empty(rtree<Value, Options, Translator, Allocator> const& tree)
+{
+ return tree.empty();
+}
+
+/*!
+\brief Get the box containing all stored values or an invalid box if the index has no values.
+
+It calls \c rtree::envelope().
+
+\ingroup rtree_functions
+
+\param tree The spatial index.
+
+\return The box containing all stored values or an invalid box.
+*/
+template <typename Value, typename Options, typename Translator, typename Allocator>
+inline typename rtree<Value, Options, Translator, Allocator>::box_type const&
+envelope(rtree<Value, Options, Translator, Allocator> const& tree)
+{
+ return tree.envelope();
+}
+
+}}} // namespace boost::geometry::index
+
+// Rtree adaptation to Box concept
+
+namespace boost { namespace geometry {
+
+// Traits specializations for box above
+#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
+namespace traits
+{
+
+template <typename Value, typename Parameters, typename Translator, typename Allocator>
+struct tag< index::rtree<Value, Parameters, Translator, Allocator> >
+{
+ typedef box_tag type;
+};
+
+template <typename Value, typename Parameters, typename Translator, typename Allocator>
+struct point_type< index::rtree<Value, Parameters, Translator, Allocator> >
+{
+ typedef typename geometry::point_type<
+ typename index::rtree<Value, Parameters, Translator, Allocator>::box_type
+ >::type type;
+};
+
+template <typename Value, typename Parameters, typename Translator, typename Allocator, std::size_t Dimension>
+struct indexed_access<index::rtree<Value, Parameters, Translator, Allocator>, min_corner, Dimension>
+{
+ typedef typename geometry::coordinate_type<
+ typename geometry::point_type<
+ index::rtree<Value, Parameters, Translator, Allocator>
+ >::type
+ >::type coordinate_type;
+
+ static inline coordinate_type get(index::rtree<Value, Parameters, Translator, Allocator> const& tree)
+ {
+ return geometry::get<min_corner, Dimension>(tree.envelope());
+ }
+
+ static inline void set(index::rtree<Value, Parameters, Translator, Allocator> & tree,
+ coordinate_type const& value)
+ {
+ return geometry::set<min_corner, Dimension>(tree.envelope(), value);
+ }
+};
+
+template <typename Value, typename Parameters, typename Translator, typename Allocator, std::size_t Dimension>
+struct indexed_access<index::rtree<Value, Parameters, Translator, Allocator>, max_corner, Dimension>
+{
+ typedef typename geometry::coordinate_type<
+ typename geometry::point_type<
+ index::rtree<Value, Parameters, Translator, Allocator>
+ >::type
+ >::type coordinate_type;
+
+ static inline coordinate_type get(index::rtree<Value, Parameters, Translator, Allocator> const& tree)
+ {
+ return geometry::get<max_corner, Dimension>(tree.envelope());
+ }
+
+ static inline void set(index::rtree<Value, Parameters, Translator, Allocator> & tree,
+ coordinate_type const& value)
+ {
+ return geometry::set<max_corner, Dimension>(tree.envelope(), value);
+ }
+};
+
+} // namespace traits
+#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
+
+}} //namespace boost::geometry
+
+#endif // BOOST_GEOMETRY_INDEX_RTREE_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/translator/def.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/translator/def.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,153 @@
+// Boost.Geometry Index
+//
+// Default translator
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_TRANSLATOR_DEF_HPP
+#define BOOST_GEOMETRY_INDEX_TRANSLATOR_DEF_HPP
+
+#include <boost/geometry/index/translator/helpers.hpp>
+
+namespace boost { namespace geometry { namespace index { namespace translator {
+
+/*!
+\brief The default translator.
+
+It translates Value object to Indexable object. The default version handles Values which are Indexables.
+This translator is also specialized for std::pair<Indexable, Second> and boost::tuple<Indexable, ...>.
+
+\tparam Value The Value type which may be translated directly to the Indexable.
+*/
+template <typename Value>
+struct def
+{
+ BOOST_MPL_ASSERT_MSG(
+ (!detail::indexable_not_found_error<
+ typename geometry::index::detail::traits::indexable_type<Value>::type
+ >::value),
+ NOT_VALID_INDEXABLE_TYPE,
+ (Value)
+ );
+
+ typedef Value const& result_type;
+
+ result_type operator()(Value const& value) const
+ {
+ return value;
+ }
+
+ bool equals(Value const& v1, Value const& v2) const
+ {
+ return geometry::equals(v1, v2);
+ }
+};
+
+/*!
+\brief The default translator.
+
+This specialization translates from std::pair<Indexable, Second>.
+
+\tparam Indexable The Indexable type.
+\tparam Second The second type.
+*/
+template <typename Indexable, typename Second>
+struct def< std::pair<Indexable, Second> >
+{
+ BOOST_MPL_ASSERT_MSG(
+ (!detail::indexable_not_found_error<
+ typename geometry::index::detail::traits::indexable_type<Indexable>::type
+ >::value),
+ NOT_VALID_INDEXABLE_TYPE,
+ (Indexable)
+ );
+
+ typedef Indexable const& result_type;
+
+ result_type operator()(std::pair<Indexable, Second> const& value) const
+ {
+ return value.first;
+ }
+
+ bool equals(std::pair<Indexable, Second> const& v1, std::pair<Indexable, Second> const& v2) const
+ {
+ return geometry::equals(v1.first, v2.first)
+ &&
+ dispatch::equals<
+ Second,
+ typename geometry::traits::tag<Second>::type
+ >::apply(v1.second, v2.second);
+ }
+};
+
+namespace detail
+{
+
+template <typename Tuple, size_t I, size_t N>
+struct compare_tuples
+{
+ inline static bool apply(Tuple const& t1, Tuple const& t2)
+ {
+ typedef typename boost::tuples::element<I, Tuple>::type T;
+ return dispatch::equals<
+ T,
+ typename geometry::traits::tag<T>::type
+ >::apply(boost::get<I>(t1), boost::get<I>(t2))
+ &&
+ compare_tuples<Tuple, I+1, N>::apply(t1, t2);
+ }
+};
+
+template <typename Tuple, size_t I>
+struct compare_tuples<Tuple, I, I>
+{
+ inline static bool apply(Tuple const&, Tuple const&)
+ {
+ return true;
+ }
+};
+
+} // namespace detail
+
+/*!
+\brief The default translator.
+
+This specialization translates from boost::tuple<Indexable, ...>.
+
+\tparam Indexable The Indexable type.
+*/
+template <typename Indexable, typename T1, typename T2, typename T3, typename T4,
+ typename T5, typename T6, typename T7, typename T8, typename T9>
+struct def< boost::tuple<Indexable, T1, T2, T3, T4, T5, T6, T7, T8, T9> >
+{
+ typedef boost::tuple<Indexable, T1, T2, T3, T4, T5, T6, T7, T8, T9> value_type;
+
+ BOOST_MPL_ASSERT_MSG(
+ (!detail::indexable_not_found_error<
+ typename geometry::index::detail::traits::indexable_type<Indexable>::type
+ >::value),
+ NOT_VALID_INDEXABLE_TYPE,
+ (Indexable)
+ );
+
+ typedef Indexable const& result_type;
+
+ result_type operator()(value_type const& value) const
+ {
+ return boost::get<0>(value);
+ }
+
+ bool equals(value_type const& v1, value_type const& v2) const
+ {
+ return detail::compare_tuples<value_type, 0, boost::tuples::length<value_type>::value>
+ ::apply(v1, v2);
+ }
+};
+
+}}}} // namespace boost::geometry::index::translator
+
+#endif // BOOST_GEOMETRY_INDEX_TRANSLATOR_DEF_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/translator/helpers.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/translator/helpers.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,194 @@
+// Boost.Geometry Index
+//
+// Translators helper functions
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_TRANSLATOR_HELPERS_HPP
+#define BOOST_GEOMETRY_INDEX_TRANSLATOR_HELPERS_HPP
+
+#include <utility>
+
+#include <boost/static_assert.hpp>
+
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/has_xxx.hpp>
+#include <boost/mpl/and.hpp>
+
+#include <boost/geometry/algorithms/equals.hpp>
+
+#include <boost/geometry/index/detail/indexable.hpp>
+
+namespace boost { namespace geometry { namespace index { namespace translator {
+
+namespace dispatch {
+
+// Extract object from std::pair by non-void tag
+
+template <typename Pair, typename FirstTag, typename SecondTag>
+struct choose_pair_element
+{
+ typedef typename Pair::first_type type;
+ static type const& get(Pair const& p) { return p.first; }
+};
+
+template <typename Pair, typename FirstTag>
+struct choose_pair_element<Pair, FirstTag, void>
+{
+ typedef typename Pair::first_type type;
+ static type const& get(Pair const& p) { return p.first; }
+};
+
+template <typename Pair, typename Second>
+struct choose_pair_element<Pair, void, Second>
+{
+ typedef typename Pair::second_type type;
+ static type const& get(Pair const& p) { return p.second; }
+};
+
+template <typename Pair>
+struct choose_pair_element<Pair, void, void>
+{
+ typedef void type;
+};
+
+} // namespace dispatch
+
+namespace detail {
+
+template <typename Geometry>
+struct indexable_not_found_error
+{
+ static const bool value = false;
+};
+template <>
+struct indexable_not_found_error<void>
+{
+ static const bool value = true;
+};
+
+// Extract indexable
+
+template <typename Value>
+struct extract_indexable
+{
+ typedef Value type;
+
+ BOOST_STATIC_ASSERT(!indexable_not_found_error<type>::value);
+
+ static type const& get(Value const& v) { return v; }
+};
+
+template <typename First, typename Second>
+struct extract_indexable< std::pair<First, Second> >
+{
+ typedef typename dispatch::choose_pair_element<
+ std::pair<First, Second>,
+ typename index::detail::traits::indexable_type<First>::type,
+ typename index::detail::traits::indexable_type<Second>::type
+ > cp;
+
+ typedef typename cp::type type;
+
+ BOOST_STATIC_ASSERT(!indexable_not_found_error<type>::value);
+
+ static type const& get(std::pair<First, Second> const& v)
+ {
+ return cp::get(v);
+ }
+};
+
+// Recognize iterators and smart pointers
+
+BOOST_MPL_HAS_XXX_TRAIT_DEF(iterator_category)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(value_type)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(difference_type)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(pointer)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(reference)
+
+BOOST_MPL_HAS_XXX_TRAIT_DEF(element_type)
+
+// TODO
+// use has_operator_xxx in the future
+
+template <typename T>
+struct is_iterator
+{
+ static const bool value = boost::mpl::and_
+ <
+ has_iterator_category<T>,
+ has_value_type<T>,
+ has_difference_type<T>,
+ has_pointer<T>,
+ has_reference<T>
+ >::value;
+};
+
+template <typename T>
+struct is_smart_ptr
+{
+ static const bool value = has_element_type<T>::value;
+};
+
+} // namespace detail
+
+namespace dispatch {
+
+template <typename Geometry, typename Tag>
+struct equals
+{
+ static bool apply(Geometry const& g1, Geometry const& g2)
+ {
+ return geometry::equals(g1, g2);
+ }
+};
+
+template <typename T>
+struct equals<T, void>
+{
+ static bool apply(T const& v1, T const& v2)
+ {
+ return v1 == v2;
+ }
+};
+
+} // namespace dispatch
+
+namespace detail {
+
+template <typename Geometry>
+struct equals
+{
+ static bool apply(Geometry const& g1, Geometry const& g2)
+ {
+ return geometry::equals(g1, g2);
+ }
+};
+
+template <typename First, typename Second>
+struct equals< std::pair<First, Second> >
+{
+ static bool apply(std::pair<First, Second> const& p1, std::pair<First, Second> const& p2)
+ {
+ return
+ dispatch::equals<
+ First,
+ typename traits::tag<First>::type
+ >::apply(p1.first, p2.first)
+ &&
+ dispatch::equals<
+ Second,
+ typename traits::tag<Second>::type
+ >::apply(p1.second, p2.second);
+ }
+};
+
+} // namespace detail
+
+}}}} // namespace boost::geometry::index::translator
+
+#endif // BOOST_GEOMETRY_INDEX_TRANSLATOR_HELPERS_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/translator/index.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/translator/index.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,63 @@
+// Boost.Geometry Index
+//
+// Translator translating random-access container index value to Indexable object
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_TRANSLATOR_INDEX_HPP
+#define BOOST_GEOMETRY_INDEX_TRANSLATOR_INDEX_HPP
+
+#include <boost/geometry/index/translator/def.hpp>
+
+namespace boost { namespace geometry { namespace index { namespace translator {
+
+/*!
+\brief The index translator.
+
+This translator translates from index of an element in an external Container to the Indexable.
+The container should have operator[](size_type) defined.
+Index translator uses translator::def<...> to translate from Container::value_type to the Indexable which
+means that it can handle Indexables, std::pairs and boost::tuples stored in an external Container.
+
+\tparam Container The Container type.
+*/
+template <typename Container>
+class index
+{
+ typedef typename Container::value_type value_type;
+ typedef typename Container::size_type size_type;
+
+public:
+ typedef typename translator::def<value_type>::result_type result_type;
+
+ /*!
+ \brief The constructor.
+
+ \param c The container which stores indexed values.
+ */
+ explicit index(Container const& c)
+ : m_c(c)
+ {}
+
+ result_type operator()(size_type i) const
+ {
+ return m_tr(m_c[i]);
+ }
+
+ bool equals(size_type i1, size_type i2) const
+ {
+ return m_tr.equals(m_c[i1], m_c[i2]);
+ }
+
+private:
+ Container const& m_c;
+ translator::def<value_type> m_tr;
+};
+
+}}}} // namespace boost::geometry::index::translator
+
+#endif // BOOST_GEOMETRY_INDEX_TRANSLATOR_INDEX_HPP

Added: sandbox-branches/geometry/index/boost/geometry/index/translator/translator.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/index/translator/translator.hpp 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -0,0 +1,29 @@
+// Boost.Geometry Index
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// 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_INDEX_TRANSLATOR_TRANSLATOR_HPP
+#define BOOST_GEOMETRY_INDEX_TRANSLATOR_TRANSLATOR_HPP
+
+#include <boost/geometry/index/translator/def.hpp>
+#include <boost/geometry/index/translator/index.hpp>
+
+namespace boost { namespace geometry { namespace index { namespace translator {
+
+template <typename Translator>
+struct indexable_type
+{
+ typedef typename boost::remove_const<
+ typename boost::remove_reference<
+ typename Translator::result_type
+ >::type
+ >::type type;
+};
+
+}}}} // namespace boost::geometry::index::translator
+
+#endif // BOOST_GEOMETRY_INDEX_TRANSLATOR_TRANSLATOR_HPP

Modified: sandbox-branches/geometry/index/doc/Doxyfile
==============================================================================
--- sandbox-branches/geometry/index/doc/Doxyfile (original)
+++ sandbox-branches/geometry/index/doc/Doxyfile 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -666,10 +666,9 @@
 # directories like "/usr/src/myproject". Separate the files or directories
 # with spaces.
 
-INPUT = ../boost/geometry/extensions/index/ \
- ../boost/geometry/extensions/index/rtree \
- ../boost/geometry/extensions/index/adaptors \
- ../boost/geometry/extensions/index/translator
+INPUT = ../boost/geometry/index/ \
+ ../boost/geometry/index/adaptors \
+ ../boost/geometry/index/translator
 
 # This tag can be used to specify the character encoding of the source files
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is

Modified: sandbox-branches/geometry/index/doc/generated/rtree.qbk
==============================================================================
--- sandbox-branches/geometry/index/doc/generated/rtree.qbk (original)
+++ sandbox-branches/geometry/index/doc/generated/rtree.qbk 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -38,7 +38,7 @@
 The Translator translates from Value to Indexable each time r-tree requires it. Which means that this operation is done for each Value access. Therefore the Translator should return the Indexable by const reference instead of a value. Default translator can translate all types adapted to Point or Box concepts (called Indexables). It also handles [^`std::pair<Indexable, T>`] and [^`boost::tuple<Indexable, ...>`]. For example, if [^`std::pair<Box, int>`] is stored in the container, the default translator translates from [^`std::pair<Box, int> const&`] to [^`Box const&`].
 
 [heading Header]
-`#include <boost/geometry/extensions/index/rtree.hpp>`
+`#include <boost/geometry/index/rtree.hpp>`
 
 [heading Synopsis]
 [pre
@@ -70,7 +70,7 @@
 [[[#classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d] `allocator_type`][The type of allocator used by the container. ]]
 [[[#classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6] `size_type`][Unsigned integral type used by the container. ]]
 [[[#classboost_1_1geometry_1_1index_1_1rtree_1ac011da09678f034a7fab487a9b973bfc] `indexable_type`][The Indexable type to which Value is translated. ]]
-[[[#classboost_1_1geometry_1_1index_1_1rtree_1a42d0c9efffbc6f3935b5b9c3dd31e50d] `box_type`][The Box type used by the R-tree. ]]
+[[[#classboost_1_1geometry_1_1index_1_1rtree_1a2803990c71c40e6770744d29e5bbd093] `envelope_type`][The Box type used by the R-tree. ]]
 ]
 
 [heading Constructor(s) and destructor]
@@ -89,29 +89,29 @@
 
 [heading Member(s)]
 [table
-[[Function][Description]]
-[[[link classboost_1_1geometry_1_1index_1_1rtree_1ab823a214501cb0f9fd00ba12a1ade179 `operator=(const rtree &)`]][The assignment operator. ]]
-[[[link classboost_1_1geometry_1_1index_1_1rtree_1a44bd4edee49db92c18b6bbbba77b42be `operator=(rtree &&)`]][The moving assignment. ]]
-[[[link classboost_1_1geometry_1_1index_1_1rtree_1aad0285d25f96341a8dd6cc22feb3bd73 `swap(rtree &)`]][Swaps contents of two rtrees. ]]
-[[[link classboost_1_1geometry_1_1index_1_1rtree_1af6d5bd81e46cb4ff89277c753133664c `insert(value_type const &)`]][Insert a value to the index. ]]
-[[[link classboost_1_1geometry_1_1index_1_1rtree_1a5263a3faac7b4f0090d4ad1d44cc540d `insert(Iterator, Iterator)`]][Insert a range of values to the index. ]]
-[[[link classboost_1_1geometry_1_1index_1_1rtree_1abb624abd9268b41e815d40342b2634c2 `insert(Range const &)`]][Insert a range of values to the index. ]]
-[[[link classboost_1_1geometry_1_1index_1_1rtree_1af6ca6909354a997f89411ef40ea5688a `remove(value_type const &)`]][Remove a value from the container. ]]
-[[[link classboost_1_1geometry_1_1index_1_1rtree_1a6e9123114697d65b16ebc49cd5371fbd `remove(Iterator, Iterator)`]][Remove a range of values from the container. ]]
-[[[link classboost_1_1geometry_1_1index_1_1rtree_1a5a57bb93b0b2d7ea1c659e925f918e9c `remove(Range const &)`]][Remove a range of values from the container. ]]
-[[[link classboost_1_1geometry_1_1index_1_1rtree_1a930bf17d595a91d8ae924383a0387920 `spatial_query(Predicates const &, OutIter)`]][Finds values meeting spatial predicates, e.g. intersecting some Box. ]]
-[[[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 `nearest_query(DistancesPredicates const &, value_type &)`]][Finds one value meeting distances predicates, e.g. nearest to some Point. ]]
-[[[link classboost_1_1geometry_1_1index_1_1rtree_1a6552331dca4d67647ef2a03bd0fbedcc `nearest_query(DistancesPredicates const &, Predicates const &, value_type &)`]][Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. ]]
-[[[link classboost_1_1geometry_1_1index_1_1rtree_1a3101652211c9f2d6ed8626dae6ff5f9d `nearest_query(DistancesPredicates const &, size_type, OutIter)`]][Finds k values meeting distances predicates, e.g. k nearest values to some Point. ]]
-[[[link classboost_1_1geometry_1_1index_1_1rtree_1a31c23b87b01f12282ef0df6404ab7301 `nearest_query(DistancesPredicates const &, size_type, Predicates const &, OutIter)`]][Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box. ]]
-[[[link classboost_1_1geometry_1_1index_1_1rtree_1a89561a834563f2ed6fc782bad16143fd `size()`]][Returns the number of stored values. ]]
-[[[link classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb975564c55804c `empty()`]][Query if the container is empty. ]]
-[[[link classboost_1_1geometry_1_1index_1_1rtree_1ae6027e42d28a4bf93e74b055c79e6b09 `clear()`]][Removes all values stored in the container. ]]
-[[[link classboost_1_1geometry_1_1index_1_1rtree_1ad534a6ed759677548f50b86dfeba07c6 `box()`]][Returns the box containing all values stored in the container. ]]
-[[[link classboost_1_1geometry_1_1index_1_1rtree_1a17fce1fac81f6460d2c3a5744f4963ee `count(ValueOrIndexable const &)`]][Count Values or Indexables stored in the container. ]]
-[[[link classboost_1_1geometry_1_1index_1_1rtree_1a18910715f67608ff010556ac41f51606 `parameters()`]][Returns parameters. ]]
-[[[link classboost_1_1geometry_1_1index_1_1rtree_1afc7e9a4bd53a58552c17c1e7cb997258 `translator()`]][Returns the translator object. ]]
-[[[link classboost_1_1geometry_1_1index_1_1rtree_1a1eeb303253f4cabe3a89a82ed41247ff `get_allocator()`]][Returns allocator used by the rtree. ]]
+[[Modifier][Function][Description]]
+[[][[link classboost_1_1geometry_1_1index_1_1rtree_1ab823a214501cb0f9fd00ba12a1ade179 `operator=(const rtree &)`]][The assignment operator. ]]
+[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a44bd4edee49db92c18b6bbbba77b42be `operator=(rtree &&)`]][The moving assignment. ]]
+[[][[link classboost_1_1geometry_1_1index_1_1rtree_1aad0285d25f96341a8dd6cc22feb3bd73 `swap(rtree &)`]][Swaps contents of two rtrees. ]]
+[[][[link classboost_1_1geometry_1_1index_1_1rtree_1af6d5bd81e46cb4ff89277c753133664c `insert(value_type const &)`]][Insert a value to the index. ]]
+[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a5263a3faac7b4f0090d4ad1d44cc540d `insert(Iterator, Iterator)`]][Insert a range of values to the index. ]]
+[[][[link classboost_1_1geometry_1_1index_1_1rtree_1abb624abd9268b41e815d40342b2634c2 `insert(Range const &)`]][Insert a range of values to the index. ]]
+[[][[link classboost_1_1geometry_1_1index_1_1rtree_1af6ca6909354a997f89411ef40ea5688a `remove(value_type const &)`]][Remove a value from the container. ]]
+[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a6e9123114697d65b16ebc49cd5371fbd `remove(Iterator, Iterator)`]][Remove a range of values from the container. ]]
+[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a5a57bb93b0b2d7ea1c659e925f918e9c `remove(Range const &)`]][Remove a range of values from the container. ]]
+[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a930bf17d595a91d8ae924383a0387920 `spatial_query(Predicates const &, OutIter)`]][Finds values meeting spatial predicates, e.g. intersecting some Box. ]]
+[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 `nearest_query(DistancesPredicates const &, value_type &)`]][Finds one value meeting distances predicates, e.g. nearest to some Point. ]]
+[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a6552331dca4d67647ef2a03bd0fbedcc `nearest_query(DistancesPredicates const &, Predicates const &, value_type &)`]][Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. ]]
+[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a3101652211c9f2d6ed8626dae6ff5f9d `nearest_query(DistancesPredicates const &, size_type, OutIter)`]][Finds k values meeting distances predicates, e.g. k nearest values to some Point. ]]
+[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a31c23b87b01f12282ef0df6404ab7301 `nearest_query(DistancesPredicates const &, size_type, Predicates const &, OutIter)`]][Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box. ]]
+[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a89561a834563f2ed6fc782bad16143fd `size()`]][Returns the number of stored values. ]]
+[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb975564c55804c `empty()`]][Query if the container is empty. ]]
+[[][[link classboost_1_1geometry_1_1index_1_1rtree_1ae6027e42d28a4bf93e74b055c79e6b09 `clear()`]][Removes all values stored in the container. ]]
+[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a131c273b6fc7e1c6d62cc5ebd015e77e `envelope()`]][Returns the box able to contain all values stored in the container. ]]
+[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a17fce1fac81f6460d2c3a5744f4963ee `count(ValueOrIndexable const &)`]][Count Values or Indexables stored in the container. ]]
+[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a18910715f67608ff010556ac41f51606 `parameters()`]][Returns parameters. ]]
+[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1afc7e9a4bd53a58552c17c1e7cb997258 `translator()`]][Returns the translator object. ]]
+[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a1eeb303253f4cabe3a89a82ed41247ff `get_allocator()`]][Returns allocator used by the rtree. ]]
 ]
 
 [#classboost_1_1geometry_1_1index_1_1rtree_1afa64d1b825b06d196b1164aec27c2d7b]
@@ -124,7 +124,8 @@
 `rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]] `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]`()``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]`()``)`
 ]
 
-[heading Parameter(s)]
+[heading Modifier(s)]
+``explicit ``[heading Parameter(s)]
 [table
 [[Type][Name][Description]]
 [[[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]][ `parameters` ][The parameters object. ]]
@@ -207,7 +208,8 @@
       [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `allocator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]`()``)`
 ]
 
-[heading Parameter(s)]
+[heading Modifier(s)]
+``explicit ``[heading Parameter(s)]
 [table
 [[Type][Name][Description]]
 [[`Range const &`][ `rng` ][The range of Values. ]]
@@ -631,7 +633,8 @@
 [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `spatial_query``(``Predicates const &` `pred``,` `OutIter` `out_it``)`
 ]
 
-[heading Parameter(s)]
+[heading Modifier(s)]
+``const ``[heading Parameter(s)]
 [table
 [[Type][Name][Description]]
 [[`Predicates const &`][ `pred` ][The spatial predicates or a Geometry. ]]
@@ -683,7 +686,8 @@
 [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `nearest_query``(``DistancesPredicates const &` `dpred``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &` `v``)`
 ]
 
-[heading Parameter(s)]
+[heading Modifier(s)]
+``const ``[heading Parameter(s)]
 [table
 [[Type][Name][Description]]
 [[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point.]]
@@ -749,7 +753,8 @@
                         [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &` `v``)`
 ]
 
-[heading Parameter(s)]
+[heading Modifier(s)]
+``const ``[heading Parameter(s)]
 [table
 [[Type][Name][Description]]
 [[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point. ]]
@@ -799,7 +804,8 @@
                         `OutIter` `out_it``)`
 ]
 
-[heading Parameter(s)]
+[heading Modifier(s)]
+``const ``[heading Parameter(s)]
 [table
 [[Type][Name][Description]]
 [[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point. ]]
@@ -869,7 +875,8 @@
                         `OutIter` `out_it``)`
 ]
 
-[heading Parameter(s)]
+[heading Modifier(s)]
+``const ``[heading Parameter(s)]
 [table
 [[Type][Name][Description]]
 [[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point ]]
@@ -894,7 +901,8 @@
 [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `size``()`
 ]
 
-[heading Returns]
+[heading Modifier(s)]
+``const ``[heading Returns]
 The number of stored values.
 [heading Throws]
 Nothing.
@@ -911,7 +919,8 @@
 `bool` `empty``()`
 ]
 
-[heading Returns]
+[heading Modifier(s)]
+``const ``[heading Returns]
 true if the container is empty.
 [heading Throws]
 Nothing.
@@ -933,19 +942,20 @@
 
 [endsect]
 
-[#classboost_1_1geometry_1_1index_1_1rtree_1ad534a6ed759677548f50b86dfeba07c6]
-[section box()]
-Returns the box containing all values stored in the container.
+[#classboost_1_1geometry_1_1index_1_1rtree_1a131c273b6fc7e1c6d62cc5ebd015e77e]
+[section envelope()]
+Returns the box able to contain all values stored in the container.
 
 [heading Description]
-Returns the box containing all values stored in the container. If the container is empty the result of [^`geometry::assign_inverse()`] is returned.[heading Synopsis]
+Returns the box able to contain all values stored in the container. If the container is empty the result of [^`geometry::assign_inverse()`] is returned.[heading Synopsis]
 [pre
 
-[^[link classboost_1_1geometry_1_1index_1_1rtree_1a42d0c9efffbc6f3935b5b9c3dd31e50d box_type]]` const &` `box``()`
+[^[link classboost_1_1geometry_1_1index_1_1rtree_1a2803990c71c40e6770744d29e5bbd093 envelope_type]]` const &` `envelope``()`
 ]
 
-[heading Returns]
-The box containing all values stored in the container or an invalid box if there are no values in the container.
+[heading Modifier(s)]
+``const ``[heading Returns]
+The box able to contain all values stored in the container or an invalid box if there are no values in the container.
 [heading Throws]
 Nothing.
 
@@ -962,7 +972,8 @@
 [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `count``(``ValueOrIndexable const &` `vori``)`
 ]
 
-[heading Parameter(s)]
+[heading Modifier(s)]
+``const ``[heading Parameter(s)]
 [table
 [[Type][Name][Description]]
 [[`ValueOrIndexable const &`][ `vori` ][The value or indexable which will be counted.]]
@@ -984,7 +995,8 @@
 [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &` `parameters``()`
 ]
 
-[heading Returns]
+[heading Modifier(s)]
+``const ``[heading Returns]
 The parameters object.
 [heading Throws]
 Nothing.
@@ -1001,7 +1013,8 @@
 [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator``()`
 ]
 
-[heading Returns]
+[heading Modifier(s)]
+``const ``[heading Returns]
 The translator object.
 [heading Throws]
 Nothing.
@@ -1018,7 +1031,8 @@
 [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `get_allocator``()`
 ]
 
-[heading Returns]
+[heading Modifier(s)]
+``const ``[heading Returns]
 The allocator.
 [heading Throws]
 If allocator copy constructor throws.

Modified: sandbox-branches/geometry/index/doc/generated/rtree_functions.qbk
==============================================================================
--- sandbox-branches/geometry/index/doc/generated/rtree_functions.qbk (original)
+++ sandbox-branches/geometry/index/doc/generated/rtree_functions.qbk 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -18,7 +18,7 @@
 [[[link group__rtree__functions_1ga0c65d7b29b1edf72f1d236ccf211f63c `clear(rtree<...> &)`]][Remove all values from the index. ]]
 [[[link group__rtree__functions_1gaec0b88a9d8b408753e3069134f1598c7 `size(rtree<...> const &)`]][Get the number of values stored in the index. ]]
 [[[link group__rtree__functions_1ga459e3d404fec7cbd66794714cbdd129e `empty(rtree<...> const &)`]][Query if there are no values stored in the index. ]]
-[[[link group__rtree__functions_1gad039bb35d79bded11a1454601f6eed3a `box(rtree<...> const &)`]][Get the box containing all stored values or an invalid box if the index has no values. ]]
+[[[link group__rtree__functions_1ga73a9002187db81c57c71f9ec204d57e4 `envelope(rtree<...> const &)`]][Get the box containing all stored values or an invalid box if the index has no values. ]]
 ]
 
 [#group__rtree__functions_1gac0ac9ed0e01f7494a5a3059e75d3c5cc]
@@ -395,18 +395,18 @@
 true if there are no values in the index.
 [endsect]
 
-[#group__rtree__functions_1gad039bb35d79bded11a1454601f6eed3a]
-[section box(rtree<...> const &)]
+[#group__rtree__functions_1ga73a9002187db81c57c71f9ec204d57e4]
+[section envelope(rtree<...> const &)]
 Get the box containing all stored values or an invalid box if the index has no values.
 
 [heading Description]
-It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1ad534a6ed759677548f50b86dfeba07c6 rtree::box()]].[heading Synopsis]
+It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a131c273b6fc7e1c6d62cc5ebd015e77e rtree::envelope()]].[heading Synopsis]
 [pre
 `template<``typename Value``,`
          `typename Options``,`
          `typename Translator``,`
          `typename Allocator``>`
-`rtree<Value, Options, Translator, Allocator>::box_type const& boost::geometry::index::box``(``rtree< Value, Options, Translator, Allocator > const &` `tree``)`
+`rtree<Value, Options, Translator, Allocator>::box_type const& boost::geometry::index::envelope``(``rtree< Value, Options, Translator, Allocator > const &` `tree``)`
 ]
 
 [heading Parameter(s)]

Modified: sandbox-branches/geometry/index/doc/generated/rtree_linear.qbk
==============================================================================
--- sandbox-branches/geometry/index/doc/generated/rtree_linear.qbk (original)
+++ sandbox-branches/geometry/index/doc/generated/rtree_linear.qbk 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -7,7 +7,7 @@
 Linear r-tree creation algorithm parameters.
 
 [heading Header]
-`#include <boost/geometry/extensions/index/parameters.hpp>`
+`#include <boost/geometry/index/parameters.hpp>`
 
 [heading Synopsis]
 [pre

Modified: sandbox-branches/geometry/index/doc/generated/rtree_quadratic.qbk
==============================================================================
--- sandbox-branches/geometry/index/doc/generated/rtree_quadratic.qbk (original)
+++ sandbox-branches/geometry/index/doc/generated/rtree_quadratic.qbk 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -7,7 +7,7 @@
 Quadratic r-tree creation algorithm parameters.
 
 [heading Header]
-`#include <boost/geometry/extensions/index/parameters.hpp>`
+`#include <boost/geometry/index/parameters.hpp>`
 
 [heading Synopsis]
 [pre

Modified: sandbox-branches/geometry/index/doc/generated/rtree_rstar.qbk
==============================================================================
--- sandbox-branches/geometry/index/doc/generated/rtree_rstar.qbk (original)
+++ sandbox-branches/geometry/index/doc/generated/rtree_rstar.qbk 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -7,7 +7,7 @@
 R*-tree creation algorithm parameters.
 
 [heading Header]
-`#include <boost/geometry/extensions/index/parameters.hpp>`
+`#include <boost/geometry/index/parameters.hpp>`
 
 [heading Synopsis]
 [pre

Modified: sandbox-branches/geometry/index/doc/generated/rtree_runtime_linear.qbk
==============================================================================
--- sandbox-branches/geometry/index/doc/generated/rtree_runtime_linear.qbk (original)
+++ sandbox-branches/geometry/index/doc/generated/rtree_runtime_linear.qbk 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -7,7 +7,7 @@
 Linear r-tree creation algorithm parameters.
 
 [heading Header]
-`#include <boost/geometry/extensions/index/parameters.hpp>`
+`#include <boost/geometry/index/parameters.hpp>`
 
 [heading Synopsis]
 [pre

Modified: sandbox-branches/geometry/index/doc/generated/rtree_runtime_quadratic.qbk
==============================================================================
--- sandbox-branches/geometry/index/doc/generated/rtree_runtime_quadratic.qbk (original)
+++ sandbox-branches/geometry/index/doc/generated/rtree_runtime_quadratic.qbk 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -7,7 +7,7 @@
 Quadratic r-tree creation algorithm parameters.
 
 [heading Header]
-`#include <boost/geometry/extensions/index/parameters.hpp>`
+`#include <boost/geometry/index/parameters.hpp>`
 
 [heading Synopsis]
 [pre

Modified: sandbox-branches/geometry/index/doc/generated/rtree_runtime_rstar.qbk
==============================================================================
--- sandbox-branches/geometry/index/doc/generated/rtree_runtime_rstar.qbk (original)
+++ sandbox-branches/geometry/index/doc/generated/rtree_runtime_rstar.qbk 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -7,7 +7,7 @@
 R*-tree creation algorithm parameters.
 
 [heading Header]
-`#include <boost/geometry/extensions/index/parameters.hpp>`
+`#include <boost/geometry/index/parameters.hpp>`
 
 [heading Synopsis]
 [pre

Modified: sandbox-branches/geometry/index/doc/generated/translator_def.qbk
==============================================================================
--- sandbox-branches/geometry/index/doc/generated/translator_def.qbk (original)
+++ sandbox-branches/geometry/index/doc/generated/translator_def.qbk 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -10,7 +10,7 @@
 It translates Value object to Indexable object. The default version handles Values which are Indexables. This translator is also specialized for std::pair<Indexable, Second> and boost::tuple<Indexable, ...>.
 
 [heading Header]
-`#include <boost/geometry/extensions/index/translator/def.hpp>`
+`#include <boost/geometry/index/translator/def.hpp>`
 
 [heading Synopsis]
 [pre

Modified: sandbox-branches/geometry/index/doc/generated/translator_index.qbk
==============================================================================
--- sandbox-branches/geometry/index/doc/generated/translator_index.qbk (original)
+++ sandbox-branches/geometry/index/doc/generated/translator_index.qbk 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -10,7 +10,7 @@
 This translator translates from index of an element in an external Container to the Indexable. The container should have operator[](size\u005ftype) defined. Index translator uses [link structboost_1_1geometry_1_1index_1_1translator_1_1def translator::def]<...> to translate from Container::value\u005ftype to the Indexable which means that it can handle Indexables, std::pairs and boost::tuples stored in an external Container.
 
 [heading Header]
-`#include <boost/geometry/extensions/index/translator/index.hpp>`
+`#include <boost/geometry/index/translator/index.hpp>`
 
 [heading Synopsis]
 [pre
@@ -43,7 +43,8 @@
 `index``(``Container const &` `c``)`
 ]
 
-[heading Parameter(s)]
+[heading Modifier(s)]
+``explicit ``[heading Parameter(s)]
 [table
 [[Type][Name][Description]]
 [[`Container const &`][ `c` ][The container which stores indexed values. ]]

Modified: sandbox-branches/geometry/index/doc/html/geometry_index/introduction.html
==============================================================================
--- sandbox-branches/geometry/index/doc/html/geometry_index/introduction.html (original)
+++ sandbox-branches/geometry/index/doc/html/geometry_index/introduction.html 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -3,7 +3,7 @@
 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
 <title>Introduction</title>
 <link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
 <link rel="home" href="../index.html" title="Chapter&#160;1.&#160;Geometry Index">
 <link rel="up" href="../index.html" title="Chapter&#160;1.&#160;Geometry Index">
 <link rel="prev" href="../index.html" title="Chapter&#160;1.&#160;Geometry Index">

Modified: sandbox-branches/geometry/index/doc/html/geometry_index/r_tree.html
==============================================================================
--- sandbox-branches/geometry/index/doc/html/geometry_index/r_tree.html (original)
+++ sandbox-branches/geometry/index/doc/html/geometry_index/r_tree.html 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -3,7 +3,7 @@
 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
 <title>R-tree</title>
 <link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
 <link rel="home" href="../index.html" title="Chapter&#160;1.&#160;Geometry Index">
 <link rel="up" href="../index.html" title="Chapter&#160;1.&#160;Geometry Index">
 <link rel="prev" href="introduction.html" title="Introduction">

Modified: sandbox-branches/geometry/index/doc/html/geometry_index/r_tree/creation_and_modification.html
==============================================================================
--- sandbox-branches/geometry/index/doc/html/geometry_index/r_tree/creation_and_modification.html (original)
+++ sandbox-branches/geometry/index/doc/html/geometry_index/r_tree/creation_and_modification.html 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -3,7 +3,7 @@
 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
 <title>Creation and modification</title>
 <link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
 <link rel="home" href="../../index.html" title="Chapter&#160;1.&#160;Geometry Index">
 <link rel="up" href="../r_tree.html" title="R-tree">
 <link rel="prev" href="rtree_quickstart.html" title="Quick Start">
@@ -55,7 +55,7 @@
         </p>
 <pre class="programlisting"><span class="identifier">rtree</span><span class="special">&lt;</span><span class="identifier">Value</span><span class="special">,</span> <span class="identifier">Parameters</span><span class="special">,</span> <span class="identifier">Translator</span> <span class="special">=</span> <span class="identifier">translator</span><span class="special">::</span><span class="identifier">def</span><span class="special">&lt;</span><span class="identifier">Value</span><span class="special">&gt;,</span> <span class="identifier">Allocator</span><span class="special">&gt;</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special">&lt;</span><span class="identifier">Value</span><span class="special">&gt;</span> <span class="special">&gt;</span>
 </pre>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
               <code class="computeroutput">Value</code> - type of object which will be stored in the container,
             </li>
@@ -90,7 +90,7 @@
           be handled by the default <code class="computeroutput">Translator</code> - <code class="computeroutput"><span class="identifier">index</span><span class="special">::</span><span class="identifier">translator</span><span class="special">::</span><span class="identifier">def</span><span class="special">&lt;</span>Value<span class="special">&gt;</span></code>
           are defined as follows:
         </p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
               <code class="computeroutput">Indexable <span class="special">=</span> Point
               <span class="special">|</span> Box</code>
@@ -116,7 +116,7 @@
           A <code class="computeroutput">Translator</code> is a type which knows how to handle <code class="computeroutput">Value</code>s.
           It has two purposes:
         </p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
               it translates <code class="computeroutput">Value</code> to a more suitable <code class="computeroutput">Indexable</code>
               type which is needed by most of operations,
@@ -134,7 +134,7 @@
 <p>
           If comparison of two <code class="computeroutput">Value</code>s is required, the default translator:
         </p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
               for <code class="computeroutput">Point</code>
               and <code class="computeroutput">Box</code>

Modified: sandbox-branches/geometry/index/doc/html/geometry_index/r_tree/introduction.html
==============================================================================
--- sandbox-branches/geometry/index/doc/html/geometry_index/r_tree/introduction.html (original)
+++ sandbox-branches/geometry/index/doc/html/geometry_index/r_tree/introduction.html 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -3,7 +3,7 @@
 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
 <title>Introduction</title>
 <link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
 <link rel="home" href="../../index.html" title="Chapter&#160;1.&#160;Geometry Index">
 <link rel="up" href="../r_tree.html" title="R-tree">
 <link rel="prev" href="../r_tree.html" title="R-tree">
@@ -28,10 +28,10 @@
 </h3></div></div></div>
 <p>
         R-tree is a tree data structure used for spatial searching. It was proposed
- by Antonin Guttman in 1984 <sup>[<a name="geometry_index.r_tree.introduction.f0" href="#ftn.geometry_index.r_tree.introduction.f0" class="footnote">1</a>]</sup> as an expansion of B-tree for multi-dimensional data. It may
+ by Antonin Guttman in 1984 [1]</sup></a> as an expansion of B-tree for multi-dimensional data. It may
         be used to store points or volumetric data in order to perform a spatial
         query later. This query may return objects that are inside some area or are
- close to some point in space <sup>[<a name="geometry_index.r_tree.introduction.f1" href="#ftn.geometry_index.r_tree.introduction.f1" class="footnote">2</a>]</sup>.
+ close to some point in space [2]</sup></a>.
       </p>
 <p>
         The R-tree structure is presented on the image below. Each R-tree's node
@@ -51,7 +51,7 @@
       </p>
 <p>
         The R-tree is a self-balanced data structure. The key part of balancing algorithm
- is node splitting algorithm <sup>[<a name="geometry_index.r_tree.introduction.f2" href="#ftn.geometry_index.r_tree.introduction.f2" class="footnote">3</a>]</sup> <sup>[<a name="geometry_index.r_tree.introduction.f3" href="#ftn.geometry_index.r_tree.introduction.f3" class="footnote">4</a>]</sup>. Each algorithm produces different splits so the internal structure
+ is node splitting algorithm [3]</sup></a> [4]</sup></a>. Each algorithm produces different splits so the internal structure
         of a tree may be different for each one of them. In general more complex
         algorithms analyses elements better and produces less overlapping nodes.
         In the searching process less nodes must be traversed in order to find desired
@@ -179,13 +179,13 @@
 </table></div>
 <h5>
 <a name="geometry_index.r_tree.introduction.h0"></a>
- <span><a name="geometry_index.r_tree.introduction.implementation_details"></a></span><a class="link" href="introduction.html#geometry_index.r_tree.introduction.implementation_details">Implementation
+ <span class="phrase"><a name="geometry_index.r_tree.introduction.implementation_details"></a></span><a class="link" href="introduction.html#geometry_index.r_tree.introduction.implementation_details">Implementation
         details</a>
       </h5>
 <p>
         Key features of this implementation of the R-tree are:
       </p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
             capable to store arbitrary Value type,
           </li>
@@ -207,7 +207,7 @@
 </ul></div>
 <h5>
 <a name="geometry_index.r_tree.introduction.h1"></a>
- <span><a name="geometry_index.r_tree.introduction.contributors"></a></span><a class="link" href="introduction.html#geometry_index.r_tree.introduction.contributors">Contributors</a>
+ <span class="phrase"><a name="geometry_index.r_tree.introduction.contributors"></a></span><a class="link" href="introduction.html#geometry_index.r_tree.introduction.contributors">Contributors</a>
       </h5>
 <p>
         The spatial index was originally started by Federico J. Fernandez during
@@ -215,7 +215,7 @@
       </p>
 <h5>
 <a name="geometry_index.r_tree.introduction.h2"></a>
- <span><a name="geometry_index.r_tree.introduction.spatial_thanks"></a></span><a class="link" href="introduction.html#geometry_index.r_tree.introduction.spatial_thanks">Spatial
+ <span class="phrase"><a name="geometry_index.r_tree.introduction.spatial_thanks"></a></span><a class="link" href="introduction.html#geometry_index.r_tree.introduction.spatial_thanks">Spatial
         thanks</a>
       </h5>
 <p>
@@ -224,20 +224,20 @@
         list for their help.
       </p>
 <div class="footnotes">
-<br><hr width="100" align="left">
-<div class="footnote"><p><sup>[<a id="ftn.geometry_index.r_tree.introduction.f0" href="#geometry_index.r_tree.introduction.f0" class="para">1</a>] </sup>
+<br><hr style="width:100; align:left;">
+<div id="ftn.geometry_index.r_tree.introduction.f0" class="footnote"><p>[1]
           Guttman, A. (1984). <span class="emphasis"><em>R-Trees: A Dynamic Index Structure for Spatial
           Searching</em></span>
         </p></div>
-<div class="footnote"><p><sup>[<a id="ftn.geometry_index.r_tree.introduction.f1" href="#geometry_index.r_tree.introduction.f1" class="para">2</a>] </sup>
+<div id="ftn.geometry_index.r_tree.introduction.f1" class="footnote"><p>[2]
           Cheung, K.; Fu, A. (1998). <span class="emphasis"><em>Enhanced Nearest Neighbour Search
           on the R-tree</em></span>
         </p></div>
-<div class="footnote"><p><sup>[<a id="ftn.geometry_index.r_tree.introduction.f2" href="#geometry_index.r_tree.introduction.f2" class="para">3</a>] </sup>
+<div id="ftn.geometry_index.r_tree.introduction.f2" class="footnote"><p>[3]
           Greene, D. (1989). <span class="emphasis"><em>An implementation and performance analysis
           of spatial data access methods</em></span>
         </p></div>
-<div class="footnote"><p><sup>[<a id="ftn.geometry_index.r_tree.introduction.f3" href="#geometry_index.r_tree.introduction.f3" class="para">4</a>] </sup>
+<div id="ftn.geometry_index.r_tree.introduction.f3" class="footnote"><p>[4]
           Beckmann, N.; Kriegel, H. P.; Schneider, R.; Seeger, B. (1990). <span class="emphasis"><em>The
           R*-tree: an efficient and robust access method for points and rectangles</em></span>
         </p></div>

Modified: sandbox-branches/geometry/index/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html
==============================================================================
--- sandbox-branches/geometry/index/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html (original)
+++ sandbox-branches/geometry/index/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -3,7 +3,7 @@
 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
 <title>Nearest neighbours queries</title>
 <link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
 <link rel="home" href="../../index.html" title="Chapter&#160;1.&#160;Geometry Index">
 <link rel="up" href="../r_tree.html" title="R-tree">
 <link rel="prev" href="spatial_queries.html" title="Spatial queries">

Modified: sandbox-branches/geometry/index/doc/html/geometry_index/r_tree/reference.html
==============================================================================
--- sandbox-branches/geometry/index/doc/html/geometry_index/r_tree/reference.html (original)
+++ sandbox-branches/geometry/index/doc/html/geometry_index/r_tree/reference.html 2013-01-18 21:26:34 EST (Fri, 18 Jan 2013)
@@ -3,7 +3,7 @@
 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
 <title>Reference</title>
 <link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
 <link rel="home" href="../../index.html" title="Chapter&#160;1.&#160;Geometry Index">
 <link rel="up" href="../r_tree.html" title="R-tree">
 <link rel="prev" href="nearest_neighbours_queries.html" title="Nearest neighbours queries">
@@ -47,12 +47,12 @@
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree"></a><a name="classboost_1_1geometry_1_1index_1_1rtree"></a><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree" title="boost::geometry::index::rtree">boost::geometry::index::rtree</a>
 </h4></div></div></div>
 <p>
- <a class="indexterm" name="idp9908160"></a><a class="indexterm" name="idp9908472"></a><a class="indexterm" name="idp9908784"></a><a class="indexterm" name="idp9909096"></a>
+ <a class="indexterm" name="id887511"></a><a class="indexterm" name="id887516"></a><a class="indexterm" name="id887521"></a><a class="indexterm" name="id887526"></a>
 The R-tree spatial index.
         </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.description">Description</a>
         </h6>
 <p>
           This is self-balancing spatial index capable to store various types of
@@ -60,7 +60,7 @@
         </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.parameters"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.parameters">Parameters</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.parameters"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.parameters">Parameters</a>
         </h6>
 <p>
           The user must pass a type defining the Parameters which will be used in
@@ -70,7 +70,7 @@
 <p>
           Predefined algorithms with compile-time parameters are:
         </p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
               <code class="literal"><a class="link" href="reference.html#structboost_1_1geometry_1_1index_1_1linear">boost::geometry::index::linear</a></code>,
             </li>
@@ -84,7 +84,7 @@
 <p>
           Predefined algorithms with run-time parameters are:
         </p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
               <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1runtime_1_1linear">boost::geometry::index::runtime::linear</a></code>,
             </li>
@@ -97,7 +97,7 @@
 </ul></div>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.translator"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.translator">Translator</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.translator"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.translator">Translator</a>
         </h6>
 <p>
           The Translator translates from Value to Indexable each time r-tree requires
@@ -114,14 +114,14 @@
         </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.h3"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.header"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.header">Header</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.header"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.header">Header</a>
         </h6>
 <p>
- <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">extensions</span><span class="special">/</span><span class="identifier">index</span><span class="special">/</span><span class="identifier">rtree</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
+ <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">index</span><span class="special">/</span><span class="identifier">rtree</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
         </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.h4"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.synopsis">Synopsis</a>
         </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Value</span></code><code class="computeroutput"><span class="special">,</span></code>
          <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Parameters</span></code><code class="computeroutput"><span class="special">,</span></code>
@@ -134,7 +134,7 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.h5"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.template_parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.template_parameter_s_">Template
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.template_parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.template_parameter_s_">Template
           parameter(s)</a>
         </h6>
 <div class="informaltable"><table class="table">
@@ -208,7 +208,7 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.h6"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.typedef_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.typedef_s_">Typedef(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.typedef_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.typedef_s_">Typedef(s)</a>
         </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -303,7 +303,7 @@
 <tr>
 <td>
                   <p>
- <a name="classboost_1_1geometry_1_1index_1_1rtree_1a42d0c9efffbc6f3935b5b9c3dd31e50d"></a><code class="computeroutput"><span class="identifier">box_type</span></code>
+ <a name="classboost_1_1geometry_1_1index_1_1rtree_1a2803990c71c40e6770744d29e5bbd093"></a><code class="computeroutput"><span class="identifier">envelope_type</span></code>
                   </p>
                 </td>
 <td>
@@ -316,7 +316,7 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.h7"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.constructor_s__and_destructor"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.constructor_s__and_destructor">Constructor(s)
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.constructor_s__and_destructor"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.constructor_s__and_destructor">Constructor(s)
           and destructor</a>
         </h6>
 <div class="informaltable"><table class="table">
@@ -458,16 +458,22 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.h8"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.member_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.member_s_">Member(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.member_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.member_s_">Member(s)</a>
         </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
 <col>
 <col>
+<col>
 </colgroup>
 <thead><tr>
 <th>
                   <p>
+ Modifier
+ </p>
+ </th>
+<th>
+ <p>
                     Function
                   </p>
                 </th>
@@ -480,6 +486,8 @@
 <tbody>
 <tr>
 <td>
+ </td>
+<td>
                   <p>
                     <a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1ab823a214501cb0f9fd00ba12a1ade179"><code class="computeroutput"><span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="identifier">rtree</span>
                     <span class="special">&amp;)</span></code></a>
@@ -493,6 +501,8 @@
 </tr>
 <tr>
 <td>
+ </td>
+<td>
                   <p>
                     <a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a44bd4edee49db92c18b6bbbba77b42be"><code class="computeroutput"><span class="keyword">operator</span><span class="special">=(</span><span class="identifier">rtree</span> <span class="special">&amp;&amp;)</span></code></a>
                   </p>
@@ -505,6 +515,8 @@
 </tr>
 <tr>
 <td>
+ </td>
+<td>
                   <p>
                     <a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1aad0285d25f96341a8dd6cc22feb3bd73"><code class="computeroutput"><span class="identifier">swap</span><span class="special">(</span><span class="identifier">rtree</span> <span class="special">&amp;)</span></code></a>
                   </p>
@@ -517,6 +529,8 @@
 </tr>
 <tr>
 <td>
+ </td>
+<td>
                   <p>
                     <a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1af6d5bd81e46cb4ff89277c753133664c"><code class="computeroutput"><span class="identifier">insert</span><span class="special">(</span><span class="identifier">value_type</span> <span class="keyword">const</span>
                     <span class="special">&amp;)</span></code></a>
@@ -530,6 +544,8 @@
 </tr>
 <tr>
 <td>
+ </td>
+<td>
                   <p>
                     <a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a5263a3faac7b4f0090d4ad1d44cc540d"><code class="computeroutput"><span class="identifier">insert</span><span class="special">(</span><span class="identifier">Iterator</span><span class="special">,</span>
                     <span class="identifier">Iterator</span><span class="special">)</span></code></a>
@@ -543,6 +559,8 @@
 </tr>
 <tr>
 <td>
+ </td>
+<td>
                   <p>
                     <a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1abb624abd9268b41e815d40342b2634c2"><code class="computeroutput"><span class="identifier">insert</span><span class="special">(</span><span class="identifier">Range</span> <span class="keyword">const</span>
                     <span class="special">&amp;)</span></code></a>
@@ -556,6 +574,8 @@
 </tr>
 <tr>
 <td>
+ </td>
+<td>
                   <p>
                     <a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1af6ca6909354a997f89411ef40ea5688a"><code class="computeroutput"><span class="identifier">remove</span><span class="special">(</span><span class="identifier">value_type</span> <span class="keyword">const</span>
                     <span class="special">&amp;)</span></code></a>
@@ -569,6 +589,8 @@
 </tr>
 <tr>
 <td>
+ </td>
+<td>
                   <p>
                     <a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a6e9123114697d65b16ebc49cd5371fbd"><code class="computeroutput"><span class="identifier">remove</span><span class="special">(</span><span class="identifier">Iterator</span><span class="special">,</span>
                     <span class="identifier">Iterator</span><span class="special">)</span></code></a>
@@ -582,6 +604,8 @@
 </tr>
 <tr>
 <td>
+ </td>
+<td>
                   <p>
                     <a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a5a57bb93b0b2d7ea1c659e925f918e9c"><code class="computeroutput"><span class="identifier">remove</span><span class="special">(</span><span class="identifier">Range</span> <span class="keyword">const</span>
                     <span class="special">&amp;)</span></code></a>
@@ -596,6 +620,11 @@
 <tr>
 <td>
                   <p>
+ <code class="computeroutput"><span class="keyword">const</span></code>
+ </p>
+ </td>
+<td>
+ <p>
                     <a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a930bf17d595a91d8ae924383a0387920"><code class="computeroutput"><span class="identifier">spatial_query</span><span class="special">(</span><span class="identifier">Predicates</span> <span class="keyword">const</span>
                     <span class="special">&amp;,</span> <span class="identifier">OutIter</span><span class="special">)</span></code></a>
                   </p>
@@ -610,6 +639,11 @@
 <tr>
 <td>
                   <p>
+ <code class="computeroutput"><span class="keyword">const</span></code>
+ </p>
+ </td>
+<td>
+ <p>
                     <a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909"><code class="computeroutput"><span class="identifier">nearest_query</span><span class="special">(</span><span class="identifier">DistancesPredicates</span> <span class="keyword">const</span>
                     <span class="special">&amp;,</span> <span class="identifier">value_type</span>
                     <span class="special">&amp;)</span></code></a>
@@ -625,6 +659,11 @@
 <tr>
 <td>
                   <p>
+ <code class="computeroutput"><span class="keyword">const</span></code>
+ </p>
+ </td>
+<td>
+ <p>
                     <a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a6552331dca4d67647ef2a03bd0fbedcc"><code class="computeroutput"><span class="identifier">nearest_query</span><span class="special">(</span><span class="identifier">DistancesPredicates</span> <span class="keyword">const</span>
                     <span class="special">&amp;,</span> <span class="identifier">Predicates</span>
                     <span class="keyword">const</span> <span class="special">&amp;,</span>
@@ -641,6 +680,11 @@
 <tr>
 <td>
                   <p>
+ <code class="computeroutput"><span class="keyword">const</span></code>
+ </p>
+ </td>
+<td>
+ <p>
                     <a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a3101652211c9f2d6ed8626dae6ff5f9d"><code class="computeroutput"><span class="identifier">nearest_query</span><span class="special">(</span><span class="identifier">DistancesPredicates</span> <span class="keyword">const</span>
                     <span class="special">&amp;,</span> <span class="identifier">size_type</span><span class="special">,</span> <span class="identifier">OutIter</span><span class="special">)</span></code></a>
                   </p>
@@ -655,6 +699,11 @@
 <tr>
 <td>
                   <p>
+ <code class="computeroutput"><span class="keyword">const</span></code>
+ </p>
+ </td>
+<td>
+ <p>
                     <a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a31c23b87b01f12282ef0df6404ab7301"><code class="computeroutput"><span class="identifier">nearest_query</span><span class="special">(</span><span class="identifier">DistancesPredicates</span> <span class="keyword">const</span>
                     <span class="special">&amp;,</span> <span class="identifier">size_type</span><span class="special">,</span> <span class="identifier">Predicates</span>
                     <span class="keyword">const</span> <span class="special">&amp;,</span>
@@ -671,6 +720,11 @@
 <tr>
 <td>
                   <p>
+ <code class="computeroutput"><span class="keyword">const</span></code>
+ </p>
+ </td>
+<td>
+ <p>
                     <a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a89561a834563f2ed6fc782bad16143fd"><code class="computeroutput"><span class="identifier">size</span><span class="special">()</span></code></a>
                   </p>
                 </td>
@@ -683,6 +737,11 @@
 <tr>
 <td>
                   <p>
+ <code class="computeroutput"><span class="keyword">const</span></code>
+ </p>
+ </td>
+<td>
+ <p>
                     <a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb975564c55804c"><code class="computeroutput"><span class="identifier">empty</span><span class="special">()</span></code></a>
                   </p>
                 </td>
@@ -694,6 +753,8 @@
 </tr>
 <tr>
 <td>
+ </td>
+<td>
                   <p>
                     <a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1ae6027e42d28a4bf93e74b055c79e6b09"><code class="computeroutput"><span class="identifier">clear</span><span class="special">()</span></code></a>
                   </p>
@@ -707,18 +768,28 @@
 <tr>
 <td>
                   <p>
- <a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1ad534a6ed759677548f50b86dfeba07c6"><code class="computeroutput"><span class="identifier">box</span><span class="special">()</span></code></a>
+ <code class="computeroutput"><span class="keyword">const</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ <a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a131c273b6fc7e1c6d62cc5ebd015e77e"><code class="computeroutput"><span class="identifier">envelope</span><span class="special">()</span></code></a>
                   </p>
                 </td>
 <td>
                   <p>
- Returns the box containing all values stored in the container.
+ Returns the box able to contain all values stored in the container.
                   </p>
                 </td>
 </tr>
 <tr>
 <td>
                   <p>
+ <code class="computeroutput"><span class="keyword">const</span></code>
+ </p>
+ </td>
+<td>
+ <p>
                     <a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a17fce1fac81f6460d2c3a5744f4963ee"><code class="computeroutput"><span class="identifier">count</span><span class="special">(</span><span class="identifier">ValueOrIndexable</span> <span class="keyword">const</span>
                     <span class="special">&amp;)</span></code></a>
                   </p>
@@ -732,6 +803,11 @@
 <tr>
 <td>
                   <p>
+ <code class="computeroutput"><span class="keyword">const</span></code>
+ </p>
+ </td>
+<td>
+ <p>
                     <a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a18910715f67608ff010556ac41f51606"><code class="computeroutput"><span class="identifier">parameters</span><span class="special">()</span></code></a>
                   </p>
                 </td>
@@ -744,6 +820,11 @@
 <tr>
 <td>
                   <p>
+ <code class="computeroutput"><span class="keyword">const</span></code>
+ </p>
+ </td>
+<td>
+ <p>
                     <a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1afc7e9a4bd53a58552c17c1e7cb997258"><code class="computeroutput"><span class="identifier">translator</span><span class="special">()</span></code></a>
                   </p>
                 </td>
@@ -756,6 +837,11 @@
 <tr>
 <td>
                   <p>
+ <code class="computeroutput"><span class="keyword">const</span></code>
+ </p>
+ </td>
+<td>
+ <p>
                     <a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a1eeb303253f4cabe3a89a82ed41247ff"><code class="computeroutput"><span class="identifier">get_allocator</span><span class="special">()</span></code></a>
                   </p>
                 </td>
@@ -776,13 +862,22 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree__.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree__.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree__.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree__.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree__.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="identifier">rtree</span></code><code class="computeroutput"><span class="special">(</span></code><code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a">parameters_type</a></code> <code class="computeroutput"><span class="identifier">parameters</span></code> = <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a">parameters_type</a></code><code class="computeroutput"><span class="special">()</span></code><code class="computeroutput"><span class="special">,</span></code> <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91">translator_type</a></code><code class="computeroutput"> <span class="keyword">const</span> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="iden
tifier">translator</span></code> = <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91">translator_type</a></code><code class="computeroutput"><span class="special">()</span></code><code class="computeroutput"><span class="special">)</span></code>
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree__.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree__.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree__.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree__.modifier_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree__.modifier_s_">Modifier(s)</a>
+ </h6>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">explicit</span></pre>
+<p>
+ </p>
+<h6>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree__.h2"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree__.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree__.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -846,8 +941,8 @@
 </tbody>
 </table></div>
 <h6>
-<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree__.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree__.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree__.throws">Throws</a>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree__.h3"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree__.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree__.throws">Throws</a>
           </h6>
 <p>
             If allocator default constructor throws.
@@ -863,7 +958,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_parameters_type__translator_type_const____allocator_type_.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_parameters_type__translator_type_const____allocator_type_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_parameters_type__translator_type_const____allocator_type_.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_parameters_type__translator_type_const____allocator_type_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_parameters_type__translator_type_const____allocator_type_.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="identifier">rtree</span></code><code class="computeroutput"><span class="special">(</span></code><code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a">parameters_type</a></code> <code class="computeroutput"><span class="identifier">parameters</span></code><code class="computeroutput"><span class="special">,</span></code>
       <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91">translator_type</a></code><code class="computeroutput"> <span class="keyword">const</span> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="identifier">translator</span></code><code class="computeroutput"><span class="special">,</span></code>
@@ -871,7 +966,7 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_parameters_type__translator_type_const____allocator_type_.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_parameters_type__translator_type_const____allocator_type_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_parameters_type__translator_type_const____allocator_type_.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_parameters_type__translator_type_const____allocator_type_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_parameters_type__translator_type_const____allocator_type_.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -953,7 +1048,7 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_parameters_type__translator_type_const____allocator_type_.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_parameters_type__translator_type_const____allocator_type_.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_parameters_type__translator_type_const____allocator_type_.throws">Throws</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_parameters_type__translator_type_const____allocator_type_.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_parameters_type__translator_type_const____allocator_type_.throws">Throws</a>
           </h6>
 <p>
             If allocator copy constructor throws.
@@ -969,7 +1064,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_iterator__iterator_.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_iterator__iterator_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_iterator__iterator_.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_iterator__iterator_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_iterator__iterator_.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Iterator</span></code><code class="computeroutput"><span class="special">&gt;</span></code>
 <code class="computeroutput"><span class="identifier">rtree</span></code><code class="computeroutput"><span class="special">(</span></code><code class="computeroutput"><span class="identifier">Iterator</span></code> <code class="computeroutput"><span class="identifier">first</span></code><code class="computeroutput"><span class="special">,</span></code>
@@ -980,7 +1075,7 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_iterator__iterator_.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_iterator__iterator_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_iterator__iterator_.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_iterator__iterator_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_iterator__iterator_.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -1096,9 +1191,9 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_iterator__iterator_.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_iterator__iterator_.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_iterator__iterator_.throws">Throws</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_iterator__iterator_.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_iterator__iterator_.throws">Throws</a>
           </h6>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 If allocator copy constructor throws.
               </li>
@@ -1123,7 +1218,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_range_const___.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_range_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_range_const___.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_range_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_range_const___.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Range</span></code><code class="computeroutput"><span class="special">&gt;</span></code>
 <code class="computeroutput"><span class="identifier">rtree</span></code><code class="computeroutput"><span class="special">(</span></code><code class="computeroutput"><span class="identifier">Range</span> <span class="keyword">const</span> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="identifier">rng</span></code><code class="computeroutput"><span class="special">,</span></code>
@@ -1133,7 +1228,16 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_range_const___.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_range_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_range_const___.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_range_const___.modifier_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_range_const___.modifier_s_">Modifier(s)</a>
+ </h6>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">explicit</span></pre>
+<p>
+ </p>
+<h6>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_range_const___.h2"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_range_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_range_const___.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -1232,10 +1336,10 @@
 </tbody>
 </table></div>
 <h6>
-<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_range_const___.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_range_const___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_range_const___.throws">Throws</a>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_range_const___.h3"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_range_const___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_range_const___.throws">Throws</a>
           </h6>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 If allocator copy constructor throws.
               </li>
@@ -1259,13 +1363,13 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree._rtree__.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree._rtree__.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree._rtree__.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree._rtree__.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree._rtree__.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="special">~</span><span class="identifier">rtree</span></code><code class="computeroutput"><span class="special">()</span></code>
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree._rtree__.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree._rtree__.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree._rtree__.throws">Throws</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree._rtree__.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree._rtree__.throws">Throws</a>
           </h6>
 <p>
             Nothing.
@@ -1281,20 +1385,20 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const___.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const___.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const___.description">Description</a>
           </h6>
 <p>
             It uses parameters, translator and allocator from the source tree.
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const___.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const___.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const___.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="identifier">rtree</span></code><code class="computeroutput"><span class="special">(</span></code><code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree">rtree</a></code><code class="computeroutput"> <span class="keyword">const</span> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="identifier">src</span></code><code class="computeroutput"><span class="special">)</span></code>
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const___.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const___.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const___.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -1340,9 +1444,9 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const___.h3"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const___.throws">Throws</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const___.throws">Throws</a>
           </h6>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 If allocator copy constructor throws.
               </li>
@@ -1367,20 +1471,20 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const____allocator_type_const___.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const____allocator_type_const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const____allocator_type_const___.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const____allocator_type_const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const____allocator_type_const___.description">Description</a>
           </h6>
 <p>
             It uses Parameters and translator from the source tree.
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const____allocator_type_const___.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const____allocator_type_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const____allocator_type_const___.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const____allocator_type_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const____allocator_type_const___.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="identifier">rtree</span></code><code class="computeroutput"><span class="special">(</span></code><code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree">rtree</a></code><code class="computeroutput"> <span class="keyword">const</span> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="identifier">src</span></code><code class="computeroutput"><span class="special">,</span></code> <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d">allocator_type</a></code><code class="computeroutput"> <span class="keyword">const</span> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="identifier">allocator</span></code><code class="computeroutput"><span class="special">)</span></code>
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const____allocator_type_const___.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const____allocator_type_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const____allocator_type_const___.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const____allocator_type_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const____allocator_type_const___.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -1446,9 +1550,9 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const____allocator_type_const___.h3"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const____allocator_type_const___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const____allocator_type_const___.throws">Throws</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const____allocator_type_const___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_const____allocator_type_const___.throws">Throws</a>
           </h6>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 If allocator copy constructor throws.
               </li>
@@ -1473,20 +1577,20 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree____.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree____.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree____.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree____.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree____.description">Description</a>
           </h6>
 <p>
             It uses parameters, translator and allocator from the source tree.
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree____.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree____.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree____.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree____.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree____.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="identifier">rtree</span></code><code class="computeroutput"><span class="special">(</span></code><code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree">rtree</a></code><code class="computeroutput"> <span class="special">&amp;&amp;</span></code> <code class="computeroutput"><span class="identifier">src</span></code><code class="computeroutput"><span class="special">)</span></code>
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree____.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree____.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree____.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree____.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree____.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -1532,7 +1636,7 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree____.h3"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree____.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree____.throws">Throws</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree____.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree____.throws">Throws</a>
           </h6>
 <p>
             Nothing.
@@ -1548,20 +1652,20 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_____allocator_type_const___.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_____allocator_type_const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_____allocator_type_const___.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_____allocator_type_const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_____allocator_type_const___.description">Description</a>
           </h6>
 <p>
             It uses parameters and translator from the source tree.
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_____allocator_type_const___.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_____allocator_type_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_____allocator_type_const___.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_____allocator_type_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_____allocator_type_const___.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="identifier">rtree</span></code><code class="computeroutput"><span class="special">(</span></code><code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree">rtree</a></code><code class="computeroutput"> <span class="special">&amp;&amp;</span></code> <code class="computeroutput"><span class="identifier">src</span></code><code class="computeroutput"><span class="special">,</span></code> <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d">allocator_type</a></code><code class="computeroutput"> <span class="keyword">const</span> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="identifier">allocator</span></code><code class="computeroutput"><span class="special">)</span></code>
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_____allocator_type_const___.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_____allocator_type_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_____allocator_type_const___.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_____allocator_type_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_____allocator_type_const___.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -1627,9 +1731,9 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_____allocator_type_const___.h3"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_____allocator_type_const___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_____allocator_type_const___.throws">Throws</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_____allocator_type_const___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.rtree_rtree_____allocator_type_const___.throws">Throws</a>
           </h6>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 If allocator copy constructor throws.
               </li>
@@ -1655,20 +1759,20 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__const_rtree___.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__const_rtree___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__const_rtree___.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__const_rtree___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__const_rtree___.description">Description</a>
           </h6>
 <p>
             It uses parameters and translator from the source tree.
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__const_rtree___.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__const_rtree___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__const_rtree___.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__const_rtree___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__const_rtree___.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree">rtree</a></code><code class="computeroutput"> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="keyword">operator</span><span class="special">=</span></code><code class="computeroutput"><span class="special">(</span></code><code class="computeroutput"><span class="keyword">const</span> </code><code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree">rtree</a></code><code class="computeroutput"> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="identifier">src</span></code><code class="computeroutput"><span class="special">)</span></code>
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__const_rtree___.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__const_rtree___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__const_rtree___.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__const_rtree___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__const_rtree___.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -1714,9 +1818,9 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__const_rtree___.h3"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__const_rtree___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__const_rtree___.throws">Throws</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__const_rtree___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__const_rtree___.throws">Throws</a>
           </h6>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 If Value copy constructor throws.
               </li>
@@ -1738,20 +1842,20 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__rtree____.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__rtree____.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__rtree____.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__rtree____.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__rtree____.description">Description</a>
           </h6>
 <p>
             It uses parameters and translator from the source tree.
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__rtree____.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__rtree____.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__rtree____.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__rtree____.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__rtree____.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree">rtree</a></code><code class="computeroutput"> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="keyword">operator</span><span class="special">=</span></code><code class="computeroutput"><span class="special">(</span></code><code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree">rtree</a></code><code class="computeroutput"> <span class="special">&amp;&amp;</span></code> <code class="computeroutput"><span class="identifier">src</span></code><code class="computeroutput"><span class="special">)</span></code>
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__rtree____.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__rtree____.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__rtree____.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__rtree____.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__rtree____.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -1797,12 +1901,12 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__rtree____.h3"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__rtree____.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__rtree____.throws">Throws</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__rtree____.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.operator__rtree____.throws">Throws</a>
           </h6>
 <p>
             Only if allocators aren't equal.
           </p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 If Value copy constructor throws.
               </li>
@@ -1824,20 +1928,20 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.swap_rtree___.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.swap_rtree___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.swap_rtree___.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.swap_rtree___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.swap_rtree___.description">Description</a>
           </h6>
 <p>
             Parameters, translator and allocators are swapped as well.
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.swap_rtree___.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.swap_rtree___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.swap_rtree___.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.swap_rtree___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.swap_rtree___.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">void</span></code> <code class="computeroutput"><span class="identifier">swap</span></code><code class="computeroutput"><span class="special">(</span></code><code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree">rtree</a></code><code class="computeroutput"> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="identifier">other</span></code><code class="computeroutput"><span class="special">)</span></code>
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.swap_rtree___.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.swap_rtree___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.swap_rtree___.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.swap_rtree___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.swap_rtree___.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -1883,7 +1987,7 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.swap_rtree___.h3"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.swap_rtree___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.swap_rtree___.throws">Throws</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.swap_rtree___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.swap_rtree___.throws">Throws</a>
           </h6>
 <p>
             If allocators swap throws.
@@ -1899,13 +2003,13 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_value_type_const___.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_value_type_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_value_type_const___.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_value_type_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_value_type_const___.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">void</span></code> <code class="computeroutput"><span class="identifier">insert</span></code><code class="computeroutput"><span class="special">(</span></code><code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb">value_type</a></code><code class="computeroutput"> <span class="keyword">const</span> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="identifier">value</span></code><code class="computeroutput"><span class="special">)</span></code>
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_value_type_const___.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_value_type_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_value_type_const___.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_value_type_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_value_type_const___.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -1951,9 +2055,9 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_value_type_const___.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_value_type_const___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_value_type_const___.throws">Throws</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_value_type_const___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_value_type_const___.throws">Throws</a>
           </h6>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 If Value copy constructor or copy assignment throws.
               </li>
@@ -1986,14 +2090,14 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_iterator__iterator_.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_iterator__iterator_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_iterator__iterator_.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_iterator__iterator_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_iterator__iterator_.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Iterator</span></code><code class="computeroutput"><span class="special">&gt;</span></code>
 <code class="computeroutput"><span class="keyword">void</span></code> <code class="computeroutput"><span class="identifier">insert</span></code><code class="computeroutput"><span class="special">(</span></code><code class="computeroutput"><span class="identifier">Iterator</span></code> <code class="computeroutput"><span class="identifier">first</span></code><code class="computeroutput"><span class="special">,</span></code> <code class="computeroutput"><span class="identifier">Iterator</span></code> <code class="computeroutput"><span class="identifier">last</span></code><code class="computeroutput"><span class="special">)</span></code>
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_iterator__iterator_.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_iterator__iterator_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_iterator__iterator_.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_iterator__iterator_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_iterator__iterator_.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -2057,9 +2161,9 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_iterator__iterator_.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_iterator__iterator_.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_iterator__iterator_.throws">Throws</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_iterator__iterator_.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_iterator__iterator_.throws">Throws</a>
           </h6>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 If Value copy constructor or copy assignment throws.
               </li>
@@ -2092,14 +2196,14 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_range_const___.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_range_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_range_const___.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_range_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_range_const___.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Range</span></code><code class="computeroutput"><span class="special">&gt;</span></code>
 <code class="computeroutput"><span class="keyword">void</span></code> <code class="computeroutput"><span class="identifier">insert</span></code><code class="computeroutput"><span class="special">(</span></code><code class="computeroutput"><span class="identifier">Range</span> <span class="keyword">const</span> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="identifier">rng</span></code><code class="computeroutput"><span class="special">)</span></code>
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_range_const___.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_range_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_range_const___.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_range_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_range_const___.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -2145,9 +2249,9 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_range_const___.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_range_const___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_range_const___.throws">Throws</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_range_const___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.insert_range_const___.throws">Throws</a>
           </h6>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 If Value copy constructor or copy assignment throws.
               </li>
@@ -2180,7 +2284,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.description">Description</a>
           </h6>
 <p>
             In contrast to the <code class="literal"><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">set</span></code></code>
@@ -2189,13 +2293,13 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6">size_type</a></code> <code class="computeroutput"><span class="identifier">remove</span></code><code class="computeroutput"><span class="special">(</span></code><code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb">value_type</a></code><code class="computeroutput"> <span class="keyword">const</span> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="identifier">value</span></code><code class="computeroutput"><span class="special">)</span></code>
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -2241,16 +2345,16 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.h3"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.returns">Returns</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.returns">Returns</a>
           </h6>
 <p>
             1 if the value was removed, 0 otherwise.
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.h4"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.throws">Throws</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_value_type_const___.throws">Throws</a>
           </h6>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 If Value copy constructor or copy assignment throws.
               </li>
@@ -2283,7 +2387,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.description">Description</a>
           </h6>
 <p>
             In contrast to the <code class="literal"><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">set</span></code></code>
@@ -2294,14 +2398,14 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Iterator</span></code><code class="computeroutput"><span class="special">&gt;</span></code>
 <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6">size_type</a></code> <code class="computeroutput"><span class="identifier">remove</span></code><code class="computeroutput"><span class="special">(</span></code><code class="computeroutput"><span class="identifier">Iterator</span></code> <code class="computeroutput"><span class="identifier">first</span></code><code class="computeroutput"><span class="special">,</span></code> <code class="computeroutput"><span class="identifier">Iterator</span></code> <code class="computeroutput"><span class="identifier">last</span></code><code class="computeroutput"><span class="special">)</span></code>
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -2365,16 +2469,16 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.h3"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.returns">Returns</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.returns">Returns</a>
           </h6>
 <p>
             The number of removed values.
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.h4"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.throws">Throws</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_iterator__iterator_.throws">Throws</a>
           </h6>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 If Value copy constructor or copy assignment throws.
               </li>
@@ -2407,7 +2511,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.description">Description</a>
           </h6>
 <p>
             In contrast to the <code class="literal"><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">set</span></code></code>
@@ -2417,14 +2521,14 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Range</span></code><code class="computeroutput"><span class="special">&gt;</span></code>
 <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6">size_type</a></code> <code class="computeroutput"><span class="identifier">remove</span></code><code class="computeroutput"><span class="special">(</span></code><code class="computeroutput"><span class="identifier">Range</span> <span class="keyword">const</span> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="identifier">rng</span></code><code class="computeroutput"><span class="special">)</span></code>
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -2470,16 +2574,16 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.h3"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.returns">Returns</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.returns">Returns</a>
           </h6>
 <p>
             The number of removed values.
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.h4"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.throws">Throws</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.remove_range_const___.throws">Throws</a>
           </h6>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 If Value copy constructor or copy assignment throws.
               </li>
@@ -2512,7 +2616,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.description">Description</a>
           </h6>
 <p>
             <span class="bold"><strong>Spatial predicates</strong></span> may be a <code class="literal"><code class="computeroutput"><span class="identifier">Geometry</span></code></code>. In this case Values
@@ -2522,7 +2626,7 @@
 <p>
             It may be generated by one of the functions listed below:
           </p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 <code class="literal"><a class="link" href="reference.html#group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61">boost::geometry::index::covered_by()</a></code>,
               </li>
@@ -2564,14 +2668,23 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Predicates</span></code><code class="computeroutput"><span class="special">,</span></code> <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">OutIter</span></code><code class="computeroutput"><span class="special">&gt;</span></code>
 <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6">size_type</a></code> <code class="computeroutput"><span class="identifier">spatial_query</span></code><code class="computeroutput"><span class="special">(</span></code><code class="computeroutput"><span class="identifier">Predicates</span> <span class="keyword">const</span> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="identifier">pred</span></code><code class="computeroutput"><span class="special">,</span></code> <code class="computeroutput"><span class="identifier">OutIter</span></code> <code class="computeroutput"><span class="identifier">out_it</span></code><code class="computeroutput"><span class="special">)</span></code>
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.modifier_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.modifier_s_">Modifier(s)</a>
+ </h6>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">const</span></pre>
+<p>
+ </p>
+<h6>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.h3"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -2635,17 +2748,17 @@
 </tbody>
 </table></div>
 <h6>
-<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.h3"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.returns">Returns</a>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.h4"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.returns">Returns</a>
           </h6>
 <p>
             The number of values found.
           </p>
 <h6>
-<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.h4"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.throws">Throws</a>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.h5"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.spatial_query_predicates_const____outiter_.throws">Throws</a>
           </h6>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 If Value copy constructor or copy assignment throws.
               </li>
@@ -2664,7 +2777,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.description">Description</a>
           </h6>
 <p>
             <span class="bold"><strong>Distances predicates</strong></span> may be a <code class="literal"><code class="computeroutput"><span class="identifier">Point</span></code></code>. In this the case the
@@ -2675,7 +2788,7 @@
             It is possible to define how distance to Value is calculated. This is
             done by passing PointRelation. It can be generated by following functions:
           </p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 <code class="literal"><a class="link" href="reference.html#group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636">boost::geometry::index::to_nearest()</a></code>
                 - default,
@@ -2692,7 +2805,7 @@
             distance must be between min_distance and max_distance. This is done
             by passing DistancesPredicates which can be generated by following functions:
           </p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 <code class="literal"><a class="link" href="reference.html#group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db">boost::geometry::index::unbounded()</a></code>
                 - default,
@@ -2711,7 +2824,7 @@
             MinRelation and MaxRelation describes bounds and can be generated by
             following functions:
           </p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 <code class="literal"><a class="link" href="reference.html#group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636">boost::geometry::index::to_nearest()</a></code>,
               </li>
@@ -2724,14 +2837,23 @@
 </ul></div>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">DistancesPredicates</span></code><code class="computeroutput"><span class="special">&gt;</span></code>
 <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6">size_type</a></code> <code class="computeroutput"><span class="identifier">nearest_query</span></code><code class="computeroutput"><span class="special">(</span></code><code class="computeroutput"><span class="identifier">DistancesPredicates</span> <span class="keyword">const</span> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="identifier">dpred</span></code><code class="computeroutput"><span class="special">,</span></code> <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb">value_type</a></code><code class="computeroutput"> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="identifier">v</span></code><code class="computeroutput"><span class="special">)</span></code>
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.modifier_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.modifier_s_">Modifier(s)</a>
+ </h6>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">const</span></pre>
+<p>
+ </p>
+<h6>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.h3"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -2796,15 +2918,15 @@
 </tbody>
 </table></div>
 <h6>
-<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.h3"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.returns">Returns</a>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.h4"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.returns">Returns</a>
           </h6>
 <p>
             The number of values found.
           </p>
 <h6>
-<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.h4"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.throws">Throws</a>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.h5"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____value_type___.throws">Throws</a>
           </h6>
 <p>
             If Value copy constructor or copy assignment throws.
@@ -2821,7 +2943,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.description">Description</a>
           </h6>
 <p>
             <span class="bold"><strong>Distances predicates</strong></span> may be a <code class="literal"><code class="computeroutput"><span class="identifier">Point</span></code></code>. In this the case the
@@ -2832,7 +2954,7 @@
             It is possible to define how distance to Value is calculated. This is
             done by passing PointRelation. It can be generated by following functions:
           </p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 <code class="literal"><a class="link" href="reference.html#group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636">boost::geometry::index::to_nearest()</a></code>
                 - default,
@@ -2849,7 +2971,7 @@
             distance must be between min_distance and max_distance. This is done
             by passing DistancesPredicates which can be generated by following functions:
           </p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 <code class="literal"><a class="link" href="reference.html#group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db">boost::geometry::index::unbounded()</a></code>
                 - default,
@@ -2868,7 +2990,7 @@
             MinRelation and MaxRelation describes bounds and can be generated by
             following functions:
           </p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 <code class="literal"><a class="link" href="reference.html#group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636">boost::geometry::index::to_nearest()</a></code>,
               </li>
@@ -2887,7 +3009,7 @@
 <p>
             It may be generated by one of the functions listed below:
           </p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 <code class="literal"><a class="link" href="reference.html#group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61">boost::geometry::index::covered_by()</a></code>,
               </li>
@@ -2929,7 +3051,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">DistancesPredicates</span></code><code class="computeroutput"><span class="special">,</span></code> <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Predicates</span></code><code class="computeroutput"><span class="special">&gt;</span></code>
 <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6">size_type</a></code> <code class="computeroutput"><span class="identifier">nearest_query</span></code><code class="computeroutput"><span class="special">(</span></code><code class="computeroutput"><span class="identifier">DistancesPredicates</span> <span class="keyword">const</span> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="identifier">dpred</span></code><code class="computeroutput"><span class="special">,</span></code>
@@ -2938,7 +3060,16 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.modifier_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.modifier_s_">Modifier(s)</a>
+ </h6>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">const</span></pre>
+<p>
+ </p>
+<h6>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.h3"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -3020,15 +3151,15 @@
 </tbody>
 </table></div>
 <h6>
-<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.h3"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.returns">Returns</a>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.h4"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.returns">Returns</a>
           </h6>
 <p>
             The number of values found.
           </p>
 <h6>
-<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.h4"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.throws">Throws</a>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.h5"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____predicates_const____value_type___.throws">Throws</a>
           </h6>
 <p>
             If Value copy constructor or copy assignment throws.
@@ -3045,7 +3176,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.description">Description</a>
           </h6>
 <p>
             <span class="bold"><strong>Distances predicates</strong></span> may be a <code class="literal"><code class="computeroutput"><span class="identifier">Point</span></code></code>. In this the case the
@@ -3056,7 +3187,7 @@
             It is possible to define how distance to Value is calculated. This is
             done by passing PointRelation. It can be generated by following functions:
           </p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 <code class="literal"><a class="link" href="reference.html#group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636">boost::geometry::index::to_nearest()</a></code>
                 - default,
@@ -3073,7 +3204,7 @@
             distance must be between min_distance and max_distance. This is done
             by passing DistancesPredicates which can be generated by following functions:
           </p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 <code class="literal"><a class="link" href="reference.html#group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db">boost::geometry::index::unbounded()</a></code>
                 - default,
@@ -3092,7 +3223,7 @@
             MinRelation and MaxRelation describes bounds and can be generated by
             following functions:
           </p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 <code class="literal"><a class="link" href="reference.html#group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636">boost::geometry::index::to_nearest()</a></code>,
               </li>
@@ -3105,7 +3236,7 @@
 </ul></div>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">DistancesPredicates</span></code><code class="computeroutput"><span class="special">,</span></code> <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">OutIter</span></code><code class="computeroutput"><span class="special">&gt;</span></code>
 <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6">size_type</a></code> <code class="computeroutput"><span class="identifier">nearest_query</span></code><code class="computeroutput"><span class="special">(</span></code><code class="computeroutput"><span class="identifier">DistancesPredicates</span> <span class="keyword">const</span> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="identifier">dpred</span></code><code class="computeroutput"><span class="special">,</span></code>
@@ -3114,7 +3245,16 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.modifier_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.modifier_s_">Modifier(s)</a>
+ </h6>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">const</span></pre>
+<p>
+ </p>
+<h6>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.h3"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -3195,15 +3335,15 @@
 </tbody>
 </table></div>
 <h6>
-<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.h3"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.returns">Returns</a>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.h4"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.returns">Returns</a>
           </h6>
 <p>
             The number of values found.
           </p>
 <h6>
-<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.h4"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.throws">Throws</a>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.h5"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__outiter_.throws">Throws</a>
           </h6>
 <p>
             If Value copy constructor or copy assignment throws. If OutIter dereference
@@ -3221,7 +3361,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.description">Description</a>
           </h6>
 <p>
             <span class="bold"><strong>Distances predicates</strong></span> may be a <code class="literal"><code class="computeroutput"><span class="identifier">Point</span></code></code>. In this the case the
@@ -3232,7 +3372,7 @@
             It is possible to define how distance to Value is calculated. This is
             done by passing PointRelation. It can be generated by following functions:
           </p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 <code class="literal"><a class="link" href="reference.html#group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636">boost::geometry::index::to_nearest()</a></code>
                 - default,
@@ -3249,7 +3389,7 @@
             distance must be between min_distance and max_distance. This is done
             by passing DistancesPredicates which can be generated by following functions:
           </p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 <code class="literal"><a class="link" href="reference.html#group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db">boost::geometry::index::unbounded()</a></code>
                 - default,
@@ -3268,7 +3408,7 @@
             MinRelation and MaxRelation describes bounds and can be generated by
             following functions:
           </p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 <code class="literal"><a class="link" href="reference.html#group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636">boost::geometry::index::to_nearest()</a></code>,
               </li>
@@ -3287,7 +3427,7 @@
 <p>
             It may be generated by one of the functions listed below:
           </p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem">
                 <code class="literal"><a class="link" href="reference.html#group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61">boost::geometry::index::covered_by()</a></code>,
               </li>
@@ -3329,7 +3469,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">DistancesPredicates</span></code><code class="computeroutput"><span class="special">,</span></code>
          <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Predicates</span></code><code class="computeroutput"><span class="special">,</span></code>
@@ -3341,7 +3481,16 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.modifier_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.modifier_s_">Modifier(s)</a>
+ </h6>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">const</span></pre>
+<p>
+ </p>
+<h6>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.h3"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -3439,15 +3588,15 @@
 </tbody>
 </table></div>
 <h6>
-<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.h3"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.returns">Returns</a>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.h4"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.returns">Returns</a>
           </h6>
 <p>
             The number of values found.
           </p>
 <h6>
-<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.h4"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.throws">Throws</a>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.h5"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.nearest_query_distancespredicates_const____size_type__predicates_const____outiter_.throws">Throws</a>
           </h6>
 <p>
             If Value copy constructor or copy assignment throws. If OutIter dereference
@@ -3463,20 +3612,29 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.size__.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.size__.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.size__.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.size__.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.size__.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6">size_type</a></code> <code class="computeroutput"><span class="identifier">size</span></code><code class="computeroutput"><span class="special">()</span></code>
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.size__.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.size__.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.size__.returns">Returns</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.size__.modifier_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.size__.modifier_s_">Modifier(s)</a>
           </h6>
 <p>
- The number of stored values.
+</p>
+<pre class="programlisting"><span class="keyword">const</span></pre>
+<p>
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.size__.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.size__.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.size__.throws">Throws</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.size__.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.size__.returns">Returns</a>
+ </h6>
+<p>
+ The number of stored values.
+ </p>
+<h6>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.size__.h3"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.size__.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.size__.throws">Throws</a>
           </h6>
 <p>
             Nothing.
@@ -3491,20 +3649,29 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.empty__.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.empty__.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.empty__.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.empty__.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.empty__.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">bool</span></code> <code class="computeroutput"><span class="identifier">empty</span></code><code class="computeroutput"><span class="special">()</span></code>
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.empty__.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.empty__.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.empty__.returns">Returns</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.empty__.modifier_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.empty__.modifier_s_">Modifier(s)</a>
           </h6>
 <p>
- true if the container is empty.
+</p>
+<pre class="programlisting"><span class="keyword">const</span></pre>
+<p>
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.empty__.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.empty__.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.empty__.throws">Throws</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.empty__.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.empty__.returns">Returns</a>
+ </h6>
+<p>
+ true if the container is empty.
+ </p>
+<h6>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.empty__.h3"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.empty__.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.empty__.throws">Throws</a>
           </h6>
 <p>
             Nothing.
@@ -3519,13 +3686,13 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.clear__.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.clear__.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.clear__.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.clear__.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.clear__.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">void</span></code> <code class="computeroutput"><span class="identifier">clear</span></code><code class="computeroutput"><span class="special">()</span></code>
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.clear__.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.clear__.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.clear__.throws">Throws</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.clear__.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.clear__.throws">Throws</a>
           </h6>
 <p>
             Nothing.
@@ -3533,36 +3700,45 @@
 </div>
 <div class="section">
 <div class="titlepage"><div><div><h5 class="title">
-<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.box__"></a><a name="classboost_1_1geometry_1_1index_1_1rtree_1ad534a6ed759677548f50b86dfeba07c6"></a><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.box__" title="box()">box()</a>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.envelope__"></a><a name="classboost_1_1geometry_1_1index_1_1rtree_1a131c273b6fc7e1c6d62cc5ebd015e77e"></a><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.envelope__" title="envelope()">envelope()</a>
 </h5></div></div></div>
 <p>
- Returns the box containing all values stored in the container.
+ Returns the box able to contain all values stored in the container.
           </p>
 <h6>
-<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.box__.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.box__.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.box__.description">Description</a>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.envelope__.h0"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.envelope__.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.envelope__.description">Description</a>
           </h6>
 <p>
- Returns the box containing all values stored in the container. If the
- container is empty the result of <code class="literal"><code class="computeroutput"><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">assign_inverse</span><span class="special">()</span></code></code> is returned.
+ Returns the box able to contain all values stored in the container. If
+ the container is empty the result of <code class="literal"><code class="computeroutput"><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">assign_inverse</span><span class="special">()</span></code></code> is returned.
           </p>
 <h6>
-<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.box__.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.box__.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.box__.synopsis">Synopsis</a>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.envelope__.h1"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.envelope__.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.envelope__.synopsis">Synopsis</a>
           </h6>
-<pre class="programlisting"><code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a42d0c9efffbc6f3935b5b9c3dd31e50d">box_type</a></code><code class="computeroutput"> <span class="keyword">const</span> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="identifier">box</span></code><code class="computeroutput"><span class="special">()</span></code>
+<pre class="programlisting"><code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a2803990c71c40e6770744d29e5bbd093">envelope_type</a></code><code class="computeroutput"> <span class="keyword">const</span> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="identifier">envelope</span></code><code class="computeroutput"><span class="special">()</span></code>
 </pre>
 <h6>
-<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.box__.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.box__.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.box__.returns">Returns</a>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.envelope__.h2"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.envelope__.modifier_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.envelope__.modifier_s_">Modifier(s)</a>
           </h6>
 <p>
- The box containing all values stored in the container or an invalid box
- if there are no values in the container.
+</p>
+<pre class="programlisting"><span class="keyword">const</span></pre>
+<p>
           </p>
 <h6>
-<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.box__.h3"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.box__.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.box__.throws">Throws</a>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.envelope__.h3"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.envelope__.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.envelope__.returns">Returns</a>
+ </h6>
+<p>
+ The box able to contain all values stored in the container or an invalid
+ box if there are no values in the container.
+ </p>
+<h6>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.envelope__.h4"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.envelope__.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.envelope__.throws">Throws</a>
           </h6>
 <p>
             Nothing.
@@ -3578,7 +3754,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.description">Description</a>
           </h6>
 <p>
             For indexable_type it returns the number of values which indexables equals
@@ -3587,14 +3763,23 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">ValueOrIndexable</span></code><code class="computeroutput"><span class="special">&gt;</span></code>
 <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6">size_type</a></code> <code class="computeroutput"><span class="identifier">count</span></code><code class="computeroutput"><span class="special">(</span></code><code class="computeroutput"><span class="identifier">ValueOrIndexable</span> <span class="keyword">const</span> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="identifier">vori</span></code><code class="computeroutput"><span class="special">)</span></code>
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.modifier_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.modifier_s_">Modifier(s)</a>
+ </h6>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">const</span></pre>
+<p>
+ </p>
+<h6>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.h3"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -3639,15 +3824,15 @@
 </tr></tbody>
 </table></div>
 <h6>
-<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.h3"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.returns">Returns</a>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.h4"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.returns">Returns</a>
           </h6>
 <p>
             The number of values found.
           </p>
 <h6>
-<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.h4"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.throws">Throws</a>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.h5"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.count_valueorindexable_const___.throws">Throws</a>
           </h6>
 <p>
             Nothing.
@@ -3662,20 +3847,29 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.parameters__.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.parameters__.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.parameters__.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.parameters__.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.parameters__.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a">parameters_type</a></code><code class="computeroutput"> <span class="keyword">const</span> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="identifier">parameters</span></code><code class="computeroutput"><span class="special">()</span></code>
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.parameters__.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.parameters__.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.parameters__.returns">Returns</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.parameters__.modifier_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.parameters__.modifier_s_">Modifier(s)</a>
           </h6>
 <p>
- The parameters object.
+</p>
+<pre class="programlisting"><span class="keyword">const</span></pre>
+<p>
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.parameters__.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.parameters__.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.parameters__.throws">Throws</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.parameters__.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.parameters__.returns">Returns</a>
+ </h6>
+<p>
+ The parameters object.
+ </p>
+<h6>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.parameters__.h3"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.parameters__.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.parameters__.throws">Throws</a>
           </h6>
 <p>
             Nothing.
@@ -3690,20 +3884,29 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.translator__.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.translator__.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.translator__.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.translator__.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.translator__.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91">translator_type</a></code><code class="computeroutput"> <span class="keyword">const</span> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="identifier">translator</span></code><code class="computeroutput"><span class="special">()</span></code>
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.translator__.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.translator__.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.translator__.returns">Returns</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.translator__.modifier_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.translator__.modifier_s_">Modifier(s)</a>
           </h6>
 <p>
- The translator object.
+</p>
+<pre class="programlisting"><span class="keyword">const</span></pre>
+<p>
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.translator__.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.translator__.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.translator__.throws">Throws</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.translator__.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.translator__.returns">Returns</a>
+ </h6>
+<p>
+ The translator object.
+ </p>
+<h6>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.translator__.h3"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.translator__.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.translator__.throws">Throws</a>
           </h6>
 <p>
             Nothing.
@@ -3718,20 +3921,29 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.get_allocator__.h0"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.get_allocator__.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.get_allocator__.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.get_allocator__.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.get_allocator__.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d">allocator_type</a></code> <code class="computeroutput"><span class="identifier">get_allocator</span></code><code class="computeroutput"><span class="special">()</span></code>
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.get_allocator__.h1"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.get_allocator__.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.get_allocator__.returns">Returns</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.get_allocator__.modifier_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.get_allocator__.modifier_s_">Modifier(s)</a>
           </h6>
 <p>
- The allocator.
+</p>
+<pre class="programlisting"><span class="keyword">const</span></pre>
+<p>
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.get_allocator__.h2"></a>
- <span><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.get_allocator__.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.get_allocator__.throws">Throws</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.get_allocator__.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.get_allocator__.returns">Returns</a>
+ </h6>
+<p>
+ The allocator.
+ </p>
+<h6>
+<a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.get_allocator__.h3"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.boost_geometry_index_rtree.get_allocator__.throws"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.boost_geometry_index_rtree.get_allocator__.throws">Throws</a>
           </h6>
 <p>
             If allocator copy constructor throws.
@@ -3745,7 +3957,7 @@
 </h4></div></div></div>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.h0"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.functions"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.functions">Functions</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.functions"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.functions">Functions</a>
         </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -3968,7 +4180,7 @@
 <tr>
 <td>
                   <p>
- <a class="link" href="reference.html#group__rtree__functions_1gad039bb35d79bded11a1454601f6eed3a"><code class="computeroutput"><span class="identifier">box</span><span class="special">(</span><span class="identifier">rtree</span><span class="special">&lt;...&gt;</span>
+ <a class="link" href="reference.html#group__rtree__functions_1ga73a9002187db81c57c71f9ec204d57e4"><code class="computeroutput"><span class="identifier">envelope</span><span class="special">(</span><span class="identifier">rtree</span><span class="special">&lt;...&gt;</span>
                     <span class="keyword">const</span> <span class="special">&amp;)</span></code></a>
                   </p>
                 </td>
@@ -3991,7 +4203,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________value_const___.h0"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________value_const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________value_const___.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________value_const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________value_const___.description">Description</a>
           </h6>
 <p>
             It calls <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1af6d5bd81e46cb4ff89277c753133664c">rtree::insert(value_type
@@ -3999,7 +4211,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________value_const___.h1"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________value_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________value_const___.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________value_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________value_const___.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Value</span></code><code class="computeroutput"><span class="special">,</span></code>
          <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Options</span></code><code class="computeroutput"><span class="special">,</span></code>
@@ -4009,7 +4221,7 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________value_const___.h2"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________value_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________value_const___.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________value_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________value_const___.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -4088,7 +4300,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________iterator__iterator_.h0"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________iterator__iterator_.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________iterator__iterator_.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________iterator__iterator_.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________iterator__iterator_.description">Description</a>
           </h6>
 <p>
             It calls <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a5263a3faac7b4f0090d4ad1d44cc540d">rtree::insert(Iterator,
@@ -4096,7 +4308,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________iterator__iterator_.h1"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________iterator__iterator_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________iterator__iterator_.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________iterator__iterator_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________iterator__iterator_.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Value</span></code><code class="computeroutput"><span class="special">,</span></code>
          <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Options</span></code><code class="computeroutput"><span class="special">,</span></code>
@@ -4109,7 +4321,7 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________iterator__iterator_.h2"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________iterator__iterator_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________iterator__iterator_.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________iterator__iterator_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________iterator__iterator_.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -4204,7 +4416,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________range_const___.h0"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________range_const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________range_const___.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________range_const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________range_const___.description">Description</a>
           </h6>
 <p>
             It calls <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1abb624abd9268b41e815d40342b2634c2">rtree::insert(Range
@@ -4212,7 +4424,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________range_const___.h1"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________range_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________range_const___.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________range_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________range_const___.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Value</span></code><code class="computeroutput"><span class="special">,</span></code>
          <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Options</span></code><code class="computeroutput"><span class="special">,</span></code>
@@ -4223,7 +4435,7 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________range_const___.h2"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________range_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________range_const___.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________range_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.insert_rtree_________range_const___.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -4302,7 +4514,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________value_const___.h0"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________value_const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________value_const___.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________value_const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________value_const___.description">Description</a>
           </h6>
 <p>
             Remove a value from the container. In contrast to the <code class="literal"><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">set</span></code></code> or <code class="literal"><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span> <span class="identifier">erase</span><span class="special">()</span></code></code> method this function removes
@@ -4314,7 +4526,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________value_const___.h1"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________value_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________value_const___.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________value_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________value_const___.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Value</span></code><code class="computeroutput"><span class="special">,</span></code>
          <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Options</span></code><code class="computeroutput"><span class="special">,</span></code>
@@ -4324,7 +4536,7 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________value_const___.h2"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________value_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________value_const___.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________value_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________value_const___.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -4394,7 +4606,7 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________value_const___.h3"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________value_const___.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________value_const___.returns">Returns</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________value_const___.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________value_const___.returns">Returns</a>
           </h6>
 <p>
             1 if value was removed, 0 otherwise.
@@ -4410,7 +4622,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________iterator__iterator_.h0"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________iterator__iterator_.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________iterator__iterator_.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________iterator__iterator_.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________iterator__iterator_.description">Description</a>
           </h6>
 <p>
             Remove a range of values from the container. In contrast to the <code class="literal"><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">set</span></code></code> or <code class="literal"><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span> <span class="identifier">erase</span><span class="special">()</span></code></code> method it doesn't take iterators
@@ -4424,7 +4636,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________iterator__iterator_.h1"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________iterator__iterator_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________iterator__iterator_.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________iterator__iterator_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________iterator__iterator_.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Value</span></code><code class="computeroutput"><span class="special">,</span></code>
          <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Options</span></code><code class="computeroutput"><span class="special">,</span></code>
@@ -4437,7 +4649,7 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________iterator__iterator_.h2"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________iterator__iterator_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________iterator__iterator_.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________iterator__iterator_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________iterator__iterator_.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -4523,7 +4735,7 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________iterator__iterator_.h3"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________iterator__iterator_.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________iterator__iterator_.returns">Returns</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________iterator__iterator_.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________iterator__iterator_.returns">Returns</a>
           </h6>
 <p>
             The number of removed values.
@@ -4539,7 +4751,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________range_const___.h0"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________range_const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________range_const___.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________range_const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________range_const___.description">Description</a>
           </h6>
 <p>
             Remove a range of values from the container. In contrast to the <code class="literal"><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">set</span></code></code> or <code class="literal"><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span> <span class="identifier">erase</span><span class="special">()</span></code></code> method it removes values
@@ -4552,7 +4764,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________range_const___.h1"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________range_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________range_const___.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________range_const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________range_const___.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Value</span></code><code class="computeroutput"><span class="special">,</span></code>
          <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Options</span></code><code class="computeroutput"><span class="special">,</span></code>
@@ -4563,7 +4775,7 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________range_const___.h2"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________range_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________range_const___.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________range_const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________range_const___.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -4633,7 +4845,7 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________range_const___.h3"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________range_const___.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________range_const___.returns">Returns</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________range_const___.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.remove_rtree_________range_const___.returns">Returns</a>
           </h6>
 <p>
             The number of removed values.
@@ -4649,7 +4861,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.spatial_query_rtree______const____predicates_const____outiter_.h0"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.spatial_query_rtree______const____predicates_const____outiter_.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.spatial_query_rtree______const____predicates_const____outiter_.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.spatial_query_rtree______const____predicates_const____outiter_.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.spatial_query_rtree______const____predicates_const____outiter_.description">Description</a>
           </h6>
 <p>
             It calls <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a930bf17d595a91d8ae924383a0387920">rtree::spatial_query</a></code>
@@ -4657,7 +4869,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.spatial_query_rtree______const____predicates_const____outiter_.h1"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.spatial_query_rtree______const____predicates_const____outiter_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.spatial_query_rtree______const____predicates_const____outiter_.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.spatial_query_rtree______const____predicates_const____outiter_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.spatial_query_rtree______const____predicates_const____outiter_.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Value</span></code><code class="computeroutput"><span class="special">,</span></code>
          <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Options</span></code><code class="computeroutput"><span class="special">,</span></code>
@@ -4671,7 +4883,7 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.spatial_query_rtree______const____predicates_const____outiter_.h2"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.spatial_query_rtree______const____predicates_const____outiter_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.spatial_query_rtree______const____predicates_const____outiter_.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.spatial_query_rtree______const____predicates_const____outiter_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.spatial_query_rtree______const____predicates_const____outiter_.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -4757,7 +4969,7 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.spatial_query_rtree______const____predicates_const____outiter_.h3"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.spatial_query_rtree______const____predicates_const____outiter_.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.spatial_query_rtree______const____predicates_const____outiter_.returns">Returns</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.spatial_query_rtree______const____predicates_const____outiter_.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.spatial_query_rtree______const____predicates_const____outiter_.returns">Returns</a>
           </h6>
 <p>
             The number of found values.
@@ -4773,7 +4985,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____value___.h0"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____value___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____value___.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____value___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____value___.description">Description</a>
           </h6>
 <p>
             It calls <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909">rtree::nearest_query</a></code>
@@ -4782,7 +4994,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____value___.h1"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____value___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____value___.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____value___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____value___.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Value</span></code><code class="computeroutput"><span class="special">,</span></code>
          <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Options</span></code><code class="computeroutput"><span class="special">,</span></code>
@@ -4795,7 +5007,7 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____value___.h2"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____value___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____value___.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____value___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____value___.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -4882,7 +5094,7 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____value___.h3"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____value___.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____value___.returns">Returns</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____value___.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____value___.returns">Returns</a>
           </h6>
 <p>
             The number of found values.
@@ -4899,7 +5111,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____predicates_const____value___.h0"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____predicates_const____value___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____predicates_const____value___.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____predicates_const____value___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____predicates_const____value___.description">Description</a>
           </h6>
 <p>
             It calls <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909">rtree::nearest_query</a></code>
@@ -4911,7 +5123,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____predicates_const____value___.h1"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____predicates_const____value___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____predicates_const____value___.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____predicates_const____value___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____predicates_const____value___.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Value</span></code><code class="computeroutput"><span class="special">,</span></code>
          <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Options</span></code><code class="computeroutput"><span class="special">,</span></code>
@@ -4926,7 +5138,7 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____predicates_const____value___.h2"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____predicates_const____value___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____predicates_const____value___.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____predicates_const____value___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____predicates_const____value___.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -5030,7 +5242,7 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____predicates_const____value___.h3"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____predicates_const____value___.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____predicates_const____value___.returns">Returns</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____predicates_const____value___.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____predicates_const____value___.returns">Returns</a>
           </h6>
 <p>
             The number of found values.
@@ -5047,7 +5259,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__outiter_.h0"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__outiter_.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__outiter_.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__outiter_.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__outiter_.description">Description</a>
           </h6>
 <p>
             It calls <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909">rtree::nearest_query</a></code>
@@ -5058,7 +5270,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__outiter_.h1"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__outiter_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__outiter_.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__outiter_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__outiter_.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Value</span></code><code class="computeroutput"><span class="special">,</span></code>
          <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Options</span></code><code class="computeroutput"><span class="special">,</span></code>
@@ -5073,7 +5285,7 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__outiter_.h2"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__outiter_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__outiter_.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__outiter_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__outiter_.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -5178,7 +5390,7 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__outiter_.h3"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__outiter_.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__outiter_.returns">Returns</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__outiter_.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__outiter_.returns">Returns</a>
           </h6>
 <p>
             The number of found values.
@@ -5195,7 +5407,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__predicates_const____outiter_.h0"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__predicates_const____outiter_.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__predicates_const____outiter_.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__predicates_const____outiter_.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__predicates_const____outiter_.description">Description</a>
           </h6>
 <p>
             It calls <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909">rtree::nearest_query</a></code>
@@ -5208,7 +5420,7 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__predicates_const____outiter_.h1"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__predicates_const____outiter_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__predicates_const____outiter_.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__predicates_const____outiter_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__predicates_const____outiter_.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Value</span></code><code class="computeroutput"><span class="special">,</span></code>
          <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Options</span></code><code class="computeroutput"><span class="special">,</span></code>
@@ -5225,7 +5437,7 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__predicates_const____outiter_.h2"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__predicates_const____outiter_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__predicates_const____outiter_.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__predicates_const____outiter_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__predicates_const____outiter_.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -5347,7 +5559,7 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__predicates_const____outiter_.h3"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__predicates_const____outiter_.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__predicates_const____outiter_.returns">Returns</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__predicates_const____outiter_.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.nearest_query_rtree______const____distancespredicates_const____typename_rtree_______size_type__predicates_const____outiter_.returns">Returns</a>
           </h6>
 <p>
             The number of found values.
@@ -5363,14 +5575,14 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.clear_rtree________.h0"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.clear_rtree________.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.clear_rtree________.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.clear_rtree________.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.clear_rtree________.description">Description</a>
           </h6>
 <p>
             It calls <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1ae6027e42d28a4bf93e74b055c79e6b09">rtree::clear()</a></code>.
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.clear_rtree________.h1"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.clear_rtree________.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.clear_rtree________.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.clear_rtree________.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.clear_rtree________.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Value</span></code><code class="computeroutput"><span class="special">,</span></code>
          <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Options</span></code><code class="computeroutput"><span class="special">,</span></code>
@@ -5380,7 +5592,7 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.clear_rtree________.h2"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.clear_rtree________.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.clear_rtree________.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.clear_rtree________.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.clear_rtree________.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -5439,14 +5651,14 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.size_rtree______const___.h0"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.size_rtree______const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.size_rtree______const___.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.size_rtree______const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.size_rtree______const___.description">Description</a>
           </h6>
 <p>
             It calls <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a89561a834563f2ed6fc782bad16143fd">rtree::size()</a></code>.
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.size_rtree______const___.h1"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.size_rtree______const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.size_rtree______const___.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.size_rtree______const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.size_rtree______const___.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Value</span></code><code class="computeroutput"><span class="special">,</span></code>
          <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Options</span></code><code class="computeroutput"><span class="special">,</span></code>
@@ -5456,7 +5668,7 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.size_rtree______const___.h2"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.size_rtree______const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.size_rtree______const___.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.size_rtree______const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.size_rtree______const___.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -5506,7 +5718,7 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.size_rtree______const___.h3"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.size_rtree______const___.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.size_rtree______const___.returns">Returns</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.size_rtree______const___.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.size_rtree______const___.returns">Returns</a>
           </h6>
 <p>
             The number of values stored in the index.
@@ -5522,14 +5734,14 @@
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.empty_rtree______const___.h0"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.empty_rtree______const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.empty_rtree______const___.description">Description</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.empty_rtree______const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.empty_rtree______const___.description">Description</a>
           </h6>
 <p>
             It calls <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb975564c55804c">rtree::empty()</a></code>.
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.empty_rtree______const___.h1"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.empty_rtree______const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.empty_rtree______const___.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.empty_rtree______const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.empty_rtree______const___.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Value</span></code><code class="computeroutput"><span class="special">,</span></code>
          <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Options</span></code><code class="computeroutput"><span class="special">,</span></code>
@@ -5539,7 +5751,7 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.empty_rtree______const___.h2"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.empty_rtree______const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.empty_rtree______const___.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.empty_rtree______const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.empty_rtree______const___.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -5589,7 +5801,7 @@
 </table></div>
 <h6>
 <a name="geometry_index.r_tree.reference.group__rtree__functions.empty_rtree______const___.h3"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.empty_rtree______const___.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.empty_rtree______const___.returns">Returns</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.empty_rtree______const___.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.empty_rtree______const___.returns">Returns</a>
           </h6>
 <p>
             true if there are no values in the index.
@@ -5597,7 +5809,7 @@
 </div>
 <div class="section">
 <div class="titlepage"><div><div><h5 class="title">
-<a name="geometry_index.r_tree.reference.group__rtree__functions.box_rtree______const___"></a><a name="group__rtree__functions_1gad039bb35d79bded11a1454601f6eed3a"></a><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.box_rtree______const___" title="box(rtree&lt;...&gt; const &amp;)">box(rtree&lt;...&gt;
+<a name="geometry_index.r_tree.reference.group__rtree__functions.envelope_rtree______const___"></a><a name="group__rtree__functions_1ga73a9002187db81c57c71f9ec204d57e4"></a><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.envelope_rtree______const___" title="envelope(rtree&lt;...&gt; const &amp;)">envelope(rtree&lt;...&gt;
           const &amp;)</a>
 </h5></div></div></div>
 <p>
@@ -5605,25 +5817,25 @@
             has no values.
           </p>
 <h6>
-<a name="geometry_index.r_tree.reference.group__rtree__functions.box_rtree______const___.h0"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.box_rtree______const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.box_rtree______const___.description">Description</a>
+<a name="geometry_index.r_tree.reference.group__rtree__functions.envelope_rtree______const___.h0"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.envelope_rtree______const___.description"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.envelope_rtree______const___.description">Description</a>
           </h6>
 <p>
- It calls <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1ad534a6ed759677548f50b86dfeba07c6">rtree::box()</a></code>.
+ It calls <code class="literal"><a class="link" href="reference.html#classboost_1_1geometry_1_1index_1_1rtree_1a131c273b6fc7e1c6d62cc5ebd015e77e">rtree::envelope()</a></code>.
           </p>
 <h6>
-<a name="geometry_index.r_tree.reference.group__rtree__functions.box_rtree______const___.h1"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.box_rtree______const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.box_rtree______const___.synopsis">Synopsis</a>
+<a name="geometry_index.r_tree.reference.group__rtree__functions.envelope_rtree______const___.h1"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.envelope_rtree______const___.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.envelope_rtree______const___.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Value</span></code><code class="computeroutput"><span class="special">,</span></code>
          <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Options</span></code><code class="computeroutput"><span class="special">,</span></code>
          <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Translator</span></code><code class="computeroutput"><span class="special">,</span></code>
          <code class="computeroutput"><span class="keyword">typename</span> <span class="identifier">Allocator</span></code><code class="computeroutput"><span class="special">&gt;</span></code>
-<code class="computeroutput"><span class="identifier">rtree</span><span class="special">&lt;</span><span class="identifier">Value</span><span class="special">,</span> <span class="identifier">Options</span><span class="special">,</span> <span class="identifier">Translator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">&gt;::</span><span class="identifier">box_type</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">index</span><span class="special">::</span><span class="identifier">box</span></code><code class="computeroutput"><span class="special">(</span></code><code class="computeroutput"><span class="identifier">rtree</span><span class="special">&lt;</span> <span class="identifier">Value</span><span class="special">,</span> <span class="identifier">Options</span><spa
n class="special">,</span> <span class="identifier">Translator</span><span class="special">,</span> <span class="identifier">Allocator</span> <span class="special">&gt;</span> <span class="keyword">const</span> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="identifier">tree</span></code><code class="computeroutput"><span class="special">)</span></code>
+<code class="computeroutput"><span class="identifier">rtree</span><span class="special">&lt;</span><span class="identifier">Value</span><span class="special">,</span> <span class="identifier">Options</span><span class="special">,</span> <span class="identifier">Translator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">&gt;::</span><span class="identifier">box_type</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">index</span><span class="special">::</span><span class="identifier">envelope</span></code><code class="computeroutput"><span class="special">(</span></code><code class="computeroutput"><span class="identifier">rtree</span><span class="special">&lt;</span> <span class="identifier">Value</span><span class="special">,</span> <span class="identifier">Options</span
><span class="special">,</span> <span class="identifier">Translator</span><span class="special">,</span> <span class="identifier">Allocator</span> <span class="special">&gt;</span> <span class="keyword">const</span> <span class="special">&amp;</span></code> <code class="computeroutput"><span class="identifier">tree</span></code><code class="computeroutput"><span class="special">)</span></code>
 </pre>
 <h6>
-<a name="geometry_index.r_tree.reference.group__rtree__functions.box_rtree______const___.h2"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.box_rtree______const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.box_rtree______const___.parameter_s_">Parameter(s)</a>
+<a name="geometry_index.r_tree.reference.group__rtree__functions.envelope_rtree______const___.h2"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.envelope_rtree______const___.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.envelope_rtree______const___.parameter_s_">Parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
 <colgroup>
@@ -5672,8 +5884,8 @@
 </tr></tbody>
 </table></div>
 <h6>
-<a name="geometry_index.r_tree.reference.group__rtree__functions.box_rtree______const___.h3"></a>
- <span><a name="geometry_index.r_tree.reference.group__rtree__functions.box_rtree______const___.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.box_rtree______const___.returns">Returns</a>
+<a name="geometry_index.r_tree.reference.group__rtree__functions.envelope_rtree______const___.h3"></a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.group__rtree__functions.envelope_rtree______const___.returns"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.group__rtree__functions.envelope_rtree______const___.returns">Returns</a>
           </h6>
 <p>
             The box containing all stored values or an invalid box.
@@ -5690,19 +5902,19 @@
 <a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_linear"></a><a name="structboost_1_1geometry_1_1index_1_1linear"></a><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_linear" title="boost::geometry::index::linear">boost::geometry::index::linear</a>
 </h5></div></div></div>
 <p>
- <a class="indexterm" name="idp11716272"></a><a class="indexterm" name="idp11716600"></a><a class="indexterm" name="idp11716944"></a><a class="indexterm" name="idp11717288"></a>
+ <a class="indexterm" name="id924524"></a><a class="indexterm" name="id924529"></a><a class="indexterm" name="id924533"></a><a class="indexterm" name="id924538"></a>
 Linear r-tree creation algorithm parameters.
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_linear.h0"></a>
- <span><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_linear.header"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_linear.header">Header</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_linear.header"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_linear.header">Header</a>
           </h6>
 <p>
- <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">extensions</span><span class="special">/</span><span class="identifier">index</span><span class="special">/</span><span class="identifier">parameters</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
+ <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">index</span><span class="special">/</span><span class="identifier">parameters</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_linear.h1"></a>
- <span><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_linear.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_linear.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_linear.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_linear.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="identifier">size_t</span> <span class="identifier">MaxElements</span></code><code class="computeroutput"><span class="special">,</span></code> <code class="computeroutput"><span class="identifier">size_t</span> <span class="identifier">MinElements</span></code><code class="computeroutput"><span class="special">&gt;</span></code>
 <code class="computeroutput"><span class="keyword">struct</span> <span class="identifier">linear</span></code>
@@ -5712,7 +5924,7 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_linear.h2"></a>
- <span><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_linear.template_parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_linear.template_parameter_s_">Template
+ <span class="phrase"><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_linear.template_parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_linear.template_parameter_s_">Template
             parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
@@ -5765,19 +5977,19 @@
 <a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_quadratic"></a><a name="structboost_1_1geometry_1_1index_1_1quadratic"></a><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_quadratic" title="boost::geometry::index::quadratic">boost::geometry::index::quadratic</a>
 </h5></div></div></div>
 <p>
- <a class="indexterm" name="idp11741816"></a><a class="indexterm" name="idp11742144"></a><a class="indexterm" name="idp11742488"></a><a class="indexterm" name="idp11742832"></a>
+ <a class="indexterm" name="id924832"></a><a class="indexterm" name="id924837"></a><a class="indexterm" name="id924842"></a><a class="indexterm" name="id924847"></a>
 Quadratic r-tree creation algorithm parameters.
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_quadratic.h0"></a>
- <span><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_quadratic.header"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_quadratic.header">Header</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_quadratic.header"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_quadratic.header">Header</a>
           </h6>
 <p>
- <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">extensions</span><span class="special">/</span><span class="identifier">index</span><span class="special">/</span><span class="identifier">parameters</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
+ <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">index</span><span class="special">/</span><span class="identifier">parameters</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_quadratic.h1"></a>
- <span><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_quadratic.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_quadratic.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_quadratic.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_quadratic.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="identifier">size_t</span> <span class="identifier">MaxElements</span></code><code class="computeroutput"><span class="special">,</span></code> <code class="computeroutput"><span class="identifier">size_t</span> <span class="identifier">MinElements</span></code><code class="computeroutput"><span class="special">&gt;</span></code>
 <code class="computeroutput"><span class="keyword">struct</span> <span class="identifier">quadratic</span></code>
@@ -5787,7 +5999,7 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_quadratic.h2"></a>
- <span><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_quadratic.template_parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_quadratic.template_parameter_s_">Template
+ <span class="phrase"><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_quadratic.template_parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_quadratic.template_parameter_s_">Template
             parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
@@ -5840,19 +6052,19 @@
 <a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_rstar"></a><a name="structboost_1_1geometry_1_1index_1_1rstar"></a><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_rstar" title="boost::geometry::index::rstar">boost::geometry::index::rstar</a>
 </h5></div></div></div>
 <p>
- <a class="indexterm" name="idp11767448"></a><a class="indexterm" name="idp11767776"></a><a class="indexterm" name="idp11768120"></a><a class="indexterm" name="idp11768464"></a>
+ <a class="indexterm" name="id925141"></a><a class="indexterm" name="id925145"></a><a class="indexterm" name="id925150"></a><a class="indexterm" name="id925155"></a>
 R*-tree creation algorithm parameters.
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_rstar.h0"></a>
- <span><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_rstar.header"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_rstar.header">Header</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_rstar.header"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_rstar.header">Header</a>
           </h6>
 <p>
- <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">extensions</span><span class="special">/</span><span class="identifier">index</span><span class="special">/</span><span class="identifier">parameters</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
+ <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">index</span><span class="special">/</span><span class="identifier">parameters</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_rstar.h1"></a>
- <span><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_rstar.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_rstar.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_rstar.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_rstar.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span></code><code class="computeroutput"><span class="identifier">size_t</span> <span class="identifier">MaxElements</span></code><code class="computeroutput"><span class="special">,</span></code>
          <code class="computeroutput"><span class="identifier">size_t</span> <span class="identifier">MinElements</span></code><code class="computeroutput"><span class="special">,</span></code>
@@ -5865,7 +6077,7 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_rstar.h2"></a>
- <span><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_rstar.template_parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_rstar.template_parameter_s_">Template
+ <span class="phrase"><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_rstar.template_parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_rstar.template_parameter_s_">Template
             parameter(s)</a>
           </h6>
 <div class="informaltable"><table class="table">
@@ -5944,19 +6156,19 @@
 <a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear"></a><a name="classboost_1_1geometry_1_1index_1_1runtime_1_1linear"></a><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear" title="boost::geometry::index::runtime::linear">boost::geometry::index::runtime::linear</a>
 </h5></div></div></div>
 <p>
- <a class="indexterm" name="idp11802656"></a><a class="indexterm" name="idp11802984"></a><a class="indexterm" name="idp11803328"></a><a class="indexterm" name="idp11803672"></a><a class="indexterm" name="idp11804016"></a>
+ <a class="indexterm" name="id925575"></a><a class="indexterm" name="id925580"></a><a class="indexterm" name="id925585"></a><a class="indexterm" name="id925589"></a><a class="indexterm" name="id925594"></a>
 Linear r-tree creation algorithm parameters.
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.h0"></a>
- <span><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.header"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.header">Header</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.header"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.header">Header</a>
           </h6>
 <p>
- <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">extensions</span><span class="special">/</span><span class="identifier">index</span><span class="special">/</span><span class="identifier">parameters</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
+ <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">index</span><span class="special">/</span><span class="identifier">parameters</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.h1"></a>
- <span><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">class</span> <span class="identifier">linear</span></code>
 <code class="computeroutput"><span class="special">{</span></code>
@@ -5965,7 +6177,7 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.h2"></a>
- <span><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.constructor_s__and_destructor"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.constructor_s__and_destructor">Constructor(s)
+ <span class="phrase"><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.constructor_s__and_destructor"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.constructor_s__and_destructor">Constructor(s)
             and destructor</a>
           </h6>
 <div class="informaltable"><table class="table">
@@ -6008,11 +6220,11 @@
               The constructor.
             </p>
 <h7><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.linear_size_t__size_t_.h0"></a>
- <span><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.linear_size_t__size_t_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.linear_size_t__size_t_.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.linear_size_t__size_t_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.linear_size_t__size_t_.synopsis">Synopsis</a>
             </h7><pre class="programlisting"><code class="computeroutput"><span class="identifier">linear</span></code><code class="computeroutput"><span class="special">(</span></code><code class="computeroutput"><span class="identifier">size_t</span></code> <code class="computeroutput"><span class="identifier">max_elements</span></code><code class="computeroutput"><span class="special">,</span></code> <code class="computeroutput"><span class="identifier">size_t</span></code> <code class="computeroutput"><span class="identifier">min_elements</span></code><code class="computeroutput"><span class="special">)</span></code>
 </pre>
 <h7><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.linear_size_t__size_t_.h1"></a>
- <span><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.linear_size_t__size_t_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.linear_size_t__size_t_.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.linear_size_t__size_t_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_linear.linear_size_t__size_t_.parameter_s_">Parameter(s)</a>
             </h7><div class="informaltable"><table class="table">
 <colgroup>
 <col>
@@ -6080,19 +6292,19 @@
 <a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic"></a><a name="classboost_1_1geometry_1_1index_1_1runtime_1_1quadratic"></a><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic" title="boost::geometry::index::runtime::quadratic">boost::geometry::index::runtime::quadratic</a>
 </h5></div></div></div>
 <p>
- <a class="indexterm" name="idp11843048"></a><a class="indexterm" name="idp11843376"></a><a class="indexterm" name="idp11843720"></a><a class="indexterm" name="idp11844064"></a><a class="indexterm" name="idp11844408"></a>
+ <a class="indexterm" name="id926053"></a><a class="indexterm" name="id926057"></a><a class="indexterm" name="id926062"></a><a class="indexterm" name="id926067"></a><a class="indexterm" name="id926072"></a>
 Quadratic r-tree creation algorithm parameters.
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.h0"></a>
- <span><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.header"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.header">Header</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.header"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.header">Header</a>
           </h6>
 <p>
- <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">extensions</span><span class="special">/</span><span class="identifier">index</span><span class="special">/</span><span class="identifier">parameters</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
+ <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">index</span><span class="special">/</span><span class="identifier">parameters</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.h1"></a>
- <span><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">class</span> <span class="identifier">quadratic</span></code>
 <code class="computeroutput"><span class="special">{</span></code>
@@ -6101,7 +6313,7 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.h2"></a>
- <span><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.constructor_s__and_destructor"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.constructor_s__and_destructor">Constructor(s)
+ <span class="phrase"><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.constructor_s__and_destructor"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.constructor_s__and_destructor">Constructor(s)
             and destructor</a>
           </h6>
 <div class="informaltable"><table class="table">
@@ -6144,11 +6356,11 @@
               The constructor.
             </p>
 <h7><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.quadratic_size_t__size_t_.h0"></a>
- <span><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.quadratic_size_t__size_t_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.quadratic_size_t__size_t_.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.quadratic_size_t__size_t_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.quadratic_size_t__size_t_.synopsis">Synopsis</a>
             </h7><pre class="programlisting"><code class="computeroutput"><span class="identifier">quadratic</span></code><code class="computeroutput"><span class="special">(</span></code><code class="computeroutput"><span class="identifier">size_t</span></code> <code class="computeroutput"><span class="identifier">max_elements</span></code><code class="computeroutput"><span class="special">,</span></code> <code class="computeroutput"><span class="identifier">size_t</span></code> <code class="computeroutput"><span class="identifier">min_elements</span></code><code class="computeroutput"><span class="special">)</span></code>
 </pre>
 <h7><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.quadratic_size_t__size_t_.h1"></a>
- <span><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.quadratic_size_t__size_t_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.quadratic_size_t__size_t_.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.quadratic_size_t__size_t_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_quadratic.quadratic_size_t__size_t_.parameter_s_">Parameter(s)</a>
             </h7><div class="informaltable"><table class="table">
 <colgroup>
 <col>
@@ -6216,19 +6428,19 @@
 <a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar"></a><a name="classboost_1_1geometry_1_1index_1_1runtime_1_1rstar"></a><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar" title="boost::geometry::index::runtime::rstar">boost::geometry::index::runtime::rstar</a>
 </h5></div></div></div>
 <p>
- <a class="indexterm" name="idp11883688"></a><a class="indexterm" name="idp11884016"></a><a class="indexterm" name="idp11884360"></a><a class="indexterm" name="idp11884704"></a><a class="indexterm" name="idp11885048"></a>
+ <a class="indexterm" name="id928310"></a><a class="indexterm" name="id928315"></a><a class="indexterm" name="id928320"></a><a class="indexterm" name="id928325"></a><a class="indexterm" name="id928330"></a>
 R*-tree creation algorithm parameters.
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.h0"></a>
- <span><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.header"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.header">Header</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.header"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.header">Header</a>
           </h6>
 <p>
- <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">extensions</span><span class="special">/</span><span class="identifier">index</span><span class="special">/</span><span class="identifier">parameters</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
+ <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">index</span><span class="special">/</span><span class="identifier">parameters</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
           </p>
 <h6>
 <a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.h1"></a>
- <span><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.synopsis">Synopsis</a>
           </h6>
 <pre class="programlisting"><code class="computeroutput"><span class="keyword">class</span> <span class="identifier">rstar</span></code>
 <code class="computeroutput"><span class="special">{</span></code>
@@ -6237,7 +6449,7 @@
 </pre>
 <h6>
 <a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.h2"></a>
- <span><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.constructor_s__and_destructor"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.constructor_s__and_destructor">Constructor(s)
+ <span class="phrase"><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.constructor_s__and_destructor"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.constructor_s__and_destructor">Constructor(s)
             and destructor</a>
           </h6>
 <div class="informaltable"><table class="table">
@@ -6280,14 +6492,14 @@
               The constructor.
             </p>
 <h7><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.rstar_size_t__size_t_.h0"></a>
- <span><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.rstar_size_t__size_t_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.rstar_size_t__size_t_.synopsis">Synopsis</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.rstar_size_t__size_t_.synopsis"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.rstar_size_t__size_t_.synopsis">Synopsis</a>
             </h7><pre class="programlisting"><code class="computeroutput"><span class="identifier">rstar</span></code><code class="computeroutput"><span class="special">(</span></code><code class="computeroutput"><span class="identifier">size_t</span></code> <code class="computeroutput"><span class="identifier">max_elements</span></code><code class="computeroutput"><span class="special">,</span></code>
       <code class="computeroutput"><span class="identifier">size_t</span></code> <code class="computeroutput"><span class="identifier">min_elements</span></code><code class="computeroutput"><span class="special">,</span></code>
       <code class="computeroutput"><span class="identifier">size_t</span></code> <code class="computeroutput"><span class="identifier">overlap_cost_threshold</span></code> = <code class="computeroutput"><span class="number">0</span></code><code class="computeroutput"><span class="special">,</span></code>
       <code class="computeroutput"><span class="identifier">size_t</span></code> <code class="computeroutput"><span class="identifier">reinserted_elements</span></code> = <code class="computeroutput"><span class="identifier">detail</span><span class="special">::</span><span class="identifier">default_rstar_reinserted_elements_d</span><span class="special">()</span></code><code class="computeroutput"><span class="special">)</span></code>
 </pre>
 <h7><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.rstar_size_t__size_t_.h1"></a>
- <span><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.rstar_size_t__size_t_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.rstar_size_t__size_t_.parameter_s_">Parameter(s)</a>
+ <span class="phrase"><a name="geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.rstar_size_t__size_t_.parameter_s_"></a></span><a class="link" href="reference.html#geometry_index.r_tree.reference.parameters.boost_geometry_index_runtime_rstar.rstar_size_t__size_t_.parameter_s_">Parameter(s)</a>
             </h7><div class="informaltable"><table class="table">