summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/geometry/index
diff options
context:
space:
mode:
Diffstat (limited to 'src/boost/libs/geometry/index')
-rw-r--r--src/boost/libs/geometry/index/Jamfile.v218
-rw-r--r--src/boost/libs/geometry/index/example/3d_benchmark.cpp161
-rw-r--r--src/boost/libs/geometry/index/example/Jamfile.v255
-rw-r--r--src/boost/libs/geometry/index/example/benchmark.cpp158
-rw-r--r--src/boost/libs/geometry/index/example/benchmark2.cpp86
-rw-r--r--src/boost/libs/geometry/index/example/benchmark3.cpp99
-rw-r--r--src/boost/libs/geometry/index/example/benchmark_experimental.cpp482
-rw-r--r--src/boost/libs/geometry/index/example/benchmark_insert.cpp196
-rw-r--r--src/boost/libs/geometry/index/example/glut_vis.cpp1094
-rw-r--r--src/boost/libs/geometry/index/example/random_test.cpp185
-rw-r--r--src/boost/libs/geometry/index/example/serialize.cpp168
-rw-r--r--src/boost/libs/geometry/index/index.html15
-rw-r--r--src/boost/libs/geometry/index/meta/libraries.json26
-rw-r--r--src/boost/libs/geometry/index/test/Jamfile.v231
-rw-r--r--src/boost/libs/geometry/index/test/algorithms/Jamfile.v220
-rw-r--r--src/boost/libs/geometry/index/test/algorithms/content.cpp71
-rw-r--r--src/boost/libs/geometry/index/test/algorithms/intersection_content.cpp70
-rw-r--r--src/boost/libs/geometry/index/test/algorithms/is_valid.cpp110
-rw-r--r--src/boost/libs/geometry/index/test/algorithms/margin.cpp66
-rw-r--r--src/boost/libs/geometry/index/test/algorithms/minmaxdist.cpp101
-rw-r--r--src/boost/libs/geometry/index/test/algorithms/path_intersection.cpp133
-rw-r--r--src/boost/libs/geometry/index/test/algorithms/segment_intersection.cpp129
-rw-r--r--src/boost/libs/geometry/index/test/algorithms/test_content.hpp49
-rw-r--r--src/boost/libs/geometry/index/test/algorithms/test_intersection_content.hpp47
-rw-r--r--src/boost/libs/geometry/index/test/algorithms/test_margin.hpp48
-rw-r--r--src/boost/libs/geometry/index/test/algorithms/test_union_content.hpp47
-rw-r--r--src/boost/libs/geometry/index/test/algorithms/union_content.cpp70
-rw-r--r--src/boost/libs/geometry/index/test/geometry_index_test_common.hpp28
-rw-r--r--src/boost/libs/geometry/index/test/movable.hpp92
-rw-r--r--src/boost/libs/geometry/index/test/rtree/Jamfile.v223
-rw-r--r--src/boost/libs/geometry/index/test/rtree/exceptions/Jamfile.v227
-rw-r--r--src/boost/libs/geometry/index/test/rtree/exceptions/rtree_exceptions_lin.cpp20
-rw-r--r--src/boost/libs/geometry/index/test/rtree/exceptions/rtree_exceptions_qua.cpp20
-rw-r--r--src/boost/libs/geometry/index/test/rtree/exceptions/rtree_exceptions_rst.cpp20
-rw-r--r--src/boost/libs/geometry/index/test/rtree/exceptions/test_exceptions.hpp193
-rw-r--r--src/boost/libs/geometry/index/test/rtree/exceptions/test_throwing.hpp167
-rw-r--r--src/boost/libs/geometry/index/test/rtree/exceptions/test_throwing_node.hpp322
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/Jamfile.v213
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b2d/Jamfile.v228
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_dlin_add_b2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_dlin_mod_b2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_dlin_que_b2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_dqua_add_b2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_dqua_mod_b2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_dqua_que_b2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_drst_add_b2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_drst_mod_b2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_drst_que_b2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_lin_add_b2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_lin_mod_b2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_lin_que_b2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_qua_add_b2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_qua_mod_b2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_qua_que_b2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_rst_add_b2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_rst_mod_b2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_rst_que_b2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b3d/Jamfile.v228
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_dlin_add_b3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_dlin_mod_b3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_dlin_que_b3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_dqua_add_b3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_dqua_mod_b3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_dqua_que_b3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_drst_add_b3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_drst_mod_b3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_drst_que_b3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_lin_add_b3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_lin_mod_b3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_lin_que_b3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_qua_add_b3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_qua_mod_b3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_qua_que_b3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_rst_add_b3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_rst_mod_b3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_rst_que_b3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p2d/Jamfile.v228
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_dlin_add_p2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_dlin_mod_p2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_dlin_que_p2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_dqua_add_p2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_dqua_mod_p2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_dqua_que_p2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_drst_add_p2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_drst_mod_p2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_drst_que_p2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_lin_add_p2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_lin_mod_p2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_lin_que_p2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_qua_add_p2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_qua_mod_p2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_qua_que_p2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_rst_add_p2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_rst_mod_p2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_rst_que_p2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p3d/Jamfile.v228
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_dlin_add_p3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_dlin_mod_p3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_dlin_que_p3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_dqua_add_p3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_dqua_mod_p3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_dqua_que_p3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_drst_add_p3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_drst_mod_p3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_drst_que_p3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_lin_add_p3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_lin_mod_p3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_lin_que_p3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_qua_add_p3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_qua_mod_p3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_qua_que_p3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_rst_add_p3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_rst_mod_p3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_rst_que_p3d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/s2d/Jamfile.v228
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_dlin_add_s2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_dlin_mod_s2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_dlin_que_s2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_dqua_add_s2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_dqua_mod_s2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_dqua_que_s2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_drst_add_s2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_drst_mod_s2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_drst_que_s2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_lin_add_s2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_lin_mod_s2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_lin_que_s2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_qua_add_s2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_qua_mod_s2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_qua_que_s2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_rst_add_s2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_rst_mod_s2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_rst_que_s2d.cpp17
-rw-r--r--src/boost/libs/geometry/index/test/rtree/interprocess/Jamfile.v234
-rw-r--r--src/boost/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_linear.cpp19
-rw-r--r--src/boost/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_linear_dyn.cpp19
-rw-r--r--src/boost/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_quadratic.cpp19
-rw-r--r--src/boost/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_quadratic_dyn.cpp19
-rw-r--r--src/boost/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_rstar.cpp19
-rw-r--r--src/boost/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_rstar_dyn.cpp19
-rw-r--r--src/boost/libs/geometry/index/test/rtree/interprocess/test_interprocess.hpp101
-rw-r--r--src/boost/libs/geometry/index/test/rtree/rtree_contains_point.cpp45
-rw-r--r--src/boost/libs/geometry/index/test/rtree/rtree_epsilon.cpp95
-rw-r--r--src/boost/libs/geometry/index/test/rtree/rtree_insert_remove.cpp82
-rw-r--r--src/boost/libs/geometry/index/test/rtree/rtree_intersects_geom.cpp55
-rw-r--r--src/boost/libs/geometry/index/test/rtree/rtree_move_pack.cpp134
-rw-r--r--src/boost/libs/geometry/index/test/rtree/rtree_non_cartesian.cpp128
-rw-r--r--src/boost/libs/geometry/index/test/rtree/rtree_test_generator.cpp111
-rw-r--r--src/boost/libs/geometry/index/test/rtree/rtree_values.cpp146
-rw-r--r--src/boost/libs/geometry/index/test/rtree/rtree_values_invalid.cpp31
-rw-r--r--src/boost/libs/geometry/index/test/rtree/test_rtree.hpp2023
-rw-r--r--src/boost/libs/geometry/index/test/varray.cpp781
-rw-r--r--src/boost/libs/geometry/index/test/varray_old.cpp490
-rw-r--r--src/boost/libs/geometry/index/test/varray_test.hpp97
154 files changed, 10797 insertions, 0 deletions
diff --git a/src/boost/libs/geometry/index/Jamfile.v2 b/src/boost/libs/geometry/index/Jamfile.v2
new file mode 100644
index 00000000..3675b7f0
--- /dev/null
+++ b/src/boost/libs/geometry/index/Jamfile.v2
@@ -0,0 +1,18 @@
+# Boost.Geometry (aka GGL, Generic Geometry Library)
+#
+# Copyright (c) 2007-2013 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2013 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2013 Mateusz Loskot, London, UK.
+#
+# 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)
+
+project boost-geometry-index
+ :
+ requirements
+ <toolset>msvc:<asynch-exceptions>on
+ ;
+
+build-project test ;
+build-project example ;
diff --git a/src/boost/libs/geometry/index/example/3d_benchmark.cpp b/src/boost/libs/geometry/index/example/3d_benchmark.cpp
new file mode 100644
index 00000000..25181768
--- /dev/null
+++ b/src/boost/libs/geometry/index/example/3d_benchmark.cpp
@@ -0,0 +1,161 @@
+// Boost.Geometry Index
+// Additional tests
+
+// 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 <iostream>
+#include <boost/geometry/index/rtree.hpp>
+
+#include <boost/chrono.hpp>
+#include <boost/foreach.hpp>
+#include <boost/random.hpp>
+
+int main()
+{
+ namespace bg = boost::geometry;
+ namespace bgi = bg::index;
+ typedef boost::chrono::thread_clock clock_t;
+ typedef boost::chrono::duration<float> dur_t;
+
+ size_t values_count = 500000;
+ size_t queries_count = 200000;
+
+ std::vector< boost::tuple<float, float, float> > coords;
+
+ //randomize values
+ {
+ boost::mt19937 rng;
+ //rng.seed(static_cast<unsigned int>(std::time(0)));
+ float max_val = static_cast<float>(values_count / 2);
+ boost::uniform_real<float> range(-max_val, max_val);
+ boost::variate_generator<boost::mt19937&, boost::uniform_real<float> > rnd(rng, range);
+
+ coords.reserve(values_count);
+
+ std::cout << "randomizing data\n";
+ for ( size_t i = 0 ; i < values_count ; ++i )
+ {
+ coords.push_back(boost::make_tuple(rnd(), rnd(), rnd()));
+ }
+ std::cout << "randomized\n";
+ }
+
+ typedef bg::model::point<float, 3, bg::cs::cartesian> P;
+ typedef bg::model::box<P> B;
+ //typedef bgi::rtree<B, bgi::linear<32, 8> > RT;
+ //typedef bgi::rtree<B, bgi::quadratic<32, 8> > RT;
+ typedef bgi::rtree<B, bgi::rstar<8, 3> > RT;
+
+ std::cout << "sizeof rtree: " << sizeof(RT) << std::endl;
+
+ for (;;)
+ {
+ RT t;
+
+ // inserting test
+ {
+ clock_t::time_point start = clock_t::now();
+ for (size_t i = 0 ; i < values_count ; ++i )
+ {
+ float x = boost::get<0>(coords[i]);
+ float y = boost::get<1>(coords[i]);
+ float z = boost::get<2>(coords[i]);
+ B b(P(x - 0.5f, y - 0.5f, z - 0.5f), P(x + 0.5f, y + 0.5f, z + 0.5f));
+
+ t.insert(b);
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - insert " << values_count << '\n';
+ }
+
+ std::vector<B> result;
+ result.reserve(100);
+ B result_one;
+
+ {
+ clock_t::time_point start = clock_t::now();
+ size_t temp = 0;
+ for (size_t i = 0 ; i < queries_count ; ++i )
+ {
+ float x = boost::get<0>(coords[i]);
+ float y = boost::get<1>(coords[i]);
+ float z = boost::get<2>(coords[i]);
+ result.clear();
+ t.query(bgi::intersects(B(P(x - 10, y - 10, z - 10), P(x + 10, y + 10, z + 10))), std::back_inserter(result));
+ temp += result.size();
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - query(B) " << queries_count << " found " << temp << '\n';
+ }
+
+ {
+ clock_t::time_point start = clock_t::now();
+ size_t temp = 0;
+ for (size_t i = 0 ; i < queries_count / 2 ; ++i )
+ {
+ float x1 = boost::get<0>(coords[i]);
+ float y1 = boost::get<1>(coords[i]);
+ float z1 = boost::get<2>(coords[i]);
+ float x2 = boost::get<0>(coords[i+1]);
+ float y2 = boost::get<1>(coords[i+1]);
+ float z2 = boost::get<2>(coords[i+1]);
+ float x3 = boost::get<0>(coords[i+2]);
+ float y3 = boost::get<1>(coords[i+2]);
+ float z3 = boost::get<2>(coords[i+2]);
+ result.clear();
+ t.query(
+ bgi::intersects(B(P(x1 - 10, y1 - 10, z1 - 10), P(x1 + 10, y1 + 10, z1 + 10)))
+ &&
+ !bgi::within(B(P(x2 - 10, y2 - 10, z2 - 10), P(x2 + 10, y2 + 10, z2 + 10)))
+ &&
+ !bgi::overlaps(B(P(x3 - 10, y3 - 10, z3 - 10), P(x3 + 10, y3 + 10, z3 + 10)))
+ ,
+ std::back_inserter(result)
+ );
+ temp += result.size();
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - query(i && !w && !o) " << queries_count << " found " << temp << '\n';
+ }
+
+ result.clear();
+
+ {
+ clock_t::time_point start = clock_t::now();
+ size_t temp = 0;
+ for (size_t i = 0 ; i < queries_count / 10 ; ++i )
+ {
+ float x = boost::get<0>(coords[i]) - 100;
+ float y = boost::get<1>(coords[i]) - 100;
+ float z = boost::get<2>(coords[i]) - 100;
+ result.clear();
+ temp += t.query(bgi::nearest(P(x, y, z), 5), std::back_inserter(result));
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - query(nearest(P, 5)) " << (queries_count / 10) << " found " << temp << '\n';
+ }
+
+ {
+ clock_t::time_point start = clock_t::now();
+ for (size_t i = 0 ; i < values_count / 10 ; ++i )
+ {
+ float x = boost::get<0>(coords[i]);
+ float y = boost::get<1>(coords[i]);
+ float z = boost::get<2>(coords[i]);
+ B b(P(x - 0.5f, y - 0.5f, z - 0.5f), P(x + 0.5f, y + 0.5f, z + 0.5f));
+
+ t.remove(b);
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - remove " << values_count / 10 << '\n';
+ }
+
+ std::cout << "------------------------------------------------\n";
+ }
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/example/Jamfile.v2 b/src/boost/libs/geometry/index/example/Jamfile.v2
new file mode 100644
index 00000000..5cfa81a0
--- /dev/null
+++ b/src/boost/libs/geometry/index/example/Jamfile.v2
@@ -0,0 +1,55 @@
+# Boost.Geometry (aka GGL, Generic Geometry Library)
+#
+# Copyright (c) 2013 Mateusz Loskot, London, UK.
+#
+# 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)
+
+# Usage:
+# Build as optimised for proper benchmarking:
+# b2 variant=release threading=multi
+# b2 variant=release threading=multi link=static runtime-link=static
+#
+# Set GLUT_ROOT to installation prefix of GLUT or, for Windows,
+# it may be all-in-one directory with GLUT header and binaries.
+
+import os ;
+
+project boost-geometry-index-example
+ : requirements
+ <implicit-dependency>/boost//headers
+ ;
+
+local GLUT_ROOT = [ os.environ GLUT_ROOT ] ;
+if $(GLUT_ROOT)
+{
+ local glut_name = glut ;
+ if [ os.name ] = NT
+ {
+ glut_name = glut32 ;
+ }
+
+ lib glut
+ :
+ :
+ <name>$(glut_name)
+ <search>$(GLUT_ROOT)
+ <search>$(GLUT_ROOT)/lib
+ :
+ :
+ <include>$(GLUT_ROOT)
+ <include>$(GLUT_ROOT)/include
+ ;
+}
+
+exe random_test : random_test.cpp ;
+link serialize.cpp /boost//serialization : ;
+link benchmark.cpp /boost//chrono : <threading>multi ;
+link benchmark2.cpp /boost//chrono : <threading>multi ;
+link benchmark3.cpp /boost//chrono : <threading>multi ;
+link benchmark_experimental.cpp /boost//chrono : <threading>multi ;
+if $(GLUT_ROOT)
+{
+ link glut_vis.cpp glut ;
+}
diff --git a/src/boost/libs/geometry/index/example/benchmark.cpp b/src/boost/libs/geometry/index/example/benchmark.cpp
new file mode 100644
index 00000000..ba2a1dec
--- /dev/null
+++ b/src/boost/libs/geometry/index/example/benchmark.cpp
@@ -0,0 +1,158 @@
+// Boost.Geometry Index
+// Additional tests
+
+// 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 <iostream>
+
+#include <boost/geometry.hpp>
+#include <boost/geometry/index/rtree.hpp>
+
+#include <boost/chrono.hpp>
+#include <boost/foreach.hpp>
+#include <boost/random.hpp>
+
+int main()
+{
+ namespace bg = boost::geometry;
+ namespace bgi = bg::index;
+ typedef boost::chrono::thread_clock clock_t;
+ typedef boost::chrono::duration<float> dur_t;
+
+ size_t values_count = 1000000;
+ size_t queries_count = 100000;
+ size_t nearest_queries_count = 10000;
+ unsigned neighbours_count = 10;
+
+ std::vector< std::pair<float, float> > coords;
+
+ //randomize values
+ {
+ boost::mt19937 rng;
+ //rng.seed(static_cast<unsigned int>(std::time(0)));
+ float max_val = static_cast<float>(values_count / 2);
+ boost::uniform_real<float> range(-max_val, max_val);
+ boost::variate_generator<boost::mt19937&, boost::uniform_real<float> > rnd(rng, range);
+
+ coords.reserve(values_count);
+
+ std::cout << "randomizing data\n";
+ for ( size_t i = 0 ; i < values_count ; ++i )
+ {
+ coords.push_back(std::make_pair(rnd(), rnd()));
+ }
+ std::cout << "randomized\n";
+ }
+
+ typedef bg::model::point<double, 2, bg::cs::cartesian> P;
+ typedef bg::model::box<P> B;
+ typedef bgi::rtree<B, bgi::linear<16, 4> > RT;
+ //typedef bgi::rtree<B, bgi::quadratic<8, 3> > RT;
+ //typedef bgi::rtree<B, bgi::rstar<8, 3> > RT;
+
+ std::cout << "sizeof rtree: " << sizeof(RT) << std::endl;
+
+ for (;;)
+ {
+ RT t;
+
+ // inserting test
+ {
+ clock_t::time_point start = clock_t::now();
+ for (size_t i = 0 ; i < values_count ; ++i )
+ {
+ float x = coords[i].first;
+ float y = coords[i].second;
+ B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f));
+
+ t.insert(b);
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - insert " << values_count << '\n';
+ }
+
+ std::vector<B> result;
+ result.reserve(100);
+ B result_one;
+
+ {
+ clock_t::time_point start = clock_t::now();
+ size_t temp = 0;
+ for (size_t i = 0 ; i < queries_count ; ++i )
+ {
+ float x = coords[i].first;
+ float y = coords[i].second;
+ result.clear();
+ t.query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result));
+ temp += result.size();
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - query(B) " << queries_count << " found " << temp << '\n';
+ }
+
+ {
+ clock_t::time_point start = clock_t::now();
+ size_t temp = 0;
+ for (size_t i = 0 ; i < queries_count / 2 ; ++i )
+ {
+ float x1 = coords[i].first;
+ float y1 = coords[i].second;
+ float x2 = coords[i+1].first;
+ float y2 = coords[i+1].second;
+ float x3 = coords[i+2].first;
+ float y3 = coords[i+2].second;
+ result.clear();
+ t.query(
+ bgi::intersects(B(P(x1 - 10, y1 - 10), P(x1 + 10, y1 + 10)))
+ &&
+ !bgi::within(B(P(x2 - 10, y2 - 10), P(x2 + 10, y2 + 10)))
+ &&
+ !bgi::overlaps(B(P(x3 - 10, y3 - 10), P(x3 + 10, y3 + 10)))
+ ,
+ std::back_inserter(result)
+ );
+ temp += result.size();
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - query(i && !w && !o) " << queries_count << " found " << temp << '\n';
+ }
+
+ result.clear();
+
+ {
+ clock_t::time_point start = clock_t::now();
+ size_t temp = 0;
+ for (size_t i = 0 ; i < nearest_queries_count ; ++i )
+ {
+ float x = coords[i].first + 100;
+ float y = coords[i].second + 100;
+ result.clear();
+ temp += t.query(bgi::nearest(P(x, y), neighbours_count), std::back_inserter(result));
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - query(nearest(P, " << neighbours_count << ")) " << nearest_queries_count << " found " << temp << '\n';
+ }
+
+ {
+ clock_t::time_point start = clock_t::now();
+ for (size_t i = 0 ; i < values_count / 10 ; ++i )
+ {
+ float x = coords[i].first;
+ float y = coords[i].second;
+ B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f));
+
+ t.remove(b);
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - remove " << values_count / 10 << '\n';
+ }
+
+ std::cout << "------------------------------------------------\n";
+ }
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/example/benchmark2.cpp b/src/boost/libs/geometry/index/example/benchmark2.cpp
new file mode 100644
index 00000000..48194cbd
--- /dev/null
+++ b/src/boost/libs/geometry/index/example/benchmark2.cpp
@@ -0,0 +1,86 @@
+// Boost.Geometry Index
+// Compare performance with std::set using 1-dimensional object
+// (i.e. angle, or number line coordiante)
+
+// 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 <iostream>
+
+#include <boost/geometry.hpp>
+#include <boost/geometry/index/rtree.hpp>
+
+#include <boost/chrono.hpp>
+#include <boost/foreach.hpp>
+#include <boost/random.hpp>
+#include <set>
+
+int main()
+{
+ namespace bg = boost::geometry;
+ namespace bgi = bg::index;
+ typedef boost::chrono::thread_clock clock_t;
+ typedef boost::chrono::duration<float> dur_t;
+
+ size_t values_count = 1001;
+ size_t count_start = 10;
+ size_t count_stop = 1000;
+ size_t count_step = 10;
+ size_t insrem_count = 3000000;
+
+ typedef bg::model::point<float, 1, bg::cs::cartesian> P;
+ //typedef bgi::rtree<P, bgi::linear<8, 3> > RT;
+ typedef bgi::rtree<P, bgi::quadratic<8, 3> > RT;
+ //typedef bgi::rtree<P, bgi::rstar<8, 3> > RT;
+
+ RT t;
+ std::set<float> s;
+ size_t val_i = 0;
+ for ( size_t curr_count = count_start ; curr_count < count_stop ; curr_count += count_step )
+ {
+ // inserting test
+ {
+ for (; val_i < curr_count ; ++val_i )
+ {
+ float v = val_i / 100.0f;
+ P p(v);
+ t.insert(p);
+ s.insert(v);
+ }
+
+ float v = (val_i+1) / 100.0f;
+ P test_p(v);
+
+ std::cout << t.size() << ' ';
+
+ clock_t::time_point start = clock_t::now();
+
+ for (size_t i = 0 ; i < insrem_count ; ++i )
+ {
+ t.insert(test_p);
+ t.remove(test_p);
+ }
+
+ dur_t time = clock_t::now() - start;
+ std::cout << time.count() << ' ';
+
+ start = clock_t::now();
+
+ for (size_t i = 0 ; i < insrem_count ; ++i )
+ {
+ s.insert(v);
+ s.erase(v);
+ }
+
+ time = clock_t::now() - start;
+ std::cout << time.count() << ' ';
+ }
+
+ std::cout << '\n';
+ }
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/example/benchmark3.cpp b/src/boost/libs/geometry/index/example/benchmark3.cpp
new file mode 100644
index 00000000..ad1910e4
--- /dev/null
+++ b/src/boost/libs/geometry/index/example/benchmark3.cpp
@@ -0,0 +1,99 @@
+// Boost.Geometry Index
+// Additional tests
+
+// 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 <iostream>
+
+#include <boost/geometry.hpp>
+#include <boost/geometry/index/rtree.hpp>
+
+#include <boost/chrono.hpp>
+#include <boost/foreach.hpp>
+#include <boost/random.hpp>
+#include <set>
+
+int main()
+{
+ namespace bg = boost::geometry;
+ namespace bgi = bg::index;
+ typedef boost::chrono::thread_clock clock_t;
+ typedef boost::chrono::duration<float> dur_t;
+
+ size_t stored_count = 100000;
+
+ std::vector< std::pair<float, float> > coords;
+
+ //randomize values
+ {
+ boost::mt19937 rng;
+ //rng.seed(static_cast<unsigned int>(std::time(0)));
+ float max_val = static_cast<float>(stored_count / 10);
+ boost::uniform_real<float> range(-max_val, max_val);
+ boost::variate_generator<boost::mt19937&, boost::uniform_real<float> > rnd(rng, range);
+
+ coords.reserve(stored_count);
+
+ std::cout << "randomizing data\n";
+ for ( size_t i = 0 ; i < stored_count ; ++i )
+ {
+ coords.push_back(std::make_pair(rnd(), rnd()));
+ }
+ std::cout << "randomized\n";
+ }
+
+ typedef bg::model::point<float, 2, bg::cs::cartesian> P;
+ typedef bgi::rtree<P, bgi::dynamic_linear > RTL;
+ typedef bgi::rtree<P, bgi::dynamic_quadratic > RTQ;
+ typedef bgi::rtree<P, bgi::dynamic_rstar > RTR;
+
+ for ( size_t m = 4 ; m < 33 ; m += 2 )
+ {
+ size_t mm = ::ceil(m / 3.0f);
+
+ RTL rtl(bgi::dynamic_linear(m, mm));
+ RTQ rtq(bgi::dynamic_quadratic(m, mm));
+ RTR rtr(bgi::dynamic_rstar(m, mm));
+
+ std::cout << m << ' ' << mm << ' ';
+
+ // inserting test
+ {
+ clock_t::time_point start = clock_t::now();
+ for (size_t i = 0 ; i < stored_count ; ++i )
+ {
+ P p(coords[i].first, coords[i].second);
+ rtl.insert(p);
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time.count() << ' ';
+
+ start = clock_t::now();
+ for (size_t i = 0 ; i < stored_count ; ++i )
+ {
+ P p(coords[i].first, coords[i].second);
+ rtq.insert(p);
+ }
+ time = clock_t::now() - start;
+ std::cout << time.count() << ' ';
+
+ start = clock_t::now();
+ for (size_t i = 0 ; i < stored_count ; ++i )
+ {
+ float v = i / 100.0f;
+ P p(coords[i].first, coords[i].second);
+ rtr.insert(p);
+ }
+ time = clock_t::now() - start;
+ std::cout << time.count() << ' ';
+ }
+
+ std::cout << '\n';
+ }
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/example/benchmark_experimental.cpp b/src/boost/libs/geometry/index/example/benchmark_experimental.cpp
new file mode 100644
index 00000000..6556d766
--- /dev/null
+++ b/src/boost/libs/geometry/index/example/benchmark_experimental.cpp
@@ -0,0 +1,482 @@
+// Boost.Geometry Index
+// Additional tests
+
+// Copyright (c) 2011-2015 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)
+
+#define BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
+
+#include <iostream>
+
+#include <boost/chrono.hpp>
+#include <boost/foreach.hpp>
+#include <boost/random.hpp>
+#include <boost/range/algorithm/copy.hpp>
+
+#include <boost/geometry.hpp>
+#include <boost/geometry/index/rtree.hpp>
+#include <boost/geometry/geometries/linestring.hpp>
+#include <boost/geometry/geometries/segment.hpp>
+
+#include <boost/geometry/index/detail/rtree/utilities/are_levels_ok.hpp>
+#include <boost/geometry/index/detail/rtree/utilities/are_boxes_ok.hpp>
+
+namespace bg = boost::geometry;
+namespace bgi = bg::index;
+
+typedef bg::model::point<double, 2, bg::cs::cartesian> P;
+typedef bg::model::box<P> B;
+typedef bg::model::linestring<P> LS;
+typedef bg::model::segment<P> S;
+//typedef P V;
+typedef B V;
+//typedef S V;
+//#define SEGMENT_INDEXABLE
+
+template <typename V>
+struct generate_value {};
+
+template <>
+struct generate_value<B>
+{
+ static inline B apply(float x, float y) { return B(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); }
+};
+
+template <>
+struct generate_value<S>
+{
+ static inline S apply(float x, float y) { return S(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); }
+};
+
+template <>
+struct generate_value<P>
+{
+ static inline P apply(float x, float y) { return P(x, y); }
+};
+
+//#include <boost/geometry/extensions/nsphere/nsphere.hpp>
+//typedef bg::model::nsphere<P, double> NS;
+//typedef NS V;
+//
+//template <>
+//struct generate_value<NS>
+//{
+// static inline NS apply(float x, float y) { return NS(P(x, y), 0.5); }
+//};
+
+template <typename I1, typename I2, typename O>
+void mycopy(I1 first, I2 last, O o)
+{
+ for ( ; first != last ; ++o, ++first )
+ *o = *first;
+}
+
+//#define BOOST_GEOMETRY_INDEX_BENCHMARK_DEBUG
+
+int main()
+{
+ typedef boost::chrono::thread_clock clock_t;
+ typedef boost::chrono::duration<float> dur_t;
+
+#ifndef BOOST_GEOMETRY_INDEX_BENCHMARK_DEBUG
+ size_t values_count = 1000000;
+ size_t queries_count = 100000;
+ size_t nearest_queries_count = 20000;
+ unsigned neighbours_count = 10;
+ size_t path_queries_count = 2000;
+ size_t path_queries_count2 = 20000;
+ unsigned path_values_count = 10;
+#else
+ size_t values_count = 1000;
+ size_t queries_count = 1;
+ size_t nearest_queries_count = 1;
+ unsigned neighbours_count = 10;
+ size_t path_queries_count = 1;
+ size_t path_queries_count2 = 1;
+ unsigned path_values_count = 10;
+#endif
+
+ float max_val = static_cast<float>(values_count / 2);
+ std::vector< std::pair<float, float> > coords;
+ std::vector<V> values;
+
+ //randomize values
+ {
+ boost::mt19937 rng;
+ //rng.seed(static_cast<unsigned int>(std::time(0)));
+ boost::uniform_real<float> range(-max_val, max_val);
+ boost::variate_generator<boost::mt19937&, boost::uniform_real<float> > rnd(rng, range);
+
+ coords.reserve(values_count);
+
+ std::cout << "randomizing data\n";
+ for ( size_t i = 0 ; i < values_count ; ++i )
+ {
+ float x = rnd();
+ float y = rnd();
+ coords.push_back(std::make_pair(x, y));
+ values.push_back(generate_value<V>::apply(x, y));
+ }
+ std::cout << "randomized\n";
+ }
+
+ typedef bgi::rtree<V, bgi::linear<16, 4> > RT;
+ //typedef bgi::rtree<V, bgi::quadratic<16, 4> > RT;
+ //typedef bgi::rtree<V, bgi::rstar<16, 4> > RT;
+
+ std::cout << "sizeof rtree: " << sizeof(RT) << std::endl;
+
+ for (;;)
+ {
+ std::vector<V> result;
+ result.reserve(100);
+ B result_one;
+
+ // packing test
+ {
+ clock_t::time_point start = clock_t::now();
+
+ RT t(values.begin(), values.end());
+
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - pack " << values_count /*<< '\n'*/;
+
+ std::cout << (bgi::detail::rtree::utilities::are_levels_ok(t) ? " ok" : " NOK")
+ << (bgi::detail::rtree::utilities::are_boxes_ok(t) ? " ok\n" : "NOK\n");
+
+ {
+ clock_t::time_point start = clock_t::now();
+ size_t temp = 0;
+ for (size_t i = 0 ; i < queries_count ; ++i )
+ {
+ float x = coords[i].first;
+ float y = coords[i].second;
+ result.clear();
+ t.query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result));
+ temp += result.size();
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - query(B) " << queries_count << " found " << temp << '\n';
+ }
+ }
+
+ RT t;
+
+ // inserting test
+ {
+ clock_t::time_point start = clock_t::now();
+ t.insert(values);
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - insert " << values_count /*<< '\n'*/;
+
+ std::cout << (bgi::detail::rtree::utilities::are_levels_ok(t) ? " ok" : " NOK")
+ << (bgi::detail::rtree::utilities::are_boxes_ok(t) ? " ok\n" : "NOK\n");
+ }
+
+
+
+ {
+ clock_t::time_point start = clock_t::now();
+ size_t temp = 0;
+ for (size_t i = 0 ; i < queries_count ; ++i )
+ {
+ float x = coords[i].first;
+ float y = coords[i].second;
+ result.clear();
+ t.query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result));
+ temp += result.size();
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - query(B) " << queries_count << " found " << temp << '\n';
+ }
+
+ {
+ clock_t::time_point start = clock_t::now();
+ size_t temp = 0;
+ for (size_t i = 0 ; i < queries_count ; ++i )
+ {
+ float x = coords[i].first;
+ float y = coords[i].second;
+ result.clear();
+ boost::copy(t | bgi::adaptors::queried(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10)))),
+ std::back_inserter(result));
+ temp += result.size();
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - range queried(B) " << queries_count << " found " << temp << '\n';
+ }
+
+#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
+ {
+ clock_t::time_point start = clock_t::now();
+ size_t temp = 0;
+ for (size_t i = 0 ; i < queries_count ; ++i )
+ {
+ float x = coords[i].first;
+ float y = coords[i].second;
+ result.clear();
+ std::copy(
+ t.qbegin_(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10)))),
+ t.qend_(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10)))),
+ std::back_inserter(result));
+ temp += result.size();
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - qbegin(B) qend(B) " << queries_count << " found " << temp << '\n';
+ }
+ {
+ clock_t::time_point start = clock_t::now();
+ size_t temp = 0;
+ for (size_t i = 0 ; i < queries_count ; ++i )
+ {
+ float x = coords[i].first;
+ float y = coords[i].second;
+ result.clear();
+ mycopy(
+ t.qbegin_(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10)))),
+ t.qend_(),
+ std::back_inserter(result));
+ temp += result.size();
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - qbegin(B) qend() " << queries_count << " found " << temp << '\n';
+ }
+ {
+ clock_t::time_point start = clock_t::now();
+ size_t temp = 0;
+ for (size_t i = 0 ; i < queries_count ; ++i )
+ {
+ float x = coords[i].first;
+ float y = coords[i].second;
+ result.clear();
+ boost::copy(
+ std::make_pair(
+ t.qbegin_(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10)))),
+ t.qend_(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))))
+ ), std::back_inserter(result));
+ temp += result.size();
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - range qbegin(B) qend(B)" << queries_count << " found " << temp << '\n';
+ }
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
+
+ {
+ clock_t::time_point start = clock_t::now();
+ size_t temp = 0;
+ for (size_t i = 0 ; i < queries_count ; ++i )
+ {
+ float x = coords[i].first;
+ float y = coords[i].second;
+ result.clear();
+ RT::const_query_iterator first = t.qbegin(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))));
+ RT::const_query_iterator last = t.qend();
+ std::copy(first, last, std::back_inserter(result));
+ temp += result.size();
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - type-erased qbegin(B) qend() " << queries_count << " found " << temp << '\n';
+ }
+ {
+ clock_t::time_point start = clock_t::now();
+ size_t temp = 0;
+ for (size_t i = 0 ; i < queries_count ; ++i )
+ {
+ float x = coords[i].first;
+ float y = coords[i].second;
+ result.clear();
+ RT::const_query_iterator first = t.qbegin(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))));
+ RT::const_query_iterator last = t.qend();
+ boost::copy(std::make_pair(first, last), std::back_inserter(result));
+ temp += result.size();
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - range type-erased qbegin(B) qend() " << queries_count << " found " << temp << '\n';
+ }
+
+#ifndef SEGMENT_INDEXABLE
+ {
+ clock_t::time_point start = clock_t::now();
+ size_t temp = 0;
+ for (size_t i = 0 ; i < queries_count / 2 ; ++i )
+ {
+ float x1 = coords[i].first;
+ float y1 = coords[i].second;
+ float x2 = coords[i+1].first;
+ float y2 = coords[i+1].second;
+ float x3 = coords[i+2].first;
+ float y3 = coords[i+2].second;
+ result.clear();
+ t.query(
+ bgi::intersects(B(P(x1 - 10, y1 - 10), P(x1 + 10, y1 + 10)))
+ &&
+ !bgi::within(B(P(x2 - 10, y2 - 10), P(x2 + 10, y2 + 10)))
+ &&
+ !bgi::covered_by(B(P(x3 - 10, y3 - 10), P(x3 + 10, y3 + 10)))
+ ,
+ std::back_inserter(result)
+ );
+ temp += result.size();
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - query(i && !w && !c) " << queries_count << " found " << temp << '\n';
+ }
+#endif
+
+ result.clear();
+
+ {
+ clock_t::time_point start = clock_t::now();
+ size_t temp = 0;
+ for (size_t i = 0 ; i < nearest_queries_count ; ++i )
+ {
+ float x = coords[i].first + 100;
+ float y = coords[i].second + 100;
+ result.clear();
+ temp += t.query(bgi::nearest(P(x, y), neighbours_count), std::back_inserter(result));
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - query(nearest(P, " << neighbours_count << ")) " << nearest_queries_count << " found " << temp << '\n';
+ }
+
+#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
+ {
+ clock_t::time_point start = clock_t::now();
+ size_t temp = 0;
+ for (size_t i = 0 ; i < nearest_queries_count ; ++i )
+ {
+ float x = coords[i].first + 100;
+ float y = coords[i].second + 100;
+ result.clear();
+ std::copy(
+ t.qbegin_(bgi::nearest(P(x, y), neighbours_count)),
+ t.qend_(bgi::nearest(P(x, y), neighbours_count)),
+ std::back_inserter(result));
+ temp += result.size();
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - qbegin(nearest(P, " << neighbours_count << ")) qend(n) " << nearest_queries_count << " found " << temp << '\n';
+ }
+ {
+ clock_t::time_point start = clock_t::now();
+ size_t temp = 0;
+ for (size_t i = 0 ; i < nearest_queries_count ; ++i )
+ {
+ float x = coords[i].first + 100;
+ float y = coords[i].second + 100;
+ result.clear();
+ mycopy(
+ t.qbegin_(bgi::nearest(P(x, y), neighbours_count)),
+ t.qend_(),
+ std::back_inserter(result));
+ temp += result.size();
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - qbegin(nearest(P, " << neighbours_count << ")) qend() " << nearest_queries_count << " found " << temp << '\n';
+ }
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
+
+ {
+ clock_t::time_point start = clock_t::now();
+ size_t temp = 0;
+ for (size_t i = 0 ; i < nearest_queries_count ; ++i )
+ {
+ float x = coords[i].first;
+ float y = coords[i].second;
+ result.clear();
+ RT::const_query_iterator first = t.qbegin(bgi::nearest(P(x, y), neighbours_count));
+ RT::const_query_iterator last = t.qend();
+ std::copy(first, last, std::back_inserter(result));
+ temp += result.size();
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - type-erased qbegin(nearest(P, " << neighbours_count << ")) qend() " << nearest_queries_count << " found " << temp << '\n';
+ }
+
+#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
+#ifndef SEGMENT_INDEXABLE
+
+ {
+ LS ls;
+ ls.resize(6);
+
+ clock_t::time_point start = clock_t::now();
+ size_t temp = 0;
+ for (size_t i = 0 ; i < path_queries_count ; ++i )
+ {
+ float x = coords[i].first;
+ float y = coords[i].second;
+ for ( int i = 0 ; i < 3 ; ++i )
+ {
+ float foo = i*max_val/300;
+ ls[2*i] = P(x, y+foo);
+ ls[2*i+1] = P(x+max_val/100, y+foo);
+ }
+ result.clear();
+ t.query(bgi::path(ls, path_values_count), std::back_inserter(result));
+ temp += result.size();
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - query(path(LS6, " << path_values_count << ")) " << path_queries_count << " found " << temp << '\n';
+ }
+
+ {
+ LS ls;
+ ls.resize(2);
+
+ clock_t::time_point start = clock_t::now();
+ size_t temp = 0;
+ for (size_t i = 0 ; i < path_queries_count2 ; ++i )
+ {
+ float x = coords[i].first;
+ float y = coords[i].second;
+ ls[0] = P(x, y);
+ ls[1] = P(x+max_val/100, y+max_val/100);
+ result.clear();
+ t.query(bgi::path(ls, path_values_count), std::back_inserter(result));
+ temp += result.size();
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - query(path(LS2, " << path_values_count << ")) " << path_queries_count2 << " found " << temp << '\n';
+ }
+
+ {
+ clock_t::time_point start = clock_t::now();
+ size_t temp = 0;
+ for (size_t i = 0 ; i < path_queries_count2 ; ++i )
+ {
+ float x = coords[i].first;
+ float y = coords[i].second;
+ S seg(P(x, y), P(x+max_val/100, y+max_val/100));
+ result.clear();
+ t.query(bgi::path(seg, path_values_count), std::back_inserter(result));
+ temp += result.size();
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - query(path(S, " << path_values_count << ")) " << path_queries_count2 << " found " << temp << '\n';
+ }
+#endif
+#endif
+ {
+ clock_t::time_point start = clock_t::now();
+ for (size_t i = 0 ; i < values_count / 10 ; ++i )
+ {
+ float x = coords[i].first;
+ float y = coords[i].second;
+
+ t.remove(generate_value<V>::apply(x, y));
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time << " - remove " << values_count / 10 << '\n';
+
+ std::cout << (bgi::detail::rtree::utilities::are_boxes_ok(t) ? " boxes ok\n" : "boxes NOT ok\n");
+ }
+
+ std::cout << "------------------------------------------------\n";
+ }
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/example/benchmark_insert.cpp b/src/boost/libs/geometry/index/example/benchmark_insert.cpp
new file mode 100644
index 00000000..4fe82e91
--- /dev/null
+++ b/src/boost/libs/geometry/index/example/benchmark_insert.cpp
@@ -0,0 +1,196 @@
+// Boost.Geometry Index
+// Additional tests
+
+// Copyright (c) 2011-2015 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 <iostream>
+#include <vector>
+#include <algorithm>
+
+#include <boost/chrono.hpp>
+#include <boost/foreach.hpp>
+#include <boost/random.hpp>
+
+#include <boost/geometry.hpp>
+#include <boost/geometry/index/rtree.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/index/detail/rtree/utilities/are_boxes_ok.hpp>
+#include <boost/geometry/index/detail/rtree/utilities/are_counts_ok.hpp>
+#include <boost/geometry/index/detail/rtree/utilities/are_levels_ok.hpp>
+
+namespace bg = boost::geometry;
+namespace bgi = bg::index;
+
+typedef bg::model::point<double, 2, bg::cs::cartesian> P;
+typedef bg::model::box<P> B;
+typedef bg::model::segment<P> S;
+typedef P V;
+//typedef B V;
+//typedef S V;
+
+template <typename V>
+struct generate_value {};
+
+template <>
+struct generate_value<B>
+{
+ static inline B apply(float x, float y) { return B(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); }
+};
+
+template <>
+struct generate_value<S>
+{
+ static inline S apply(float x, float y) { return S(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); }
+};
+
+template <>
+struct generate_value<P>
+{
+ static inline P apply(float x, float y) { return P(x, y); }
+};
+
+template <typename RT>
+void test_queries(RT const& t, std::vector< std::pair<float, float> > const& coords, size_t queries_count)
+{
+ typedef boost::chrono::thread_clock clock_t;
+ typedef boost::chrono::duration<float> dur_t;
+
+ std::vector<V> result;
+ result.reserve(100);
+
+ clock_t::time_point start = clock_t::now();
+ size_t temp = 0;
+ for (size_t i = 0 ; i < queries_count ; ++i )
+ {
+ float x = coords[i].first;
+ float y = coords[i].second;
+ result.clear();
+ t.query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result));
+ temp += result.size();
+ }
+ dur_t time = clock_t::now() - start;
+ std::cout << time.count() << " " << temp << '\n';
+}
+
+//#define BOOST_GEOMETRY_INDEX_BENCHMARK_DEBUG
+
+int main()
+{
+ //typedef bgi::rtree<V, bgi::linear<4, 2> > RT;
+ //typedef bgi::rtree<V, bgi::linear<16, 4> > RT;
+ //typedef bgi::rtree<V, bgi::quadratic<4, 2> > RT;
+ typedef bgi::rtree<V, bgi::rstar<8, 2> > RT;
+
+ typedef boost::chrono::thread_clock clock_t;
+ typedef boost::chrono::duration<float> dur_t;
+
+#ifndef BOOST_GEOMETRY_INDEX_BENCHMARK_DEBUG
+ size_t values_count = 1000000;
+ size_t queries_count = 100000;
+ size_t nearest_queries_count = 20000;
+ unsigned neighbours_count = 10;
+ size_t max_range_inserts = 10;
+#else
+ size_t values_count = 10000;
+ size_t queries_count = 1000;
+ size_t nearest_queries_count = 100;
+ unsigned neighbours_count = 10;
+ size_t max_range_inserts = 10;
+#endif
+
+ float max_val = static_cast<float>(values_count / 2);
+ std::vector< std::pair<float, float> > coords;
+ std::vector<V> values;
+
+ //randomize values
+ {
+ boost::mt19937 rng;
+ //rng.seed(static_cast<unsigned int>(std::time(0)));
+ boost::uniform_real<float> range(-max_val, max_val);
+ boost::variate_generator<boost::mt19937&, boost::uniform_real<float> > rnd(rng, range);
+
+ coords.reserve(values_count);
+
+ std::cout << "randomizing data\n";
+ for ( size_t i = 0 ; i < values_count ; ++i )
+ {
+ float x = rnd();
+ float y = rnd();
+ coords.push_back(std::make_pair(x, y));
+ values.push_back(generate_value<V>::apply(x, y));
+ }
+ std::cout << "randomized\n";
+ }
+
+ for (;;)
+ {
+ // packing test
+ {
+ clock_t::time_point start = clock_t::now();
+
+ RT t(values.begin(), values.end());
+
+ BOOST_ASSERT(bgi::detail::rtree::utilities::are_boxes_ok(t));
+ BOOST_ASSERT(bgi::detail::rtree::utilities::are_counts_ok(t));
+ BOOST_ASSERT(bgi::detail::rtree::utilities::are_levels_ok(t));
+
+ dur_t time = clock_t::now() - start;
+ std::cout << "pack(" << values_count << ") - " << time.count() << ", ";
+
+ test_queries(t, coords, queries_count);
+ }
+
+ {
+ size_t n_per_max = values_count / max_range_inserts;
+
+ for ( size_t j = 0 ; j < max_range_inserts ; ++j )
+ {
+ clock_t::time_point start = clock_t::now();
+
+ RT t;
+
+ // perform j range-inserts
+ for ( size_t i = 0 ; i < j ; ++i )
+ {
+ t.insert(values.begin() + n_per_max * i,
+ values.begin() + (std::min)(n_per_max * (i + 1), values_count));
+ }
+
+ if ( !t.empty() )
+ {
+ BOOST_ASSERT(bgi::detail::rtree::utilities::are_boxes_ok(t));
+ BOOST_ASSERT(bgi::detail::rtree::utilities::are_counts_ok(t));
+ BOOST_ASSERT(bgi::detail::rtree::utilities::are_levels_ok(t));
+ }
+
+ // perform n-n/max_inserts*j inserts
+ size_t inserted_count = (std::min)(n_per_max*j, values_count);
+ for ( size_t i = inserted_count ; i < values_count ; ++i )
+ {
+ t.insert(values[i]);
+ }
+
+ if ( !t.empty() )
+ {
+ BOOST_ASSERT(bgi::detail::rtree::utilities::are_boxes_ok(t));
+ BOOST_ASSERT(bgi::detail::rtree::utilities::are_counts_ok(t));
+ BOOST_ASSERT(bgi::detail::rtree::utilities::are_levels_ok(t));
+ }
+
+ dur_t time = clock_t::now() - start;
+ std::cout << j << "*insert(N/" << max_range_inserts << ")+insert(" << (values_count - inserted_count) << ") - " << time.count() << ", ";
+
+ test_queries(t, coords, queries_count);
+ }
+ }
+
+ std::cout << "------------------------------------------------\n";
+ }
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/example/glut_vis.cpp b/src/boost/libs/geometry/index/example/glut_vis.cpp
new file mode 100644
index 00000000..2c5f5740
--- /dev/null
+++ b/src/boost/libs/geometry/index/example/glut_vis.cpp
@@ -0,0 +1,1094 @@
+// Boost.Geometry Index
+// OpenGL visualization
+
+// Copyright (c) 2011-2014 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 <GL/glut.h>
+
+#include <boost/foreach.hpp>
+
+#include <boost/geometry.hpp>
+#include <boost/geometry/index/rtree.hpp>
+
+#include <boost/geometry/geometries/linestring.hpp>
+#include <boost/geometry/geometries/segment.hpp>
+#include <boost/geometry/geometries/ring.hpp>
+#include <boost/geometry/geometries/polygon.hpp>
+#include <boost/geometry/geometries/multi_polygon.hpp>
+
+#include <boost/geometry/index/detail/rtree/utilities/gl_draw.hpp>
+#include <boost/geometry/index/detail/rtree/utilities/print.hpp>
+#include <boost/geometry/index/detail/rtree/utilities/are_boxes_ok.hpp>
+#include <boost/geometry/index/detail/rtree/utilities/are_levels_ok.hpp>
+#include <boost/geometry/index/detail/rtree/utilities/statistics.hpp>
+
+#include <boost/variant.hpp>
+
+#define ENABLE_POINTS_AND_SEGMENTS
+
+namespace bg = boost::geometry;
+namespace bgi = bg::index;
+
+// used types
+
+typedef bg::model::point<float, 2, boost::geometry::cs::cartesian> P;
+typedef bg::model::box<P> B;
+typedef bg::model::linestring<P> LS;
+typedef bg::model::segment<P> S;
+typedef bg::model::ring<P> R;
+typedef bg::model::polygon<P> Poly;
+typedef bg::model::multi_polygon<Poly> MPoly;
+
+// containers variant
+
+template <typename V>
+struct containers
+{
+ containers & operator=(containers const& c)
+ {
+ tree = c.tree;
+ values = c.values;
+ result = c.result;
+ return *this;
+ }
+
+ bgi::rtree< V, bgi::rstar<4, 2> > tree;
+ std::vector<V> values;
+ std::vector<V> result;
+};
+
+boost::variant<
+ containers<B>
+#ifdef ENABLE_POINTS_AND_SEGMENTS
+ , containers<P>
+ , containers<S>
+#endif
+> cont;
+
+// visitors
+
+template <typename Pred>
+struct query_v : boost::static_visitor<size_t>
+{
+ Pred m_pred;
+ query_v(Pred const& pred) : m_pred(pred) {}
+
+ template <typename C>
+ size_t operator()(C & c) const
+ {
+ c.result.clear();
+ return c.tree.query(m_pred, std::back_inserter(c.result));
+ }
+};
+template <typename Cont, typename Pred>
+inline size_t query(Cont & cont, Pred const& pred)
+{
+ return boost::apply_visitor(query_v<Pred>(pred), cont);
+}
+
+struct print_result_v : boost::static_visitor<>
+{
+ template <typename C>
+ void operator()(C & c) const
+ {
+ for ( size_t i = 0 ; i < c.result.size() ; ++i )
+ {
+ bgi::detail::utilities::print_indexable(std::cout, c.result[i]);
+ std::cout << '\n';
+ }
+ }
+};
+template <typename Cont>
+inline void print_result(Cont const& cont)
+{
+ boost::apply_visitor(print_result_v(), cont);
+}
+
+struct bounds_v : boost::static_visitor<B>
+{
+ template <typename C>
+ B operator()(C & c) const
+ {
+ return c.tree.bounds();
+ }
+};
+template <typename Cont>
+inline B bounds(Cont const& cont)
+{
+ return boost::apply_visitor(bounds_v(), cont);
+}
+
+struct depth_v : boost::static_visitor<size_t>
+{
+ template <typename C>
+ size_t operator()(C & c) const
+ {
+ return get(c.tree);
+ }
+ template <typename RTree>
+ static size_t get(RTree const& t)
+ {
+ return bgi::detail::rtree::utilities::view<RTree>(t).depth();
+ }
+};
+template <typename Cont>
+inline size_t depth(Cont const& cont)
+{
+ return boost::apply_visitor(depth_v(), cont);
+}
+
+struct draw_tree_v : boost::static_visitor<>
+{
+ template <typename C>
+ void operator()(C & c) const
+ {
+ bgi::detail::rtree::utilities::gl_draw(c.tree);
+ }
+};
+template <typename Cont>
+inline void draw_tree(Cont const& cont)
+{
+ return boost::apply_visitor(draw_tree_v(), cont);
+}
+
+struct draw_result_v : boost::static_visitor<>
+{
+ template <typename C>
+ void operator()(C & c) const
+ {
+ for ( size_t i = 0 ; i < c.result.size() ; ++i )
+ {
+ bgi::detail::utilities::gl_draw_indexable(c.result[i], depth_v::get(c.tree));
+ }
+ }
+};
+template <typename Cont>
+inline void draw_result(Cont const& cont)
+{
+ return boost::apply_visitor(draw_result_v(), cont);
+}
+
+struct print_tree_v : boost::static_visitor<>
+{
+ template <typename C>
+ void operator()(C & c) const
+ {
+ bgi::detail::rtree::utilities::print(std::cout, c.tree);
+ }
+};
+template <typename Cont>
+inline void print_tree(Cont const& cont)
+{
+ return boost::apply_visitor(print_tree_v(), cont);
+}
+
+// globals used in querying
+
+size_t found_count = 0;
+size_t count = 5;
+
+P search_point;
+B search_box;
+R search_ring;
+Poly search_poly;
+MPoly search_multi_poly;
+S search_segment;
+LS search_linestring;
+LS search_path;
+
+enum query_mode_type {
+ qm_knn, qm_knnb, qm_knns, qm_c, qm_d, qm_i, qm_o, qm_w, qm_nc, qm_nd, qm_ni, qm_no, qm_nw, qm_all, qm_ri, qm_pi, qm_mpi, qm_si, qm_lsi, qm_path
+} query_mode = qm_knn;
+
+bool search_valid = false;
+
+// various queries
+
+void query_knn()
+{
+ float x = ( rand() % 1000 ) / 10.0f;
+ float y = ( rand() % 1000 ) / 10.0f;
+
+ if ( query_mode == qm_knn )
+ {
+ search_point = P(x, y);
+ found_count = query(cont, bgi::nearest(search_point, count));
+ }
+ else if ( query_mode == qm_knnb )
+ {
+ float w = 2 + ( rand() % 1000 ) / 500.0f;
+ float h = 2 + ( rand() % 1000 ) / 500.0f;
+ search_box = B(P(x - w, y - h), P(x + w, y + h));
+ found_count = query(cont, bgi::nearest(search_box, count));
+ }
+ else if ( query_mode == qm_knns )
+ {
+ int signx = rand() % 2 ? 1 : -1;
+ int signy = rand() % 2 ? 1 : -1;
+ float w = (10 + ( rand() % 1000 ) / 100.0f) * signx;
+ float h = (10 + ( rand() % 1000 ) / 100.0f) * signy;
+ search_segment = S(P(x - w, y - h), P(x + w, y + h));
+ found_count = query(cont, bgi::nearest(search_segment, count));
+ }
+ else
+ {
+ BOOST_ASSERT(false);
+ }
+
+ if ( found_count > 0 )
+ {
+ if ( query_mode == qm_knn )
+ {
+ std::cout << "search point: ";
+ bgi::detail::utilities::print_indexable(std::cout, search_point);
+ }
+ else if ( query_mode == qm_knnb )
+ {
+ std::cout << "search box: ";
+ bgi::detail::utilities::print_indexable(std::cout, search_box);
+ }
+ else if ( query_mode == qm_knns )
+ {
+ std::cout << "search segment: ";
+ bgi::detail::utilities::print_indexable(std::cout, search_segment);
+ }
+ else
+ {
+ BOOST_ASSERT(false);
+ }
+ std::cout << "\nfound: ";
+ print_result(cont);
+ }
+ else
+ std::cout << "nearest not found\n";
+}
+
+#ifndef ENABLE_POINTS_AND_SEGMENTS
+void query_path()
+{
+ float x = ( rand() % 1000 ) / 10.0f;
+ float y = ( rand() % 1000 ) / 10.0f;
+ float w = 20 + ( rand() % 1000 ) / 100.0f;
+ float h = 20 + ( rand() % 1000 ) / 100.0f;
+
+ search_path.resize(10);
+ float yy = y-h;
+ for ( int i = 0 ; i < 5 ; ++i, yy += h / 2 )
+ {
+ search_path[2 * i] = P(x-w, yy);
+ search_path[2 * i + 1] = P(x+w, yy);
+ }
+
+ found_count = query(cont, bgi::detail::path<LS>(search_path, count));
+
+ if ( found_count > 0 )
+ {
+ std::cout << "search path: ";
+ BOOST_FOREACH(P const& p, search_path)
+ bgi::detail::utilities::print_indexable(std::cout, p);
+ std::cout << "\nfound: ";
+ print_result(cont);
+ }
+ else
+ std::cout << "values on path not found\n";
+}
+#endif
+
+template <typename Predicate>
+void query()
+{
+ if ( query_mode != qm_all )
+ {
+ float x = ( rand() % 1000 ) / 10.0f;
+ float y = ( rand() % 1000 ) / 10.0f;
+ float w = 10 + ( rand() % 1000 ) / 100.0f;
+ float h = 10 + ( rand() % 1000 ) / 100.0f;
+
+ search_box = B(P(x - w, y - h), P(x + w, y + h));
+ }
+ else
+ {
+ search_box = bounds(cont);
+ }
+
+ found_count = query(cont, Predicate(search_box));
+
+ if ( found_count > 0 )
+ {
+ std::cout << "search box: ";
+ bgi::detail::utilities::print_indexable(std::cout, search_box);
+ std::cout << "\nfound: ";
+ print_result(cont);
+ }
+ else
+ std::cout << "boxes not found\n";
+}
+
+template <typename Predicate>
+void query_ring()
+{
+ float x = ( rand() % 1000 ) / 10.0f;
+ float y = ( rand() % 1000 ) / 10.0f;
+ float w = 10 + ( rand() % 1000 ) / 100.0f;
+ float h = 10 + ( rand() % 1000 ) / 100.0f;
+
+ search_ring.clear();
+ search_ring.push_back(P(x - w, y - h));
+ search_ring.push_back(P(x - w/2, y - h));
+ search_ring.push_back(P(x, y - 3*h/2));
+ search_ring.push_back(P(x + w/2, y - h));
+ search_ring.push_back(P(x + w, y - h));
+ search_ring.push_back(P(x + w, y - h/2));
+ search_ring.push_back(P(x + 3*w/2, y));
+ search_ring.push_back(P(x + w, y + h/2));
+ search_ring.push_back(P(x + w, y + h));
+ search_ring.push_back(P(x + w/2, y + h));
+ search_ring.push_back(P(x, y + 3*h/2));
+ search_ring.push_back(P(x - w/2, y + h));
+ search_ring.push_back(P(x - w, y + h));
+ search_ring.push_back(P(x - w, y + h/2));
+ search_ring.push_back(P(x - 3*w/2, y));
+ search_ring.push_back(P(x - w, y - h/2));
+ search_ring.push_back(P(x - w, y - h));
+
+ found_count = query(cont, Predicate(search_ring));
+
+ if ( found_count > 0 )
+ {
+ std::cout << "search ring: ";
+ BOOST_FOREACH(P const& p, search_ring)
+ {
+ bgi::detail::utilities::print_indexable(std::cout, p);
+ std::cout << ' ';
+ }
+ std::cout << "\nfound: ";
+ print_result(cont);
+ }
+ else
+ std::cout << "boxes not found\n";
+}
+
+template <typename Predicate>
+void query_poly()
+{
+ float x = ( rand() % 1000 ) / 10.0f;
+ float y = ( rand() % 1000 ) / 10.0f;
+ float w = 10 + ( rand() % 1000 ) / 100.0f;
+ float h = 10 + ( rand() % 1000 ) / 100.0f;
+
+ search_poly.clear();
+ search_poly.outer().push_back(P(x - w, y - h));
+ search_poly.outer().push_back(P(x - w/2, y - h));
+ search_poly.outer().push_back(P(x, y - 3*h/2));
+ search_poly.outer().push_back(P(x + w/2, y - h));
+ search_poly.outer().push_back(P(x + w, y - h));
+ search_poly.outer().push_back(P(x + w, y - h/2));
+ search_poly.outer().push_back(P(x + 3*w/2, y));
+ search_poly.outer().push_back(P(x + w, y + h/2));
+ search_poly.outer().push_back(P(x + w, y + h));
+ search_poly.outer().push_back(P(x + w/2, y + h));
+ search_poly.outer().push_back(P(x, y + 3*h/2));
+ search_poly.outer().push_back(P(x - w/2, y + h));
+ search_poly.outer().push_back(P(x - w, y + h));
+ search_poly.outer().push_back(P(x - w, y + h/2));
+ search_poly.outer().push_back(P(x - 3*w/2, y));
+ search_poly.outer().push_back(P(x - w, y - h/2));
+ search_poly.outer().push_back(P(x - w, y - h));
+
+ search_poly.inners().push_back(Poly::ring_type());
+ search_poly.inners()[0].push_back(P(x - w/2, y - h/2));
+ search_poly.inners()[0].push_back(P(x + w/2, y - h/2));
+ search_poly.inners()[0].push_back(P(x + w/2, y + h/2));
+ search_poly.inners()[0].push_back(P(x - w/2, y + h/2));
+ search_poly.inners()[0].push_back(P(x - w/2, y - h/2));
+
+ found_count = query(cont, Predicate(search_poly));
+
+ if ( found_count > 0 )
+ {
+ std::cout << "search poly outer: ";
+ BOOST_FOREACH(P const& p, search_poly.outer())
+ {
+ bgi::detail::utilities::print_indexable(std::cout, p);
+ std::cout << ' ';
+ }
+ std::cout << "\nfound: ";
+ print_result(cont);
+ }
+ else
+ std::cout << "boxes not found\n";
+}
+
+template <typename Predicate>
+void query_multi_poly()
+{
+ float x = ( rand() % 1000 ) / 10.0f;
+ float y = ( rand() % 1000 ) / 10.0f;
+ float w = 10 + ( rand() % 1000 ) / 100.0f;
+ float h = 10 + ( rand() % 1000 ) / 100.0f;
+
+ search_multi_poly.clear();
+
+ search_multi_poly.push_back(Poly());
+ search_multi_poly[0].outer().push_back(P(x - w, y - h));
+ search_multi_poly[0].outer().push_back(P(x - w/2, y - h));
+ search_multi_poly[0].outer().push_back(P(x, y - 3*h/2));
+ search_multi_poly[0].outer().push_back(P(x + w/2, y - h));
+ search_multi_poly[0].outer().push_back(P(x + w, y - h));
+ search_multi_poly[0].outer().push_back(P(x + w, y - h/2));
+ search_multi_poly[0].outer().push_back(P(x + 3*w/2, y));
+ search_multi_poly[0].outer().push_back(P(x + w, y + h/2));
+ search_multi_poly[0].outer().push_back(P(x + w, y + h));
+ search_multi_poly[0].outer().push_back(P(x + w/2, y + h));
+ search_multi_poly[0].outer().push_back(P(x, y + 3*h/2));
+ search_multi_poly[0].outer().push_back(P(x - w/2, y + h));
+ search_multi_poly[0].outer().push_back(P(x - w, y + h));
+ search_multi_poly[0].outer().push_back(P(x - w, y + h/2));
+ search_multi_poly[0].outer().push_back(P(x - 3*w/2, y));
+ search_multi_poly[0].outer().push_back(P(x - w, y - h/2));
+ search_multi_poly[0].outer().push_back(P(x - w, y - h));
+
+ search_multi_poly[0].inners().push_back(Poly::ring_type());
+ search_multi_poly[0].inners()[0].push_back(P(x - w/2, y - h/2));
+ search_multi_poly[0].inners()[0].push_back(P(x + w/2, y - h/2));
+ search_multi_poly[0].inners()[0].push_back(P(x + w/2, y + h/2));
+ search_multi_poly[0].inners()[0].push_back(P(x - w/2, y + h/2));
+ search_multi_poly[0].inners()[0].push_back(P(x - w/2, y - h/2));
+
+ search_multi_poly.push_back(Poly());
+ search_multi_poly[1].outer().push_back(P(x - 2*w, y - 2*h));
+ search_multi_poly[1].outer().push_back(P(x - 6*w/5, y - 2*h));
+ search_multi_poly[1].outer().push_back(P(x - 6*w/5, y - 6*h/5));
+ search_multi_poly[1].outer().push_back(P(x - 2*w, y - 6*h/5));
+ search_multi_poly[1].outer().push_back(P(x - 2*w, y - 2*h));
+
+ search_multi_poly.push_back(Poly());
+ search_multi_poly[2].outer().push_back(P(x + 6*w/5, y + 6*h/5));
+ search_multi_poly[2].outer().push_back(P(x + 2*w, y + 6*h/5));
+ search_multi_poly[2].outer().push_back(P(x + 2*w, y + 2*h));
+ search_multi_poly[2].outer().push_back(P(x + 6*w/5, y + 2*h));
+ search_multi_poly[2].outer().push_back(P(x + 6*w/5, y + 6*h/5));
+
+ found_count = query(cont, Predicate(search_multi_poly));
+
+ if ( found_count > 0 )
+ {
+ std::cout << "search multi_poly[0] outer: ";
+ BOOST_FOREACH(P const& p, search_multi_poly[0].outer())
+ {
+ bgi::detail::utilities::print_indexable(std::cout, p);
+ std::cout << ' ';
+ }
+ std::cout << "\nfound: ";
+ print_result(cont);
+ }
+ else
+ std::cout << "boxes not found\n";
+}
+
+template <typename Predicate>
+void query_segment()
+{
+ float x = ( rand() % 1000 ) / 10.0f;
+ float y = ( rand() % 1000 ) / 10.0f;
+ float w = 10.0f - ( rand() % 1000 ) / 50.0f;
+ float h = 10.0f - ( rand() % 1000 ) / 50.0f;
+ w += 0 <= w ? 10 : -10;
+ h += 0 <= h ? 10 : -10;
+
+ boost::geometry::set<0, 0>(search_segment, x - w);
+ boost::geometry::set<0, 1>(search_segment, y - h);
+ boost::geometry::set<1, 0>(search_segment, x + w);
+ boost::geometry::set<1, 1>(search_segment, y + h);
+
+ found_count = query(cont, Predicate(search_segment));
+
+ if ( found_count > 0 )
+ {
+ std::cout << "search segment: ";
+ bgi::detail::utilities::print_indexable(std::cout, P(x-w, y-h));
+ bgi::detail::utilities::print_indexable(std::cout, P(x+w, y+h));
+
+ std::cout << "\nfound: ";
+ print_result(cont);
+ }
+ else
+ std::cout << "boxes not found\n";
+}
+
+template <typename Predicate>
+void query_linestring()
+{
+ float x = ( rand() % 1000 ) / 10.0f;
+ float y = ( rand() % 1000 ) / 10.0f;
+ float w = 10 + ( rand() % 1000 ) / 100.0f;
+ float h = 10 + ( rand() % 1000 ) / 100.0f;
+
+ search_linestring.clear();
+ float a = 0;
+ float d = 0;
+ for ( size_t i = 0 ; i < 300 ; ++i, a += 0.05, d += 0.005 )
+ {
+ float xx = x + w * d * ::cos(a);
+ float yy = y + h * d * ::sin(a);
+ search_linestring.push_back(P(xx, yy));
+ }
+
+ found_count = query(cont, Predicate(search_linestring));
+
+ if ( found_count > 0 )
+ {
+ std::cout << "search linestring: ";
+ BOOST_FOREACH(P const& p, search_linestring)
+ {
+ bgi::detail::utilities::print_indexable(std::cout, p);
+ std::cout << ' ';
+ }
+ std::cout << "\nfound: ";
+ print_result(cont);
+ }
+ else
+ std::cout << "boxes not found\n";
+}
+
+// the function running the correct query based on the query_mode
+
+void search()
+{
+ namespace d = bgi::detail;
+
+ if ( query_mode == qm_knn || query_mode == qm_knnb || query_mode == qm_knns )
+ query_knn();
+ else if ( query_mode == qm_d )
+ query< d::spatial_predicate<B, d::disjoint_tag, false> >();
+ else if ( query_mode == qm_i )
+ query< d::spatial_predicate<B, d::intersects_tag, false> >();
+ else if ( query_mode == qm_nd )
+ query< d::spatial_predicate<B, d::disjoint_tag, true> >();
+ else if ( query_mode == qm_ni )
+ query< d::spatial_predicate<B, d::intersects_tag, true> >();
+ else if ( query_mode == qm_all )
+ query< d::spatial_predicate<B, d::intersects_tag, false> >();
+#ifdef ENABLE_POINTS_AND_SEGMENTS
+ else
+ std::cout << "query disabled\n";
+#else
+ else if ( query_mode == qm_c )
+ query< d::spatial_predicate<B, d::covered_by_tag, false> >();
+ else if ( query_mode == qm_o )
+ query< d::spatial_predicate<B, d::overlaps_tag, false> >();
+ else if ( query_mode == qm_w )
+ query< d::spatial_predicate<B, d::within_tag, false> >();
+ else if ( query_mode == qm_nc )
+ query< d::spatial_predicate<B, d::covered_by_tag, true> >();
+ else if ( query_mode == qm_no )
+ query< d::spatial_predicate<B, d::overlaps_tag, true> >();
+ else if ( query_mode == qm_nw )
+ query< d::spatial_predicate<B, d::within_tag, true> >();
+ else if ( query_mode == qm_ri )
+ query_ring< d::spatial_predicate<R, d::intersects_tag, false> >();
+ else if ( query_mode == qm_pi )
+ query_poly< d::spatial_predicate<Poly, d::intersects_tag, false> >();
+ else if ( query_mode == qm_mpi )
+ query_multi_poly< d::spatial_predicate<MPoly, d::intersects_tag, false> >();
+ else if ( query_mode == qm_si )
+ query_segment< d::spatial_predicate<S, d::intersects_tag, false> >();
+ else if ( query_mode == qm_lsi )
+ query_linestring< d::spatial_predicate<LS, d::intersects_tag, false> >();
+ else if ( query_mode == qm_path )
+ query_path();
+#endif
+
+ search_valid = true;
+}
+
+// various drawing functions
+
+void draw_point(P const& p)
+{
+ float x = boost::geometry::get<0>(p);
+ float y = boost::geometry::get<1>(p);
+ float z = depth(cont);
+
+ glBegin(GL_QUADS);
+ glVertex3f(x+1, y, z);
+ glVertex3f(x, y+1, z);
+ glVertex3f(x-1, y, z);
+ glVertex3f(x, y-1, z);
+ glEnd();
+}
+
+void draw_knn_area(float min_distance, float max_distance)
+{
+ float x = boost::geometry::get<0>(search_point);
+ float y = boost::geometry::get<1>(search_point);
+ float z = depth(cont);
+
+ draw_point(search_point);
+
+ // search min circle
+
+ glBegin(GL_LINE_LOOP);
+ for(float a = 0 ; a < 3.14158f * 2 ; a += 3.14158f / 180)
+ glVertex3f(x + min_distance * ::cos(a), y + min_distance * ::sin(a), z);
+ glEnd();
+
+ // search max circle
+
+ glBegin(GL_LINE_LOOP);
+ for(float a = 0 ; a < 3.14158f * 2 ; a += 3.14158f / 180)
+ glVertex3f(x + max_distance * ::cos(a), y + max_distance * ::sin(a), z);
+ glEnd();
+}
+
+void draw_linestring(LS const& ls)
+{
+ glBegin(GL_LINE_STRIP);
+
+ BOOST_FOREACH(P const& p, ls)
+ {
+ float x = boost::geometry::get<0>(p);
+ float y = boost::geometry::get<1>(p);
+ float z = depth(cont);
+ glVertex3f(x, y, z);
+ }
+
+ glEnd();
+}
+
+void draw_segment(S const& s)
+{
+ float x1 = boost::geometry::get<0, 0>(s);
+ float y1 = boost::geometry::get<0, 1>(s);
+ float x2 = boost::geometry::get<1, 0>(s);
+ float y2 = boost::geometry::get<1, 1>(s);
+ float z = depth(cont);
+
+ glBegin(GL_LINES);
+ glVertex3f(x1, y1, z);
+ glVertex3f(x2, y2, z);
+ glEnd();
+}
+
+template <typename Box>
+void draw_box(Box const& box)
+{
+ float x1 = boost::geometry::get<bg::min_corner, 0>(box);
+ float y1 = boost::geometry::get<bg::min_corner, 1>(box);
+ float x2 = boost::geometry::get<bg::max_corner, 0>(box);
+ float y2 = boost::geometry::get<bg::max_corner, 1>(box);
+ float z = depth(cont);
+
+ // search box
+ glBegin(GL_LINE_LOOP);
+ glVertex3f(x1, y1, z);
+ glVertex3f(x2, y1, z);
+ glVertex3f(x2, y2, z);
+ glVertex3f(x1, y2, z);
+ glEnd();
+}
+
+template <typename Range>
+void draw_ring(Range const& range)
+{
+ float z = depth(cont);
+
+ // search box
+ glBegin(GL_LINE_LOOP);
+
+ BOOST_FOREACH(P const& p, range)
+ {
+ float x = boost::geometry::get<0>(p);
+ float y = boost::geometry::get<1>(p);
+
+ glVertex3f(x, y, z);
+ }
+ glEnd();
+}
+
+template <typename Polygon>
+void draw_polygon(Polygon const& polygon)
+{
+ draw_ring(polygon.outer());
+ BOOST_FOREACH(Poly::ring_type const& r, polygon.inners())
+ draw_ring(r);
+}
+
+template <typename MultiPolygon>
+void draw_multi_polygon(MultiPolygon const& multi_polygon)
+{
+ BOOST_FOREACH(Poly const& p, multi_polygon)
+ draw_polygon(p);
+}
+
+// render the scene -> tree, if searching data available also the query geometry and result
+
+void render_scene(void)
+{
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ draw_tree(cont);
+
+ if ( search_valid )
+ {
+ glColor3f(1.0f, 0.25f, 0.0f);
+
+ if ( query_mode == qm_knn )
+ draw_knn_area(0, 0);
+ else if ( query_mode == qm_knnb )
+ draw_box(search_box);
+ else if ( query_mode == qm_knns )
+ draw_segment(search_segment);
+ else if ( query_mode == qm_ri )
+ draw_ring(search_ring);
+ else if ( query_mode == qm_pi )
+ draw_polygon(search_poly);
+ else if ( query_mode == qm_mpi )
+ draw_multi_polygon(search_multi_poly);
+ else if ( query_mode == qm_si )
+ draw_segment(search_segment);
+ else if ( query_mode == qm_lsi )
+ draw_linestring(search_linestring);
+ else if ( query_mode == qm_path )
+ draw_linestring(search_path);
+ else
+ draw_box(search_box);
+
+ glColor3f(1.0f, 0.5f, 0.0f);
+
+ draw_result(cont);
+ }
+
+ glFlush();
+}
+
+void resize(int w, int h)
+{
+ if ( h == 0 )
+ h = 1;
+
+ //float ratio = float(w) / h;
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+
+ glViewport(0, 0, w, h);
+
+ //gluPerspective(45, ratio, 1, 1000);
+ glOrtho(-150, 150, -150, 150, -150, 150);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ /*gluLookAt(
+ 120.0f, 120.0f, 120.0f,
+ 50.0f, 50.0f, -1.0f,
+ 0.0f, 1.0f, 0.0f);*/
+ gluLookAt(
+ 50.0f, 50.0f, 75.0f,
+ 50.0f, 50.0f, -1.0f,
+ 0.0f, 1.0f, 0.0f);
+
+ glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
+ glLineWidth(1.5f);
+
+ srand(1);
+}
+
+// randomize various indexables
+
+inline void rand_val(B & b)
+{
+ float x = ( rand() % 100 );
+ float y = ( rand() % 100 );
+ float w = ( rand() % 2 ) + 1;
+ float h = ( rand() % 2 ) + 1;
+ b = B(P(x - w, y - h),P(x + w, y + h));
+}
+inline void rand_val(P & p)
+{
+ float x = ( rand() % 100 );
+ float y = ( rand() % 100 );
+ p = P(x, y);
+}
+inline void rand_val(S & s)
+{
+ float x = ( rand() % 100 );
+ float y = ( rand() % 100 );
+ float w = ( rand() % 2 + 1) * (rand() % 2 ? 1.0f : -1.0f);
+ float h = ( rand() % 2 + 1) * (rand() % 2 ? 1.0f : -1.0f);
+ s = S(P(x - w, y - h),P(x + w, y + h));
+}
+
+// more higher-level visitors
+
+struct insert_random_value_v : boost::static_visitor<>
+{
+ template <typename V>
+ void operator()(containers<V> & c) const
+ {
+ V v;
+ rand_val(v);
+
+ boost::geometry::index::insert(c.tree, v);
+ c.values.push_back(v);
+
+ std::cout << "inserted: ";
+ bgi::detail::utilities::print_indexable(std::cout, v);
+ std::cout << '\n';
+
+ std::cout << ( bgi::detail::rtree::utilities::are_boxes_ok(c.tree) ? "boxes OK\n" : "WRONG BOXES!\n" );
+ std::cout << ( bgi::detail::rtree::utilities::are_levels_ok(c.tree) ? "levels OK\n" : "WRONG LEVELS!\n" );
+ std::cout << "\n";
+ }
+};
+template <typename Cont>
+inline void insert_random_value(Cont & cont)
+{
+ return boost::apply_visitor(insert_random_value_v(), cont);
+}
+
+struct remove_random_value_v : boost::static_visitor<>
+{
+ template <typename V>
+ void operator()(containers<V> & c) const
+ {
+ if ( c.values.empty() )
+ return;
+
+ size_t i = rand() % c.values.size();
+ V v = c.values[i];
+
+ c.tree.remove(v);
+ c.values.erase(c.values.begin() + i);
+
+ std::cout << "removed: ";
+ bgi::detail::utilities::print_indexable(std::cout, v);
+ std::cout << '\n';
+
+ std::cout << ( bgi::detail::rtree::utilities::are_boxes_ok(c.tree) ? "boxes OK\n" : "WRONG BOXES!\n" );
+ std::cout << ( bgi::detail::rtree::utilities::are_levels_ok(c.tree) ? "levels OK\n" : "WRONG LEVELS!\n" );
+ std::cout << "\n";
+ }
+};
+template <typename Cont>
+inline void remove_random_value(Cont & cont)
+{
+ return boost::apply_visitor(remove_random_value_v(), cont);
+}
+
+// handle mouse input
+
+void mouse(int button, int state, int /*x*/, int /*y*/)
+{
+ if ( button == GLUT_LEFT_BUTTON && state == GLUT_DOWN )
+ {
+ insert_random_value(cont);
+ search_valid = false;
+ }
+ else if ( button == GLUT_RIGHT_BUTTON && state == GLUT_DOWN )
+ {
+ remove_random_value(cont);
+ search_valid = false;
+ }
+ else if ( button == GLUT_MIDDLE_BUTTON && state == GLUT_DOWN )
+ {
+ search();
+ }
+
+ glutPostRedisplay();
+}
+
+// more higher-level visitors
+
+struct insert_random_values_v : boost::static_visitor<>
+{
+ template <typename V>
+ void operator()(containers<V> & c) const
+ {
+ for ( size_t i = 0 ; i < 35 ; ++i )
+ {
+ V v;
+ rand_val(v);
+
+ c.tree.insert(v);
+ c.values.push_back(v);
+
+ std::cout << "inserted: ";
+ bgi::detail::utilities::print_indexable(std::cout, v);
+ std::cout << '\n';
+ }
+
+ std::cout << ( bgi::detail::rtree::utilities::are_boxes_ok(c.tree) ? "boxes OK\n" : "WRONG BOXES!\n" );
+ std::cout << ( bgi::detail::rtree::utilities::are_levels_ok(c.tree) ? "levels OK\n" : "WRONG LEVELS!\n" );
+ std::cout << "\n";
+ }
+};
+template <typename Cont>
+inline void insert_random_values(Cont & cont)
+{
+ return boost::apply_visitor(insert_random_values_v(), cont);
+}
+
+struct bulk_insert_random_values_v : boost::static_visitor<>
+{
+ template <typename V>
+ void operator()(containers<V> & c) const
+ {
+ c.values.clear();
+
+ for ( size_t i = 0 ; i < 35 ; ++i )
+ {
+ V v;
+ rand_val(v);
+
+ c.values.push_back(v);
+
+ std::cout << "inserted: ";
+ bgi::detail::utilities::print_indexable(std::cout, v);
+ std::cout << '\n';
+ }
+
+ create(c.tree, c.values);
+
+ std::cout << ( bgi::detail::rtree::utilities::are_boxes_ok(c.tree) ? "boxes OK\n" : "WRONG BOXES!\n" );
+ std::cout << ( bgi::detail::rtree::utilities::are_levels_ok(c.tree) ? "levels OK\n" : "WRONG LEVELS!\n" );
+ std::cout << "\n";
+ }
+
+ template <typename Tree, typename Values>
+ void create(Tree & tree, Values const& values) const
+ {
+ Tree t(values);
+ tree = boost::move(t);
+ }
+};
+template <typename Cont>
+inline void bulk_insert_random_values(Cont & cont)
+{
+ return boost::apply_visitor(bulk_insert_random_values_v(), cont);
+}
+
+// handle keyboard input
+
+std::string current_line;
+
+void keyboard(unsigned char key, int /*x*/, int /*y*/)
+{
+ if ( key == '\r' || key == '\n' )
+ {
+ if ( current_line == "storeb" )
+ {
+ cont = containers<B>();
+ glutPostRedisplay();
+ }
+#ifdef ENABLE_POINTS_AND_SEGMENTS
+ else if ( current_line == "storep" )
+ {
+ cont = containers<P>();
+ glutPostRedisplay();
+ }
+ else if ( current_line == "stores" )
+ {
+ cont = containers<S>();
+ glutPostRedisplay();
+ }
+#endif
+ else if ( current_line == "t" )
+ {
+ std::cout << "\n";
+ print_tree(cont);
+ std::cout << "\n";
+ }
+ else if ( current_line == "rand" )
+ {
+ insert_random_values(cont);
+ search_valid = false;
+
+ glutPostRedisplay();
+ }
+ else if ( current_line == "bulk" )
+ {
+ bulk_insert_random_values(cont);
+ search_valid = false;
+
+ glutPostRedisplay();
+ }
+ else
+ {
+ if ( current_line == "knn" )
+ query_mode = qm_knn;
+ else if ( current_line == "knnb" )
+ query_mode = qm_knnb;
+ else if ( current_line == "knns" )
+ query_mode = qm_knns;
+ else if ( current_line == "c" )
+ query_mode = qm_c;
+ else if ( current_line == "d" )
+ query_mode = qm_d;
+ else if ( current_line == "i" )
+ query_mode = qm_i;
+ else if ( current_line == "o" )
+ query_mode = qm_o;
+ else if ( current_line == "w" )
+ query_mode = qm_w;
+ else if ( current_line == "nc" )
+ query_mode = qm_nc;
+ else if ( current_line == "nd" )
+ query_mode = qm_nd;
+ else if ( current_line == "ni" )
+ query_mode = qm_ni;
+ else if ( current_line == "no" )
+ query_mode = qm_no;
+ else if ( current_line == "nw" )
+ query_mode = qm_nw;
+ else if ( current_line == "all" )
+ query_mode = qm_all;
+ else if ( current_line == "ri" )
+ query_mode = qm_ri;
+ else if ( current_line == "pi" )
+ query_mode = qm_pi;
+ else if ( current_line == "mpi" )
+ query_mode = qm_mpi;
+ else if ( current_line == "si" )
+ query_mode = qm_si;
+ else if ( current_line == "lsi" )
+ query_mode = qm_lsi;
+ else if ( current_line == "path" )
+ query_mode = qm_path;
+
+ search();
+ glutPostRedisplay();
+ }
+
+ current_line.clear();
+ std::cout << '\n';
+ }
+ else
+ {
+ current_line += key;
+ std::cout << key;
+ }
+}
+
+// main function
+
+int main(int argc, char **argv)
+{
+ glutInit(&argc, argv);
+ glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA);
+ glutInitWindowPosition(100,100);
+ glutInitWindowSize(600, 600);
+ glutCreateWindow("boost::geometry::index::rtree GLUT test");
+
+ glutDisplayFunc(render_scene);
+ glutReshapeFunc(resize);
+ glutMouseFunc(mouse);
+ glutKeyboardFunc(keyboard);
+
+ glutMainLoop();
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/example/random_test.cpp b/src/boost/libs/geometry/index/example/random_test.cpp
new file mode 100644
index 00000000..1c40d155
--- /dev/null
+++ b/src/boost/libs/geometry/index/example/random_test.cpp
@@ -0,0 +1,185 @@
+// Boost.Geometry Index
+// Additional tests
+
+// 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 <iostream>
+
+#define BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
+
+#include <boost/geometry.hpp>
+#include <boost/geometry/index/rtree.hpp>
+
+#include <boost/foreach.hpp>
+#include <boost/random.hpp>
+
+int main()
+{
+ namespace bg = boost::geometry;
+ namespace bgi = bg::index;
+
+ size_t values_count = 1000000;
+ size_t queries_count = 10000;
+ size_t nearest_queries_count = 10000;
+ unsigned neighbours_count = 10;
+
+ std::vector< std::pair<float, float> > coords;
+
+ //randomize values
+ {
+ boost::mt19937 rng;
+ //rng.seed(static_cast<unsigned int>(std::time(0)));
+ float max_val = static_cast<float>(values_count / 2);
+ boost::uniform_real<float> range(-max_val, max_val);
+ boost::variate_generator<boost::mt19937&, boost::uniform_real<float> > rnd(rng, range);
+
+ coords.reserve(values_count);
+
+ std::cout << "randomizing data\n";
+ for ( size_t i = 0 ; i < values_count ; ++i )
+ {
+ coords.push_back(std::make_pair(rnd(), rnd()));
+ }
+ std::cout << "randomized\n";
+ }
+
+ typedef bg::model::point<double, 2, bg::cs::cartesian> P;
+ typedef bg::model::box<P> B;
+ typedef bgi::rtree<B, bgi::linear<16, 4> > RT;
+ //typedef bgi::rtree<B, bgi::quadratic<8, 3> > RT;
+ //typedef bgi::rtree<B, bgi::rstar<8, 3> > RT;
+
+ std::cout << "sizeof rtree: " << sizeof(RT) << std::endl;
+
+ {
+ RT t;
+
+ // inserting
+ {
+ for (size_t i = 0 ; i < values_count ; ++i )
+ {
+ float x = coords[i].first;
+ float y = coords[i].second;
+ B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f));
+
+ t.insert(b);
+ }
+ std::cout << "inserted values: " << values_count << '\n';
+ }
+
+ std::vector<B> result;
+ result.reserve(100);
+
+ // test
+ std::vector<size_t> spatial_query_data;
+ size_t spatial_query_index = 0;
+
+ {
+ size_t found_count = 0;
+ for (size_t i = 0 ; i < queries_count ; ++i )
+ {
+ float x = coords[i].first;
+ float y = coords[i].second;
+ result.clear();
+ t.query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result));
+
+ // test
+ spatial_query_data.push_back(result.size());
+ found_count += result.size();
+ }
+ std::cout << "spatial queries found: " << found_count << '\n';
+ }
+
+#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
+ {
+ size_t found_count = 0;
+ for (size_t i = 0 ; i < queries_count ; ++i )
+ {
+ float x = coords[i].first;
+ float y = coords[i].second;
+ result.clear();
+ std::copy(t.qbegin_(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10)))),
+ t.qend_(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10)))),
+ std::back_inserter(result));
+
+ // test
+ if ( spatial_query_data[spatial_query_index] != result.size() )
+ std::cout << "Spatial query error - should be: " << spatial_query_data[spatial_query_index] << ", is: " << result.size() << '\n';
+ ++spatial_query_index;
+ found_count += result.size();
+ }
+ std::cout << "incremental spatial queries found: " << found_count << '\n';
+ }
+#endif
+
+ // test
+ std::vector<float> nearest_query_data;
+ size_t nearest_query_data_index = 0;
+
+ {
+ size_t found_count = 0;
+ for (size_t i = 0 ; i < nearest_queries_count ; ++i )
+ {
+ float x = coords[i].first + 100;
+ float y = coords[i].second + 100;
+ result.clear();
+ t.query(bgi::nearest(P(x, y), neighbours_count), std::back_inserter(result));
+
+ // test
+ {
+ float max_dist = 0;
+ BOOST_FOREACH(B const& b, result)
+ {
+ float curr_dist = bgi::detail::comparable_distance_near(P(x, y), b);
+ if ( max_dist < curr_dist )
+ max_dist = curr_dist;
+ }
+ nearest_query_data.push_back(max_dist);
+ }
+ found_count += result.size();
+ }
+ std::cout << "nearest queries found: " << found_count << '\n';
+ }
+
+#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
+ {
+ size_t found_count = 0;
+ for (size_t i = 0 ; i < nearest_queries_count ; ++i )
+ {
+ float x = coords[i].first + 100;
+ float y = coords[i].second + 100;
+ result.clear();
+
+ std::copy(t.qbegin_(bgi::nearest(P(x, y), neighbours_count)),
+ t.qend_(bgi::nearest(P(x, y), neighbours_count)),
+ std::back_inserter(result));
+
+ // test
+ {
+ float max_dist = 0;
+ BOOST_FOREACH(B const& b, result)
+ {
+ float curr_dist = bgi::detail::comparable_distance_near(P(x, y), b);
+ if ( max_dist < curr_dist )
+ max_dist = curr_dist;
+ }
+ if ( nearest_query_data_index < nearest_query_data.size() &&
+ nearest_query_data[nearest_query_data_index] != max_dist )
+ std::cout << "Max distance error - should be: " << nearest_query_data[nearest_query_data_index] << ", and is: " << max_dist << "\n";
+ ++nearest_query_data_index;
+ }
+ found_count += result.size();
+ }
+ std::cout << "incremental nearest queries found: " << found_count << '\n';
+ }
+#endif
+
+ std::cout << "finished\n";
+ }
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/example/serialize.cpp b/src/boost/libs/geometry/index/example/serialize.cpp
new file mode 100644
index 00000000..11ce08bc
--- /dev/null
+++ b/src/boost/libs/geometry/index/example/serialize.cpp
@@ -0,0 +1,168 @@
+// Boost.Geometry Index
+// Additional tests
+
+// 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 <iostream>
+#include <fstream>
+
+#define BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
+
+#include <boost/geometry.hpp>
+#include <boost/geometry/index/rtree.hpp>
+#include <boost/geometry/index/detail/rtree/utilities/statistics.hpp>
+
+#include <boost/archive/binary_oarchive.hpp>
+#include <boost/archive/binary_iarchive.hpp>
+#include <boost/archive/xml_oarchive.hpp>
+#include <boost/archive/xml_iarchive.hpp>
+#include <boost/serialization/vector.hpp>
+
+#include <boost/foreach.hpp>
+#include <boost/timer.hpp>
+
+template <typename T, size_t I = 0, size_t S = boost::tuples::length<T>::value>
+struct print_tuple
+{
+ template <typename Os>
+ static inline Os & apply(Os & os, T const& t)
+ {
+ os << boost::get<I>(t) << ", ";
+ return print_tuple<T, I+1>::apply(os, t);
+ }
+};
+
+template <typename T, size_t S>
+struct print_tuple<T, S, S>
+{
+ template <typename Os>
+ static inline Os & apply(Os & os, T const&)
+ {
+ return os;
+ }
+};
+
+int main()
+{
+ namespace bg = boost::geometry;
+ namespace bgi = bg::index;
+
+ typedef boost::tuple<std::size_t, std::size_t, std::size_t, std::size_t, std::size_t, std::size_t> S;
+
+ typedef bg::model::point<double, 2, bg::cs::cartesian> P;
+ typedef bg::model::box<P> B;
+ typedef B V;
+ //typedef bgi::rtree<V, bgi::linear<16> > RT;
+ //typedef bgi::rtree<V, bgi::quadratic<8, 3> > RT;
+ //typedef bgi::rtree<V, bgi::rstar<8, 3> > RT;
+ typedef bgi::rtree<V, bgi::dynamic_linear > RT;
+
+ //RT tree;
+ RT tree(bgi::dynamic_linear(16));
+ std::vector<V> vect;
+
+ boost::timer t;
+
+ //insert values
+ {
+ for ( double x = 0 ; x < 1000 ; x += 1 )
+ for ( double y = 0 ; y < 1000 ; y += 1 )
+ vect.push_back(B(P(x, y), P(x+0.5, y+0.5)));
+ RT tmp(vect, tree.parameters());
+ tree = boost::move(tmp);
+ }
+ B q(P(5, 5), P(6, 6));
+ S s;
+
+ std::cout << "vector and tree created in: " << t.elapsed() << std::endl;
+
+ print_tuple<S>::apply(std::cout, bgi::detail::rtree::utilities::statistics(tree)) << std::endl;
+ std::cout << boost::get<0>(s) << std::endl;
+ BOOST_FOREACH(V const& v, tree | bgi::adaptors::queried(bgi::intersects(q)))
+ std::cout << bg::wkt<V>(v) << std::endl;
+
+ // save
+ {
+ std::ofstream ofs("serialized_vector.bin", std::ios::binary | std::ios::trunc);
+ boost::archive::binary_oarchive oa(ofs);
+ t.restart();
+ oa << vect;
+ std::cout << "vector saved to bin in: " << t.elapsed() << std::endl;
+ }
+ {
+ std::ofstream ofs("serialized_tree.bin", std::ios::binary | std::ios::trunc);
+ boost::archive::binary_oarchive oa(ofs);
+ t.restart();
+ oa << tree;
+ std::cout << "tree saved to bin in: " << t.elapsed() << std::endl;
+ }
+ {
+ std::ofstream ofs("serialized_tree.xml", std::ios::trunc);
+ boost::archive::xml_oarchive oa(ofs);
+ t.restart();
+ oa << boost::serialization::make_nvp("rtree", tree);
+ std::cout << "tree saved to xml in: " << t.elapsed() << std::endl;
+ }
+
+ t.restart();
+ vect.clear();
+ std::cout << "vector cleared in: " << t.elapsed() << std::endl;
+
+ t.restart();
+ tree.clear();
+ std::cout << "tree cleared in: " << t.elapsed() << std::endl;
+
+ // load
+
+ {
+ std::ifstream ifs("serialized_vector.bin", std::ios::binary);
+ boost::archive::binary_iarchive ia(ifs);
+ t.restart();
+ ia >> vect;
+ std::cout << "vector loaded from bin in: " << t.elapsed() << std::endl;
+ t.restart();
+ RT tmp(vect, tree.parameters());
+ tree = boost::move(tmp);
+ std::cout << "tree rebuilt from vector in: " << t.elapsed() << std::endl;
+ }
+
+ t.restart();
+ tree.clear();
+ std::cout << "tree cleared in: " << t.elapsed() << std::endl;
+
+ {
+ std::ifstream ifs("serialized_tree.bin", std::ios::binary);
+ boost::archive::binary_iarchive ia(ifs);
+ t.restart();
+ ia >> tree;
+ std::cout << "tree loaded from bin in: " << t.elapsed() << std::endl;
+ }
+
+ std::cout << "loaded from bin" << std::endl;
+ print_tuple<S>::apply(std::cout, bgi::detail::rtree::utilities::statistics(tree)) << std::endl;
+ BOOST_FOREACH(V const& v, tree | bgi::adaptors::queried(bgi::intersects(q)))
+ std::cout << bg::wkt<V>(v) << std::endl;
+
+ t.restart();
+ tree.clear();
+ std::cout << "tree cleared in: " << t.elapsed() << std::endl;
+
+ {
+ std::ifstream ifs("serialized_tree.xml");
+ boost::archive::xml_iarchive ia(ifs);
+ t.restart();
+ ia >> boost::serialization::make_nvp("rtree", tree);
+ std::cout << "tree loaded from xml in: " << t.elapsed() << std::endl;
+ }
+
+ std::cout << "loaded from xml" << std::endl;
+ print_tuple<S>::apply(std::cout, bgi::detail::rtree::utilities::statistics(tree)) << std::endl;
+ BOOST_FOREACH(V const& v, tree | bgi::adaptors::queried(bgi::intersects(q)))
+ std::cout << bg::wkt<V>(v) << std::endl;
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/index.html b/src/boost/libs/geometry/index/index.html
new file mode 100644
index 00000000..ff0005b2
--- /dev/null
+++ b/src/boost/libs/geometry/index/index.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="refresh" content="0; URL=../doc/html/index.html">
+ </head>
+ <body>
+ Automatic redirection failed, click this
+ <a href="doc/html/index.html">link</a> &nbsp;<hr>
+ <p>Copyright © 2009-2019 Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam Wulkiewicz, Oracle and/or its affiliates</p>
+ <p>Distributed under the Boost Software License, Version 1.0. (See
+ accompanying file <a href="../../../LICENSE_1_0.txt">
+ LICENSE_1_0.txt</a> or copy at
+ <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</p>
+ </body>
+</html>
diff --git a/src/boost/libs/geometry/index/meta/libraries.json b/src/boost/libs/geometry/index/meta/libraries.json
new file mode 100644
index 00000000..46b6fd93
--- /dev/null
+++ b/src/boost/libs/geometry/index/meta/libraries.json
@@ -0,0 +1,26 @@
+[
+ {
+ "key": "geometry/index",
+ "boost-version": "hidden",
+ "name": "Geometry Index",
+ "status": "hidden",
+ "authors": [
+ "Barend Gehrels",
+ "Bruno Lalande",
+ "Mateusz Loskot",
+ "Adam Wulkiewicz",
+ "Menelaos Karavelas"
+ ],
+ "maintainers": [
+ "Barend Gehrels <barend -at- xs4all.nl>",
+ "Bruno Lalande <bruno.lalande -at- gmail.com>",
+ "Mateusz Loskot <mateusz -at- loskot.net>",
+ "Adam Wulkiewicz <adam.wulkiewicz -at- gmail.com>"
+ ],
+ "description":
+ "The Boost.Geometry library provides geometric algorithms, primitives and spatial index.",
+ "category": [
+ "Algorithms", "Data", "Math"
+ ]
+ }
+]
diff --git a/src/boost/libs/geometry/index/test/Jamfile.v2 b/src/boost/libs/geometry/index/test/Jamfile.v2
new file mode 100644
index 00000000..90fcbf42
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/Jamfile.v2
@@ -0,0 +1,31 @@
+# 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)
+
+import testing ;
+
+project boost-geometry-index-test
+ :
+ requirements
+ <include>. # libs/geometry/index/test
+ <include>../../test # libs/geometry/test
+ #<include>../../../../boost/geometry/extensions/contrib/ttmath
+ <toolset>msvc:<asynch-exceptions>on
+ <toolset>msvc:<cxxflags>/bigobj
+ <host-os>windows,<toolset>intel:<cxxflags>/bigobj
+ <define>BOOST_NO_AUTO_PTR # disable the deprecated std::auto_ptr support in SmartPtr and Core
+ <library>/boost/timer//boost_timer
+ ;
+
+test-suite boost-geometry-index-varray
+ :
+ [ run varray_old.cpp ]
+ [ run varray.cpp ]
+ ;
+
+build-project algorithms ;
+build-project rtree ;
diff --git a/src/boost/libs/geometry/index/test/algorithms/Jamfile.v2 b/src/boost/libs/geometry/index/test/algorithms/Jamfile.v2
new file mode 100644
index 00000000..1fe75c6f
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/algorithms/Jamfile.v2
@@ -0,0 +1,20 @@
+# 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)
+
+test-suite boost-geometry-index-algorithms
+ :
+ [ run content.cpp ]
+ [ run intersection_content.cpp ] # this tests overlap() too
+ [ run is_valid.cpp ]
+ [ run margin.cpp ]
+ #[ run minmaxdist.cpp ]
+ [ run union_content.cpp ]
+ [ run segment_intersection.cpp ]
+ [ run path_intersection.cpp ]
+ ;
+
diff --git a/src/boost/libs/geometry/index/test/algorithms/content.cpp b/src/boost/libs/geometry/index/test/algorithms/content.cpp
new file mode 100644
index 00000000..07644656
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/algorithms/content.cpp
@@ -0,0 +1,71 @@
+// Boost.Geometry Index
+// Unit Test
+
+// 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 <algorithms/test_content.hpp>
+
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/box.hpp>
+
+//#define BOOST_GEOMETRY_TEST_DEBUG
+
+void test_large_integers()
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> int_point_type;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> double_point_type;
+
+ bg::model::box<int_point_type> int_box;
+ bg::model::box<double_point_type> double_box;
+
+ std::string const box_li = "POLYGON((1536119 192000, 1872000 528000))";
+ bg::read_wkt(box_li, int_box);
+ bg::read_wkt(box_li, double_box);
+
+ double int_value = bgi::detail::content(int_box);
+ double double_value = bgi::detail::content(double_box);
+
+ BOOST_CHECK_CLOSE(int_value, double_value, 0.0001);
+}
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> P2ic;
+ typedef bg::model::point<float, 2, bg::cs::cartesian> P2fc;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> P2dc;
+
+ typedef bg::model::point<int, 3, bg::cs::cartesian> P3ic;
+ typedef bg::model::point<float, 3, bg::cs::cartesian> P3fc;
+ typedef bg::model::point<double, 3, bg::cs::cartesian> P3dc;
+
+ test_content(P2ic(0, 0), 0);
+ test_content(P2fc(0, 0), 0);
+ test_content(P2dc(0, 0), 0);
+ test_content(P3ic(0, 0, 0), 0);
+ test_content(P3fc(0, 0, 0), 0);
+ test_content(P3dc(0, 0, 0), 0);
+
+ test_geometry<bg::model::box<P2ic> >("POLYGON((0 1,2 4))", 6.0);
+ test_geometry<bg::model::box<P2fc> >("POLYGON((0 1,2 4))", 6.0);
+ test_geometry<bg::model::box<P2dc> >("POLYGON((0 1,2 4))", 6.0);
+ test_geometry<bg::model::box<P3ic> >("POLYGON((0 1 2,2 4 6))", 24.0);
+ test_geometry<bg::model::box<P3fc> >("POLYGON((0 1 2,2 4 6))", 24.0);
+ test_geometry<bg::model::box<P3dc> >("POLYGON((0 1 2,2 4 6))", 24.0);
+
+#ifdef HAVE_TTMATH
+ typedef bg::model::point<ttmath_big, 2, bg::cs::cartesian> P2ttmc;
+ typedef bg::model::point<ttmath_big, 3, bg::cs::cartesian> P3ttmc;
+
+ test_geometry<bg::model::box<P2ttmc> >("POLYGON((0 1,2 4))", 6.0);
+ test_geometry<bg::model::box<P3ttmc> >("POLYGON((0 1 2,2 4 6))", 24.0);
+#endif
+
+ test_large_integers();
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/algorithms/intersection_content.cpp b/src/boost/libs/geometry/index/test/algorithms/intersection_content.cpp
new file mode 100644
index 00000000..a668af79
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/algorithms/intersection_content.cpp
@@ -0,0 +1,70 @@
+// Boost.Geometry Index
+// Unit Test
+
+// 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 <algorithms/test_intersection_content.hpp>
+
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/box.hpp>
+
+//#define BOOST_GEOMETRY_TEST_DEBUG
+
+void test_large_integers()
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> int_point_type;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> double_point_type;
+
+ bg::model::box<int_point_type> int_box1, int_box2;
+ bg::model::box<double_point_type> double_box1, double_box2;
+
+ std::string const box_li1 = "POLYGON((1536119 192000, 1872000 528000))";
+ std::string const box_li2 = "POLYGON((1701234 368250, 2673400 777400))";
+ bg::read_wkt(box_li1, int_box1);
+ bg::read_wkt(box_li1, double_box1);
+ bg::read_wkt(box_li2, int_box2);
+ bg::read_wkt(box_li2, double_box2);
+
+ double int_value = bgi::detail::intersection_content(int_box1, int_box2);
+ double double_value = bgi::detail::intersection_content(double_box1, double_box2);
+
+ BOOST_CHECK_CLOSE(int_value, double_value, 0.0001);
+}
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> P2ic;
+ typedef bg::model::point<float, 2, bg::cs::cartesian> P2fc;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> P2dc;
+
+ typedef bg::model::point<int, 3, bg::cs::cartesian> P3ic;
+ typedef bg::model::point<float, 3, bg::cs::cartesian> P3fc;
+ typedef bg::model::point<double, 3, bg::cs::cartesian> P3dc;
+
+ test_geometry<bg::model::box<P2ic> >("POLYGON((0 1,2 4))", "POLYGON((1 2,3 5))", 2.0);
+ test_geometry<bg::model::box<P2fc> >("POLYGON((0 1,2 4))", "POLYGON((1 2,3 5))", 2.0);
+ test_geometry<bg::model::box<P2dc> >("POLYGON((0 1,2 4))", "POLYGON((1 2,3 5))", 2.0);
+ test_geometry<bg::model::box<P3ic> >("POLYGON((0 1 2,2 4 6))", "POLYGON((1 2 3,3 5 7))", 6.0);
+ test_geometry<bg::model::box<P3fc> >("POLYGON((0 1 2,2 4 6))", "POLYGON((1 2 3,3 5 7))", 6.0);
+ test_geometry<bg::model::box<P3dc> >("POLYGON((0 1 2,2 4 6))", "POLYGON((1 2 3,3 5 7))", 6.0);
+
+ test_geometry<bg::model::box<P2dc> >("POLYGON((0 1,2 4))", "POLYGON((2 1,3 4))", 0.0);
+ test_geometry<bg::model::box<P2dc> >("POLYGON((0 1,2 4))", "POLYGON((2 4,3 5))", 0.0);
+
+#ifdef HAVE_TTMATH
+ typedef bg::model::point<ttmath_big, 2, bg::cs::cartesian> P2ttmc;
+ typedef bg::model::point<ttmath_big, 3, bg::cs::cartesian> P3ttmc;
+
+ test_geometry<bg::model::box<P2ttmc> >("POLYGON((0 1,2 4))", "POLYGON((1 2,3 5))", 2.0);
+ test_geometry<bg::model::box<P3ttmc> >("POLYGON((0 1 2,2 4 6))", "POLYGON((1 2 3,3 5 7))", 6.0);
+#endif
+
+ test_large_integers();
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/algorithms/is_valid.cpp b/src/boost/libs/geometry/index/test/algorithms/is_valid.cpp
new file mode 100644
index 00000000..4c0584a0
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/algorithms/is_valid.cpp
@@ -0,0 +1,110 @@
+// Boost.Geometry Index
+// Unit Test
+
+// 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 <algorithm>
+
+#include <geometry_index_test_common.hpp>
+
+#include <boost/geometry/index/detail/algorithms/is_valid.hpp>
+
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/box.hpp>
+
+//#define BOOST_GEOMETRY_TEST_DEBUG
+
+template <typename Geometry>
+void test(Geometry const& geometry, bool expected_value)
+{
+ bool value = bgi::detail::is_valid(geometry);
+
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::ostringstream out;
+ out << typeid(typename bg::coordinate_type<Geometry>::type).name()
+ << " "
+ << typeid(bool).name()
+ << " "
+ << "is_valid : " << value
+ << std::endl;
+ std::cout << out.str();
+#endif
+
+ BOOST_CHECK(value == expected_value);
+}
+
+template <typename Box>
+void test_box(std::string const& wkt, bool expected_value)
+{
+ Box box;
+ bg::read_wkt(wkt, box);
+ test(box, expected_value);
+ typename bg::point_type<Box>::type temp_pt;
+ temp_pt = box.min_corner();
+ box.min_corner() = box.max_corner();
+ box.max_corner() = temp_pt;
+ test(box, !expected_value);
+}
+
+void test_large_integers()
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> int_point_type;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> double_point_type;
+
+ bg::model::box<int_point_type> int_box;
+ bg::model::box<double_point_type> double_box;
+
+ std::string const box_li = "POLYGON((1536119 192000, 1872000 528000))";
+ bg::read_wkt(box_li, int_box);
+ bg::read_wkt(box_li, double_box);
+
+ BOOST_CHECK(bgi::detail::is_valid(int_box) == bgi::detail::is_valid(double_box));
+
+ std::string const box_li2 = "POLYGON((1872000 528000, 1536119 192000))";
+ bg::read_wkt(box_li2, int_box);
+ bg::read_wkt(box_li2, double_box);
+
+ BOOST_CHECK(bgi::detail::is_valid(int_box) == bgi::detail::is_valid(double_box));
+}
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> P2ic;
+ typedef bg::model::point<float, 2, bg::cs::cartesian> P2fc;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> P2dc;
+
+ typedef bg::model::point<int, 3, bg::cs::cartesian> P3ic;
+ typedef bg::model::point<float, 3, bg::cs::cartesian> P3fc;
+ typedef bg::model::point<double, 3, bg::cs::cartesian> P3dc;
+
+ test(P2ic(0, 0), true);
+ test(P2fc(0, 0), true);
+ test(P2dc(0, 0), true);
+ test(P3ic(0, 0, 0), true);
+ test(P3fc(0, 0, 0), true);
+ test(P3dc(0, 0, 0), true);
+
+ test_box<bg::model::box<P2ic> >("POLYGON((0 1,2 4))", true);
+ test_box<bg::model::box<P2fc> >("POLYGON((0 1,2 4))", true);
+ test_box<bg::model::box<P2dc> >("POLYGON((0 1,2 4))", true);
+ test_box<bg::model::box<P3ic> >("POLYGON((0 1 2,2 4 6))", true);
+ test_box<bg::model::box<P3fc> >("POLYGON((0 1 2,2 4 6))", true);
+ test_box<bg::model::box<P3dc> >("POLYGON((0 1 2,2 4 6))", true);
+
+#ifdef HAVE_TTMATH
+ typedef bg::model::point<ttmath_big, 2, bg::cs::cartesian> P2ttmc;
+ typedef bg::model::point<ttmath_big, 3, bg::cs::cartesian> P3ttmc;
+
+ test_geometry<bg::model::box<P2ttmc> >("POLYGON((0 1,2 4))", true);
+ test_geometry<bg::model::box<P3ttmc> >("POLYGON((0 1 2,2 4 6))", true);
+#endif
+
+ test_large_integers();
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/algorithms/margin.cpp b/src/boost/libs/geometry/index/test/algorithms/margin.cpp
new file mode 100644
index 00000000..e1e9eab0
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/algorithms/margin.cpp
@@ -0,0 +1,66 @@
+// Boost.Geometry Index
+// Unit Test
+
+// 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 <algorithms/test_margin.hpp>
+
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/box.hpp>
+
+//#define BOOST_GEOMETRY_TEST_DEBUG
+
+void test_large_integers()
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> int_point_type;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> double_point_type;
+
+ bg::model::box<int_point_type> int_box;
+ bg::model::box<double_point_type> double_box;
+
+ std::string const box_li = "POLYGON((1536119 192000, 1872000 528000))";
+ bg::read_wkt(box_li, int_box);
+ bg::read_wkt(box_li, double_box);
+
+ double int_value = bgi::detail::comparable_margin(int_box);
+ double double_value = bgi::detail::comparable_margin(double_box);
+
+ BOOST_CHECK_CLOSE(int_value, double_value, 0.0001);
+}
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> P2ic;
+ typedef bg::model::point<float, 2, bg::cs::cartesian> P2fc;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> P2dc;
+
+ typedef bg::model::point<int, 3, bg::cs::cartesian> P3ic;
+ typedef bg::model::point<float, 3, bg::cs::cartesian> P3fc;
+ typedef bg::model::point<double, 3, bg::cs::cartesian> P3dc;
+
+ test_geometry<bg::model::box<P2ic> >("POLYGON((0 1,2 4))", 5);
+ test_geometry<bg::model::box<P2fc> >("POLYGON((0 1,2 4))", 5.0);
+ test_geometry<bg::model::box<P2dc> >("POLYGON((0 1,2 4))", 5.0);
+ test_geometry<bg::model::box<P3ic> >("POLYGON((0 1 2,2 4 6))", 9);
+ test_geometry<bg::model::box<P3fc> >("POLYGON((0 1 2,2 4 6))", 9.0);
+ test_geometry<bg::model::box<P3dc> >("POLYGON((0 1 2,2 4 6))", 9.0);
+
+#ifdef HAVE_TTMATH
+ typedef bg::model::point<ttmath_big, 2, bg::cs::cartesian> P2ttmc;
+ typedef bg::model::point<ttmath_big, 3, bg::cs::cartesian> P3ttmc;
+
+ test_geometry<bg::model::box<P2ttmc> >("POLYGON((0 1,2 4))", 10.0);
+ test_geometry<bg::model::box<P3ttmc> >("POLYGON((0 1 2,2 4 6))", 52.0);
+#endif
+
+ test_large_integers();
+
+ // test_empty_input<bg::model::d2::point_xy<int> >();
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/algorithms/minmaxdist.cpp b/src/boost/libs/geometry/index/test/algorithms/minmaxdist.cpp
new file mode 100644
index 00000000..4534b2f3
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/algorithms/minmaxdist.cpp
@@ -0,0 +1,101 @@
+// Boost.Geometry Index
+// Unit Test
+
+// 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 <algorithm>
+
+#include <geometry_index_test_common.hpp>
+
+#include <boost/geometry/index/detail/algorithms/minmaxdist.hpp>
+
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/box.hpp>
+
+#define BOOST_GEOMETRY_TEST_DEBUG
+
+template <typename Point, typename Indexable>
+void test(Point const& pt, Indexable const& indexable,
+ typename bg::default_distance_result<Point, Indexable>::type expected_value)
+{
+ typename bg::default_distance_result<Point, Indexable>::type value = bgi::detail::minmaxdist(pt, indexable);
+
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::ostringstream out;
+ out << typeid(typename bg::coordinate_type<Point>::type).name()
+ << " "
+ << typeid(typename bg::coordinate_type<Indexable>::type).name()
+ << " "
+ << typeid(bg::default_distance_result<Point, Indexable>::type).name()
+ << " "
+ << "minmaxdist : " << value
+ << std::endl;
+ std::cout << out.str();
+#endif
+
+ BOOST_CHECK_CLOSE(value, expected_value, 0.0001);
+}
+
+template <typename Indexable, typename Point>
+void test_indexable(Point const& pt, std::string const& wkt,
+ typename bg::default_distance_result<Point, Indexable>::type expected_value)
+{
+ Indexable indexable;
+ bg::read_wkt(wkt, indexable);
+ test(pt, indexable, expected_value);
+}
+
+void test_large_integers()
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> int_point_type;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> double_point_type;
+
+ int_point_type int_pt(0, 0);
+ double_point_type double_pt(0, 0);
+
+ bg::model::box<int_point_type> int_box;
+ bg::model::box<double_point_type> double_box;
+
+ std::string const box_li = "POLYGON((1536119 192000, 1872000 528000))";
+ bg::read_wkt(box_li, int_box);
+ bg::read_wkt(box_li, double_box);
+
+ BOOST_CHECK(bgi::detail::minmaxdist(int_pt, int_box) == bgi::detail::minmaxdist(double_pt, double_box));
+}
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> P2ic;
+ typedef bg::model::point<float, 2, bg::cs::cartesian> P2fc;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> P2dc;
+
+ typedef bg::model::point<int, 3, bg::cs::cartesian> P3ic;
+ typedef bg::model::point<float, 3, bg::cs::cartesian> P3fc;
+ typedef bg::model::point<double, 3, bg::cs::cartesian> P3dc;
+
+ test_indexable<bg::model::box<P2ic> >(P2ic(1, 2), "POLYGON((0 1,2 4))", 5.0);
+ test_indexable<bg::model::box<P2fc> >(P2fc(1, 2), "POLYGON((0 1,2 4))", 5.0);
+ test_indexable<bg::model::box<P2dc> >(P2dc(1, 2), "POLYGON((0 1,2 4))", 5.0);
+ test_indexable<bg::model::box<P3ic> >(P3ic(1, 2, 3), "POLYGON((0 1 2,2 4 6))", 14.0);
+ test_indexable<bg::model::box<P3fc> >(P3fc(1, 2, 3), "POLYGON((0 1 2,2 4 6))", 14.0);
+ test_indexable<bg::model::box<P3dc> >(P3dc(1, 2, 3), "POLYGON((0 1 2,2 4 6))", 14.0);
+
+ test_indexable<bg::model::box<P2ic> >(P2ic(1, 2), "POLYGON((1 2,3 5))", 4.0);
+
+#ifdef HAVE_TTMATH
+ typedef bg::model::point<ttmath_big, 2, bg::cs::cartesian> P2ttmc;
+ typedef bg::model::point<ttmath_big, 3, bg::cs::cartesian> P3ttmc;
+
+ test_indexable<bg::model::box<P2ttmc> >(P2ttmc(1, 2), "POLYGON((0 1,2 4))", 5.0);
+ test_indexable<bg::model::box<P3ttmc> >(P3ttmc(1, 2, 3), "POLYGON((0 1 2,2 4 6))", 14.0);
+#endif
+
+ test_large_integers();
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/algorithms/path_intersection.cpp b/src/boost/libs/geometry/index/test/algorithms/path_intersection.cpp
new file mode 100644
index 00000000..2670d077
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/algorithms/path_intersection.cpp
@@ -0,0 +1,133 @@
+// Boost.Geometry Index
+// Unit Test
+
+// 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 <geometry_index_test_common.hpp>
+
+#include <boost/geometry/index/detail/algorithms/path_intersection.hpp>
+
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/box.hpp>
+#include <boost/geometry/geometries/linestring.hpp>
+#include <boost/geometry/geometries/segment.hpp>
+
+//#include <boost/geometry/io/wkt/read.hpp>
+
+template <typename Box, typename Linestring>
+void test_path_intersection(Box const& box, Linestring const& path,
+ bool expected_result,
+ typename bg::default_length_result<Linestring>::type expected_dist)
+{
+ typename bgi::detail::default_path_intersection_distance_type<Box, Linestring>::type dist;
+
+ bool value = bgi::detail::path_intersection(box, path, dist);
+ BOOST_CHECK(value == expected_result);
+ if ( value && expected_result )
+ BOOST_CHECK_CLOSE(dist, expected_dist, 0.0001);
+
+ if ( ::boost::size(path) == 2 )
+ {
+ typedef typename ::boost::range_value<Linestring>::type P;
+ typedef bg::model::segment<P> Seg;
+ typename bgi::detail::default_path_intersection_distance_type<Box, Seg>::type dist;
+ Seg seg(*::boost::begin(path), *(::boost::begin(path)+1));
+ bool value = bgi::detail::path_intersection(box, seg, dist);
+ BOOST_CHECK(value == expected_result);
+ if ( value && expected_result )
+ BOOST_CHECK_CLOSE(dist, expected_dist, 0.0001);
+ }
+}
+
+template <typename Box, typename Linestring>
+void test_geometry(std::string const& wkt_g, std::string const& wkt_path,
+ bool expected_result,
+ typename bg::default_length_result<Linestring>::type expected_dist)
+{
+ Box box;
+ bg::read_wkt(wkt_g, box);
+ Linestring path;
+ bg::read_wkt(wkt_path, path);
+ test_path_intersection(box, path, expected_result, expected_dist);
+}
+
+void test_large_integers()
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> int_point_type;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> double_point_type;
+
+ bg::model::box<int_point_type> int_box;
+ bg::model::box<double_point_type> double_box;
+ typedef bg::model::linestring<int_point_type> IP;
+ IP int_path;
+ typedef bg::model::linestring<double_point_type> DP;
+ DP double_path;
+
+ std::string const str_box = "POLYGON((1536119 192000, 1872000 528000))";
+ std::string const str_path = "LINESTRING(1535000 191000, 1873000 191000, 1873000 300000, 1536119 300000)";
+ bg::read_wkt(str_box, int_box);
+ bg::read_wkt(str_box, double_box);
+ bg::read_wkt(str_path, int_path);
+ bg::read_wkt(str_path, double_path);
+
+ bg::default_length_result<IP>::type int_value;
+ bool int_result = bgi::detail::path_intersection(int_box, int_path, int_value);
+ bg::default_length_result<DP>::type double_value;
+ bool double_result = bgi::detail::path_intersection(double_box, double_path, double_value);
+
+ BOOST_CHECK(int_result == double_result);
+ if ( int_result && double_result )
+ BOOST_CHECK_CLOSE(int_value, double_value, 0.0001);
+}
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> P2ic;
+ typedef bg::model::point<float, 2, bg::cs::cartesian> P2fc;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> P2dc;
+
+ typedef bg::model::point<int, 3, bg::cs::cartesian> P3ic;
+ typedef bg::model::point<float, 3, bg::cs::cartesian> P3fc;
+ typedef bg::model::point<double, 3, bg::cs::cartesian> P3dc;
+
+ typedef bg::model::linestring<P2ic> L2ic;
+ typedef bg::model::linestring<P2fc> L2fc;
+ typedef bg::model::linestring<P2dc> L2dc;
+
+ typedef bg::model::linestring<P3ic> L3ic;
+ typedef bg::model::linestring<P3fc> L3fc;
+ typedef bg::model::linestring<P3dc> L3dc;
+
+ // IMPORTANT! For 2-point linestrings comparable distance optimization is enabled!
+
+ test_geometry<bg::model::box<P2ic>, L2ic>("POLYGON((0 1,2 4))", "LINESTRING(0 0, 2 5)", true, 1.0f/5);
+ test_geometry<bg::model::box<P2fc>, L2fc>("POLYGON((0 1,2 4))", "LINESTRING(0 0, 2 5)", true, 1.0f/5);
+ test_geometry<bg::model::box<P2dc>, L2dc>("POLYGON((0 1,2 4))", "LINESTRING(0 0, 2 5)", true, 1.0/5);
+ test_geometry<bg::model::box<P3ic>, L3ic>("POLYGON((0 1 2,2 4 6))", "LINESTRING(0 0 0, 2 5 7)", true, 2.0f/7);
+ test_geometry<bg::model::box<P3fc>, L3fc>("POLYGON((0 1 2,2 4 6))", "LINESTRING(0 0 0, 2 5 7)", true, 2.0f/7);
+ test_geometry<bg::model::box<P3dc>, L3dc>("POLYGON((0 1 2,2 4 6))", "LINESTRING(0 0 0, 2 5 7)", true, 2.0/7);
+
+ test_geometry<bg::model::box<P2fc>, L2fc>("POLYGON((0 1,2 4))", "LINESTRING(0 0, 1 0, 1 5)", true, 2);
+ test_geometry<bg::model::box<P2fc>, L2fc>("POLYGON((0 1,2 4))", "LINESTRING(0 0, 3 0, 3 2, 0 2)", true, 6);
+ test_geometry<bg::model::box<P2fc>, L2fc>("POLYGON((0 1,2 4))", "LINESTRING(1 2, 3 3, 0 3)", true, 0);
+
+#ifdef HAVE_TTMATH
+ typedef bg::model::point<ttmath_big, 2, bg::cs::cartesian> P2ttmc;
+ typedef bg::model::point<ttmath_big, 3, bg::cs::cartesian> P3ttmc;
+
+ typedef bg::model::linestring<P2ttmc> L2ttmc;
+ typedef bg::model::linestring<P3ttmc> L3ttmc;
+
+ test_geometry<bg::model::box<P2ttmc>, L2ttmc>("POLYGON((0 1,2 4))", "LINESTRING(0 0, 2 5)", true, 1.0/5);
+ test_geometry<bg::model::box<P3ttmc>, L3ttmc>("POLYGON((0 1 2,2 4 6))", "LINESTRING(0 0 0, 2 5 7)", true, 2.0/7);
+#endif
+
+ test_large_integers();
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/algorithms/segment_intersection.cpp b/src/boost/libs/geometry/index/test/algorithms/segment_intersection.cpp
new file mode 100644
index 00000000..1cc6dc22
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/algorithms/segment_intersection.cpp
@@ -0,0 +1,129 @@
+// Boost.Geometry Index
+// Unit Test
+
+// 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 <geometry_index_test_common.hpp>
+
+#include <boost/geometry/index/detail/algorithms/segment_intersection.hpp>
+
+//#include <boost/geometry/io/wkt/read.hpp>
+
+template <typename Box, typename Point, typename RelativeDistance>
+void test_segment_intersection(Box const& box, Point const& p0, Point const& p1,
+ bool expected_result,
+ RelativeDistance expected_rel_dist)
+{
+ RelativeDistance rel_dist;
+ bool value = bgi::detail::segment_intersection(box, p0, p1, rel_dist);
+ BOOST_CHECK(value == expected_result);
+ if ( value && expected_result )
+ BOOST_CHECK_CLOSE(rel_dist, expected_rel_dist, 0.0001);
+}
+
+template <typename Box, typename Point, typename RelativeDistance>
+void test_geometry(std::string const& wkt_g, std::string const& wkt_p0, std::string const& wkt_p1,
+ bool expected_result,
+ RelativeDistance expected_rel_dist)
+{
+ Box box;
+ bg::read_wkt(wkt_g, box);
+ Point p0, p1;
+ bg::read_wkt(wkt_p0, p0);
+ bg::read_wkt(wkt_p1, p1);
+ test_segment_intersection(box, p0, p1, expected_result, expected_rel_dist);
+}
+
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/box.hpp>
+
+void test_large_integers()
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> int_point_type;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> double_point_type;
+
+ bg::model::box<int_point_type> int_box;
+ bg::model::box<double_point_type> double_box;
+ int_point_type int_p0, int_p1;
+ double_point_type double_p0, double_p1;
+
+ std::string const str_box = "POLYGON((1536119 192000, 1872000 528000))";
+ std::string const str_p0 = "POINT(1535000 191000)";
+ std::string const str_p1 = "POINT(1873000 529000)";
+ bg::read_wkt(str_box, int_box);
+ bg::read_wkt(str_box, double_box);
+ bg::read_wkt(str_p0, int_p0);
+ bg::read_wkt(str_p1, int_p1);
+ bg::read_wkt(str_p0, double_p0);
+ bg::read_wkt(str_p1, double_p1);
+
+ float int_value;
+ bool int_result = bgi::detail::segment_intersection(int_box, int_p0, int_p1, int_value);
+ double double_value;
+ bool double_result = bgi::detail::segment_intersection(double_box, double_p0, double_p1, double_value);
+ BOOST_CHECK(int_result == double_result);
+ if ( int_result && double_result )
+ BOOST_CHECK_CLOSE(int_value, double_value, 0.0001);
+}
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> P2ic;
+ typedef bg::model::point<float, 2, bg::cs::cartesian> P2fc;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> P2dc;
+
+ typedef bg::model::point<int, 3, bg::cs::cartesian> P3ic;
+ typedef bg::model::point<float, 3, bg::cs::cartesian> P3fc;
+ typedef bg::model::point<double, 3, bg::cs::cartesian> P3dc;
+
+ test_geometry<bg::model::box<P2ic>, P2ic>("POLYGON((0 1,2 4))", "POINT(0 0)", "POINT(2 5)", true, 1.0f/5);
+ test_geometry<bg::model::box<P2fc>, P2fc>("POLYGON((0 1,2 4))", "POINT(0 0)", "POINT(2 5)", true, 1.0f/5);
+ test_geometry<bg::model::box<P2dc>, P2dc>("POLYGON((0 1,2 4))", "POINT(0 0)", "POINT(2 5)", true, 1.0/5);
+ test_geometry<bg::model::box<P3ic>, P3ic>("POLYGON((0 1 2,2 4 6))", "POINT(0 0 0)", "POINT(2 5 7)", true, 2.0f/7);
+ test_geometry<bg::model::box<P3fc>, P3fc>("POLYGON((0 1 2,2 4 6))", "POINT(0 0 0)", "POINT(2 5 7)", true, 2.0f/7);
+ test_geometry<bg::model::box<P3dc>, P3dc>("POLYGON((0 1 2,2 4 6))", "POINT(0 0 0)", "POINT(2 5 7)", true, 2.0/7);
+
+ test_geometry<bg::model::box<P2ic>, P2ic>("POLYGON((0 1,2 4))", "POINT(3 4)", "POINT(0 0)", true, 1.0f/3);
+ test_geometry<bg::model::box<P2fc>, P2fc>("POLYGON((0 1,2 4))", "POINT(3 4)", "POINT(0 2)", true, 1.0f/3);
+ test_geometry<bg::model::box<P2dc>, P2dc>("POLYGON((0 1,2 4))", "POINT(3 4)", "POINT(0 2)", true, 1.0/3);
+ test_geometry<bg::model::box<P3ic>, P3ic>("POLYGON((0 1 2,2 4 6))", "POINT(3 5 6)", "POINT(0 3 3)", true, 1.0f/2);
+ test_geometry<bg::model::box<P3fc>, P3fc>("POLYGON((0 1 2,2 4 6))", "POINT(3 5 6)", "POINT(0 3 3)", true, 1.0f/2);
+ test_geometry<bg::model::box<P3dc>, P3dc>("POLYGON((0 1 2,2 4 6))", "POINT(3 5 6)", "POINT(0 3 3)", true, 1.0/2);
+
+ test_geometry<bg::model::box<P2ic>, P2ic>("POLYGON((0 1,2 4))", "POINT(1 0)", "POINT(1 5)", true, 1.0f/5);
+ test_geometry<bg::model::box<P2fc>, P2fc>("POLYGON((0 1,2 4))", "POINT(1 5)", "POINT(1 0)", true, 1.0f/5);
+ test_geometry<bg::model::box<P2dc>, P2dc>("POLYGON((0 1,2 4))", "POINT(1 0)", "POINT(1 5)", true, 1.0/5);
+ test_geometry<bg::model::box<P3ic>, P3ic>("POLYGON((0 1 2,2 4 6))", "POINT(1 3 0)", "POINT(1 3 7)", true, 2.0f/7);
+ test_geometry<bg::model::box<P3fc>, P3fc>("POLYGON((0 1 2,2 4 6))", "POINT(1 3 7)", "POINT(1 3 0)", true, 1.0f/7);
+ test_geometry<bg::model::box<P3dc>, P3dc>("POLYGON((0 1 2,2 4 6))", "POINT(1 3 0)", "POINT(1 3 7)", true, 2.0/7);
+
+ test_geometry<bg::model::box<P2ic>, P2ic>("POLYGON((0 1,2 4))", "POINT(0 0)", "POINT(0 5)", true, 0.2f);
+ test_geometry<bg::model::box<P2fc>, P2fc>("POLYGON((0 1,2 4))", "POINT(0 5)", "POINT(0 0)", true, 0.2f);
+ test_geometry<bg::model::box<P2dc>, P2dc>("POLYGON((0 1,2 4))", "POINT(0 0)", "POINT(0 5)", true, 0.2);
+
+ test_geometry<bg::model::box<P2ic>, P2ic>("POLYGON((0 1,2 4))", "POINT(3 0)", "POINT(3 5)", false, 0.0f);
+ test_geometry<bg::model::box<P2fc>, P2fc>("POLYGON((0 1,2 4))", "POINT(3 5)", "POINT(3 0)", false, 0.0f);
+ test_geometry<bg::model::box<P2dc>, P2dc>("POLYGON((0 1,2 4))", "POINT(3 0)", "POINT(3 5)", false, 0.0);
+
+ test_geometry<bg::model::box<P2fc>, P2fc>("POLYGON((0 1,2 4))", "POINT(1 0)", "POINT(1 1)", true, 1.0f);
+ test_geometry<bg::model::box<P2fc>, P2fc>("POLYGON((0 1,2 4))", "POINT(1 4)", "POINT(1 5)", true, 0.0f);
+
+ test_geometry<bg::model::box<P2fc>, P2fc>("POLYGON((0 1,2 4))", "POINT(0.5 2)", "POINT(1.5 3)", true, 0.0f);
+
+#ifdef HAVE_TTMATH
+ typedef bg::model::point<ttmath_big, 2, bg::cs::cartesian> P2ttmc;
+ typedef bg::model::point<ttmath_big, 3, bg::cs::cartesian> P3ttmc;
+
+ test_geometry<bg::model::box<P2ttmc>, P2ttmc>("POLYGON((0 1,2 4))", "POINT(0 0)", "POINT(2 5)", true, 1.0f/5);
+ test_geometry<bg::model::box<P3ttmc>, P3ttmc>("POLYGON((0 1 2,2 4 6))", "POINT(0 0 0)", "POINT(2 5 7)", true, 2.0f/7);
+#endif
+
+ test_large_integers();
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/algorithms/test_content.hpp b/src/boost/libs/geometry/index/test/algorithms/test_content.hpp
new file mode 100644
index 00000000..92282f8b
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/algorithms/test_content.hpp
@@ -0,0 +1,49 @@
+// Boost.Geometry Index
+// Unit Test
+
+// 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_TEST_CONTENT_HPP
+#define BOOST_GEOMETRY_INDEX_TEST_CONTENT_HPP
+
+#include <geometry_index_test_common.hpp>
+
+#include <boost/geometry/index/detail/algorithms/content.hpp>
+
+//#include <boost/geometry/io/wkt/read.hpp>
+
+
+template <typename Geometry>
+void test_content(Geometry const& geometry,
+ typename bgi::detail::default_content_result<Geometry>::type expected_value)
+{
+ typename bgi::detail::default_content_result<Geometry>::type value = bgi::detail::content(geometry);
+
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::ostringstream out;
+ out << typeid(typename bg::coordinate_type<Geometry>::type).name()
+ << " "
+ << typeid(typename bgi::detail::default_content_result<Geometry>::type).name()
+ << " "
+ << "content : " << value
+ << std::endl;
+ std::cout << out.str();
+#endif
+
+ BOOST_CHECK_CLOSE(value, expected_value, 0.0001);
+}
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt,
+ typename bgi::detail::default_content_result<Geometry>::type expected_value)
+{
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+ test_content(geometry, expected_value);
+}
+
+#endif
diff --git a/src/boost/libs/geometry/index/test/algorithms/test_intersection_content.hpp b/src/boost/libs/geometry/index/test/algorithms/test_intersection_content.hpp
new file mode 100644
index 00000000..1445f8f4
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/algorithms/test_intersection_content.hpp
@@ -0,0 +1,47 @@
+// Boost.Geometry Index
+// Unit Test
+
+// 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_TEST_INTERSECTION_CONTENT_HPP
+#define BOOST_GEOMETRY_INDEX_TEST_INTERSECTION_CONTENT_HPP
+
+#include <geometry_index_test_common.hpp>
+
+#include <boost/geometry/index/detail/algorithms/intersection_content.hpp>
+
+template <typename Geometry>
+void test_intersection_content(Geometry const& geometry1, Geometry const& geometry2,
+ typename bgi::detail::default_content_result<Geometry>::type expected_value)
+{
+ typename bgi::detail::default_content_result<Geometry>::type value = bgi::detail::intersection_content(geometry1, geometry2);
+
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::ostringstream out;
+ out << typeid(typename bg::coordinate_type<Geometry>::type).name()
+ << " "
+ << typeid(typename bgi::detail::default_content_result<Geometry>::type).name()
+ << " "
+ << "intersection_content : " << value
+ << std::endl;
+ std::cout << out.str();
+#endif
+
+ BOOST_CHECK_CLOSE(value, expected_value, 0.0001);
+}
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt1, std::string const& wkt2,
+ typename bgi::detail::default_content_result<Geometry>::type expected_value)
+{
+ Geometry geometry1, geometry2;
+ bg::read_wkt(wkt1, geometry1);
+ bg::read_wkt(wkt2, geometry2);
+ test_intersection_content(geometry1, geometry2, expected_value);
+}
+
+#endif
diff --git a/src/boost/libs/geometry/index/test/algorithms/test_margin.hpp b/src/boost/libs/geometry/index/test/algorithms/test_margin.hpp
new file mode 100644
index 00000000..8146b7fe
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/algorithms/test_margin.hpp
@@ -0,0 +1,48 @@
+// Boost.Geometry Index
+// Unit Test
+
+// 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_TEST_MARGIN_HPP
+#define BOOST_GEOMETRY_INDEX_TEST_MARGIN_HPP
+
+#include <geometry_index_test_common.hpp>
+
+#include <boost/geometry/index/detail/algorithms/margin.hpp>
+
+//#include <boost/geometry/io/wkt/read.hpp>
+
+template <typename Geometry>
+void test_margin(Geometry const& geometry,
+ typename bgi::detail::default_margin_result<Geometry>::type expected_value)
+{
+ typename bgi::detail::default_margin_result<Geometry>::type value = bgi::detail::comparable_margin(geometry);
+
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::ostringstream out;
+ out << typeid(typename bg::coordinate_type<Geometry>::type).name()
+ << " "
+ << typeid(typename bgi::detail::default_margin_result<Geometry>::type).name()
+ << " "
+ << "content : " << value
+ << std::endl;
+ std::cout << out.str();
+#endif
+
+ BOOST_CHECK_CLOSE(value, expected_value, 0.0001);
+}
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt,
+ typename bgi::detail::default_margin_result<Geometry>::type expected_value)
+{
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+ test_margin(geometry, expected_value);
+}
+
+#endif
diff --git a/src/boost/libs/geometry/index/test/algorithms/test_union_content.hpp b/src/boost/libs/geometry/index/test/algorithms/test_union_content.hpp
new file mode 100644
index 00000000..b2648c47
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/algorithms/test_union_content.hpp
@@ -0,0 +1,47 @@
+// Boost.Geometry Index
+// Unit Test
+
+// 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_TEST_UNION_CONTENT_HPP
+#define BOOST_GEOMETRY_INDEX_TEST_UNION_CONTENT_HPP
+
+#include <geometry_index_test_common.hpp>
+
+#include <boost/geometry/index/detail/algorithms/union_content.hpp>
+
+template <typename Geometry>
+void test_union_content(Geometry const& geometry1, Geometry const& geometry2,
+ typename bgi::detail::default_content_result<Geometry>::type expected_value)
+{
+ typename bgi::detail::default_content_result<Geometry>::type value = bgi::detail::union_content(geometry1, geometry2);
+
+#ifdef BOOST_GEOMETRY_TEST_DEBUG
+ std::ostringstream out;
+ out << typeid(typename bg::coordinate_type<Geometry>::type).name()
+ << " "
+ << typeid(typename bgi::detail::default_content_result<Geometry>::type).name()
+ << " "
+ << "union_content : " << value
+ << std::endl;
+ std::cout << out.str();
+#endif
+
+ BOOST_CHECK_CLOSE(value, expected_value, 0.0001);
+}
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt1, std::string const& wkt2,
+ typename bgi::detail::default_content_result<Geometry>::type expected_value)
+{
+ Geometry geometry1, geometry2;
+ bg::read_wkt(wkt1, geometry1);
+ bg::read_wkt(wkt2, geometry2);
+ test_union_content(geometry1, geometry2, expected_value);
+}
+
+#endif
diff --git a/src/boost/libs/geometry/index/test/algorithms/union_content.cpp b/src/boost/libs/geometry/index/test/algorithms/union_content.cpp
new file mode 100644
index 00000000..beaa1713
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/algorithms/union_content.cpp
@@ -0,0 +1,70 @@
+// Boost.Geometry Index
+// Unit Test
+
+// 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 <algorithms/test_union_content.hpp>
+
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/box.hpp>
+
+//#define BOOST_GEOMETRY_TEST_DEBUG
+
+void test_large_integers()
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> int_point_type;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> double_point_type;
+
+ bg::model::box<int_point_type> int_box1, int_box2;
+ bg::model::box<double_point_type> double_box1, double_box2;
+
+ std::string const box_li1 = "POLYGON((1536119 192000, 1872000 528000))";
+ std::string const box_li2 = "POLYGON((1701234 368250, 2673400 777400))";
+ bg::read_wkt(box_li1, int_box1);
+ bg::read_wkt(box_li1, double_box1);
+ bg::read_wkt(box_li2, int_box2);
+ bg::read_wkt(box_li2, double_box2);
+
+ double int_value = bgi::detail::union_content(int_box1, int_box2);
+ double double_value = bgi::detail::union_content(double_box1, double_box2);
+
+ BOOST_CHECK_CLOSE(int_value, double_value, 0.0001);
+}
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> P2ic;
+ typedef bg::model::point<float, 2, bg::cs::cartesian> P2fc;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> P2dc;
+
+ typedef bg::model::point<int, 3, bg::cs::cartesian> P3ic;
+ typedef bg::model::point<float, 3, bg::cs::cartesian> P3fc;
+ typedef bg::model::point<double, 3, bg::cs::cartesian> P3dc;
+
+ test_geometry<bg::model::box<P2ic> >("POLYGON((0 1,2 4))", "POLYGON((1 2,3 5))", 12.0);
+ test_geometry<bg::model::box<P2fc> >("POLYGON((0 1,2 4))", "POLYGON((1 2,3 5))", 12.0);
+ test_geometry<bg::model::box<P2dc> >("POLYGON((0 1,2 4))", "POLYGON((1 2,3 5))", 12.0);
+ test_geometry<bg::model::box<P3ic> >("POLYGON((0 1 2,2 4 6))", "POLYGON((1 2 3,3 5 7))", 60.0);
+ test_geometry<bg::model::box<P3fc> >("POLYGON((0 1 2,2 4 6))", "POLYGON((1 2 3,3 5 7))", 60.0);
+ test_geometry<bg::model::box<P3dc> >("POLYGON((0 1 2,2 4 6))", "POLYGON((1 2 3,3 5 7))", 60.0);
+
+ test_geometry<bg::model::box<P2dc> >("POLYGON((0 1,2 4))", "POLYGON((2 1,3 4))", 9.0);
+ test_geometry<bg::model::box<P2dc> >("POLYGON((0 1,2 4))", "POLYGON((2 4,3 5))", 12.0);
+
+#ifdef HAVE_TTMATH
+ typedef bg::model::point<ttmath_big, 2, bg::cs::cartesian> P2ttmc;
+ typedef bg::model::point<ttmath_big, 3, bg::cs::cartesian> P3ttmc;
+
+ test_geometry<bg::model::box<P2ttmc> >("POLYGON((0 1,2 4))", "POLYGON((1 2,3 5))", 12.0);
+ test_geometry<bg::model::box<P3ttmc> >("POLYGON((0 1 2,2 4 6))", "POLYGON((1 2 3,3 5 7))", 60.0);
+#endif
+
+ test_large_integers();
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/geometry_index_test_common.hpp b/src/boost/libs/geometry/index/test/geometry_index_test_common.hpp
new file mode 100644
index 00000000..4a2ac615
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/geometry_index_test_common.hpp
@@ -0,0 +1,28 @@
+// Boost.Geometry Index
+// Test
+
+// 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 GEOMETRY_TEST_GEOMETRY_INDEX_TEST_COMMON_HPP
+#define GEOMETRY_TEST_GEOMETRY_INDEX_TEST_COMMON_HPP
+
+#if defined(_MSC_VER)
+
+//#pragma warning (disable : 4996) // deprecated functions
+//#pragma warning (disable : 4100) // unreferenced formal parameter
+//#pragma warning (disable : 4127) // conditional expression is constant
+
+#endif // _MSC_VER
+
+#include <boost/geometry.hpp>
+
+#include <geometry_test_common.hpp>
+
+namespace boost { namespace geometry { namespace index {}}}
+namespace bgi = boost::geometry::index;
+
+#endif // GEOMETRY_TEST_GEOMETRY_INDEX_TEST_COMMON_HPP
diff --git a/src/boost/libs/geometry/index/test/movable.hpp b/src/boost/libs/geometry/index/test/movable.hpp
new file mode 100644
index 00000000..c1dd278e
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/movable.hpp
@@ -0,0 +1,92 @@
+// Boost.Geometry.Index varray
+// Unit Test
+
+// Copyright (c) 2009 Ion Gaztanaga
+// Copyright (c) 2012-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_TEST_MOVABLE_HPP
+#define BOOST_GEOMETRY_INDEX_TEST_MOVABLE_HPP
+
+//[movable_definition
+//header file "movable.hpp"
+#include <boost/move/move.hpp>
+
+//A movable class
+class movable
+{
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(movable)
+ int value_;
+
+public:
+ movable() : value_(1){}
+
+ //Move constructor and assignment
+ movable(BOOST_RV_REF(movable) m)
+ { value_ = m.value_; m.value_ = 0; }
+
+ movable & operator=(BOOST_RV_REF(movable) m)
+ { value_ = m.value_; m.value_ = 0; return *this; }
+
+ bool moved() const //Observer
+ { return value_ == 0; }
+};
+
+
+class copy_movable
+{
+ BOOST_COPYABLE_AND_MOVABLE(copy_movable)
+ size_t value_;
+
+public:
+ copy_movable(size_t value = 1) : value_(value){}
+
+ //Move constructor and assignment
+ copy_movable(BOOST_RV_REF(copy_movable) m)
+ { value_ = m.value_; m.value_ = 0; }
+
+ copy_movable(const copy_movable &m)
+ { value_ = m.value_; }
+
+ copy_movable & operator=(BOOST_RV_REF(copy_movable) m)
+ { value_ = m.value_; m.value_ = 0; return *this; }
+
+ copy_movable & operator=(BOOST_COPY_ASSIGN_REF(copy_movable) m)
+ { value_ = m.value_; return *this; }
+
+ bool moved() const //Observer
+ { return value_ == 0; }
+
+ bool operator==(const copy_movable& m) const
+ { return value_ == m.value_; }
+};
+
+struct copy_movable_wrapper
+{
+ copy_movable cm;
+};
+
+copy_movable produce()
+{ return copy_movable(); }
+
+namespace boost{
+
+template<>
+struct has_nothrow_move<movable>
+{
+ static const bool value = true;
+};
+
+template<>
+struct has_nothrow_move<copy_movable>
+{
+ static const bool value = true;
+};
+
+} //namespace boost{
+//]
+
+#endif //BOOST_GEOMETRY_INDEX_TEST_MOVABLE_HPP
diff --git a/src/boost/libs/geometry/index/test/rtree/Jamfile.v2 b/src/boost/libs/geometry/index/test/rtree/Jamfile.v2
new file mode 100644
index 00000000..c930e8a3
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/Jamfile.v2
@@ -0,0 +1,23 @@
+# Boost.Geometry Index
+#
+# Copyright (c) 2011-2016 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)
+
+build-project exceptions ;
+build-project interprocess ;
+build-project generated ;
+
+test-suite boost-geometry-index-rtree
+ :
+ [ run rtree_contains_point.cpp ]
+ [ run rtree_epsilon.cpp ]
+ [ run rtree_insert_remove.cpp ]
+ [ run rtree_intersects_geom.cpp ]
+ [ run rtree_move_pack.cpp ]
+ [ run rtree_non_cartesian.cpp ]
+ [ run rtree_values.cpp ]
+ [ compile-fail rtree_values_invalid.cpp ]
+ ;
diff --git a/src/boost/libs/geometry/index/test/rtree/exceptions/Jamfile.v2 b/src/boost/libs/geometry/index/test/rtree/exceptions/Jamfile.v2
new file mode 100644
index 00000000..84855c4f
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/exceptions/Jamfile.v2
@@ -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)
+
+rule test_all
+{
+ local all_rules = ;
+
+ for local fileb in [ glob *.cpp ]
+ {
+ all_rules += [ run $(fileb)
+ : # additional args
+ : # test-files
+ : # requirements
+ <toolset>msvc:<cxxflags>/bigobj
+ <host-os>windows,<toolset>intel:<cxxflags>/bigobj
+ ] ;
+ }
+
+ return $(all_rules) ;
+}
+
+test-suite boost-geometry-index-rtree-exceptions : [ test_all r ] ;
diff --git a/src/boost/libs/geometry/index/test/rtree/exceptions/rtree_exceptions_lin.cpp b/src/boost/libs/geometry/index/test/rtree/exceptions/rtree_exceptions_lin.cpp
new file mode 100644
index 00000000..74c0ba6d
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/exceptions/rtree_exceptions_lin.cpp
@@ -0,0 +1,20 @@
+// Boost.Geometry Index
+// Unit Test
+
+// 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 <rtree/exceptions/test_exceptions.hpp>
+
+int test_main(int, char* [])
+{
+ test_rtree_value_exceptions< bgi::linear<4, 2> >();
+ test_rtree_value_exceptions(bgi::dynamic_linear(4, 2));
+
+ test_rtree_elements_exceptions< bgi::linear_throwing<4, 2> >();
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/exceptions/rtree_exceptions_qua.cpp b/src/boost/libs/geometry/index/test/rtree/exceptions/rtree_exceptions_qua.cpp
new file mode 100644
index 00000000..5dde64a8
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/exceptions/rtree_exceptions_qua.cpp
@@ -0,0 +1,20 @@
+// Boost.Geometry Index
+// Unit Test
+
+// 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 <rtree/exceptions/test_exceptions.hpp>
+
+int test_main(int, char* [])
+{
+ test_rtree_value_exceptions< bgi::quadratic<4, 2> >();
+ test_rtree_value_exceptions(bgi::dynamic_quadratic(4, 2));
+
+ test_rtree_elements_exceptions< bgi::quadratic_throwing<4, 2> >();
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/exceptions/rtree_exceptions_rst.cpp b/src/boost/libs/geometry/index/test/rtree/exceptions/rtree_exceptions_rst.cpp
new file mode 100644
index 00000000..c09e2d37
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/exceptions/rtree_exceptions_rst.cpp
@@ -0,0 +1,20 @@
+// Boost.Geometry Index
+// Unit Test
+
+// 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 <rtree/exceptions/test_exceptions.hpp>
+
+int test_main(int, char* [])
+{
+ test_rtree_value_exceptions< bgi::rstar<4, 2> >();
+ test_rtree_value_exceptions(bgi::dynamic_rstar(4, 2));
+
+ test_rtree_elements_exceptions< bgi::rstar_throwing<4, 2> >();
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/exceptions/test_exceptions.hpp b/src/boost/libs/geometry/index/test/rtree/exceptions/test_exceptions.hpp
new file mode 100644
index 00000000..25f9fb84
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/exceptions/test_exceptions.hpp
@@ -0,0 +1,193 @@
+// Boost.Geometry Index
+//
+// R-tree nodes based on runtime-polymorphism, storing static-size containers
+// test version throwing exceptions on creation
+//
+// 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_TEST_RTREE_EXCEPTIONS_HPP
+#define BOOST_GEOMETRY_INDEX_TEST_RTREE_EXCEPTIONS_HPP
+
+#include <rtree/test_rtree.hpp>
+
+#include <rtree/exceptions/test_throwing.hpp>
+#include <rtree/exceptions/test_throwing_node.hpp>
+
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/box.hpp>
+
+// test value exceptions
+template <typename Parameters>
+void test_rtree_value_exceptions(Parameters const& parameters = Parameters())
+{
+ typedef std::pair<bg::model::point<float, 2, bg::cs::cartesian>, throwing_value> Value;
+ typedef bgi::rtree<Value, Parameters> Tree;
+ typedef typename Tree::bounds_type B;
+
+ throwing_value::reset_calls_counter();
+ throwing_value::set_max_calls((std::numeric_limits<size_t>::max)());
+ std::vector<Value> input;
+ B qbox;
+ generate::input<2>::apply(input, qbox);
+
+ for ( size_t i = 0 ; i < 50 ; i += 2 )
+ {
+ throwing_value::reset_calls_counter();
+ throwing_value::set_max_calls(10000);
+
+ Tree tree(parameters);
+
+ throwing_value::reset_calls_counter();
+ throwing_value::set_max_calls(i);
+
+ BOOST_CHECK_THROW( tree.insert(input.begin(), input.end()), throwing_value_copy_exception );
+ }
+
+ for ( size_t i = 0 ; i < 20 ; i += 1 )
+ {
+ throwing_value::reset_calls_counter();
+ throwing_value::set_max_calls(i);
+
+ BOOST_CHECK_THROW( Tree tree(input.begin(), input.end(), parameters), throwing_value_copy_exception );
+ }
+
+ for ( size_t i = 0 ; i < 10 ; i += 1 )
+ {
+ throwing_value::reset_calls_counter();
+ throwing_value::set_max_calls(10000);
+
+ Tree tree(parameters);
+
+ tree.insert(input.begin(), input.end());
+
+ throwing_value::reset_calls_counter();
+ throwing_value::set_max_calls(i);
+
+ BOOST_CHECK_THROW( tree.remove(input.begin(), input.end()), throwing_value_copy_exception );
+ }
+
+ for ( size_t i = 0 ; i < 20 ; i += 2 )
+ {
+ throwing_value::reset_calls_counter();
+ throwing_value::set_max_calls(10000);
+
+ Tree tree(parameters);
+
+ tree.insert(input.begin(), input.end());
+
+ throwing_value::reset_calls_counter();
+ throwing_value::set_max_calls(i);
+
+ BOOST_CHECK_THROW( Tree tree2(tree), throwing_value_copy_exception );
+ }
+
+ for ( size_t i = 0 ; i < 20 ; i += 2 )
+ {
+ throwing_value::reset_calls_counter();
+ throwing_value::set_max_calls(10000);
+
+ Tree tree(parameters);
+ Tree tree2(parameters);
+
+ tree.insert(input.begin(), input.end());
+
+ throwing_value::reset_calls_counter();
+ throwing_value::set_max_calls(i);
+
+ BOOST_CHECK_THROW(tree2 = tree, throwing_value_copy_exception );
+ }
+}
+
+// test value exceptions
+template <typename Parameters>
+void test_rtree_elements_exceptions(Parameters const& parameters = Parameters())
+{
+ typedef std::pair<bg::model::point<float, 2, bg::cs::cartesian>, throwing_value> Value;
+ typedef bgi::rtree<Value, Parameters> Tree;
+ typedef typename Tree::bounds_type B;
+
+ throwing_value::reset_calls_counter();
+ throwing_value::set_max_calls((std::numeric_limits<size_t>::max)());
+
+ std::vector<Value> input;
+ B qbox;
+ generate::input<2>::apply(input, qbox, 2);
+
+ for ( size_t i = 0 ; i < 100 ; i += 2 )
+ {
+ throwing_varray_settings::reset_calls_counter();
+ throwing_varray_settings::set_max_calls(10000);
+
+ Tree tree(parameters);
+
+ throwing_varray_settings::reset_calls_counter();
+ throwing_varray_settings::set_max_calls(i);
+
+ BOOST_CHECK_THROW( tree.insert(input.begin(), input.end()), throwing_varray_exception );
+ }
+
+ for ( size_t i = 0 ; i < 100 ; i += 2 )
+ {
+ throwing_varray_settings::reset_calls_counter();
+ throwing_varray_settings::set_max_calls(i);
+
+ throwing_nodes_stats::reset_counters();
+
+ BOOST_CHECK_THROW( Tree tree(input.begin(), input.end(), parameters), throwing_varray_exception );
+
+ BOOST_CHECK_EQUAL(throwing_nodes_stats::internal_nodes_count(), 0u);
+ BOOST_CHECK_EQUAL(throwing_nodes_stats::leafs_count(), 0u);
+ }
+
+ for ( size_t i = 0 ; i < 50 ; i += 2 )
+ {
+ throwing_varray_settings::reset_calls_counter();
+ throwing_varray_settings::set_max_calls(10000);
+
+ Tree tree(parameters);
+
+ tree.insert(input.begin(), input.end());
+
+ throwing_varray_settings::reset_calls_counter();
+ throwing_varray_settings::set_max_calls(i);
+
+ BOOST_CHECK_THROW( tree.remove(input.begin(), input.end()), throwing_varray_exception );
+ }
+
+ for ( size_t i = 0 ; i < 50 ; i += 2 )
+ {
+ throwing_varray_settings::reset_calls_counter();
+ throwing_varray_settings::set_max_calls(10000);
+
+ Tree tree(parameters);
+
+ tree.insert(input.begin(), input.end());
+
+ throwing_varray_settings::reset_calls_counter();
+ throwing_varray_settings::set_max_calls(i);
+
+ BOOST_CHECK_THROW( Tree tree2(tree), throwing_varray_exception );
+ }
+
+ for ( size_t i = 0 ; i < 50 ; i += 2 )
+ {
+ throwing_varray_settings::reset_calls_counter();
+ throwing_varray_settings::set_max_calls(10000);
+
+ Tree tree(parameters);
+ Tree tree2(parameters);
+
+ tree.insert(input.begin(), input.end());
+
+ throwing_varray_settings::reset_calls_counter();
+ throwing_varray_settings::set_max_calls(i);
+
+ BOOST_CHECK_THROW(tree2 = tree, throwing_varray_exception );
+ }
+}
+
+#endif // BOOST_GEOMETRY_INDEX_TEST_RTREE_EXCEPTIONS_HPP
diff --git a/src/boost/libs/geometry/index/test/rtree/exceptions/test_throwing.hpp b/src/boost/libs/geometry/index/test/rtree/exceptions/test_throwing.hpp
new file mode 100644
index 00000000..c88a5f56
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/exceptions/test_throwing.hpp
@@ -0,0 +1,167 @@
+// Boost.Geometry Index
+//
+// Throwing objects implementation
+//
+// Copyright (c) 2011-2014 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_TEST_THROWING_HPP
+#define BOOST_GEOMETRY_INDEX_TEST_THROWING_HPP
+
+// value
+
+struct throwing_value_copy_exception : public std::exception
+{
+ const char * what() const throw() { return "value copy failed."; }
+};
+
+struct throwing_value
+{
+ explicit throwing_value(int v = 0)
+ : value(v)
+ {}
+
+ bool operator==(throwing_value const& v) const
+ {
+ return value == v.value;
+ }
+
+ throwing_value(throwing_value const& v)
+ {
+ throw_if_required();
+
+ value = v.value;
+ }
+
+ throwing_value & operator=(throwing_value const& v)
+ {
+ throw_if_required();
+
+ value = v.value;
+ return *this;
+ }
+
+ void throw_if_required()
+ {
+ // throw if counter meets max count
+ if ( get_max_calls_ref() <= get_calls_counter_ref() )
+ throw throwing_value_copy_exception();
+ else
+ ++get_calls_counter_ref();
+ }
+
+ static void reset_calls_counter() { get_calls_counter_ref() = 0; }
+ static void set_max_calls(size_t mc) { get_max_calls_ref() = mc; }
+
+ static size_t & get_calls_counter_ref() { static size_t cc = 0; return cc; }
+ static size_t & get_max_calls_ref() { static size_t mc = (std::numeric_limits<size_t>::max)(); return mc; }
+
+ int value;
+};
+
+namespace generate {
+template <typename T, typename C>
+struct value< std::pair<bg::model::point<T, 2, C>, throwing_value> >
+{
+ typedef bg::model::point<T, 2, C> P;
+ typedef std::pair<P, throwing_value> R;
+ static R apply(int x, int y)
+ {
+ return std::make_pair(P(x, y), throwing_value(x + y * 100));
+ }
+};
+} // namespace generate
+
+#include <boost/geometry/index/detail/varray.hpp>
+
+struct throwing_varray_exception : public std::exception
+{
+ const char * what() const throw() { return "static vector exception."; }
+};
+
+struct throwing_varray_settings
+{
+ static void throw_if_required()
+ {
+ // throw if counter meets max count
+ if ( get_max_calls_ref() <= get_calls_counter_ref() )
+ throw throwing_varray_exception();
+ else
+ ++get_calls_counter_ref();
+ }
+
+ static void reset_calls_counter() { get_calls_counter_ref() = 0; }
+ static void set_max_calls(size_t mc) { get_max_calls_ref() = mc; }
+
+ static size_t & get_calls_counter_ref() { static size_t cc = 0; return cc; }
+ static size_t & get_max_calls_ref() { static size_t mc = (std::numeric_limits<size_t>::max)(); return mc; }
+};
+
+template <typename Element, size_t Capacity>
+class throwing_varray
+ : public boost::geometry::index::detail::varray<Element, Capacity>
+{
+ typedef boost::geometry::index::detail::varray<Element, Capacity> container;
+
+public:
+ typedef typename container::value_type value_type;
+ typedef typename container::size_type size_type;
+ typedef typename container::iterator iterator;
+ typedef typename container::const_iterator const_iterator;
+ typedef typename container::reverse_iterator reverse_iterator;
+ typedef typename container::const_reverse_iterator const_reverse_iterator;
+ typedef typename container::reference reference;
+ typedef typename container::const_reference const_reference;
+
+ inline throwing_varray() {}
+
+ template <typename It>
+ inline throwing_varray(It first, It last)
+ : container(first, last)
+ {}
+
+ inline throwing_varray(size_type s)
+ {
+ throwing_varray_settings::throw_if_required();
+ container::resize(s);
+ }
+
+ inline void resize(size_type s)
+ {
+ throwing_varray_settings::throw_if_required();
+ container::resize(s);
+ }
+
+ inline void reserve(size_type s)
+ {
+ throwing_varray_settings::throw_if_required();
+ container::reserve(s);
+ }
+
+ void push_back(Element const& v)
+ {
+ throwing_varray_settings::throw_if_required();
+ container::push_back(v);
+ }
+};
+
+// elements derived type trait
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+template <typename OldValue, size_t N, typename NewValue>
+struct container_from_elements_type<throwing_varray<OldValue, N>, NewValue>
+{
+ typedef throwing_varray<NewValue, N> type;
+};
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_TEST_THROWING_HPP
diff --git a/src/boost/libs/geometry/index/test/rtree/exceptions/test_throwing_node.hpp b/src/boost/libs/geometry/index/test/rtree/exceptions/test_throwing_node.hpp
new file mode 100644
index 00000000..4aa0ef75
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/exceptions/test_throwing_node.hpp
@@ -0,0 +1,322 @@
+// Boost.Geometry Index
+//
+// R-tree nodes storing static-size containers
+// test version throwing exceptions on creation
+//
+// Copyright (c) 2011-2014 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_TEST_RTREE_THROWING_NODE_HPP
+#define BOOST_GEOMETRY_INDEX_TEST_RTREE_THROWING_NODE_HPP
+
+#include <rtree/exceptions/test_throwing.hpp>
+
+struct throwing_nodes_stats
+{
+ static void reset_counters() { get_internal_nodes_counter_ref() = 0; get_leafs_counter_ref() = 0; }
+ static size_t internal_nodes_count() { return get_internal_nodes_counter_ref(); }
+ static size_t leafs_count() { return get_leafs_counter_ref(); }
+
+ static size_t & get_internal_nodes_counter_ref() { static size_t cc = 0; return cc; }
+ static size_t & get_leafs_counter_ref() { static size_t cc = 0; return cc; }
+};
+
+namespace boost { namespace geometry { namespace index {
+
+template <size_t MaxElements, size_t MinElements>
+struct linear_throwing : public linear<MaxElements, MinElements> {};
+
+template <size_t MaxElements, size_t MinElements>
+struct quadratic_throwing : public quadratic<MaxElements, MinElements> {};
+
+template <size_t MaxElements, size_t MinElements, size_t OverlapCostThreshold = 0, size_t ReinsertedElements = detail::default_rstar_reinserted_elements_s<MaxElements>::value>
+struct rstar_throwing : public rstar<MaxElements, MinElements, OverlapCostThreshold, ReinsertedElements> {};
+
+namespace detail { namespace rtree {
+
+// options implementation (from options.hpp)
+
+struct node_throwing_static_tag {};
+
+template <size_t MaxElements, size_t MinElements>
+struct options_type< linear_throwing<MaxElements, MinElements> >
+{
+ typedef options<
+ linear_throwing<MaxElements, MinElements>,
+ insert_default_tag, choose_by_content_diff_tag, split_default_tag, linear_tag,
+ node_throwing_static_tag
+ > type;
+};
+
+template <size_t MaxElements, size_t MinElements>
+struct options_type< quadratic_throwing<MaxElements, MinElements> >
+{
+ typedef options<
+ quadratic_throwing<MaxElements, MinElements>,
+ insert_default_tag, choose_by_content_diff_tag, split_default_tag, quadratic_tag,
+ node_throwing_static_tag
+ > type;
+};
+
+template <size_t MaxElements, size_t MinElements, size_t OverlapCostThreshold, size_t ReinsertedElements>
+struct options_type< rstar_throwing<MaxElements, MinElements, OverlapCostThreshold, ReinsertedElements> >
+{
+ typedef options<
+ rstar_throwing<MaxElements, MinElements, OverlapCostThreshold, ReinsertedElements>,
+ insert_reinsert_tag, choose_by_overlap_diff_tag, split_default_tag, rstar_tag,
+ node_throwing_static_tag
+ > type;
+};
+
+}} // namespace detail::rtree
+
+// node implementation
+
+namespace detail { namespace rtree {
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct variant_internal_node<Value, Parameters, Box, Allocators, node_throwing_static_tag>
+{
+ typedef throwing_varray<
+ rtree::ptr_pair<Box, typename Allocators::node_pointer>,
+ Parameters::max_elements + 1
+ > elements_type;
+
+ template <typename Alloc>
+ inline variant_internal_node(Alloc const&) { throwing_nodes_stats::get_internal_nodes_counter_ref()++; }
+ inline ~variant_internal_node() { throwing_nodes_stats::get_internal_nodes_counter_ref()--; }
+
+ // required because variants are initialized using node object
+ // temporary must be taken into account
+ inline variant_internal_node(variant_internal_node const& n)
+ : elements(n.elements)
+ {
+ throwing_nodes_stats::get_internal_nodes_counter_ref()++;
+ }
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ inline variant_internal_node(variant_internal_node && n)
+ : elements(boost::move(n.elements))
+ {
+ throwing_nodes_stats::get_internal_nodes_counter_ref()++;
+ }
+#endif
+
+ elements_type elements;
+
+private:
+ variant_internal_node & operator=(variant_internal_node const& n);
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct variant_leaf<Value, Parameters, Box, Allocators, node_throwing_static_tag>
+{
+ typedef throwing_varray<Value, Parameters::max_elements + 1> elements_type;
+
+ template <typename Alloc>
+ inline variant_leaf(Alloc const&) { throwing_nodes_stats::get_leafs_counter_ref()++; }
+ inline ~variant_leaf() { throwing_nodes_stats::get_leafs_counter_ref()--; }
+
+ // required because variants are initialized using node object
+ // temporary must be taken into account
+ inline variant_leaf(variant_leaf const& n)
+ : elements(n.elements)
+ {
+ throwing_nodes_stats::get_leafs_counter_ref()++;
+ }
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ inline variant_leaf(variant_leaf && n)
+ : elements(boost::move(n.elements))
+ {
+ throwing_nodes_stats::get_leafs_counter_ref()++;
+ }
+#endif
+
+ elements_type elements;
+
+private:
+ variant_leaf & operator=(variant_leaf const& n);
+};
+
+// nodes traits
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct node<Value, Parameters, Box, Allocators, node_throwing_static_tag>
+{
+ typedef boost::variant<
+ variant_leaf<Value, Parameters, Box, Allocators, node_throwing_static_tag>,
+ variant_internal_node<Value, Parameters, Box, Allocators, node_throwing_static_tag>
+ > type;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct internal_node<Value, Parameters, Box, Allocators, node_throwing_static_tag>
+{
+ typedef variant_internal_node<Value, Parameters, Box, Allocators, node_throwing_static_tag> type;
+};
+
+template <typename Value, typename Parameters, typename Box, typename Allocators>
+struct leaf<Value, Parameters, Box, Allocators, node_throwing_static_tag>
+{
+ typedef variant_leaf<Value, Parameters, Box, Allocators, node_throwing_static_tag> type;
+};
+
+// visitor traits
+
+template <typename Value, typename Parameters, typename Box, typename Allocators, bool IsVisitableConst>
+struct visitor<Value, Parameters, Box, Allocators, node_throwing_static_tag, IsVisitableConst>
+{
+ typedef static_visitor<> type;
+};
+
+// allocators
+
+template <typename Allocator, typename Value, typename Parameters, typename Box>
+class allocators<Allocator, Value, Parameters, Box, node_throwing_static_tag>
+ : public Allocator::template rebind<
+ typename node<
+ Value, Parameters, Box,
+ allocators<Allocator, Value, Parameters, Box, node_throwing_static_tag>,
+ node_throwing_static_tag
+ >::type
+ >::other
+{
+ typedef typename Allocator::template rebind<
+ Value
+ >::other value_allocator_type;
+
+public:
+ typedef Allocator allocator_type;
+
+ typedef Value value_type;
+ typedef value_type & reference;
+ typedef const value_type & const_reference;
+ typedef typename value_allocator_type::size_type size_type;
+ typedef typename value_allocator_type::difference_type difference_type;
+ typedef typename value_allocator_type::pointer pointer;
+ typedef typename value_allocator_type::const_pointer const_pointer;
+
+ typedef typename Allocator::template rebind<
+ typename node<Value, Parameters, Box, allocators, node_throwing_static_tag>::type
+ >::other::pointer node_pointer;
+
+// typedef typename Allocator::template rebind<
+// typename internal_node<Value, Parameters, Box, allocators, node_throwing_static_tag>::type
+// >::other::pointer internal_node_pointer;
+
+ typedef typename Allocator::template rebind<
+ typename node<Value, Parameters, Box, allocators, node_throwing_static_tag>::type
+ >::other node_allocator_type;
+
+ inline allocators()
+ : node_allocator_type()
+ {}
+
+ template <typename Alloc>
+ inline explicit allocators(Alloc const& alloc)
+ : node_allocator_type(alloc)
+ {}
+
+ inline allocators(BOOST_FWD_REF(allocators) a)
+ : node_allocator_type(boost::move(a.node_allocator()))
+ {}
+
+ inline allocators & operator=(BOOST_FWD_REF(allocators) a)
+ {
+ node_allocator() = boost::move(a.node_allocator());
+ return *this;
+ }
+
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ inline allocators & operator=(allocators const& a)
+ {
+ node_allocator() = a.node_allocator();
+ return *this;
+ }
+#endif
+
+ void swap(allocators & a)
+ {
+ boost::swap(node_allocator(), a.node_allocator());
+ }
+
+ bool operator==(allocators const& a) const { return node_allocator() == a.node_allocator(); }
+ template <typename Alloc>
+ bool operator==(Alloc const& a) const { return node_allocator() == node_allocator_type(a); }
+
+ Allocator allocator() const { return Allocator(node_allocator()); }
+
+ node_allocator_type & node_allocator() { return *this; }
+ node_allocator_type const& node_allocator() const { return *this; }
+};
+
+struct node_bad_alloc : public std::exception
+{
+ const char * what() const throw() { return "internal node creation failed."; }
+};
+
+struct throwing_node_settings
+{
+ static void throw_if_required()
+ {
+ // throw if counter meets max count
+ if ( get_max_calls_ref() <= get_calls_counter_ref() )
+ throw node_bad_alloc();
+ else
+ ++get_calls_counter_ref();
+ }
+
+ static void reset_calls_counter() { get_calls_counter_ref() = 0; }
+ static void set_max_calls(size_t mc) { get_max_calls_ref() = mc; }
+
+ static size_t & get_calls_counter_ref() { static size_t cc = 0; return cc; }
+ static size_t & get_max_calls_ref() { static size_t mc = (std::numeric_limits<size_t>::max)(); return mc; }
+};
+
+// create_node
+
+template <typename Allocators, typename Value, typename Parameters, typename Box>
+struct create_node<
+ Allocators,
+ variant_internal_node<Value, Parameters, Box, Allocators, node_throwing_static_tag>
+>
+{
+ static inline typename Allocators::node_pointer
+ apply(Allocators & allocators)
+ {
+ // throw if counter meets max count
+ throwing_node_settings::throw_if_required();
+
+ return create_variant_node<
+ typename Allocators::node_pointer,
+ variant_internal_node<Value, Parameters, Box, Allocators, node_throwing_static_tag>
+ >::apply(allocators.node_allocator());
+ }
+};
+
+template <typename Allocators, typename Value, typename Parameters, typename Box>
+struct create_node<
+ Allocators,
+ variant_leaf<Value, Parameters, Box, Allocators, node_throwing_static_tag>
+>
+{
+ static inline typename Allocators::node_pointer
+ apply(Allocators & allocators)
+ {
+ // throw if counter meets max count
+ throwing_node_settings::throw_if_required();
+
+ return create_variant_node<
+ typename Allocators::node_pointer,
+ variant_leaf<Value, Parameters, Box, Allocators, node_throwing_static_tag>
+ >::apply(allocators.node_allocator());
+ }
+};
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_INDEX_TEST_RTREE_THROWING_NODE_HPP
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/Jamfile.v2 b/src/boost/libs/geometry/index/test/rtree/generated/Jamfile.v2
new file mode 100644
index 00000000..02e2122b
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/Jamfile.v2
@@ -0,0 +1,13 @@
+# Boost.Geometry Index
+#
+# Copyright (c) 2011-2018 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)
+
+build-project b2d ;
+build-project b3d ;
+build-project p2d ;
+build-project p3d ;
+build-project s2d ;
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b2d/Jamfile.v2 b/src/boost/libs/geometry/index/test/rtree/generated/b2d/Jamfile.v2
new file mode 100644
index 00000000..6db91618
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b2d/Jamfile.v2
@@ -0,0 +1,28 @@
+# Boost.Geometry Index
+#
+# Copyright (c) 2011-2018 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)
+
+rule test_all
+{
+ local all_rules = ;
+
+ for local fileb in [ glob *.cpp ]
+ {
+ all_rules += [ run $(fileb)
+ : # additional args
+ : # test-files
+ : # requirements
+ <toolset>msvc:<cxxflags>/bigobj
+ <host-os>windows,<toolset>intel:<cxxflags>/bigobj
+ ] ;
+ }
+
+ return $(all_rules) ;
+}
+
+test-suite boost-geometry-index-rtree-generated-b2d : [ test_all r ] ;
+
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_dlin_add_b2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_dlin_add_b2d.cpp
new file mode 100644
index 00000000..adab4cb9
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_dlin_add_b2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::additional<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_dlin_mod_b2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_dlin_mod_b2d.cpp
new file mode 100644
index 00000000..0b355cb8
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_dlin_mod_b2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::modifiers<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_dlin_que_b2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_dlin_que_b2d.cpp
new file mode 100644
index 00000000..8a2ee0e7
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_dlin_que_b2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::queries<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_dqua_add_b2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_dqua_add_b2d.cpp
new file mode 100644
index 00000000..80c16cd1
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_dqua_add_b2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::additional<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_dqua_mod_b2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_dqua_mod_b2d.cpp
new file mode 100644
index 00000000..7de20a5f
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_dqua_mod_b2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::modifiers<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_dqua_que_b2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_dqua_que_b2d.cpp
new file mode 100644
index 00000000..790e29c4
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_dqua_que_b2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::queries<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_drst_add_b2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_drst_add_b2d.cpp
new file mode 100644
index 00000000..358de99d
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_drst_add_b2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::additional<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_drst_mod_b2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_drst_mod_b2d.cpp
new file mode 100644
index 00000000..df3cfdac
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_drst_mod_b2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::modifiers<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_drst_que_b2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_drst_que_b2d.cpp
new file mode 100644
index 00000000..5f1ea2e2
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_drst_que_b2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::queries<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_lin_add_b2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_lin_add_b2d.cpp
new file mode 100644
index 00000000..3474fc43
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_lin_add_b2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::additional<Indexable>(bgi::linear<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_lin_mod_b2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_lin_mod_b2d.cpp
new file mode 100644
index 00000000..dc8f48c3
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_lin_mod_b2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::modifiers<Indexable>(bgi::linear<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_lin_que_b2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_lin_que_b2d.cpp
new file mode 100644
index 00000000..19f08a6a
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_lin_que_b2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::queries<Indexable>(bgi::linear<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_qua_add_b2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_qua_add_b2d.cpp
new file mode 100644
index 00000000..4601697c
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_qua_add_b2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::additional<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_qua_mod_b2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_qua_mod_b2d.cpp
new file mode 100644
index 00000000..201c0979
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_qua_mod_b2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::modifiers<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_qua_que_b2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_qua_que_b2d.cpp
new file mode 100644
index 00000000..875cbf4f
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_qua_que_b2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::queries<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_rst_add_b2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_rst_add_b2d.cpp
new file mode 100644
index 00000000..cdce8583
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_rst_add_b2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::additional<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_rst_mod_b2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_rst_mod_b2d.cpp
new file mode 100644
index 00000000..5d0760d3
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_rst_mod_b2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::modifiers<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_rst_que_b2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_rst_que_b2d.cpp
new file mode 100644
index 00000000..b7d694b0
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b2d/rtree_rst_que_b2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::queries<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b3d/Jamfile.v2 b/src/boost/libs/geometry/index/test/rtree/generated/b3d/Jamfile.v2
new file mode 100644
index 00000000..00cbbe25
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b3d/Jamfile.v2
@@ -0,0 +1,28 @@
+# Boost.Geometry Index
+#
+# Copyright (c) 2011-2018 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)
+
+rule test_all
+{
+ local all_rules = ;
+
+ for local fileb in [ glob *.cpp ]
+ {
+ all_rules += [ run $(fileb)
+ : # additional args
+ : # test-files
+ : # requirements
+ <toolset>msvc:<cxxflags>/bigobj
+ <host-os>windows,<toolset>intel:<cxxflags>/bigobj
+ ] ;
+ }
+
+ return $(all_rules) ;
+}
+
+test-suite boost-geometry-index-rtree-generated-b3d : [ test_all r ] ;
+
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_dlin_add_b3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_dlin_add_b3d.cpp
new file mode 100644
index 00000000..b387eb1f
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_dlin_add_b3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable;
+ testset::additional<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_dlin_mod_b3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_dlin_mod_b3d.cpp
new file mode 100644
index 00000000..86a1df0d
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_dlin_mod_b3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable;
+ testset::modifiers<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_dlin_que_b3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_dlin_que_b3d.cpp
new file mode 100644
index 00000000..c054f630
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_dlin_que_b3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable;
+ testset::queries<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_dqua_add_b3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_dqua_add_b3d.cpp
new file mode 100644
index 00000000..47760e22
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_dqua_add_b3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable;
+ testset::additional<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_dqua_mod_b3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_dqua_mod_b3d.cpp
new file mode 100644
index 00000000..4c2e7c71
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_dqua_mod_b3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable;
+ testset::modifiers<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_dqua_que_b3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_dqua_que_b3d.cpp
new file mode 100644
index 00000000..3c27c09e
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_dqua_que_b3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable;
+ testset::queries<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_drst_add_b3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_drst_add_b3d.cpp
new file mode 100644
index 00000000..1816462b
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_drst_add_b3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable;
+ testset::additional<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_drst_mod_b3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_drst_mod_b3d.cpp
new file mode 100644
index 00000000..9f8ea3be
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_drst_mod_b3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable;
+ testset::modifiers<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_drst_que_b3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_drst_que_b3d.cpp
new file mode 100644
index 00000000..61e51a2f
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_drst_que_b3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable;
+ testset::queries<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_lin_add_b3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_lin_add_b3d.cpp
new file mode 100644
index 00000000..d390a866
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_lin_add_b3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable;
+ testset::additional<Indexable>(bgi::linear<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_lin_mod_b3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_lin_mod_b3d.cpp
new file mode 100644
index 00000000..c00b20ab
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_lin_mod_b3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable;
+ testset::modifiers<Indexable>(bgi::linear<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_lin_que_b3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_lin_que_b3d.cpp
new file mode 100644
index 00000000..19f2ee5c
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_lin_que_b3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable;
+ testset::queries<Indexable>(bgi::linear<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_qua_add_b3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_qua_add_b3d.cpp
new file mode 100644
index 00000000..fbcd9810
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_qua_add_b3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable;
+ testset::additional<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_qua_mod_b3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_qua_mod_b3d.cpp
new file mode 100644
index 00000000..0f96c816
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_qua_mod_b3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable;
+ testset::modifiers<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_qua_que_b3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_qua_que_b3d.cpp
new file mode 100644
index 00000000..f29b0883
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_qua_que_b3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable;
+ testset::queries<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_rst_add_b3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_rst_add_b3d.cpp
new file mode 100644
index 00000000..b8d85a03
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_rst_add_b3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable;
+ testset::additional<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_rst_mod_b3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_rst_mod_b3d.cpp
new file mode 100644
index 00000000..8ed1ca8c
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_rst_mod_b3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable;
+ testset::modifiers<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_rst_que_b3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_rst_que_b3d.cpp
new file mode 100644
index 00000000..75f89886
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/b3d/rtree_rst_que_b3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::box< bg::model::point<double, 3, bg::cs::cartesian> > Indexable;
+ testset::queries<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p2d/Jamfile.v2 b/src/boost/libs/geometry/index/test/rtree/generated/p2d/Jamfile.v2
new file mode 100644
index 00000000..d150007d
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p2d/Jamfile.v2
@@ -0,0 +1,28 @@
+# Boost.Geometry Index
+#
+# Copyright (c) 2011-2018 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)
+
+rule test_all
+{
+ local all_rules = ;
+
+ for local fileb in [ glob *.cpp ]
+ {
+ all_rules += [ run $(fileb)
+ : # additional args
+ : # test-files
+ : # requirements
+ <toolset>msvc:<cxxflags>/bigobj
+ <host-os>windows,<toolset>intel:<cxxflags>/bigobj
+ ] ;
+ }
+
+ return $(all_rules) ;
+}
+
+test-suite boost-geometry-index-rtree-generated-p2d : [ test_all r ] ;
+
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_dlin_add_p2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_dlin_add_p2d.cpp
new file mode 100644
index 00000000..09e1c20e
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_dlin_add_p2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable;
+ testset::additional<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_dlin_mod_p2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_dlin_mod_p2d.cpp
new file mode 100644
index 00000000..072b8e24
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_dlin_mod_p2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable;
+ testset::modifiers<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_dlin_que_p2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_dlin_que_p2d.cpp
new file mode 100644
index 00000000..22bdb83f
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_dlin_que_p2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable;
+ testset::queries<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_dqua_add_p2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_dqua_add_p2d.cpp
new file mode 100644
index 00000000..46cc6db2
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_dqua_add_p2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable;
+ testset::additional<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_dqua_mod_p2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_dqua_mod_p2d.cpp
new file mode 100644
index 00000000..3cce646e
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_dqua_mod_p2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable;
+ testset::modifiers<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_dqua_que_p2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_dqua_que_p2d.cpp
new file mode 100644
index 00000000..8ba91c01
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_dqua_que_p2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable;
+ testset::queries<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_drst_add_p2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_drst_add_p2d.cpp
new file mode 100644
index 00000000..2b2146e0
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_drst_add_p2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable;
+ testset::additional<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_drst_mod_p2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_drst_mod_p2d.cpp
new file mode 100644
index 00000000..0cdd1706
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_drst_mod_p2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable;
+ testset::modifiers<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_drst_que_p2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_drst_que_p2d.cpp
new file mode 100644
index 00000000..f9bd1951
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_drst_que_p2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable;
+ testset::queries<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_lin_add_p2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_lin_add_p2d.cpp
new file mode 100644
index 00000000..af06e30e
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_lin_add_p2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable;
+ testset::additional<Indexable>(bgi::linear<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_lin_mod_p2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_lin_mod_p2d.cpp
new file mode 100644
index 00000000..7879a5bf
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_lin_mod_p2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable;
+ testset::modifiers<Indexable>(bgi::linear<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_lin_que_p2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_lin_que_p2d.cpp
new file mode 100644
index 00000000..b05ee3f6
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_lin_que_p2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable;
+ testset::queries<Indexable>(bgi::linear<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_qua_add_p2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_qua_add_p2d.cpp
new file mode 100644
index 00000000..c7644da8
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_qua_add_p2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable;
+ testset::additional<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_qua_mod_p2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_qua_mod_p2d.cpp
new file mode 100644
index 00000000..5c0710ba
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_qua_mod_p2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable;
+ testset::modifiers<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_qua_que_p2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_qua_que_p2d.cpp
new file mode 100644
index 00000000..91fd0cfe
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_qua_que_p2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable;
+ testset::queries<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_rst_add_p2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_rst_add_p2d.cpp
new file mode 100644
index 00000000..154c5ecd
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_rst_add_p2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable;
+ testset::additional<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_rst_mod_p2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_rst_mod_p2d.cpp
new file mode 100644
index 00000000..7040f93f
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_rst_mod_p2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable;
+ testset::modifiers<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_rst_que_p2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_rst_que_p2d.cpp
new file mode 100644
index 00000000..9345409b
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p2d/rtree_rst_que_p2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 2, bg::cs::cartesian> Indexable;
+ testset::queries<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p3d/Jamfile.v2 b/src/boost/libs/geometry/index/test/rtree/generated/p3d/Jamfile.v2
new file mode 100644
index 00000000..748563a5
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p3d/Jamfile.v2
@@ -0,0 +1,28 @@
+# Boost.Geometry Index
+#
+# Copyright (c) 2011-2018 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)
+
+rule test_all
+{
+ local all_rules = ;
+
+ for local fileb in [ glob *.cpp ]
+ {
+ all_rules += [ run $(fileb)
+ : # additional args
+ : # test-files
+ : # requirements
+ <toolset>msvc:<cxxflags>/bigobj
+ <host-os>windows,<toolset>intel:<cxxflags>/bigobj
+ ] ;
+ }
+
+ return $(all_rules) ;
+}
+
+test-suite boost-geometry-index-rtree-generated-p3d : [ test_all r ] ;
+
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_dlin_add_p3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_dlin_add_p3d.cpp
new file mode 100644
index 00000000..9959dc3f
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_dlin_add_p3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable;
+ testset::additional<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_dlin_mod_p3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_dlin_mod_p3d.cpp
new file mode 100644
index 00000000..b8e1d623
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_dlin_mod_p3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable;
+ testset::modifiers<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_dlin_que_p3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_dlin_que_p3d.cpp
new file mode 100644
index 00000000..68f90177
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_dlin_que_p3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable;
+ testset::queries<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_dqua_add_p3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_dqua_add_p3d.cpp
new file mode 100644
index 00000000..28ec6586
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_dqua_add_p3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable;
+ testset::additional<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_dqua_mod_p3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_dqua_mod_p3d.cpp
new file mode 100644
index 00000000..c0d782d3
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_dqua_mod_p3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable;
+ testset::modifiers<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_dqua_que_p3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_dqua_que_p3d.cpp
new file mode 100644
index 00000000..2fad909f
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_dqua_que_p3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable;
+ testset::queries<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_drst_add_p3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_drst_add_p3d.cpp
new file mode 100644
index 00000000..ecbc1c33
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_drst_add_p3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable;
+ testset::additional<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_drst_mod_p3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_drst_mod_p3d.cpp
new file mode 100644
index 00000000..e1530511
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_drst_mod_p3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable;
+ testset::modifiers<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_drst_que_p3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_drst_que_p3d.cpp
new file mode 100644
index 00000000..b7cfc7f7
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_drst_que_p3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable;
+ testset::queries<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_lin_add_p3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_lin_add_p3d.cpp
new file mode 100644
index 00000000..24fc32fe
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_lin_add_p3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable;
+ testset::additional<Indexable>(bgi::linear<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_lin_mod_p3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_lin_mod_p3d.cpp
new file mode 100644
index 00000000..440dbbd0
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_lin_mod_p3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable;
+ testset::modifiers<Indexable>(bgi::linear<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_lin_que_p3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_lin_que_p3d.cpp
new file mode 100644
index 00000000..726287fd
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_lin_que_p3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable;
+ testset::queries<Indexable>(bgi::linear<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_qua_add_p3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_qua_add_p3d.cpp
new file mode 100644
index 00000000..17d37809
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_qua_add_p3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable;
+ testset::additional<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_qua_mod_p3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_qua_mod_p3d.cpp
new file mode 100644
index 00000000..d3db906e
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_qua_mod_p3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable;
+ testset::modifiers<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_qua_que_p3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_qua_que_p3d.cpp
new file mode 100644
index 00000000..15646b04
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_qua_que_p3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable;
+ testset::queries<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_rst_add_p3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_rst_add_p3d.cpp
new file mode 100644
index 00000000..f072f354
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_rst_add_p3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable;
+ testset::additional<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_rst_mod_p3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_rst_mod_p3d.cpp
new file mode 100644
index 00000000..95014311
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_rst_mod_p3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable;
+ testset::modifiers<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_rst_que_p3d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_rst_que_p3d.cpp
new file mode 100644
index 00000000..51a3f449
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/p3d/rtree_rst_que_p3d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 3, bg::cs::cartesian> Indexable;
+ testset::queries<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/s2d/Jamfile.v2 b/src/boost/libs/geometry/index/test/rtree/generated/s2d/Jamfile.v2
new file mode 100644
index 00000000..889b6ec8
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/s2d/Jamfile.v2
@@ -0,0 +1,28 @@
+# Boost.Geometry Index
+#
+# Copyright (c) 2011-2018 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)
+
+rule test_all
+{
+ local all_rules = ;
+
+ for local fileb in [ glob *.cpp ]
+ {
+ all_rules += [ run $(fileb)
+ : # additional args
+ : # test-files
+ : # requirements
+ <toolset>msvc:<cxxflags>/bigobj
+ <host-os>windows,<toolset>intel:<cxxflags>/bigobj
+ ] ;
+ }
+
+ return $(all_rules) ;
+}
+
+test-suite boost-geometry-index-rtree-generated-s2d : [ test_all r ] ;
+
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_dlin_add_s2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_dlin_add_s2d.cpp
new file mode 100644
index 00000000..c89e3ddb
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_dlin_add_s2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::segment< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::additional<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_dlin_mod_s2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_dlin_mod_s2d.cpp
new file mode 100644
index 00000000..595312c4
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_dlin_mod_s2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::segment< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::modifiers<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_dlin_que_s2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_dlin_que_s2d.cpp
new file mode 100644
index 00000000..41f93c57
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_dlin_que_s2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::segment< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::queries<Indexable>(bgi::dynamic_linear(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_dqua_add_s2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_dqua_add_s2d.cpp
new file mode 100644
index 00000000..e6009b83
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_dqua_add_s2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::segment< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::additional<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_dqua_mod_s2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_dqua_mod_s2d.cpp
new file mode 100644
index 00000000..be0cb0ad
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_dqua_mod_s2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::segment< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::modifiers<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_dqua_que_s2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_dqua_que_s2d.cpp
new file mode 100644
index 00000000..8d353e62
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_dqua_que_s2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::segment< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::queries<Indexable>(bgi::dynamic_quadratic(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_drst_add_s2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_drst_add_s2d.cpp
new file mode 100644
index 00000000..fabc1e2e
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_drst_add_s2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::segment< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::additional<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_drst_mod_s2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_drst_mod_s2d.cpp
new file mode 100644
index 00000000..ca393441
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_drst_mod_s2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::segment< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::modifiers<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_drst_que_s2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_drst_que_s2d.cpp
new file mode 100644
index 00000000..8b402560
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_drst_que_s2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::segment< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::queries<Indexable>(bgi::dynamic_rstar(5, 2), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_lin_add_s2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_lin_add_s2d.cpp
new file mode 100644
index 00000000..10419db6
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_lin_add_s2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::segment< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::additional<Indexable>(bgi::linear<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_lin_mod_s2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_lin_mod_s2d.cpp
new file mode 100644
index 00000000..92c81faf
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_lin_mod_s2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::segment< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::modifiers<Indexable>(bgi::linear<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_lin_que_s2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_lin_que_s2d.cpp
new file mode 100644
index 00000000..8cfba6bf
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_lin_que_s2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::segment< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::queries<Indexable>(bgi::linear<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_qua_add_s2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_qua_add_s2d.cpp
new file mode 100644
index 00000000..456e1039
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_qua_add_s2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::segment< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::additional<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_qua_mod_s2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_qua_mod_s2d.cpp
new file mode 100644
index 00000000..efd0e0d0
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_qua_mod_s2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::segment< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::modifiers<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_qua_que_s2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_qua_que_s2d.cpp
new file mode 100644
index 00000000..84ba5c6b
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_qua_que_s2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::segment< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::queries<Indexable>(bgi::quadratic<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_rst_add_s2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_rst_add_s2d.cpp
new file mode 100644
index 00000000..ec2df11c
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_rst_add_s2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::segment< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::additional<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_rst_mod_s2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_rst_mod_s2d.cpp
new file mode 100644
index 00000000..10daa866
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_rst_mod_s2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::segment< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::modifiers<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_rst_que_s2d.cpp b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_rst_que_s2d.cpp
new file mode 100644
index 00000000..33fb4f52
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/generated/s2d/rtree_rst_que_s2d.cpp
@@ -0,0 +1,17 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2014 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 <rtree/test_rtree.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::segment< bg::model::point<double, 2, bg::cs::cartesian> > Indexable;
+ testset::queries<Indexable>(bgi::rstar<5, 2>(), std::allocator<int>());
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/interprocess/Jamfile.v2 b/src/boost/libs/geometry/index/test/rtree/interprocess/Jamfile.v2
new file mode 100644
index 00000000..0933eae0
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/interprocess/Jamfile.v2
@@ -0,0 +1,34 @@
+# 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)
+
+rule test_all
+{
+ local all_rules = ;
+
+ for local fileb in [ glob *.cpp ]
+ {
+ all_rules += [ run $(fileb) /boost/thread//boost_thread
+ : # additional args
+ : # test-files
+ : # requirements
+ <toolset>acc:<linkflags>-lrt
+ <toolset>acc-pa_risc:<linkflags>-lrt
+ <target-os>hpux,<toolset>gcc:<linkflags>"-Wl,+as,mpas"
+# <toolset>gcc-mingw:<linkflags>"-lole32 -loleaut32 -lpsapi -ladvapi32"
+ <toolset>gcc,<target-os>windows:<linkflags>"-lole32 -loleaut32 -lpsapi -ladvapi32"
+ <target-os>windows,<toolset>clang:<linkflags>"-lole32 -loleaut32 -lpsapi -ladvapi32"
+ <toolset>msvc:<cxxflags>/bigobj
+ <target-os>windows,<toolset>intel:<cxxflags>/bigobj
+ <target-os>linux:<linkflags>"-lrt"
+ ] ;
+ }
+
+ return $(all_rules) ;
+}
+
+test-suite boost-geometry-index-rtree-interprocess : [ test_all r ] : <threading>multi ;
diff --git a/src/boost/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_linear.cpp b/src/boost/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_linear.cpp
new file mode 100644
index 00000000..80221ac3
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_linear.cpp
@@ -0,0 +1,19 @@
+// Boost.Geometry Index
+// Unit Test
+
+// 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 <rtree/interprocess/test_interprocess.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<float, 2, bg::cs::cartesian> P2f;
+
+ testset::interprocess::modifiers_and_additional<P2f>(bgi::linear<32, 8>());
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_linear_dyn.cpp b/src/boost/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_linear_dyn.cpp
new file mode 100644
index 00000000..17717ce3
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_linear_dyn.cpp
@@ -0,0 +1,19 @@
+// Boost.Geometry Index
+// Unit Test
+
+// 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 <rtree/interprocess/test_interprocess.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<float, 2, bg::cs::cartesian> P2f;
+
+ testset::interprocess::modifiers_and_additional<P2f>(bgi::dynamic_linear(32, 8));
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_quadratic.cpp b/src/boost/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_quadratic.cpp
new file mode 100644
index 00000000..b4630a17
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_quadratic.cpp
@@ -0,0 +1,19 @@
+// Boost.Geometry Index
+// Unit Test
+
+// 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 <rtree/interprocess/test_interprocess.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<float, 2, bg::cs::cartesian> P2f;
+
+ testset::interprocess::modifiers_and_additional<P2f>(bgi::quadratic<32, 8>());
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_quadratic_dyn.cpp b/src/boost/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_quadratic_dyn.cpp
new file mode 100644
index 00000000..cf935b37
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_quadratic_dyn.cpp
@@ -0,0 +1,19 @@
+// Boost.Geometry Index
+// Unit Test
+
+// 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 <rtree/interprocess/test_interprocess.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<float, 2, bg::cs::cartesian> P2f;
+
+ testset::interprocess::modifiers_and_additional<P2f>(bgi::dynamic_quadratic(32, 8));
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_rstar.cpp b/src/boost/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_rstar.cpp
new file mode 100644
index 00000000..415a473d
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_rstar.cpp
@@ -0,0 +1,19 @@
+// Boost.Geometry Index
+// Unit Test
+
+// 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 <rtree/interprocess/test_interprocess.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<float, 2, bg::cs::cartesian> P2f;
+
+ testset::interprocess::modifiers_and_additional<P2f>(bgi::rstar<32, 8>());
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_rstar_dyn.cpp b/src/boost/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_rstar_dyn.cpp
new file mode 100644
index 00000000..06edc43a
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/interprocess/rtree_interprocess_rstar_dyn.cpp
@@ -0,0 +1,19 @@
+// Boost.Geometry Index
+// Unit Test
+
+// 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 <rtree/interprocess/test_interprocess.hpp>
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<float, 2, bg::cs::cartesian> P2f;
+
+ testset::interprocess::modifiers_and_additional<P2f>(bgi::dynamic_rstar(32, 8));
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/interprocess/test_interprocess.hpp b/src/boost/libs/geometry/index/test/rtree/interprocess/test_interprocess.hpp
new file mode 100644
index 00000000..7f061b00
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/interprocess/test_interprocess.hpp
@@ -0,0 +1,101 @@
+// Boost.Geometry Index
+// Unit Test
+
+// 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 <rtree/test_rtree.hpp>
+
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/box.hpp>
+
+#include <boost/interprocess/managed_shared_memory.hpp>
+#include <boost/interprocess/allocators/allocator.hpp>
+
+template <typename Point, typename Parameters>
+void test_rtree_interprocess(Parameters const& parameters = Parameters())
+{
+ namespace bi = boost::interprocess;
+ struct shm_remove
+ {
+ shm_remove() { bi::shared_memory_object::remove("shmem"); }
+ ~shm_remove(){ bi::shared_memory_object::remove("shmem"); }
+ } remover;
+
+ bi::managed_shared_memory segment(bi::create_only, "shmem", 65535);
+ typedef bi::allocator<Point, bi::managed_shared_memory::segment_manager> shmem_alloc;
+
+ test_rtree_for_box<Point>(parameters, shmem_alloc(segment.get_segment_manager()));
+}
+
+namespace testset { namespace interprocess {
+
+template <typename Indexable, typename Parameters>
+void modifiers(Parameters const& parameters = Parameters())
+{
+ namespace bi = boost::interprocess;
+ struct shm_remove
+ {
+ shm_remove() { bi::shared_memory_object::remove("shmem"); }
+ ~shm_remove(){ bi::shared_memory_object::remove("shmem"); }
+ } remover;
+
+ bi::managed_shared_memory segment(bi::create_only, "shmem", 65535);
+ typedef bi::allocator<Indexable, bi::managed_shared_memory::segment_manager> shmem_alloc;
+
+ testset::modifiers<Indexable>(parameters, shmem_alloc(segment.get_segment_manager()));
+}
+
+template <typename Indexable, typename Parameters>
+void queries(Parameters const& parameters = Parameters())
+{
+ namespace bi = boost::interprocess;
+ struct shm_remove
+ {
+ shm_remove() { bi::shared_memory_object::remove("shmem"); }
+ ~shm_remove(){ bi::shared_memory_object::remove("shmem"); }
+ } remover;
+
+ bi::managed_shared_memory segment(bi::create_only, "shmem", 65535);
+ typedef bi::allocator<Indexable, bi::managed_shared_memory::segment_manager> shmem_alloc;
+
+ testset::queries<Indexable>(parameters, shmem_alloc(segment.get_segment_manager()));
+}
+
+template <typename Indexable, typename Parameters>
+void additional(Parameters const& parameters = Parameters())
+{
+ namespace bi = boost::interprocess;
+ struct shm_remove
+ {
+ shm_remove() { bi::shared_memory_object::remove("shmem"); }
+ ~shm_remove(){ bi::shared_memory_object::remove("shmem"); }
+ } remover;
+
+ bi::managed_shared_memory segment(bi::create_only, "shmem", 65535);
+ typedef bi::allocator<Indexable, bi::managed_shared_memory::segment_manager> shmem_alloc;
+
+ testset::additional<Indexable>(parameters, shmem_alloc(segment.get_segment_manager()));
+}
+
+template <typename Indexable, typename Parameters>
+void modifiers_and_additional(Parameters const& parameters = Parameters())
+{
+ namespace bi = boost::interprocess;
+ struct shm_remove
+ {
+ shm_remove() { bi::shared_memory_object::remove("shmem"); }
+ ~shm_remove(){ bi::shared_memory_object::remove("shmem"); }
+ } remover;
+
+ bi::managed_shared_memory segment(bi::create_only, "shmem", 65535);
+ typedef bi::allocator<Indexable, bi::managed_shared_memory::segment_manager> shmem_alloc;
+
+ testset::modifiers<Indexable>(parameters, shmem_alloc(segment.get_segment_manager()));
+ testset::additional<Indexable>(parameters, shmem_alloc(segment.get_segment_manager()));
+}
+
+}}
diff --git a/src/boost/libs/geometry/index/test/rtree/rtree_contains_point.cpp b/src/boost/libs/geometry/index/test/rtree/rtree_contains_point.cpp
new file mode 100644
index 00000000..3ab81fad
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/rtree_contains_point.cpp
@@ -0,0 +1,45 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2016 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 <rtree/test_rtree.hpp>
+
+#include <boost/geometry/index/rtree.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+
+template <typename Params>
+void test_one()
+{
+ typedef bg::model::point<double, 2, bg::cs::cartesian> Pt;
+ typedef bgi::rtree<Pt, Params> Rtree;
+ Rtree rtree;
+
+ rtree.insert(Pt(0, 0));
+ rtree.insert(Pt(1, 1));
+ rtree.insert(Pt(2, 2));
+ rtree.insert(Pt(3, 3));
+ rtree.insert(Pt(4, 4));
+ rtree.insert(Pt(4, 3));
+ rtree.insert(Pt(0, 3));
+
+ for (typename Rtree::const_iterator it = rtree.begin() ; it != rtree.end() ; ++it)
+ {
+ std::vector<Pt> result;
+ rtree.query(bgi::contains(*it), std::back_inserter(result));
+ BOOST_CHECK(result.size() == 1);
+ }
+}
+
+int test_main(int, char* [])
+{
+ test_one< bgi::linear<4> >();
+ test_one< bgi::quadratic<4> >();
+ test_one< bgi::rstar<4> >();
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/rtree_epsilon.cpp b/src/boost/libs/geometry/index/test/rtree/rtree_epsilon.cpp
new file mode 100644
index 00000000..728e22d9
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/rtree_epsilon.cpp
@@ -0,0 +1,95 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2015 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)
+
+// Enable enlargement of Values' bounds by epsilon in the rtree
+// for Points and Segments
+#define BOOST_GEOMETRY_INDEX_EXPERIMENTAL_ENLARGE_BY_EPSILON
+
+#include <vector>
+
+#include <rtree/test_rtree.hpp>
+
+#include <boost/geometry/geometries/register/point.hpp>
+#include <boost/geometry/geometries/polygon.hpp>
+
+template <typename Params>
+void test_rtree(unsigned vcount)
+{
+ typedef bg::model::point<double, 2, bg::cs::cartesian> point_t;
+
+ std::vector<point_t> values;
+
+ double eps = std::numeric_limits<double>::epsilon();
+ values.push_back(point_t(eps/2, eps/2));
+
+ for ( unsigned i = 1 ; i < vcount ; ++i )
+ {
+ values.push_back(point_t(i, i));
+ }
+
+ point_t qpt(0, 0);
+
+ BOOST_CHECK(bg::intersects(qpt, values[0]));
+
+ {
+ bgi::rtree<point_t, Params> rt(values);
+
+ std::vector<point_t> result;
+ rt.query(bgi::intersects(qpt), std::back_inserter(result));
+ BOOST_CHECK(result.size() == 1);
+
+ rt.remove(values.begin() + vcount/2, values.end());
+
+ result.clear();
+ rt.query(bgi::intersects(qpt), std::back_inserter(result));
+ BOOST_CHECK(result.size() == 1);
+ }
+
+ {
+ bgi::rtree<point_t, Params> rt;
+ rt.insert(values);
+
+ std::vector<point_t> result;
+ rt.query(bgi::intersects(qpt), std::back_inserter(result));
+ BOOST_CHECK(result.size() == 1);
+
+ rt.remove(values.begin() + vcount/2, values.end());
+
+ result.clear();
+ rt.query(bgi::intersects(qpt), std::back_inserter(result));
+ BOOST_CHECK(result.size() == 1);
+ }
+}
+
+template <int Max, int Min>
+void test_rtree_all()
+{
+ int pow = Max;
+ for (int l = 0 ; l < 3 ; ++l)
+ {
+ pow *= Max;
+ int vcount = (pow * 8) / 10;
+
+ //std::cout << Max << " " << Min << " " << vcount << std::endl;
+
+ test_rtree< bgi::linear<Max, Min> >(vcount);
+ test_rtree< bgi::quadratic<Max, Min> >(vcount);
+ test_rtree< bgi::rstar<Max, Min> >(vcount);
+ }
+}
+
+int test_main(int, char* [])
+{
+ test_rtree_all<2, 1>();
+ test_rtree_all<4, 1>();
+ test_rtree_all<4, 2>();
+ test_rtree_all<5, 3>();
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/rtree_insert_remove.cpp b/src/boost/libs/geometry/index/test/rtree/rtree_insert_remove.cpp
new file mode 100644
index 00000000..068843fa
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/rtree_insert_remove.cpp
@@ -0,0 +1,82 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2015 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 <rtree/test_rtree.hpp>
+
+#include <boost/geometry/geometries/register/point.hpp>
+#include <boost/geometry/geometries/polygon.hpp>
+
+template <typename Params>
+void test_rtree(unsigned vcount)
+{
+ typedef bg::model::point<int, 1, bg::cs::cartesian> point_t;
+
+ bgi::rtree<point_t, Params> rt;
+
+ BOOST_CHECK(rt.remove(point_t(0)) == 0);
+
+ for ( unsigned i = 0 ; i < vcount ; ++i )
+ {
+ rt.insert(point_t(static_cast<int>(i)));
+ }
+
+ BOOST_CHECK(rt.size() == vcount);
+ BOOST_CHECK(rt.count(point_t(vcount / 2)) == 1);
+
+ for ( unsigned i = 0 ; i < vcount + 3 ; ++i )
+ {
+ rt.remove(point_t((i + 3) % vcount));
+ }
+
+ BOOST_CHECK(rt.size() == 0);
+ BOOST_CHECK(rt.count(point_t(vcount / 2)) == 0);
+
+ for ( unsigned i = 0 ; i < vcount ; ++i )
+ {
+ rt.insert(point_t((i + 5) % vcount));
+ }
+
+ BOOST_CHECK(rt.size() == vcount);
+ BOOST_CHECK(rt.count(point_t(vcount / 2)) == 1);
+
+ for ( unsigned i = 0 ; i < vcount + 3 ; ++i )
+ {
+ rt.remove(point_t((i + 7) % vcount));
+ }
+
+ BOOST_CHECK(rt.size() == 0);
+ BOOST_CHECK(rt.count(point_t(vcount / 2)) == 0);
+}
+
+template <int Max, int Min>
+void test_rtree_all()
+{
+ int pow = Max;
+ for (int l = 0 ; l < 3 ; ++l)
+ {
+ pow *= Max;
+ int vcount = (pow * 8) / 10;
+
+ //std::cout << Max << " " << Min << " " << vcount << std::endl;
+
+ test_rtree< bgi::linear<Max, Min> >(vcount);
+ test_rtree< bgi::quadratic<Max, Min> >(vcount);
+ test_rtree< bgi::rstar<Max, Min> >(vcount);
+ }
+}
+
+int test_main(int, char* [])
+{
+ test_rtree_all<2, 1>();
+ test_rtree_all<4, 1>();
+ test_rtree_all<4, 2>();
+ test_rtree_all<5, 3>();
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/rtree_intersects_geom.cpp b/src/boost/libs/geometry/index/test/rtree/rtree_intersects_geom.cpp
new file mode 100644
index 00000000..973628cb
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/rtree_intersects_geom.cpp
@@ -0,0 +1,55 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2016 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 <rtree/test_rtree.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+
+template <typename Value, typename Point, typename Params>
+void test_all()
+{
+ typedef bg::model::box<Point> Box;
+ typedef bg::model::segment<Point> Seg;
+ typedef bg::model::ring<Point> Ring;
+ typedef bg::model::polygon<Point> Poly;
+ typedef bg::model::multi_polygon<Poly> MPoly;
+ typedef bg::model::linestring<Point> Ls;
+ typedef bg::model::multi_linestring<Ls> MLs;
+ typedef bg::model::multi_point<Point> MPt;
+
+ bgi::rtree<Value, Params> rt;
+ std::vector<Value> found;
+
+ rt.query(bgi::intersects(Point()), back_inserter(found));
+ rt.query(bgi::intersects(Seg()), back_inserter(found));
+ rt.query(bgi::intersects(Box()), back_inserter(found));
+ rt.query(bgi::intersects(Ring()), back_inserter(found));
+ rt.query(bgi::intersects(Poly()), back_inserter(found));
+ rt.query(bgi::intersects(MPoly()), back_inserter(found));
+ rt.query(bgi::intersects(Ls()), back_inserter(found));
+ rt.query(bgi::intersects(MLs()), back_inserter(found));
+ rt.query(bgi::intersects(MPt()), back_inserter(found));
+}
+
+int test_main(int, char* [])
+{
+ typedef bg::model::d2::point_xy<double> Pt;
+ typedef bg::model::box<Pt> Box;
+
+ test_all< Pt, Pt, bgi::linear<16> >();
+ test_all< Pt, Pt, bgi::quadratic<4> >();
+ test_all< Pt, Pt, bgi::rstar<4> >();
+
+ test_all< Box, Pt, bgi::linear<16> >();
+ test_all< Box, Pt, bgi::quadratic<4> >();
+ test_all< Box, Pt, bgi::rstar<4> >();
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/rtree_move_pack.cpp b/src/boost/libs/geometry/index/test/rtree/rtree_move_pack.cpp
new file mode 100644
index 00000000..b7210772
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/rtree_move_pack.cpp
@@ -0,0 +1,134 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2015 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 <rtree/test_rtree.hpp>
+
+#include <algorithm>
+#include <boost/container/vector.hpp>
+#include <boost/move/move.hpp>
+#include <boost/move/iterator.hpp>
+
+#include <boost/geometry/geometries/register/point.hpp>
+
+class point_cm
+{
+ BOOST_COPYABLE_AND_MOVABLE(point_cm)
+
+public:
+ point_cm(double xx = 0, double yy = 0)
+ : x(xx)
+ , y(yy)
+ , moved(false)
+ {}
+ point_cm(point_cm const& other)
+ : x(other.x)
+ , y(other.y)
+ , moved(false)
+ {
+ BOOST_CHECK_MESSAGE(false, "copy not allowed");
+ }
+ point_cm & operator=(BOOST_COPY_ASSIGN_REF(point_cm) other)
+ {
+ BOOST_CHECK_MESSAGE(false, "copy not allowed");
+ x = other.x;
+ y = other.y;
+ moved = false;
+ return *this;
+ }
+ point_cm(BOOST_RV_REF(point_cm) other)
+ : x(other.x)
+ , y(other.y)
+ , moved(false)
+ {
+ BOOST_CHECK_MESSAGE(!other.moved, "only one move allowed");
+ other.moved = true;
+ }
+ point_cm & operator=(BOOST_RV_REF(point_cm) other)
+ {
+ BOOST_CHECK_MESSAGE(!other.moved, "only one move allowed");
+ x = other.x;
+ y = other.y;
+ moved = false;
+ other.moved = true;
+ return *this;
+ }
+
+ double x, y;
+ bool moved;
+};
+
+template <typename Point>
+struct indexable
+{
+ typedef Point const& result_type;
+ result_type operator()(Point const& p) const
+ {
+ BOOST_CHECK_MESSAGE(!p.moved, "can't access indexable of moved Value");
+ return p;
+ }
+};
+
+BOOST_GEOMETRY_REGISTER_POINT_2D(point_cm, double, bg::cs::cartesian, x, y)
+
+template <typename Vector>
+void append(Vector & vec, double x, double y)
+{
+ point_cm pt(x, y);
+ BOOST_CHECK(!pt.moved);
+ vec.push_back(boost::move(pt));
+ BOOST_CHECK(pt.moved);
+}
+
+struct test_moved
+{
+ test_moved(bool ex)
+ : expected(ex)
+ {}
+ template <typename Point>
+ void operator()(Point const& p) const
+ {
+ BOOST_CHECK_EQUAL(p.moved, expected);
+ }
+ bool expected;
+};
+
+template <typename Point, typename Params>
+void test_rtree(Params const& params = Params())
+{
+ // sanity check
+ boost::container::vector<Point> vec;
+ append(vec, 0, 0); append(vec, 0, 1); append(vec, 0, 2);
+ append(vec, 1, 0); append(vec, 1, 1); append(vec, 1, 2);
+ append(vec, 2, 0); append(vec, 2, 1); append(vec, 2, 2);
+
+ std::for_each(vec.begin(), vec.end(), test_moved(false));
+
+ bgi::rtree<Point, Params, indexable<Point> > rt(
+ boost::make_move_iterator(vec.begin()),
+ boost::make_move_iterator(vec.end()),
+ params);
+
+ std::for_each(vec.begin(), vec.end(), test_moved(true));
+
+ BOOST_CHECK_EQUAL(rt.size(), vec.size());
+}
+
+
+int test_main(int, char* [])
+{
+ test_rtree< point_cm, bgi::linear<4> >();
+ test_rtree< point_cm, bgi::quadratic<4> >();
+ test_rtree< point_cm, bgi::rstar<4> >();
+
+ test_rtree<point_cm>(bgi::dynamic_linear(4));
+ test_rtree<point_cm>(bgi::dynamic_quadratic(4));
+ test_rtree<point_cm>(bgi::dynamic_rstar(4));
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/rtree_non_cartesian.cpp b/src/boost/libs/geometry/index/test/rtree/rtree_non_cartesian.cpp
new file mode 100644
index 00000000..6111a284
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/rtree_non_cartesian.cpp
@@ -0,0 +1,128 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2016 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 <rtree/test_rtree.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/io/wkt/read.hpp>
+
+template <typename Point>
+inline void fill(Point & pt, double x, double y)
+{
+ bg::set<0>(pt, x);
+ bg::set<1>(pt, y);
+}
+
+template <typename Point>
+inline void fill(bg::model::box<Point> & box, double x, double y)
+{
+ bg::set<0, 0>(box, x);
+ bg::set<0, 1>(box, y);
+ bg::set<1, 0>(box, x + 20);
+ bg::set<1, 1>(box, y + 20);
+}
+
+template <typename Rtree>
+void test_rtree()
+{
+ typedef typename Rtree::value_type value_t;
+
+ Rtree rtree;
+ value_t v;
+
+ // This is not fully valid because both point's longitude and box's min
+ // longitude should be in range [-180, 180]. So if this stopped passing
+ // in the future it wouldn't be that bad. Still it works as it is now.
+
+ size_t n = 0;
+ for (double x = -170; x < 400; x += 30, ++n)
+ {
+ //double lon = x <= 180 ? x : x - 360;
+ double lon = x;
+ double lat = x <= 180 ? 0 : 30;
+
+ fill(v, lon, lat);
+ rtree.insert(v);
+ BOOST_CHECK_EQUAL(rtree.size(), n + 1);
+ size_t vcount = 1; // x < 180 ? 1 : 2;
+ BOOST_CHECK_EQUAL(rtree.count(v), vcount);
+ std::vector<value_t> res;
+ rtree.query(bgi::intersects(v), std::back_inserter(res));
+ BOOST_CHECK_EQUAL(res.size(), vcount);
+ }
+
+ for (double x = -170; x < 400; x += 30, --n)
+ {
+ //double lon = x <= 180 ? x : x - 360;
+ double lon = x;
+ double lat = x <= 180 ? 0 : 30;
+
+ fill(v, lon, lat);
+ rtree.remove(v);
+ BOOST_CHECK_EQUAL(rtree.size(), n - 1);
+ size_t vcount = 0; // x < 180 ? 1 : 0;
+ BOOST_CHECK_EQUAL(rtree.count(v), vcount);
+ std::vector<value_t> res;
+ rtree.query(bgi::intersects(v), std::back_inserter(res));
+ BOOST_CHECK_EQUAL(res.size(), vcount);
+ }
+}
+
+template <typename Value>
+void test_value()
+{
+ test_rtree<bgi::rtree<Value, bgi::linear<4> > >();
+ test_rtree<bgi::rtree<Value, bgi::quadratic<4> > >();
+ test_rtree<bgi::rtree<Value, bgi::rstar<4> > >();
+}
+
+template <typename Rtree>
+void test_ticket_12413()
+{
+ typedef typename Rtree::value_type pair_t;
+ typedef typename pair_t::first_type point_t;
+
+ Rtree rtree;
+ rtree.insert(std::make_pair(point_t(-1.558444, 52.38664), 792));
+ rtree.insert(std::make_pair(point_t(-1.558444, 52.38664), 793));
+ rtree.insert(std::make_pair(point_t(-2.088824, 51.907406), 800));
+ rtree.insert(std::make_pair(point_t(-1.576363, 53.784089), 799));
+ rtree.insert(std::make_pair(point_t(-77.038816, 38.897282), 801));
+ rtree.insert(std::make_pair(point_t(-1.558444, 52.38664), 794));
+ rtree.insert(std::make_pair(point_t(-0.141588, 51.501009), 797));
+ rtree.insert(std::make_pair(point_t(-118.410468, 34.103003), 798));
+ rtree.insert(std::make_pair(point_t(-0.127592, 51.503407), 796));
+
+ size_t num_removed = rtree.remove(std::make_pair(point_t(-0.127592, 51.503407), 796));
+
+ BOOST_CHECK_EQUAL(num_removed, 1);
+}
+
+template <typename Point>
+void test_cs()
+{
+ test_value<Point>();
+ test_value<bg::model::box<Point> >();
+
+ {
+ typedef std::pair<Point, unsigned> value_t;
+ test_ticket_12413<bgi::rtree<value_t, bgi::linear<4> > >();
+ test_ticket_12413<bgi::rtree<value_t, bgi::quadratic<4> > >();
+ test_ticket_12413<bgi::rtree<value_t, bgi::rstar<4> > >();
+ }
+}
+
+int test_main(int, char* [])
+{
+ //test_cs<bg::model::point<double, 2, bg::cs::cartesian> >();
+ test_cs<bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> > >();
+ test_cs<bg::model::point<double, 2, bg::cs::geographic<bg::degree> > >();
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/rtree_test_generator.cpp b/src/boost/libs/geometry/index/test/rtree/rtree_test_generator.cpp
new file mode 100644
index 00000000..e1d76ee2
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/rtree_test_generator.cpp
@@ -0,0 +1,111 @@
+// Boost.Geometry Index
+// Rtree tests generator
+
+// Copyright (c) 2011-2014 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 <fstream>
+#include <vector>
+#include <string>
+#include <boost/foreach.hpp>
+#include <boost/assert.hpp>
+#include <boost/tuple/tuple.hpp>
+
+int main()
+{
+ typedef boost::tuple<std::string, std::string> CT;
+ std::vector<CT> coordinate_types;
+ coordinate_types.push_back(boost::make_tuple("double", "d"));
+ //coordinate_types.push_back(boost::make_tuple("int", "i"));
+ //coordinate_types.push_back(boost::make_tuple("float", "f"));
+
+ std::vector<std::string> dimensions;
+ dimensions.push_back("2");
+ dimensions.push_back("3");
+
+ typedef boost::tuple<std::string, std::string> P;
+ std::vector<P> parameters;
+ parameters.push_back(boost::make_tuple("bgi::linear<5, 2>()", "lin"));
+ parameters.push_back(boost::make_tuple("bgi::dynamic_linear(5, 2)", "dlin"));
+ parameters.push_back(boost::make_tuple("bgi::quadratic<5, 2>()", "qua"));
+ parameters.push_back(boost::make_tuple("bgi::dynamic_quadratic(5, 2)", "dqua"));
+ parameters.push_back(boost::make_tuple("bgi::rstar<5, 2>()", "rst"));
+ parameters.push_back(boost::make_tuple("bgi::dynamic_rstar(5, 2)","drst"));
+
+ std::vector<std::string> indexables;
+ indexables.push_back("p");
+ indexables.push_back("b");
+ indexables.push_back("s");
+
+ typedef std::pair<std::string, std::string> TS;
+ std::vector<TS> testsets;
+ testsets.push_back(std::make_pair("testset::modifiers", "mod"));
+ testsets.push_back(std::make_pair("testset::queries", "que"));
+ testsets.push_back(std::make_pair("testset::additional", "add"));
+
+ BOOST_FOREACH(P const& p, parameters)
+ {
+ BOOST_FOREACH(TS const& ts, testsets)
+ {
+ BOOST_FOREACH(std::string const& i, indexables)
+ {
+ BOOST_FOREACH(std::string const& d, dimensions)
+ {
+ // If the I is Segment, generate only for 2d
+ if ( i == "s" && d != "2" )
+ {
+ continue;
+ }
+
+ BOOST_FOREACH(CT const& c, coordinate_types)
+ {
+ std::string filename = std::string() +
+ "rtree_" + boost::get<1>(p) + '_' + ts.second + '_' + i + d + boost::get<1>(c) + ".cpp";
+
+ std::ofstream f(filename.c_str(), std::ios::trunc);
+
+ f <<
+ "// Boost.Geometry Index\n" <<
+ "// Unit Test\n" <<
+ "\n" <<
+ "// Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland.\n" <<
+ "\n" <<
+ "// Use, modification and distribution is subject to the Boost Software License,\n" <<
+ "// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at\n" <<
+ "// http://www.boost.org/LICENSE_1_0.txt)\n" <<
+ "\n";
+
+ f <<
+ "#include <rtree/test_rtree.hpp>\n" <<
+ "\n";
+
+ std::string indexable_type;
+ std::string point_type = std::string("bg::model::point<") + boost::get<0>(c) + ", " + d + ", bg::cs::cartesian>";
+ if ( i == "p" )
+ indexable_type = point_type;
+ else if ( i == "b" )
+ indexable_type = std::string("bg::model::box< ") + point_type + " >";
+ else if ( i == "s" )
+ indexable_type = std::string("bg::model::segment< ") + point_type + " >";
+ else
+ BOOST_ASSERT(false);
+
+ f <<
+ "int test_main(int, char* [])\n" <<
+ "{\n" <<
+ " typedef " << indexable_type << " Indexable;\n" <<
+ " " << ts.first << "<Indexable>(" << boost::get<0>(p) << ", std::allocator<int>());\n" <<
+ " return 0;\n" <<
+ "}\n";
+ }
+ }
+ }
+
+ }
+ }
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/rtree_values.cpp b/src/boost/libs/geometry/index/test/rtree/rtree_values.cpp
new file mode 100644
index 00000000..e9eb1381
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/rtree_values.cpp
@@ -0,0 +1,146 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2014-2015 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 <rtree/test_rtree.hpp>
+
+#include <boost/core/addressof.hpp>
+
+#include <boost/geometry/geometries/register/point.hpp>
+#include <boost/geometry/geometries/polygon.hpp>
+
+struct point
+{
+ point(double xx = 0, double yy = 0) : x(xx), y(yy) {}
+ double x, y;
+};
+
+BOOST_GEOMETRY_REGISTER_POINT_2D(point, double, bg::cs::cartesian, x, y)
+
+template <typename Rtree, typename Convertible>
+void check_convertible_to_value(Rtree const& rt, Convertible const& conv)
+{
+ static const bool
+ is_conv_to_indexable
+ = boost::is_convertible<Convertible, typename Rtree::indexable_type>::value;
+ static const bool
+ is_conv_to_value
+ = boost::is_convertible<Convertible, typename Rtree::value_type>::value;
+ static const bool
+ is_same_as_indexable
+ = boost::is_same<Convertible, typename Rtree::indexable_type>::value;
+ static const bool
+ is_same_as_value
+ = boost::is_same<Convertible, typename Rtree::value_type>::value;
+
+ BOOST_CHECK_EQUAL(is_same_as_indexable, false);
+ BOOST_CHECK_EQUAL(is_same_as_value, false);
+ BOOST_CHECK_EQUAL(is_conv_to_indexable, false);
+ BOOST_CHECK_EQUAL(is_conv_to_value, true);
+
+ typename Rtree::value_type const& val = conv;
+ BOOST_CHECK(rt.value_eq()(val, conv));
+}
+
+template <typename Box, typename Params>
+void test_pair()
+{
+ typedef std::pair<Box, std::size_t> Value;
+
+ typename boost::remove_const<Box>::type box;
+ bg::assign_zero(box);
+
+ Value val(box, 0);
+
+ // sanity check
+ std::vector<Value> vec;
+ vec.push_back(val);
+ vec.push_back(std::make_pair(box, 0));
+ vec.push_back(std::make_pair(box, (unsigned short)0));
+
+ bgi::rtree<Value, Params> rt;
+ rt.insert(val);
+ rt.insert(std::make_pair(box, 0));
+ rt.insert(std::make_pair(box, (unsigned short)0));
+ BOOST_CHECK_EQUAL(rt.size(), 3u);
+
+ check_convertible_to_value(rt, std::make_pair(box, 0));
+ check_convertible_to_value(rt, std::make_pair(box, (unsigned short)0));
+ BOOST_CHECK(bg::covered_by(rt.indexable_get()(std::make_pair(box, 0)), rt.bounds()));
+ BOOST_CHECK(bg::covered_by(rt.indexable_get()(std::make_pair(box, (unsigned short)0)), rt.bounds()));
+
+ BOOST_CHECK_EQUAL(rt.count(val), 3u);
+ BOOST_CHECK_EQUAL(rt.count(std::make_pair(box, 0)), 3u);
+ BOOST_CHECK_EQUAL(rt.count(std::make_pair(box, (unsigned short)0)), 3u);
+ BOOST_CHECK_EQUAL(rt.count(box), 3u);
+
+ BOOST_CHECK_EQUAL(rt.remove(val), 1u);
+ BOOST_CHECK_EQUAL(rt.remove(std::make_pair(box, 0)), 1u);
+ BOOST_CHECK_EQUAL(rt.remove(std::make_pair(box, (unsigned short)0)), 1u);
+ BOOST_CHECK_EQUAL(rt.size(), 0u);
+}
+
+template <typename Box, typename Params>
+void test_pair_geom_ptr()
+{
+ typedef typename bg::point_type<Box>::type point_t;
+ typedef bg::model::polygon<point_t> polygon_t;
+
+ typedef std::pair<Box, polygon_t*> Value;
+
+ typename boost::remove_const<Box>::type box;
+ bg::assign_zero(box);
+
+ polygon_t poly;
+
+ Value val(box, boost::addressof(poly));
+
+ bgi::rtree<Value, Params> rt;
+ rt.insert(val);
+ rt.insert(std::make_pair(box, boost::addressof(poly)));
+
+ BOOST_CHECK_EQUAL(rt.size(), 2u);
+
+ BOOST_CHECK_EQUAL(rt.remove(val), 1u);
+ BOOST_CHECK_EQUAL(rt.remove(std::make_pair(box, boost::addressof(poly))), 1u);
+
+ BOOST_CHECK_EQUAL(rt.size(), 0u);
+}
+
+template <typename Params>
+void test_point()
+{
+ bgi::rtree<point, Params> rt;
+
+ rt.insert(0.0);
+ BOOST_CHECK_EQUAL(rt.size(), 1u);
+ BOOST_CHECK_EQUAL(rt.remove(0.0), 1u);
+}
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 2, bg::cs::cartesian> Pt;
+ typedef bg::model::box<Pt> Box;
+
+ test_pair< Box, bgi::linear<16> >();
+ test_pair< Box, bgi::quadratic<4> >();
+ test_pair< Box, bgi::rstar<4> >();
+ //test_rtree< Box const, bgi::linear<16> >();
+ //test_rtree< Box const, bgi::quadratic<4> >();
+ //test_rtree< Box const, bgi::rstar<4> >();
+
+ test_pair_geom_ptr< Box, bgi::linear<16> >();
+ test_pair_geom_ptr< Box, bgi::quadratic<4> >();
+ test_pair_geom_ptr< Box, bgi::rstar<4> >();
+
+ test_point< bgi::linear<16> >();
+ test_point< bgi::quadratic<4> >();
+ test_point< bgi::rstar<4> >();
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/rtree_values_invalid.cpp b/src/boost/libs/geometry/index/test/rtree/rtree_values_invalid.cpp
new file mode 100644
index 00000000..d1686133
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/rtree_values_invalid.cpp
@@ -0,0 +1,31 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2014 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 <rtree/test_rtree.hpp>
+
+
+template <typename Point, typename Params>
+void test_rtree()
+{
+ bgi::rtree<Point, Params> rt;
+ // coordinates aren't implicitly convertible to Point
+ rt.insert(1.0);
+ rt.remove(1.0);
+}
+
+int test_main(int, char* [])
+{
+ typedef bg::model::point<double, 1, bg::cs::cartesian> Pt;
+
+ test_rtree<Pt, bgi::linear<16> >();
+ test_rtree<Pt, bgi::quadratic<4> >();
+ test_rtree<Pt, bgi::rstar<4> >();
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/rtree/test_rtree.hpp b/src/boost/libs/geometry/index/test/rtree/test_rtree.hpp
new file mode 100644
index 00000000..f937e768
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/rtree/test_rtree.hpp
@@ -0,0 +1,2023 @@
+// Boost.Geometry Index
+// Unit Test
+
+// Copyright (c) 2011-2015 Adam Wulkiewicz, Lodz, Poland.
+
+// This file was modified by Oracle on 2019.
+// Modifications copyright (c) 2019, Oracle and/or its affiliates.
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
+// 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_TEST_RTREE_HPP
+#define BOOST_GEOMETRY_INDEX_TEST_RTREE_HPP
+
+#include <boost/foreach.hpp>
+#include <vector>
+#include <algorithm>
+
+#include <geometry_index_test_common.hpp>
+
+#include <boost/geometry/index/rtree.hpp>
+
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/box.hpp>
+#include <boost/geometry/geometries/segment.hpp>
+
+#include <boost/geometry/index/detail/rtree/utilities/are_levels_ok.hpp>
+#include <boost/geometry/index/detail/rtree/utilities/are_boxes_ok.hpp>
+
+//#include <boost/geometry/geometries/ring.hpp>
+//#include <boost/geometry/geometries/polygon.hpp>
+
+namespace generate {
+
+// Set point's coordinates
+
+template <typename Point>
+struct outside_point
+{};
+
+template <typename T, typename C>
+struct outside_point< bg::model::point<T, 2, C> >
+{
+ typedef bg::model::point<T, 2, C> P;
+ static P apply()
+ {
+ return P(13, 26);
+ }
+};
+
+template <typename T, typename C>
+struct outside_point< bg::model::point<T, 3, C> >
+{
+ typedef bg::model::point<T, 3, C> P;
+ static P apply()
+ {
+ return P(13, 26, 13);
+ }
+};
+
+// Default value generation
+
+template <typename Value>
+struct value_default
+{
+ static Value apply(){ return Value(); }
+};
+
+// Values, input and rtree generation
+
+template <typename Value>
+struct value
+{};
+
+template <typename T, typename C>
+struct value< bg::model::point<T, 2, C> >
+{
+ typedef bg::model::point<T, 2, C> P;
+ static P apply(int x, int y)
+ {
+ return P(x, y);
+ }
+};
+
+template <typename T, typename C>
+struct value< bg::model::box< bg::model::point<T, 2, C> > >
+{
+ typedef bg::model::point<T, 2, C> P;
+ typedef bg::model::box<P> B;
+ static B apply(int x, int y)
+ {
+ return B(P(x, y), P(x + 2, y + 3));
+ }
+};
+
+template <typename T, typename C>
+struct value< bg::model::segment< bg::model::point<T, 2, C> > >
+{
+ typedef bg::model::point<T, 2, C> P;
+ typedef bg::model::segment<P> S;
+ static S apply(int x, int y)
+ {
+ return S(P(x, y), P(x + 2, y + 3));
+ }
+};
+
+template <typename T, typename C>
+struct value< std::pair<bg::model::point<T, 2, C>, int> >
+{
+ typedef bg::model::point<T, 2, C> P;
+ typedef std::pair<P, int> R;
+ static R apply(int x, int y)
+ {
+ return std::make_pair(P(x, y), x + y * 100);
+ }
+};
+
+template <typename T, typename C>
+struct value< std::pair<bg::model::box< bg::model::point<T, 2, C> >, int> >
+{
+ typedef bg::model::point<T, 2, C> P;
+ typedef bg::model::box<P> B;
+ typedef std::pair<B, int> R;
+ static R apply(int x, int y)
+ {
+ return std::make_pair(B(P(x, y), P(x + 2, y + 3)), x + y * 100);
+ }
+};
+
+template <typename T, typename C>
+struct value< std::pair<bg::model::segment< bg::model::point<T, 2, C> >, int> >
+{
+ typedef bg::model::point<T, 2, C> P;
+ typedef bg::model::segment<P> S;
+ typedef std::pair<S, int> R;
+ static R apply(int x, int y)
+ {
+ return std::make_pair(S(P(x, y), P(x + 2, y + 3)), x + y * 100);
+ }
+};
+
+template <typename T, typename C>
+struct value< boost::tuple<bg::model::point<T, 2, C>, int, int> >
+{
+ typedef bg::model::point<T, 2, C> P;
+ typedef boost::tuple<P, int, int> R;
+ static R apply(int x, int y)
+ {
+ return boost::make_tuple(P(x, y), x + y * 100, 0);
+ }
+};
+
+template <typename T, typename C>
+struct value< boost::tuple<bg::model::box< bg::model::point<T, 2, C> >, int, int> >
+{
+ typedef bg::model::point<T, 2, C> P;
+ typedef bg::model::box<P> B;
+ typedef boost::tuple<B, int, int> R;
+ static R apply(int x, int y)
+ {
+ return boost::make_tuple(B(P(x, y), P(x + 2, y + 3)), x + y * 100, 0);
+ }
+};
+
+template <typename T, typename C>
+struct value< boost::tuple<bg::model::segment< bg::model::point<T, 2, C> >, int, int> >
+{
+ typedef bg::model::point<T, 2, C> P;
+ typedef bg::model::segment<P> S;
+ typedef boost::tuple<S, int, int> R;
+ static R apply(int x, int y)
+ {
+ return boost::make_tuple(S(P(x, y), P(x + 2, y + 3)), x + y * 100, 0);
+ }
+};
+
+template <typename T, typename C>
+struct value< bg::model::point<T, 3, C> >
+{
+ typedef bg::model::point<T, 3, C> P;
+ static P apply(int x, int y, int z)
+ {
+ return P(x, y, z);
+ }
+};
+
+template <typename T, typename C>
+struct value< bg::model::box< bg::model::point<T, 3, C> > >
+{
+ typedef bg::model::point<T, 3, C> P;
+ typedef bg::model::box<P> B;
+ static B apply(int x, int y, int z)
+ {
+ return B(P(x, y, z), P(x + 2, y + 3, z + 4));
+ }
+};
+
+template <typename T, typename C>
+struct value< std::pair<bg::model::point<T, 3, C>, int> >
+{
+ typedef bg::model::point<T, 3, C> P;
+ typedef std::pair<P, int> R;
+ static R apply(int x, int y, int z)
+ {
+ return std::make_pair(P(x, y, z), x + y * 100 + z * 10000);
+ }
+};
+
+template <typename T, typename C>
+struct value< std::pair<bg::model::box< bg::model::point<T, 3, C> >, int> >
+{
+ typedef bg::model::point<T, 3, C> P;
+ typedef bg::model::box<P> B;
+ typedef std::pair<B, int> R;
+ static R apply(int x, int y, int z)
+ {
+ return std::make_pair(B(P(x, y, z), P(x + 2, y + 3, z + 4)), x + y * 100 + z * 10000);
+ }
+};
+
+template <typename T, typename C>
+struct value< boost::tuple<bg::model::point<T, 3, C>, int, int> >
+{
+ typedef bg::model::point<T, 3, C> P;
+ typedef boost::tuple<P, int, int> R;
+ static R apply(int x, int y, int z)
+ {
+ return boost::make_tuple(P(x, y, z), x + y * 100 + z * 10000, 0);
+ }
+};
+
+template <typename T, typename C>
+struct value< boost::tuple<bg::model::box< bg::model::point<T, 3, C> >, int, int> >
+{
+ typedef bg::model::point<T, 3, C> P;
+ typedef bg::model::box<P> B;
+ typedef boost::tuple<B, int, int> R;
+ static R apply(int x, int y, int z)
+ {
+ return boost::make_tuple(B(P(x, y, z), P(x + 2, y + 3, z + 4)), x + y * 100 + z * 10000, 0);
+ }
+};
+
+#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+template <typename T, typename C>
+struct value< std::tuple<bg::model::point<T, 2, C>, int, int> >
+{
+ typedef bg::model::point<T, 2, C> P;
+ typedef std::tuple<P, int, int> R;
+ static R apply(int x, int y)
+ {
+ return std::make_tuple(P(x, y), x + y * 100, 0);
+ }
+};
+
+template <typename T, typename C>
+struct value< std::tuple<bg::model::box< bg::model::point<T, 2, C> >, int, int> >
+{
+ typedef bg::model::point<T, 2, C> P;
+ typedef bg::model::box<P> B;
+ typedef std::tuple<B, int, int> R;
+ static R apply(int x, int y)
+ {
+ return std::make_tuple(B(P(x, y), P(x + 2, y + 3)), x + y * 100, 0);
+ }
+};
+
+template <typename T, typename C>
+struct value< std::tuple<bg::model::segment< bg::model::point<T, 2, C> >, int, int> >
+{
+ typedef bg::model::point<T, 2, C> P;
+ typedef bg::model::segment<P> S;
+ typedef std::tuple<S, int, int> R;
+ static R apply(int x, int y)
+ {
+ return std::make_tuple(S(P(x, y), P(x + 2, y + 3)), x + y * 100, 0);
+ }
+};
+
+template <typename T, typename C>
+struct value< std::tuple<bg::model::point<T, 3, C>, int, int> >
+{
+ typedef bg::model::point<T, 3, C> P;
+ typedef std::tuple<P, int, int> R;
+ static R apply(int x, int y, int z)
+ {
+ return std::make_tuple(P(x, y, z), x + y * 100 + z * 10000, 0);
+ }
+};
+
+template <typename T, typename C>
+struct value< std::tuple<bg::model::box< bg::model::point<T, 3, C> >, int, int> >
+{
+ typedef bg::model::point<T, 3, C> P;
+ typedef bg::model::box<P> B;
+ typedef std::tuple<B, int, int> R;
+ static R apply(int x, int y, int z)
+ {
+ return std::make_tuple(B(P(x, y, z), P(x + 2, y + 3, z + 4)), x + y * 100 + z * 10000, 0);
+ }
+};
+
+#endif // #if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+} // namespace generate
+
+// shared_ptr value
+
+template <typename Indexable>
+struct test_object
+{
+ test_object(Indexable const& indexable_) : indexable(indexable_) {}
+ Indexable indexable;
+};
+
+namespace boost { namespace geometry { namespace index {
+
+template <typename Indexable>
+struct indexable< boost::shared_ptr< test_object<Indexable> > >
+{
+ typedef boost::shared_ptr< test_object<Indexable> > value_type;
+ typedef Indexable const& result_type;
+
+ result_type operator()(value_type const& value) const
+ {
+ return value->indexable;
+ }
+};
+
+}}}
+
+namespace generate {
+
+template <typename T, typename C>
+struct value< boost::shared_ptr<test_object<bg::model::point<T, 2, C> > > >
+{
+ typedef bg::model::point<T, 2, C> P;
+ typedef test_object<P> O;
+ typedef boost::shared_ptr<O> R;
+
+ static R apply(int x, int y)
+ {
+ return R(new O(P(x, y)));
+ }
+};
+
+template <typename T, typename C>
+struct value< boost::shared_ptr<test_object<bg::model::point<T, 3, C> > > >
+{
+ typedef bg::model::point<T, 3, C> P;
+ typedef test_object<P> O;
+ typedef boost::shared_ptr<O> R;
+
+ static R apply(int x, int y, int z)
+ {
+ return R(new O(P(x, y, z)));
+ }
+};
+
+template <typename T, typename C>
+struct value< boost::shared_ptr<test_object<bg::model::box<bg::model::point<T, 2, C> > > > >
+{
+ typedef bg::model::point<T, 2, C> P;
+ typedef bg::model::box<P> B;
+ typedef test_object<B> O;
+ typedef boost::shared_ptr<O> R;
+
+ static R apply(int x, int y)
+ {
+ return R(new O(B(P(x, y), P(x + 2, y + 3))));
+ }
+};
+
+template <typename T, typename C>
+struct value< boost::shared_ptr<test_object<bg::model::box<bg::model::point<T, 3, C> > > > >
+{
+ typedef bg::model::point<T, 3, C> P;
+ typedef bg::model::box<P> B;
+ typedef test_object<B> O;
+ typedef boost::shared_ptr<O> R;
+
+ static R apply(int x, int y, int z)
+ {
+ return R(new O(B(P(x, y, z), P(x + 2, y + 3, z + 4))));
+ }
+};
+
+template <typename T, typename C>
+struct value< boost::shared_ptr<test_object<bg::model::segment<bg::model::point<T, 2, C> > > > >
+{
+ typedef bg::model::point<T, 2, C> P;
+ typedef bg::model::segment<P> S;
+ typedef test_object<S> O;
+ typedef boost::shared_ptr<O> R;
+
+ static R apply(int x, int y)
+ {
+ return R(new O(S(P(x, y), P(x + 2, y + 3))));
+ }
+};
+
+} //namespace generate
+
+// counting value
+
+template <typename Indexable>
+struct counting_value
+{
+ counting_value() { counter()++; }
+ counting_value(Indexable const& i) : indexable(i) { counter()++; }
+ counting_value(counting_value const& c) : indexable(c.indexable) { counter()++; }
+ ~counting_value() { counter()--; }
+
+ static size_t & counter() { static size_t c = 0; return c; }
+ Indexable indexable;
+};
+
+namespace boost { namespace geometry { namespace index {
+
+template <typename Indexable>
+struct indexable< counting_value<Indexable> >
+{
+ typedef counting_value<Indexable> value_type;
+ typedef Indexable const& result_type;
+ result_type operator()(value_type const& value) const
+ {
+ return value.indexable;
+ }
+};
+
+template <typename Indexable>
+struct equal_to< counting_value<Indexable> >
+{
+ typedef counting_value<Indexable> value_type;
+ typedef bool result_type;
+ bool operator()(value_type const& v1, value_type const& v2) const
+ {
+ return boost::geometry::equals(v1.indexable, v2.indexable);
+ }
+};
+
+}}}
+
+namespace generate {
+
+template <typename T, typename C>
+struct value< counting_value<bg::model::point<T, 2, C> > >
+{
+ typedef bg::model::point<T, 2, C> P;
+ typedef counting_value<P> R;
+ static R apply(int x, int y) { return R(P(x, y)); }
+};
+
+template <typename T, typename C>
+struct value< counting_value<bg::model::point<T, 3, C> > >
+{
+ typedef bg::model::point<T, 3, C> P;
+ typedef counting_value<P> R;
+ static R apply(int x, int y, int z) { return R(P(x, y, z)); }
+};
+
+template <typename T, typename C>
+struct value< counting_value<bg::model::box<bg::model::point<T, 2, C> > > >
+{
+ typedef bg::model::point<T, 2, C> P;
+ typedef bg::model::box<P> B;
+ typedef counting_value<B> R;
+ static R apply(int x, int y) { return R(B(P(x, y), P(x+2, y+3))); }
+};
+
+template <typename T, typename C>
+struct value< counting_value<bg::model::box<bg::model::point<T, 3, C> > > >
+{
+ typedef bg::model::point<T, 3, C> P;
+ typedef bg::model::box<P> B;
+ typedef counting_value<B> R;
+ static R apply(int x, int y, int z) { return R(B(P(x, y, z), P(x+2, y+3, z+4))); }
+};
+
+template <typename T, typename C>
+struct value< counting_value<bg::model::segment<bg::model::point<T, 2, C> > > >
+{
+ typedef bg::model::point<T, 2, C> P;
+ typedef bg::model::segment<P> S;
+ typedef counting_value<S> R;
+ static R apply(int x, int y) { return R(S(P(x, y), P(x+2, y+3))); }
+};
+
+} // namespace generate
+
+// value without default constructor
+
+template <typename Indexable>
+struct value_no_dctor
+{
+ value_no_dctor(Indexable const& i) : indexable(i) {}
+ Indexable indexable;
+};
+
+namespace boost { namespace geometry { namespace index {
+
+template <typename Indexable>
+struct indexable< value_no_dctor<Indexable> >
+{
+ typedef value_no_dctor<Indexable> value_type;
+ typedef Indexable const& result_type;
+ result_type operator()(value_type const& value) const
+ {
+ return value.indexable;
+ }
+};
+
+template <typename Indexable>
+struct equal_to< value_no_dctor<Indexable> >
+{
+ typedef value_no_dctor<Indexable> value_type;
+ typedef bool result_type;
+ bool operator()(value_type const& v1, value_type const& v2) const
+ {
+ return boost::geometry::equals(v1.indexable, v2.indexable);
+ }
+};
+
+}}}
+
+namespace generate {
+
+template <typename Indexable>
+struct value_default< value_no_dctor<Indexable> >
+{
+ static value_no_dctor<Indexable> apply() { return value_no_dctor<Indexable>(Indexable()); }
+};
+
+template <typename T, typename C>
+struct value< value_no_dctor<bg::model::point<T, 2, C> > >
+{
+ typedef bg::model::point<T, 2, C> P;
+ typedef value_no_dctor<P> R;
+ static R apply(int x, int y) { return R(P(x, y)); }
+};
+
+template <typename T, typename C>
+struct value< value_no_dctor<bg::model::point<T, 3, C> > >
+{
+ typedef bg::model::point<T, 3, C> P;
+ typedef value_no_dctor<P> R;
+ static R apply(int x, int y, int z) { return R(P(x, y, z)); }
+};
+
+template <typename T, typename C>
+struct value< value_no_dctor<bg::model::box<bg::model::point<T, 2, C> > > >
+{
+ typedef bg::model::point<T, 2, C> P;
+ typedef bg::model::box<P> B;
+ typedef value_no_dctor<B> R;
+ static R apply(int x, int y) { return R(B(P(x, y), P(x+2, y+3))); }
+};
+
+template <typename T, typename C>
+struct value< value_no_dctor<bg::model::box<bg::model::point<T, 3, C> > > >
+{
+ typedef bg::model::point<T, 3, C> P;
+ typedef bg::model::box<P> B;
+ typedef value_no_dctor<B> R;
+ static R apply(int x, int y, int z) { return R(B(P(x, y, z), P(x+2, y+3, z+4))); }
+};
+
+template <typename T, typename C>
+struct value< value_no_dctor<bg::model::segment<bg::model::point<T, 2, C> > > >
+{
+ typedef bg::model::point<T, 2, C> P;
+ typedef bg::model::segment<P> S;
+ typedef value_no_dctor<S> R;
+ static R apply(int x, int y) { return R(S(P(x, y), P(x+2, y+3))); }
+};
+
+// generate input
+
+template <size_t Dimension>
+struct input
+{};
+
+template <>
+struct input<2>
+{
+ template <typename Value, typename Box>
+ static void apply(std::vector<Value> & input, Box & qbox, int size = 1)
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(0 < size, "the value must be greather than 0");
+
+ for ( int i = 0 ; i < 12 * size ; i += 3 )
+ {
+ for ( int j = 1 ; j < 25 * size ; j += 4 )
+ {
+ input.push_back( generate::value<Value>::apply(i, j) );
+ }
+ }
+
+ typedef typename bg::traits::point_type<Box>::type P;
+
+ qbox = Box(P(3, 0), P(10, 9));
+ }
+};
+
+template <>
+struct input<3>
+{
+ template <typename Value, typename Box>
+ static void apply(std::vector<Value> & input, Box & qbox, int size = 1)
+ {
+ BOOST_GEOMETRY_INDEX_ASSERT(0 < size, "the value must be greather than 0");
+
+ for ( int i = 0 ; i < 12 * size ; i += 3 )
+ {
+ for ( int j = 1 ; j < 25 * size ; j += 4 )
+ {
+ for ( int k = 2 ; k < 12 * size ; k += 5 )
+ {
+ input.push_back( generate::value<Value>::apply(i, j, k) );
+ }
+ }
+ }
+
+ typedef typename bg::traits::point_type<Box>::type P;
+
+ qbox = Box(P(3, 0, 3), P(10, 9, 11));
+ }
+};
+
+// generate_value_outside
+
+template <typename Value, size_t Dimension>
+struct value_outside_impl
+{};
+
+template <typename Value>
+struct value_outside_impl<Value, 2>
+{
+ static Value apply()
+ {
+ //TODO - for size > 1 in generate_input<> this won't be outside
+ return generate::value<Value>::apply(13, 26);
+ }
+};
+
+template <typename Value>
+struct value_outside_impl<Value, 3>
+{
+ static Value apply()
+ {
+ //TODO - for size > 1 in generate_input<> this won't be outside
+ return generate::value<Value>::apply(13, 26, 13);
+ }
+};
+
+template <typename Rtree>
+inline typename Rtree::value_type
+value_outside()
+{
+ typedef typename Rtree::value_type V;
+ typedef typename Rtree::indexable_type I;
+
+ return value_outside_impl<V, bg::dimension<I>::value>::apply();
+}
+
+template<typename Rtree, typename Elements, typename Box>
+void rtree(Rtree & tree, Elements & input, Box & qbox)
+{
+ typedef typename Rtree::indexable_type I;
+
+ generate::input<
+ bg::dimension<I>::value
+ >::apply(input, qbox);
+
+ tree.insert(input.begin(), input.end());
+}
+
+} // namespace generate
+
+namespace basictest {
+
+// low level test functions
+
+template <typename Rtree, typename Iter, typename Value>
+Iter find(Rtree const& rtree, Iter first, Iter last, Value const& value)
+{
+ for ( ; first != last ; ++first )
+ if ( rtree.value_eq()(value, *first) )
+ return first;
+ return first;
+}
+
+template <typename Rtree, typename Value>
+void compare_outputs(Rtree const& rtree, std::vector<Value> const& output, std::vector<Value> const& expected_output)
+{
+ bool are_sizes_ok = (expected_output.size() == output.size());
+ BOOST_CHECK( are_sizes_ok );
+ if ( are_sizes_ok )
+ {
+ BOOST_FOREACH(Value const& v, expected_output)
+ {
+ BOOST_CHECK(find(rtree, output.begin(), output.end(), v) != output.end() );
+ }
+ }
+}
+
+template <typename Rtree, typename Range1, typename Range2>
+void exactly_the_same_outputs(Rtree const& rtree, Range1 const& output, Range2 const& expected_output)
+{
+ size_t s1 = std::distance(output.begin(), output.end());
+ size_t s2 = std::distance(expected_output.begin(), expected_output.end());
+ BOOST_CHECK(s1 == s2);
+
+ if ( s1 == s2 )
+ {
+ typename Range1::const_iterator it1 = output.begin();
+ typename Range2::const_iterator it2 = expected_output.begin();
+ for ( ; it1 != output.end() && it2 != expected_output.end() ; ++it1, ++it2 )
+ {
+ if ( !rtree.value_eq()(*it1, *it2) )
+ {
+ BOOST_CHECK(false && "rtree.translator().equals(*it1, *it2)");
+ break;
+ }
+ }
+ }
+}
+
+// alternative version of std::copy taking iterators of differnet types
+template <typename First, typename Last, typename Out>
+void copy_alt(First first, Last last, Out out)
+{
+ for ( ; first != last ; ++first, ++out )
+ *out = *first;
+}
+
+// test query iterators
+template <typename QItF, typename QItL>
+void check_fwd_iterators(QItF first, QItL last)
+{
+ QItF vinit = QItF();
+ BOOST_CHECK(vinit == last);
+
+#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
+ QItL vinit2 = QItL();
+ BOOST_CHECK(vinit2 == last);
+#endif
+
+ QItF def;
+ BOOST_CHECK(def == last);
+
+#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
+ QItL def2;
+ BOOST_CHECK(def2 == last);
+#endif
+
+ QItF it = first;
+ for ( ; it != last && first != last ; ++it, ++first)
+ {
+ BOOST_CHECK(it == first);
+
+ bg::index::equal_to<typename std::iterator_traits<QItF>::value_type> eq;
+ BOOST_CHECK(eq(*it, *first));
+ }
+ BOOST_CHECK(it == last);
+ BOOST_CHECK(first == last);
+}
+
+// spatial query
+
+template <typename Rtree, typename Value, typename Predicates>
+void spatial_query(Rtree & rtree, Predicates const& pred, std::vector<Value> const& expected_output)
+{
+ BOOST_CHECK( bgi::detail::rtree::utilities::are_levels_ok(rtree) );
+ if ( !rtree.empty() )
+ BOOST_CHECK( bgi::detail::rtree::utilities::are_boxes_ok(rtree) );
+
+ std::vector<Value> output;
+ size_t n = rtree.query(pred, std::back_inserter(output));
+
+ BOOST_CHECK( expected_output.size() == n );
+ compare_outputs(rtree, output, expected_output);
+
+ std::vector<Value> output2;
+ size_t n2 = query(rtree, pred, std::back_inserter(output2));
+
+ BOOST_CHECK( n == n2 );
+ exactly_the_same_outputs(rtree, output, output2);
+
+ exactly_the_same_outputs(rtree, output, rtree | bgi::adaptors::queried(pred));
+
+ std::vector<Value> output3;
+ std::copy(rtree.qbegin(pred), rtree.qend(), std::back_inserter(output3));
+
+ compare_outputs(rtree, output3, expected_output);
+
+ std::vector<Value> output4;
+ std::copy(qbegin(rtree, pred), qend(rtree), std::back_inserter(output4));
+
+ exactly_the_same_outputs(rtree, output3, output4);
+
+ check_fwd_iterators(rtree.qbegin(pred), rtree.qend());
+
+#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
+ {
+ std::vector<Value> output4;
+ std::copy(rtree.qbegin_(pred), rtree.qend_(pred), std::back_inserter(output4));
+ compare_outputs(rtree, output4, expected_output);
+ output4.clear();
+ copy_alt(rtree.qbegin_(pred), rtree.qend_(), std::back_inserter(output4));
+ compare_outputs(rtree, output4, expected_output);
+
+ check_fwd_iterators(rtree.qbegin_(pred), rtree.qend_(pred));
+ check_fwd_iterators(rtree.qbegin_(pred), rtree.qend_());
+ }
+#endif
+}
+
+// rtree specific queries tests
+
+template <typename Rtree, typename Value, typename Box>
+void intersects(Rtree const& tree, std::vector<Value> const& input, Box const& qbox)
+{
+ std::vector<Value> expected_output;
+
+ BOOST_FOREACH(Value const& v, input)
+ if ( bg::intersects(tree.indexable_get()(v), qbox) )
+ expected_output.push_back(v);
+
+ //spatial_query(tree, qbox, expected_output);
+ spatial_query(tree, bgi::intersects(qbox), expected_output);
+ spatial_query(tree, !bgi::disjoint(qbox), expected_output);
+
+ /*typedef bg::traits::point_type<Box>::type P;
+ bg::model::ring<P> qring;
+ bg::convert(qbox, qring);
+ spatial_query(tree, bgi::intersects(qring), expected_output);
+ spatial_query(tree, !bgi::disjoint(qring), expected_output);
+ bg::model::polygon<P> qpoly;
+ bg::convert(qbox, qpoly);
+ spatial_query(tree, bgi::intersects(qpoly), expected_output);
+ spatial_query(tree, !bgi::disjoint(qpoly), expected_output);*/
+}
+
+template <typename Rtree, typename Value, typename Box>
+void disjoint(Rtree const& tree, std::vector<Value> const& input, Box const& qbox)
+{
+ std::vector<Value> expected_output;
+
+ BOOST_FOREACH(Value const& v, input)
+ if ( bg::disjoint(tree.indexable_get()(v), qbox) )
+ expected_output.push_back(v);
+
+ spatial_query(tree, bgi::disjoint(qbox), expected_output);
+ spatial_query(tree, !bgi::intersects(qbox), expected_output);
+
+ /*typedef bg::traits::point_type<Box>::type P;
+ bg::model::ring<P> qring;
+ bg::convert(qbox, qring);
+ spatial_query(tree, bgi::disjoint(qring), expected_output);
+ bg::model::polygon<P> qpoly;
+ bg::convert(qbox, qpoly);
+ spatial_query(tree, bgi::disjoint(qpoly), expected_output);*/
+}
+
+template <typename Tag>
+struct contains_impl
+{
+ template <typename Rtree, typename Value, typename Box>
+ static void apply(Rtree const& tree, std::vector<Value> const& input, Box const& qbox)
+ {
+ std::vector<Value> expected_output;
+
+ BOOST_FOREACH(Value const& v, input)
+ if ( bg::within(qbox, tree.indexable_get()(v)) )
+ expected_output.push_back(v);
+
+ spatial_query(tree, bgi::contains(qbox), expected_output);
+
+ /*typedef bg::traits::point_type<Box>::type P;
+ bg::model::ring<P> qring;
+ bg::convert(qbox, qring);
+ spatial_query(tree, bgi::contains(qring), expected_output);
+ bg::model::polygon<P> qpoly;
+ bg::convert(qbox, qpoly);
+ spatial_query(tree, bgi::contains(qpoly), expected_output);*/
+ }
+};
+
+template <>
+struct contains_impl<bg::point_tag>
+{
+ template <typename Rtree, typename Value, typename Box>
+ static void apply(Rtree const& /*tree*/, std::vector<Value> const& /*input*/, Box const& /*qbox*/)
+ {}
+};
+
+template <>
+struct contains_impl<bg::segment_tag>
+{
+ template <typename Rtree, typename Value, typename Box>
+ static void apply(Rtree const& /*tree*/, std::vector<Value> const& /*input*/, Box const& /*qbox*/)
+ {}
+};
+
+template <typename Rtree, typename Value, typename Box>
+void contains(Rtree const& tree, std::vector<Value> const& input, Box const& qbox)
+{
+ contains_impl<
+ typename bg::tag<
+ typename Rtree::indexable_type
+ >::type
+ >::apply(tree, input, qbox);
+}
+
+template <typename Tag>
+struct covered_by_impl
+{
+ template <typename Rtree, typename Value, typename Box>
+ static void apply(Rtree const& tree, std::vector<Value> const& input, Box const& qbox)
+ {
+ std::vector<Value> expected_output;
+
+ BOOST_FOREACH(Value const& v, input)
+ {
+ if ( bgi::detail::covered_by_bounds(
+ tree.indexable_get()(v),
+ qbox,
+ bgi::detail::get_strategy(tree.parameters())) )
+ {
+ expected_output.push_back(v);
+ }
+ }
+
+ spatial_query(tree, bgi::covered_by(qbox), expected_output);
+
+ /*typedef bg::traits::point_type<Box>::type P;
+ bg::model::ring<P> qring;
+ bg::convert(qbox, qring);
+ spatial_query(tree, bgi::covered_by(qring), expected_output);
+ bg::model::polygon<P> qpoly;
+ bg::convert(qbox, qpoly);
+ spatial_query(tree, bgi::covered_by(qpoly), expected_output);*/
+ }
+};
+
+template <>
+struct covered_by_impl<bg::segment_tag>
+{
+ template <typename Rtree, typename Value, typename Box>
+ static void apply(Rtree const& /*tree*/, std::vector<Value> const& /*input*/, Box const& /*qbox*/)
+ {}
+};
+
+template <typename Rtree, typename Value, typename Box>
+void covered_by(Rtree const& tree, std::vector<Value> const& input, Box const& qbox)
+{
+ covered_by_impl<
+ typename bg::tag<
+ typename Rtree::indexable_type
+ >::type
+ >::apply(tree, input, qbox);
+}
+
+template <typename Tag>
+struct covers_impl
+{
+ template <typename Rtree, typename Value, typename Box>
+ static void apply(Rtree const& tree, std::vector<Value> const& input, Box const& qbox)
+ {
+ std::vector<Value> expected_output;
+
+ BOOST_FOREACH(Value const& v, input)
+ if ( bg::covered_by(qbox, tree.indexable_get()(v)) )
+ expected_output.push_back(v);
+
+ spatial_query(tree, bgi::covers(qbox), expected_output);
+
+ /*typedef bg::traits::point_type<Box>::type P;
+ bg::model::ring<P> qring;
+ bg::convert(qbox, qring);
+ spatial_query(tree, bgi::covers(qring), expected_output);
+ bg::model::polygon<P> qpoly;
+ bg::convert(qbox, qpoly);
+ spatial_query(tree, bgi::covers(qpoly), expected_output);*/
+ }
+};
+
+template <>
+struct covers_impl<bg::point_tag>
+{
+ template <typename Rtree, typename Value, typename Box>
+ static void apply(Rtree const& /*tree*/, std::vector<Value> const& /*input*/, Box const& /*qbox*/)
+ {}
+};
+
+template <>
+struct covers_impl<bg::segment_tag>
+{
+ template <typename Rtree, typename Value, typename Box>
+ static void apply(Rtree const& /*tree*/, std::vector<Value> const& /*input*/, Box const& /*qbox*/)
+ {}
+};
+
+template <typename Rtree, typename Value, typename Box>
+void covers(Rtree const& tree, std::vector<Value> const& input, Box const& qbox)
+{
+ covers_impl<
+ typename bg::tag<
+ typename Rtree::indexable_type
+ >::type
+ >::apply(tree, input, qbox);
+}
+
+template <typename Tag>
+struct overlaps_impl
+{
+ template <typename Rtree, typename Value, typename Box>
+ static void apply(Rtree const& tree, std::vector<Value> const& input, Box const& qbox)
+ {
+ std::vector<Value> expected_output;
+
+ BOOST_FOREACH(Value const& v, input)
+ if ( bg::overlaps(tree.indexable_get()(v), qbox) )
+ expected_output.push_back(v);
+
+ spatial_query(tree, bgi::overlaps(qbox), expected_output);
+
+ /*typedef bg::traits::point_type<Box>::type P;
+ bg::model::ring<P> qring;
+ bg::convert(qbox, qring);
+ spatial_query(tree, bgi::overlaps(qring), expected_output);
+ bg::model::polygon<P> qpoly;
+ bg::convert(qbox, qpoly);
+ spatial_query(tree, bgi::overlaps(qpoly), expected_output);*/
+ }
+};
+
+template <>
+struct overlaps_impl<bg::point_tag>
+{
+ template <typename Rtree, typename Value, typename Box>
+ static void apply(Rtree const& /*tree*/, std::vector<Value> const& /*input*/, Box const& /*qbox*/)
+ {}
+};
+
+template <>
+struct overlaps_impl<bg::segment_tag>
+{
+ template <typename Rtree, typename Value, typename Box>
+ static void apply(Rtree const& /*tree*/, std::vector<Value> const& /*input*/, Box const& /*qbox*/)
+ {}
+};
+
+template <typename Rtree, typename Value, typename Box>
+void overlaps(Rtree const& tree, std::vector<Value> const& input, Box const& qbox)
+{
+ overlaps_impl<
+ typename bg::tag<
+ typename Rtree::indexable_type
+ >::type
+ >::apply(tree, input, qbox);
+}
+
+//template <typename Tag, size_t Dimension>
+//struct touches_impl
+//{
+// template <typename Rtree, typename Value, typename Box>
+// static void apply(Rtree const& tree, std::vector<Value> const& input, Box const& qbox)
+// {}
+//};
+//
+//template <>
+//struct touches_impl<bg::box_tag, 2>
+//{
+// template <typename Rtree, typename Value, typename Box>
+// static void apply(Rtree const& tree, std::vector<Value> const& input, Box const& qbox)
+// {
+// std::vector<Value> expected_output;
+//
+// BOOST_FOREACH(Value const& v, input)
+// if ( bg::touches(tree.translator()(v), qbox) )
+// expected_output.push_back(v);
+//
+// spatial_query(tree, bgi::touches(qbox), expected_output);
+// }
+//};
+//
+//template <typename Rtree, typename Value, typename Box>
+//void touches(Rtree const& tree, std::vector<Value> const& input, Box const& qbox)
+//{
+// touches_impl<
+// bgi::traits::tag<typename Rtree::indexable_type>::type,
+// bgi::traits::dimension<typename Rtree::indexable_type>::value
+// >::apply(tree, input, qbox);
+//}
+
+template <typename Tag>
+struct within_impl
+{
+ template <typename Rtree, typename Value, typename Box>
+ static void apply(Rtree const& tree, std::vector<Value> const& input, Box const& qbox)
+ {
+ std::vector<Value> expected_output;
+
+ BOOST_FOREACH(Value const& v, input)
+ if ( bg::within(tree.indexable_get()(v), qbox) )
+ expected_output.push_back(v);
+
+ spatial_query(tree, bgi::within(qbox), expected_output);
+
+ /*typedef bg::traits::point_type<Box>::type P;
+ bg::model::ring<P> qring;
+ bg::convert(qbox, qring);
+ spatial_query(tree, bgi::within(qring), expected_output);
+ bg::model::polygon<P> qpoly;
+ bg::convert(qbox, qpoly);
+ spatial_query(tree, bgi::within(qpoly), expected_output);*/
+ }
+};
+
+template <>
+struct within_impl<bg::segment_tag>
+{
+ template <typename Rtree, typename Value, typename Box>
+ static void apply(Rtree const& /*tree*/, std::vector<Value> const& /*input*/, Box const& /*qbox*/)
+ {}
+};
+
+template <typename Rtree, typename Value, typename Box>
+void within(Rtree const& tree, std::vector<Value> const& input, Box const& qbox)
+{
+ within_impl<
+ typename bg::tag<
+ typename Rtree::indexable_type
+ >::type
+ >::apply(tree, input, qbox);
+}
+
+// rtree nearest queries
+
+template <typename Rtree, typename Point>
+struct NearestKLess
+{
+ typedef typename bg::default_distance_result<Point, typename Rtree::indexable_type>::type D;
+
+ template <typename Value>
+ bool operator()(std::pair<D, Value> const& p1, std::pair<D, Value> const& p2) const
+ {
+ return p1.first < p2.first;
+ }
+};
+
+template <typename Rtree, typename Point>
+struct NearestKTransform
+{
+ typedef typename bg::default_distance_result<Point, typename Rtree::indexable_type>::type D;
+
+ template <typename Value>
+ Value const& operator()(std::pair<D, Value> const& p) const
+ {
+ return p.second;
+ }
+};
+
+template <typename Rtree, typename Value, typename Point, typename Distance>
+inline void compare_nearest_outputs(Rtree const& rtree, std::vector<Value> const& output, std::vector<Value> const& expected_output, Point const& pt, Distance greatest_distance)
+{
+ // check output
+ bool are_sizes_ok = (expected_output.size() == output.size());
+ BOOST_CHECK( are_sizes_ok );
+ if ( are_sizes_ok )
+ {
+ BOOST_FOREACH(Value const& v, output)
+ {
+ // TODO - perform explicit check here?
+ // should all objects which are closest be checked and should exactly the same be found?
+
+ if ( find(rtree, expected_output.begin(), expected_output.end(), v) == expected_output.end() )
+ {
+ Distance d = bg::comparable_distance(pt, rtree.indexable_get()(v));
+ BOOST_CHECK(d == greatest_distance);
+ }
+ }
+ }
+}
+
+template <typename Rtree, typename Value, typename Point>
+inline void check_sorted_by_distance(Rtree const& rtree, std::vector<Value> const& output, Point const& pt)
+{
+ typedef typename bg::default_distance_result<Point, typename Rtree::indexable_type>::type D;
+
+ D prev_dist = 0;
+ BOOST_FOREACH(Value const& v, output)
+ {
+ D d = bg::comparable_distance(pt, rtree.indexable_get()(v));
+ BOOST_CHECK(prev_dist <= d);
+ prev_dist = d;
+ }
+}
+
+template <typename Rtree, typename Value, typename Point>
+inline void nearest_query_k(Rtree const& rtree, std::vector<Value> const& input, Point const& pt, unsigned int k)
+{
+ // TODO: Nearest object may not be the same as found by the rtree if distances are equal
+ // All objects with the same closest distance should be picked
+
+ typedef typename bg::default_distance_result<Point, typename Rtree::indexable_type>::type D;
+
+ std::vector< std::pair<D, Value> > test_output;
+
+ // calculate test output - k closest values pairs
+ BOOST_FOREACH(Value const& v, input)
+ {
+ D d = bg::comparable_distance(pt, rtree.indexable_get()(v));
+
+ if ( test_output.size() < k )
+ test_output.push_back(std::make_pair(d, v));
+ else
+ {
+ std::sort(test_output.begin(), test_output.end(), NearestKLess<Rtree, Point>());
+ if ( d < test_output.back().first )
+ test_output.back() = std::make_pair(d, v);
+ }
+ }
+
+ // caluclate biggest distance
+ std::sort(test_output.begin(), test_output.end(), NearestKLess<Rtree, Point>());
+ D greatest_distance = 0;
+ if ( !test_output.empty() )
+ greatest_distance = test_output.back().first;
+
+ // transform test output to vector of values
+ std::vector<Value> expected_output(test_output.size(), generate::value_default<Value>::apply());
+ std::transform(test_output.begin(), test_output.end(), expected_output.begin(), NearestKTransform<Rtree, Point>());
+
+ // calculate output using rtree
+ std::vector<Value> output;
+ rtree.query(bgi::nearest(pt, k), std::back_inserter(output));
+
+ // check output
+ compare_nearest_outputs(rtree, output, expected_output, pt, greatest_distance);
+
+ exactly_the_same_outputs(rtree, output, rtree | bgi::adaptors::queried(bgi::nearest(pt, k)));
+
+ std::vector<Value> output2(k, generate::value_default<Value>::apply());
+ typename Rtree::size_type found_count = rtree.query(bgi::nearest(pt, k), output2.begin());
+ output2.resize(found_count, generate::value_default<Value>::apply());
+
+ exactly_the_same_outputs(rtree, output, output2);
+
+ std::vector<Value> output3;
+ std::copy(rtree.qbegin(bgi::nearest(pt, k)), rtree.qend(), std::back_inserter(output3));
+
+ compare_nearest_outputs(rtree, output3, expected_output, pt, greatest_distance);
+ check_sorted_by_distance(rtree, output3, pt);
+
+ check_fwd_iterators(rtree.qbegin(bgi::nearest(pt, k)), rtree.qend());
+
+#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
+ {
+ std::vector<Value> output4;
+ std::copy(rtree.qbegin_(bgi::nearest(pt, k)), rtree.qend_(bgi::nearest(pt, k)), std::back_inserter(output4));
+ exactly_the_same_outputs(rtree, output4, output3);
+ output4.clear();
+ copy_alt(rtree.qbegin_(bgi::nearest(pt, k)), rtree.qend_(), std::back_inserter(output4));
+ exactly_the_same_outputs(rtree, output4, output3);
+
+ check_fwd_iterators(rtree.qbegin_(bgi::nearest(pt, k)), rtree.qend_(bgi::nearest(pt, k)));
+ check_fwd_iterators(rtree.qbegin_(bgi::nearest(pt, k)), rtree.qend_());
+ }
+#endif
+}
+
+// rtree nearest not found
+
+struct AlwaysFalse
+{
+ template <typename Value>
+ bool operator()(Value const& ) const { return false; }
+};
+
+template <typename Rtree, typename Point>
+void nearest_query_not_found(Rtree const& rtree, Point const& pt)
+{
+ typedef typename Rtree::value_type Value;
+
+ std::vector<Value> output_v;
+ size_t n_res = rtree.query(bgi::nearest(pt, 5) && bgi::satisfies(AlwaysFalse()), std::back_inserter(output_v));
+ BOOST_CHECK(output_v.size() == n_res);
+ BOOST_CHECK(n_res < 5);
+}
+
+template <typename Value>
+bool satisfies_fun(Value const& ) { return true; }
+
+struct satisfies_obj
+{
+ template <typename Value>
+ bool operator()(Value const& ) const { return true; }
+};
+
+template <typename Rtree, typename Value>
+void satisfies(Rtree const& rtree, std::vector<Value> const& input)
+{
+ std::vector<Value> result;
+ rtree.query(bgi::satisfies(satisfies_obj()), std::back_inserter(result));
+ BOOST_CHECK(result.size() == input.size());
+ result.clear();
+ rtree.query(!bgi::satisfies(satisfies_obj()), std::back_inserter(result));
+ BOOST_CHECK(result.size() == 0);
+
+ result.clear();
+ rtree.query(bgi::satisfies(satisfies_fun<Value>), std::back_inserter(result));
+ BOOST_CHECK(result.size() == input.size());
+ result.clear();
+ rtree.query(!bgi::satisfies(satisfies_fun<Value>), std::back_inserter(result));
+ BOOST_CHECK(result.size() == 0);
+
+#ifndef BOOST_NO_CXX11_LAMBDAS
+ result.clear();
+ rtree.query(bgi::satisfies([](Value const&){ return true; }), std::back_inserter(result));
+ BOOST_CHECK(result.size() == input.size());
+ result.clear();
+ rtree.query(!bgi::satisfies([](Value const&){ return true; }), std::back_inserter(result));
+ BOOST_CHECK(result.size() == 0);
+#endif
+}
+
+// rtree copying and moving
+
+template <typename Rtree, typename Box>
+void copy_swap_move(Rtree const& tree, Box const& qbox)
+{
+ typedef typename Rtree::value_type Value;
+ typedef typename Rtree::parameters_type Params;
+
+ size_t s = tree.size();
+ Params params = tree.parameters();
+
+ std::vector<Value> expected_output;
+ tree.query(bgi::intersects(qbox), std::back_inserter(expected_output));
+
+ // copy constructor
+ Rtree t1(tree);
+
+ BOOST_CHECK(tree.empty() == t1.empty());
+ BOOST_CHECK(tree.size() == t1.size());
+ BOOST_CHECK(t1.parameters().get_max_elements() == params.get_max_elements());
+ BOOST_CHECK(t1.parameters().get_min_elements() == params.get_min_elements());
+
+ std::vector<Value> output;
+ t1.query(bgi::intersects(qbox), std::back_inserter(output));
+ exactly_the_same_outputs(t1, output, expected_output);
+
+ // copying assignment operator
+ t1 = tree;
+
+ BOOST_CHECK(tree.empty() == t1.empty());
+ BOOST_CHECK(tree.size() == t1.size());
+ BOOST_CHECK(t1.parameters().get_max_elements() == params.get_max_elements());
+ BOOST_CHECK(t1.parameters().get_min_elements() == params.get_min_elements());
+
+ output.clear();
+ t1.query(bgi::intersects(qbox), std::back_inserter(output));
+ exactly_the_same_outputs(t1, output, expected_output);
+
+ Rtree t2(tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator());
+ t2.swap(t1);
+ BOOST_CHECK(tree.empty() == t2.empty());
+ BOOST_CHECK(tree.size() == t2.size());
+ BOOST_CHECK(true == t1.empty());
+ BOOST_CHECK(0 == t1.size());
+ // those fails e.g. on darwin 4.2.1 because it can't copy base obejcts properly
+ BOOST_CHECK(t1.parameters().get_max_elements() == params.get_max_elements());
+ BOOST_CHECK(t1.parameters().get_min_elements() == params.get_min_elements());
+ BOOST_CHECK(t2.parameters().get_max_elements() == params.get_max_elements());
+ BOOST_CHECK(t2.parameters().get_min_elements() == params.get_min_elements());
+
+ output.clear();
+ t1.query(bgi::intersects(qbox), std::back_inserter(output));
+ BOOST_CHECK(output.empty());
+
+ output.clear();
+ t2.query(bgi::intersects(qbox), std::back_inserter(output));
+ exactly_the_same_outputs(t2, output, expected_output);
+ t2.swap(t1);
+ // those fails e.g. on darwin 4.2.1 because it can't copy base obejcts properly
+ BOOST_CHECK(t1.parameters().get_max_elements() == params.get_max_elements());
+ BOOST_CHECK(t1.parameters().get_min_elements() == params.get_min_elements());
+ BOOST_CHECK(t2.parameters().get_max_elements() == params.get_max_elements());
+ BOOST_CHECK(t2.parameters().get_min_elements() == params.get_min_elements());
+
+ // moving constructor
+ Rtree t3(boost::move(t1), tree.get_allocator());
+
+ BOOST_CHECK(t3.size() == s);
+ BOOST_CHECK(t1.size() == 0);
+ BOOST_CHECK(t3.parameters().get_max_elements() == params.get_max_elements());
+ BOOST_CHECK(t3.parameters().get_min_elements() == params.get_min_elements());
+
+ output.clear();
+ t3.query(bgi::intersects(qbox), std::back_inserter(output));
+ exactly_the_same_outputs(t3, output, expected_output);
+
+ // moving assignment operator
+ t1 = boost::move(t3);
+
+ BOOST_CHECK(t1.size() == s);
+ BOOST_CHECK(t3.size() == 0);
+ BOOST_CHECK(t1.parameters().get_max_elements() == params.get_max_elements());
+ BOOST_CHECK(t1.parameters().get_min_elements() == params.get_min_elements());
+
+ output.clear();
+ t1.query(bgi::intersects(qbox), std::back_inserter(output));
+ exactly_the_same_outputs(t1, output, expected_output);
+
+ //TODO - test SWAP
+
+ ::boost::ignore_unused(params);
+}
+
+template <typename I, typename O>
+inline void my_copy(I first, I last, O out)
+{
+ for ( ; first != last ; ++first, ++out )
+ *out = *first;
+}
+
+// rtree creation and insertion
+
+template <typename Rtree, typename Value, typename Box>
+void create_insert(Rtree const& tree, std::vector<Value> const& input, Box const& qbox)
+{
+ std::vector<Value> expected_output;
+ tree.query(bgi::intersects(qbox), std::back_inserter(expected_output));
+
+ {
+ Rtree t(tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator());
+ BOOST_FOREACH(Value const& v, input)
+ t.insert(v);
+ BOOST_CHECK(tree.size() == t.size());
+ std::vector<Value> output;
+ t.query(bgi::intersects(qbox), std::back_inserter(output));
+ exactly_the_same_outputs(t, output, expected_output);
+ }
+ {
+ Rtree t(tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator());
+ //std::copy(input.begin(), input.end(), bgi::inserter(t));
+ my_copy(input.begin(), input.end(), bgi::inserter(t)); // to suppress MSVC warnings
+ BOOST_CHECK(tree.size() == t.size());
+ std::vector<Value> output;
+ t.query(bgi::intersects(qbox), std::back_inserter(output));
+ exactly_the_same_outputs(t, output, expected_output);
+ }
+ {
+ Rtree t(input.begin(), input.end(), tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator());
+ BOOST_CHECK(tree.size() == t.size());
+ std::vector<Value> output;
+ t.query(bgi::intersects(qbox), std::back_inserter(output));
+ compare_outputs(t, output, expected_output);
+ }
+ {
+ Rtree t(input, tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator());
+ BOOST_CHECK(tree.size() == t.size());
+ std::vector<Value> output;
+ t.query(bgi::intersects(qbox), std::back_inserter(output));
+ compare_outputs(t, output, expected_output);
+ }
+ {
+ Rtree t(tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator());
+ t.insert(input.begin(), input.end());
+ BOOST_CHECK(tree.size() == t.size());
+ std::vector<Value> output;
+ t.query(bgi::intersects(qbox), std::back_inserter(output));
+ exactly_the_same_outputs(t, output, expected_output);
+ }
+ {
+ Rtree t(tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator());
+ t.insert(input);
+ BOOST_CHECK(tree.size() == t.size());
+ std::vector<Value> output;
+ t.query(bgi::intersects(qbox), std::back_inserter(output));
+ exactly_the_same_outputs(t, output, expected_output);
+ }
+
+ {
+ Rtree t(tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator());
+ BOOST_FOREACH(Value const& v, input)
+ bgi::insert(t, v);
+ BOOST_CHECK(tree.size() == t.size());
+ std::vector<Value> output;
+ bgi::query(t, bgi::intersects(qbox), std::back_inserter(output));
+ exactly_the_same_outputs(t, output, expected_output);
+ }
+ {
+ Rtree t(tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator());
+ bgi::insert(t, input.begin(), input.end());
+ BOOST_CHECK(tree.size() == t.size());
+ std::vector<Value> output;
+ bgi::query(t, bgi::intersects(qbox), std::back_inserter(output));
+ exactly_the_same_outputs(t, output, expected_output);
+ }
+ {
+ Rtree t(tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator());
+ bgi::insert(t, input);
+ BOOST_CHECK(tree.size() == t.size());
+ std::vector<Value> output;
+ bgi::query(t, bgi::intersects(qbox), std::back_inserter(output));
+ exactly_the_same_outputs(t, output, expected_output);
+ }
+}
+
+// rtree removing
+
+template <typename Rtree, typename Box>
+void remove(Rtree const& tree, Box const& qbox)
+{
+ typedef typename Rtree::value_type Value;
+
+ std::vector<Value> values_to_remove;
+ tree.query(bgi::intersects(qbox), std::back_inserter(values_to_remove));
+ BOOST_CHECK(0 < values_to_remove.size());
+
+ std::vector<Value> expected_output;
+ tree.query(bgi::disjoint(qbox), std::back_inserter(expected_output));
+ size_t expected_removed_count = values_to_remove.size();
+ size_t expected_size_after_remove = tree.size() - values_to_remove.size();
+
+ // Add value which is not stored in the Rtree
+ Value outsider = generate::value_outside<Rtree>();
+ values_to_remove.push_back(outsider);
+
+ {
+ Rtree t(tree);
+ size_t r = 0;
+ BOOST_FOREACH(Value const& v, values_to_remove)
+ r += t.remove(v);
+ BOOST_CHECK( r == expected_removed_count );
+ std::vector<Value> output;
+ t.query(bgi::disjoint(qbox), std::back_inserter(output));
+ BOOST_CHECK( t.size() == expected_size_after_remove );
+ BOOST_CHECK( output.size() == tree.size() - expected_removed_count );
+ compare_outputs(t, output, expected_output);
+ }
+ {
+ Rtree t(tree);
+ size_t r = t.remove(values_to_remove.begin(), values_to_remove.end());
+ BOOST_CHECK( r == expected_removed_count );
+ std::vector<Value> output;
+ t.query(bgi::disjoint(qbox), std::back_inserter(output));
+ BOOST_CHECK( t.size() == expected_size_after_remove );
+ BOOST_CHECK( output.size() == tree.size() - expected_removed_count );
+ compare_outputs(t, output, expected_output);
+ }
+ {
+ Rtree t(tree);
+ size_t r = t.remove(values_to_remove);
+ BOOST_CHECK( r == expected_removed_count );
+ std::vector<Value> output;
+ t.query(bgi::disjoint(qbox), std::back_inserter(output));
+ BOOST_CHECK( t.size() == expected_size_after_remove );
+ BOOST_CHECK( output.size() == tree.size() - expected_removed_count );
+ compare_outputs(t, output, expected_output);
+ }
+
+ {
+ Rtree t(tree);
+ size_t r = 0;
+ BOOST_FOREACH(Value const& v, values_to_remove)
+ r += bgi::remove(t, v);
+ BOOST_CHECK( r == expected_removed_count );
+ std::vector<Value> output;
+ bgi::query(t, bgi::disjoint(qbox), std::back_inserter(output));
+ BOOST_CHECK( t.size() == expected_size_after_remove );
+ BOOST_CHECK( output.size() == tree.size() - expected_removed_count );
+ compare_outputs(t, output, expected_output);
+ }
+ {
+ Rtree t(tree);
+ size_t r = bgi::remove(t, values_to_remove.begin(), values_to_remove.end());
+ BOOST_CHECK( r == expected_removed_count );
+ std::vector<Value> output;
+ bgi::query(t, bgi::disjoint(qbox), std::back_inserter(output));
+ BOOST_CHECK( t.size() == expected_size_after_remove );
+ BOOST_CHECK( output.size() == tree.size() - expected_removed_count );
+ compare_outputs(t, output, expected_output);
+ }
+ {
+ Rtree t(tree);
+ size_t r = bgi::remove(t, values_to_remove);
+ BOOST_CHECK( r == expected_removed_count );
+ std::vector<Value> output;
+ bgi::query(t, bgi::disjoint(qbox), std::back_inserter(output));
+ BOOST_CHECK( t.size() == expected_size_after_remove );
+ BOOST_CHECK( output.size() == tree.size() - expected_removed_count );
+ compare_outputs(t, output, expected_output);
+ }
+}
+
+template <typename Rtree, typename Value, typename Box>
+void clear(Rtree const& tree, std::vector<Value> const& input, Box const& qbox)
+{
+ std::vector<Value> values_to_remove;
+ tree.query(bgi::intersects(qbox), std::back_inserter(values_to_remove));
+ BOOST_CHECK(0 < values_to_remove.size());
+
+ //clear
+ {
+ Rtree t(tree);
+
+ std::vector<Value> expected_output;
+ t.query(bgi::intersects(qbox), std::back_inserter(expected_output));
+ size_t s = t.size();
+ t.clear();
+ BOOST_CHECK(t.empty());
+ BOOST_CHECK(t.size() == 0);
+ t.insert(input);
+ BOOST_CHECK(t.size() == s);
+ std::vector<Value> output;
+ t.query(bgi::intersects(qbox), std::back_inserter(output));
+ exactly_the_same_outputs(t, output, expected_output);
+ }
+}
+
+template <typename Rtree, typename Value>
+void range(Rtree & tree, std::vector<Value> const& input)
+{
+ check_fwd_iterators(tree.begin(), tree.end());
+
+ size_t count = std::distance(tree.begin(), tree.end());
+ BOOST_CHECK(count == tree.size());
+ BOOST_CHECK(count == input.size());
+
+ count = std::distance(boost::begin(tree), boost::end(tree));
+ BOOST_CHECK(count == tree.size());
+
+ count = boost::size(tree);
+ BOOST_CHECK(count == tree.size());
+
+ count = 0;
+ BOOST_FOREACH(Value const& v, tree)
+ {
+ boost::ignore_unused(v);
+ ++count;
+ }
+ BOOST_CHECK(count == tree.size());
+
+}
+
+// rtree queries
+
+template <typename Rtree, typename Value, typename Box>
+void queries(Rtree const& tree, std::vector<Value> const& input, Box const& qbox)
+{
+ basictest::intersects(tree, input, qbox);
+ basictest::disjoint(tree, input, qbox);
+ basictest::covered_by(tree, input, qbox);
+ basictest::overlaps(tree, input, qbox);
+ //basictest::touches(tree, input, qbox);
+ basictest::within(tree, input, qbox);
+ basictest::contains(tree, input, qbox);
+ basictest::covers(tree, input, qbox);
+
+ typedef typename bg::point_type<Box>::type P;
+ P pt;
+ bg::centroid(qbox, pt);
+
+ basictest::nearest_query_k(tree, input, pt, 10);
+ basictest::nearest_query_not_found(tree, generate::outside_point<P>::apply());
+
+ basictest::satisfies(tree, input);
+}
+
+// rtree creation and modification
+
+template <typename Rtree, typename Value, typename Box>
+void modifiers(Rtree const& tree, std::vector<Value> const& input, Box const& qbox)
+{
+ basictest::copy_swap_move(tree, qbox);
+ basictest::create_insert(tree, input, qbox);
+ basictest::remove(tree, qbox);
+ basictest::clear(tree, input, qbox);
+}
+
+} // namespace basictest
+
+template <typename Value, typename Parameters, typename Allocator>
+void test_rtree_queries(Parameters const& parameters, Allocator const& allocator)
+{
+ typedef bgi::indexable<Value> I;
+ typedef bgi::equal_to<Value> E;
+ typedef typename Allocator::template rebind<Value>::other A;
+ typedef bgi::rtree<Value, Parameters, I, E, A> Tree;
+ typedef typename Tree::bounds_type B;
+
+ Tree tree(parameters, I(), E(), allocator);
+ std::vector<Value> input;
+ B qbox;
+
+ generate::rtree(tree, input, qbox);
+
+ basictest::queries(tree, input, qbox);
+
+ Tree empty_tree(parameters, I(), E(), allocator);
+ std::vector<Value> empty_input;
+
+ basictest::queries(empty_tree, empty_input, qbox);
+}
+
+template <typename Value, typename Parameters, typename Allocator>
+void test_rtree_modifiers(Parameters const& parameters, Allocator const& allocator)
+{
+ typedef bgi::indexable<Value> I;
+ typedef bgi::equal_to<Value> E;
+ typedef typename Allocator::template rebind<Value>::other A;
+ typedef bgi::rtree<Value, Parameters, I, E, A> Tree;
+ typedef typename Tree::bounds_type B;
+
+ Tree tree(parameters, I(), E(), allocator);
+ std::vector<Value> input;
+ B qbox;
+
+ generate::rtree(tree, input, qbox);
+
+ basictest::modifiers(tree, input, qbox);
+
+ Tree empty_tree(parameters, I(), E(), allocator);
+ std::vector<Value> empty_input;
+
+ basictest::copy_swap_move(empty_tree, qbox);
+}
+
+// run all tests for a single Algorithm and single rtree
+// defined by Value
+
+template <typename Value, typename Parameters, typename Allocator>
+void test_rtree_by_value(Parameters const& parameters, Allocator const& allocator)
+{
+ test_rtree_queries<Value>(parameters, allocator);
+ test_rtree_modifiers<Value>(parameters, allocator);
+}
+
+// rtree inserting and removing of counting_value
+
+template <typename Indexable, typename Parameters, typename Allocator>
+void test_count_rtree_values(Parameters const& parameters, Allocator const& allocator)
+{
+ typedef counting_value<Indexable> Value;
+
+ typedef bgi::indexable<Value> I;
+ typedef bgi::equal_to<Value> E;
+ typedef typename Allocator::template rebind<Value>::other A;
+ typedef bgi::rtree<Value, Parameters, I, E, A> Tree;
+ typedef typename Tree::bounds_type B;
+
+ Tree t(parameters, I(), E(), allocator);
+ std::vector<Value> input;
+ B qbox;
+
+ generate::rtree(t, input, qbox);
+
+ size_t rest_count = input.size();
+
+ BOOST_CHECK(t.size() + rest_count == Value::counter());
+
+ std::vector<Value> values_to_remove;
+ t.query(bgi::intersects(qbox), std::back_inserter(values_to_remove));
+
+ rest_count += values_to_remove.size();
+
+ BOOST_CHECK(t.size() + rest_count == Value::counter());
+
+ size_t values_count = Value::counter();
+
+ BOOST_FOREACH(Value const& v, values_to_remove)
+ {
+ size_t r = t.remove(v);
+ --values_count;
+
+ BOOST_CHECK(1 == r);
+ BOOST_CHECK(Value::counter() == values_count);
+ BOOST_CHECK(t.size() + rest_count == values_count);
+ }
+}
+
+// rtree count
+
+template <typename Indexable, typename Parameters, typename Allocator>
+void test_rtree_count(Parameters const& parameters, Allocator const& allocator)
+{
+ typedef std::pair<Indexable, int> Value;
+
+ typedef bgi::indexable<Value> I;
+ typedef bgi::equal_to<Value> E;
+ typedef typename Allocator::template rebind<Value>::other A;
+ typedef bgi::rtree<Value, Parameters, I, E, A> Tree;
+ typedef typename Tree::bounds_type B;
+
+ Tree t(parameters, I(), E(), allocator);
+ std::vector<Value> input;
+ B qbox;
+
+ generate::rtree(t, input, qbox);
+
+ BOOST_CHECK(t.count(input[0]) == 1);
+ BOOST_CHECK(t.count(input[0].first) == 1);
+
+ t.insert(input[0]);
+
+ BOOST_CHECK(t.count(input[0]) == 2);
+ BOOST_CHECK(t.count(input[0].first) == 2);
+
+ t.insert(std::make_pair(input[0].first, -1));
+
+ BOOST_CHECK(t.count(input[0]) == 2);
+ BOOST_CHECK(t.count(input[0].first) == 3);
+}
+
+// test rtree box
+
+template <typename Value, typename Parameters, typename Allocator>
+void test_rtree_bounds(Parameters const& parameters, Allocator const& allocator)
+{
+ typedef bgi::indexable<Value> I;
+ typedef bgi::equal_to<Value> E;
+ typedef typename Allocator::template rebind<Value>::other A;
+ typedef bgi::rtree<Value, Parameters, I, E, A> Tree;
+ typedef typename Tree::bounds_type B;
+ //typedef typename bg::traits::point_type<B>::type P;
+
+ Tree t(parameters, I(), E(), allocator);
+ std::vector<Value> input;
+ B qbox;
+
+ B b;
+ bg::assign_inverse(b);
+
+ BOOST_CHECK(bg::equals(t.bounds(), b));
+
+ generate::rtree(t, input, qbox);
+
+ b = bgi::detail::rtree::values_box<B>(input.begin(), input.end(), t.indexable_get(),
+ bgi::detail::get_strategy(parameters));
+
+ BOOST_CHECK(bg::equals(t.bounds(), b));
+ BOOST_CHECK(bg::equals(t.bounds(), bgi::bounds(t)));
+
+ size_t s = input.size();
+ while ( s/2 < input.size() && !input.empty() )
+ {
+ t.remove(input.back());
+ input.pop_back();
+ }
+
+ b = bgi::detail::rtree::values_box<B>(input.begin(), input.end(), t.indexable_get(),
+ bgi::detail::get_strategy(parameters));
+
+ BOOST_CHECK(bg::equals(t.bounds(), b));
+
+ Tree t2(t);
+ BOOST_CHECK(bg::equals(t2.bounds(), b));
+ t2.clear();
+ t2 = t;
+ BOOST_CHECK(bg::equals(t2.bounds(), b));
+ t2.clear();
+ t2 = boost::move(t);
+ BOOST_CHECK(bg::equals(t2.bounds(), b));
+
+ t.clear();
+
+ bg::assign_inverse(b);
+ BOOST_CHECK(bg::equals(t.bounds(), b));
+}
+
+// test rtree iterator
+
+template <typename Indexable, typename Parameters, typename Allocator>
+void test_rtree_range(Parameters const& parameters, Allocator const& allocator)
+{
+ typedef std::pair<Indexable, int> Value;
+
+ typedef bgi::indexable<Value> I;
+ typedef bgi::equal_to<Value> E;
+ typedef typename Allocator::template rebind<Value>::other A;
+ typedef bgi::rtree<Value, Parameters, I, E, A> Tree;
+ typedef typename Tree::bounds_type B;
+
+ Tree t(parameters, I(), E(), allocator);
+ std::vector<Value> input;
+ B qbox;
+
+ generate::rtree(t, input, qbox);
+
+ basictest::range(t, input);
+ basictest::range((Tree const&)t, input);
+}
+
+template <typename Indexable, typename Parameters, typename Allocator>
+void test_rtree_additional(Parameters const& parameters, Allocator const& allocator)
+{
+ test_count_rtree_values<Indexable>(parameters, allocator);
+ test_rtree_count<Indexable>(parameters, allocator);
+ test_rtree_bounds<Indexable>(parameters, allocator);
+ test_rtree_range<Indexable>(parameters, allocator);
+}
+
+// run all tests for one Algorithm for some number of rtrees
+// defined by some number of Values constructed from given Point
+
+template<typename Point, typename Parameters, typename Allocator>
+void test_rtree_for_point(Parameters const& parameters, Allocator const& allocator)
+{
+ typedef std::pair<Point, int> PairP;
+ typedef boost::tuple<Point, int, int> TupleP;
+ typedef boost::shared_ptr< test_object<Point> > SharedPtrP;
+ typedef value_no_dctor<Point> VNoDCtor;
+
+ test_rtree_by_value<Point, Parameters>(parameters, allocator);
+ test_rtree_by_value<PairP, Parameters>(parameters, allocator);
+ test_rtree_by_value<TupleP, Parameters>(parameters, allocator);
+
+ test_rtree_by_value<SharedPtrP, Parameters>(parameters, allocator);
+ test_rtree_by_value<VNoDCtor, Parameters>(parameters, allocator);
+
+ test_rtree_additional<Point>(parameters, allocator);
+
+#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+ typedef std::tuple<Point, int, int> StdTupleP;
+ test_rtree_by_value<StdTupleP, Parameters>(parameters, allocator);
+#endif
+}
+
+template<typename Point, typename Parameters, typename Allocator>
+void test_rtree_for_box(Parameters const& parameters, Allocator const& allocator)
+{
+ typedef bg::model::box<Point> Box;
+ typedef std::pair<Box, int> PairB;
+ typedef boost::tuple<Box, int, int> TupleB;
+ typedef value_no_dctor<Box> VNoDCtor;
+
+ test_rtree_by_value<Box, Parameters>(parameters, allocator);
+ test_rtree_by_value<PairB, Parameters>(parameters, allocator);
+ test_rtree_by_value<TupleB, Parameters>(parameters, allocator);
+
+ test_rtree_by_value<VNoDCtor, Parameters>(parameters, allocator);
+
+ test_rtree_additional<Box>(parameters, allocator);
+
+#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+ typedef std::tuple<Box, int, int> StdTupleB;
+ test_rtree_by_value<StdTupleB, Parameters>(parameters, allocator);
+#endif
+}
+
+template<typename Point, typename Parameters>
+void test_rtree_for_point(Parameters const& parameters)
+{
+ test_rtree_for_point<Point>(parameters, std::allocator<int>());
+}
+
+template<typename Point, typename Parameters>
+void test_rtree_for_box(Parameters const& parameters)
+{
+ test_rtree_for_box<Point>(parameters, std::allocator<int>());
+}
+
+namespace testset {
+
+template<typename Indexable, typename Parameters, typename Allocator>
+void modifiers(Parameters const& parameters, Allocator const& allocator)
+{
+ typedef std::pair<Indexable, int> Pair;
+ typedef boost::tuple<Indexable, int, int> Tuple;
+ typedef boost::shared_ptr< test_object<Indexable> > SharedPtr;
+ typedef value_no_dctor<Indexable> VNoDCtor;
+
+ test_rtree_modifiers<Indexable>(parameters, allocator);
+ test_rtree_modifiers<Pair>(parameters, allocator);
+ test_rtree_modifiers<Tuple>(parameters, allocator);
+
+ test_rtree_modifiers<SharedPtr>(parameters, allocator);
+ test_rtree_modifiers<VNoDCtor>(parameters, allocator);
+
+#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+ typedef std::tuple<Indexable, int, int> StdTuple;
+ test_rtree_modifiers<StdTuple>(parameters, allocator);
+#endif
+}
+
+template<typename Indexable, typename Parameters, typename Allocator>
+void queries(Parameters const& parameters, Allocator const& allocator)
+{
+ typedef std::pair<Indexable, int> Pair;
+ typedef boost::tuple<Indexable, int, int> Tuple;
+ typedef boost::shared_ptr< test_object<Indexable> > SharedPtr;
+ typedef value_no_dctor<Indexable> VNoDCtor;
+
+ test_rtree_queries<Indexable>(parameters, allocator);
+ test_rtree_queries<Pair>(parameters, allocator);
+ test_rtree_queries<Tuple>(parameters, allocator);
+
+ test_rtree_queries<SharedPtr>(parameters, allocator);
+ test_rtree_queries<VNoDCtor>(parameters, allocator);
+
+#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+ typedef std::tuple<Indexable, int, int> StdTuple;
+ test_rtree_queries<StdTuple>(parameters, allocator);
+#endif
+}
+
+template<typename Indexable, typename Parameters, typename Allocator>
+void additional(Parameters const& parameters, Allocator const& allocator)
+{
+ test_rtree_additional<Indexable, Parameters>(parameters, allocator);
+}
+
+} // namespace testset
+
+#endif // BOOST_GEOMETRY_INDEX_TEST_RTREE_HPP
diff --git a/src/boost/libs/geometry/index/test/varray.cpp b/src/boost/libs/geometry/index/test/varray.cpp
new file mode 100644
index 00000000..d561f1c7
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/varray.cpp
@@ -0,0 +1,781 @@
+// Boost.Geometry.Index varray
+// Unit Test
+
+// Copyright (c) 2012-2014 Adam Wulkiewicz, Lodz, Poland.
+// Copyright (c) 2012-2013 Andrew Hundt.
+
+// 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/test/included/test_exec_monitor.hpp>
+#include <boost/test/impl/execution_monitor.ipp>
+
+// TODO: Disable parts of the unit test that should not run when BOOST_NO_EXCEPTIONS
+// if exceptions are enabled there must be a user defined throw_exception function
+#ifdef BOOST_NO_EXCEPTIONS
+namespace boost {
+ void throw_exception(std::exception const & e){}; // user defined
+} // namespace boost
+#endif // BOOST_NO_EXCEPTIONS
+
+#include <vector>
+#include <list>
+
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+#include <boost/container/vector.hpp>
+#include <boost/container/stable_vector.hpp>
+using namespace boost::container;
+#endif
+
+#include "varray_test.hpp"
+
+using namespace boost::geometry::index::detail;
+
+template <typename T, size_t N>
+void test_ctor_ndc()
+{
+ varray<T, N> s;
+ BOOST_CHECK_EQUAL(s.size(), 0u);
+ BOOST_CHECK(s.capacity() == N);
+#ifndef BOOST_NO_EXCEPTIONS
+ BOOST_CHECK_THROW( s.at(0), std::out_of_range );
+#endif // BOOST_NO_EXCEPTIONS
+}
+
+template <typename T, size_t N>
+void test_ctor_nc(size_t n)
+{
+ varray<T, N> s(n);
+ BOOST_CHECK(s.size() == n);
+ BOOST_CHECK(s.capacity() == N);
+#ifndef BOOST_NO_EXCEPTIONS
+ BOOST_CHECK_THROW( s.at(n), std::out_of_range );
+#endif // BOOST_NO_EXCEPTIONS
+ if ( 1 < n )
+ {
+ T val10(10);
+ s[0] = val10;
+ BOOST_CHECK(T(10) == s[0]);
+ BOOST_CHECK(T(10) == s.at(0));
+ T val20(20);
+ s.at(1) = val20;
+ BOOST_CHECK(T(20) == s[1]);
+ BOOST_CHECK(T(20) == s.at(1));
+ }
+}
+
+template <typename T, size_t N>
+void test_ctor_nd(size_t n, T const& v)
+{
+ varray<T, N> s(n, v);
+ BOOST_CHECK(s.size() == n);
+ BOOST_CHECK(s.capacity() == N);
+#ifndef BOOST_NO_EXCEPTIONS
+ BOOST_CHECK_THROW( s.at(n), std::out_of_range );
+#endif // BOOST_NO_EXCEPTIONS
+ if ( 1 < n )
+ {
+ BOOST_CHECK(v == s[0]);
+ BOOST_CHECK(v == s.at(0));
+ BOOST_CHECK(v == s[1]);
+ BOOST_CHECK(v == s.at(1));
+ s[0] = T(10);
+ BOOST_CHECK(T(10) == s[0]);
+ BOOST_CHECK(T(10) == s.at(0));
+ s.at(1) = T(20);
+ BOOST_CHECK(T(20) == s[1]);
+ BOOST_CHECK(T(20) == s.at(1));
+ }
+}
+
+template <typename T, size_t N>
+void test_resize_nc(size_t n)
+{
+ varray<T, N> s;
+
+ s.resize(n);
+ BOOST_CHECK(s.size() == n);
+ BOOST_CHECK(s.capacity() == N);
+#ifndef BOOST_NO_EXCEPTIONS
+ BOOST_CHECK_THROW( s.at(n), std::out_of_range );
+#endif // BOOST_NO_EXCEPTIONS
+ if ( 1 < n )
+ {
+ T val10(10);
+ s[0] = val10;
+ BOOST_CHECK(T(10) == s[0]);
+ BOOST_CHECK(T(10) == s.at(0));
+ T val20(20);
+ s.at(1) = val20;
+ BOOST_CHECK(T(20) == s[1]);
+ BOOST_CHECK(T(20) == s.at(1));
+ }
+}
+
+template <typename T, size_t N>
+void test_resize_nd(size_t n, T const& v)
+{
+ varray<T, N> s;
+
+ s.resize(n, v);
+ BOOST_CHECK(s.size() == n);
+ BOOST_CHECK(s.capacity() == N);
+#ifndef BOOST_NO_EXCEPTIONS
+ BOOST_CHECK_THROW( s.at(n), std::out_of_range );
+#endif // BOOST_NO_EXCEPTIONS
+ if ( 1 < n )
+ {
+ BOOST_CHECK(v == s[0]);
+ BOOST_CHECK(v == s.at(0));
+ BOOST_CHECK(v == s[1]);
+ BOOST_CHECK(v == s.at(1));
+ s[0] = T(10);
+ BOOST_CHECK(T(10) == s[0]);
+ BOOST_CHECK(T(10) == s.at(0));
+ s.at(1) = T(20);
+ BOOST_CHECK(T(20) == s[1]);
+ BOOST_CHECK(T(20) == s.at(1));
+ }
+}
+
+template <typename T, size_t N>
+void test_push_back_nd()
+{
+ varray<T, N> s;
+
+ BOOST_CHECK(s.size() == 0);
+#ifndef BOOST_NO_EXCEPTIONS
+ BOOST_CHECK_THROW( s.at(0), std::out_of_range );
+#endif // BOOST_NO_EXCEPTIONS
+
+ for ( size_t i = 0 ; i < N ; ++i )
+ {
+ T t(i);
+ s.push_back(t);
+ BOOST_CHECK(s.size() == i + 1);
+#ifndef BOOST_NO_EXCEPTIONS
+ BOOST_CHECK_THROW( s.at(i + 1), std::out_of_range );
+#endif // BOOST_NO_EXCEPTIONS
+ BOOST_CHECK(T(i) == s.at(i));
+ BOOST_CHECK(T(i) == s[i]);
+ BOOST_CHECK(T(i) == s.back());
+ BOOST_CHECK(T(0) == s.front());
+ BOOST_CHECK(T(i) == *(s.data() + i));
+ }
+}
+
+template <typename T, size_t N>
+void test_pop_back_nd()
+{
+ varray<T, N> s;
+
+ for ( size_t i = 0 ; i < N ; ++i )
+ {
+ T t(i);
+ s.push_back(t);
+ }
+
+ for ( size_t i = N ; i > 1 ; --i )
+ {
+ s.pop_back();
+ BOOST_CHECK(s.size() == i - 1);
+#ifndef BOOST_NO_EXCEPTIONS
+ BOOST_CHECK_THROW( s.at(i - 1), std::out_of_range );
+#endif // BOOST_NO_EXCEPTIONS
+ BOOST_CHECK(T(i - 2) == s.at(i - 2));
+ BOOST_CHECK(T(i - 2) == s[i - 2]);
+ BOOST_CHECK(T(i - 2) == s.back());
+ BOOST_CHECK(T(0) == s.front());
+ }
+}
+
+template <typename It1, typename It2>
+void test_compare_ranges(It1 first1, It1 last1, It2 first2, It2 last2)
+{
+ BOOST_CHECK(std::distance(first1, last1) == std::distance(first2, last2));
+ for ( ; first1 != last1 && first2 != last2 ; ++first1, ++first2 )
+ BOOST_CHECK(*first1 == *first2);
+}
+
+template <typename T, size_t N, typename C>
+void test_copy_and_assign(C const& c)
+{
+ {
+ varray<T, N> s(c.begin(), c.end());
+ BOOST_CHECK(s.size() == c.size());
+ test_compare_ranges(s.begin(), s.end(), c.begin(), c.end());
+ }
+ {
+ varray<T, N> s;
+ BOOST_CHECK(0 == s.size());
+ s.assign(c.begin(), c.end());
+ BOOST_CHECK(s.size() == c.size());
+ test_compare_ranges(s.begin(), s.end(), c.begin(), c.end());
+ }
+}
+
+template <typename T, size_t N>
+void test_copy_and_assign_nd(T const& val)
+{
+ varray<T, N> s;
+ std::vector<T> v;
+ std::list<T> l;
+
+ for ( size_t i = 0 ; i < N ; ++i )
+ {
+ T t(i);
+ s.push_back(t);
+ v.push_back(t);
+ l.push_back(t);
+ }
+ // copy ctor
+ {
+ varray<T, N> s1(s);
+ BOOST_CHECK(s.size() == s1.size());
+ test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end());
+ }
+ // copy assignment
+ {
+ varray<T, N> s1;
+ BOOST_CHECK(0 == s1.size());
+ s1 = s;
+ BOOST_CHECK(s.size() == s1.size());
+ test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end());
+ }
+
+ // ctor(Iter, Iter) and assign(Iter, Iter)
+ test_copy_and_assign<T, N>(s);
+ test_copy_and_assign<T, N>(v);
+ test_copy_and_assign<T, N>(l);
+
+ // assign(N, V)
+ {
+ varray<T, N> s1(s);
+ test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end());
+ std::vector<T> a(N, val);
+ s1.assign(N, val);
+ test_compare_ranges(a.begin(), a.end(), s1.begin(), s1.end());
+ }
+
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+ stable_vector<T> bsv(s.begin(), s.end());
+ vector<T> bv(s.begin(), s.end());
+ test_copy_and_assign<T, N>(bsv);
+ test_copy_and_assign<T, N>(bv);
+#endif
+}
+
+template <typename T, size_t N>
+void test_iterators_nd()
+{
+ varray<T, N> s;
+ std::vector<T> v;
+
+ for ( size_t i = 0 ; i < N ; ++i )
+ {
+ s.push_back(T(i));
+ v.push_back(T(i));
+ }
+
+ test_compare_ranges(s.begin(), s.end(), v.begin(), v.end());
+ test_compare_ranges(s.rbegin(), s.rend(), v.rbegin(), v.rend());
+
+ s.assign(v.rbegin(), v.rend());
+
+ test_compare_ranges(s.cbegin(), s.cend(), v.rbegin(), v.rend());
+ test_compare_ranges(s.crbegin(), s.crend(), v.begin(), v.end());
+
+ varray<T, N> const& cs = s;
+ std::vector<T> const& cv = v;
+ s.assign(cv.rbegin(), cv.rend());
+
+ test_compare_ranges(cs.begin(), cs.end(), cv.rbegin(), cv.rend());
+ test_compare_ranges(cs.rbegin(), cs.rend(), cv.begin(), cv.end());
+}
+
+template <typename T, size_t N>
+void test_erase_nd()
+{
+ varray<T, N> s;
+ typedef typename varray<T, N>::iterator It;
+
+ for ( size_t i = 0 ; i < N ; ++i )
+ s.push_back(T(i));
+
+ // erase(pos)
+ {
+ for ( size_t i = 0 ; i < N ; ++i )
+ {
+ varray<T, N> s1(s);
+ It it = s1.erase(s1.begin() + i);
+ BOOST_CHECK(s1.begin() + i == it);
+ BOOST_CHECK(s1.size() == N - 1);
+ for ( size_t j = 0 ; j < i ; ++j )
+ BOOST_CHECK(s1[j] == T(j));
+ for ( size_t j = i+1 ; j < N ; ++j )
+ BOOST_CHECK(s1[j-1] == T(j));
+ }
+ }
+ // erase(first, last)
+ {
+ size_t n = N/3;
+ for ( size_t i = 0 ; i <= N ; ++i )
+ {
+ varray<T, N> s1(s);
+ size_t removed = i + n < N ? n : N - i;
+ It it = s1.erase(s1.begin() + i, s1.begin() + i + removed);
+ BOOST_CHECK(s1.begin() + i == it);
+ BOOST_CHECK(s1.size() == N - removed);
+ for ( size_t j = 0 ; j < i ; ++j )
+ BOOST_CHECK(s1[j] == T(j));
+ for ( size_t j = i+n ; j < N ; ++j )
+ BOOST_CHECK(s1[j-n] == T(j));
+ }
+ }
+}
+
+template <typename T, size_t N, typename SV, typename C>
+void test_insert(SV const& s, C const& c)
+{
+ size_t h = N/2;
+ size_t n = size_t(h/1.5f);
+
+ for ( size_t i = 0 ; i <= h ; ++i )
+ {
+ varray<T, N> s1(s);
+
+ typename C::const_iterator it = c.begin();
+ std::advance(it, n);
+ typename varray<T, N>::iterator
+ it1 = s1.insert(s1.begin() + i, c.begin(), it);
+
+ BOOST_CHECK(s1.begin() + i == it1);
+ BOOST_CHECK(s1.size() == h+n);
+ for ( size_t j = 0 ; j < i ; ++j )
+ BOOST_CHECK(s1[j] == T(j));
+ for ( size_t j = 0 ; j < n ; ++j )
+ BOOST_CHECK(s1[j+i] == T(100 + j));
+ for ( size_t j = 0 ; j < h-i ; ++j )
+ BOOST_CHECK(s1[j+i+n] == T(j+i));
+ }
+}
+
+template <typename T, size_t N>
+void test_insert_nd(T const& val)
+{
+ size_t h = N/2;
+
+ varray<T, N> s, ss;
+ std::vector<T> v;
+ std::list<T> l;
+
+ typedef typename varray<T, N>::iterator It;
+
+ for ( size_t i = 0 ; i < h ; ++i )
+ {
+ s.push_back(T(i));
+ ss.push_back(T(100 + i));
+ v.push_back(T(100 + i));
+ l.push_back(T(100 + i));
+ }
+
+ // insert(pos, val)
+ {
+ for ( size_t i = 0 ; i <= h ; ++i )
+ {
+ varray<T, N> s1(s);
+ It it = s1.insert(s1.begin() + i, val);
+ BOOST_CHECK(s1.begin() + i == it);
+ BOOST_CHECK(s1.size() == h+1);
+ for ( size_t j = 0 ; j < i ; ++j )
+ BOOST_CHECK(s1[j] == T(j));
+ BOOST_CHECK(s1[i] == val);
+ for ( size_t j = 0 ; j < h-i ; ++j )
+ BOOST_CHECK(s1[j+i+1] == T(j+i));
+ }
+ }
+ // insert(pos, n, val)
+ {
+ size_t n = size_t(h/1.5f);
+ for ( size_t i = 0 ; i <= h ; ++i )
+ {
+ varray<T, N> s1(s);
+ It it = s1.insert(s1.begin() + i, n, val);
+ BOOST_CHECK(s1.begin() + i == it);
+ BOOST_CHECK(s1.size() == h+n);
+ for ( size_t j = 0 ; j < i ; ++j )
+ BOOST_CHECK(s1[j] == T(j));
+ for ( size_t j = 0 ; j < n ; ++j )
+ BOOST_CHECK(s1[j+i] == val);
+ for ( size_t j = 0 ; j < h-i ; ++j )
+ BOOST_CHECK(s1[j+i+n] == T(j+i));
+ }
+ }
+ // insert(pos, first, last)
+ test_insert<T, N>(s, ss);
+ test_insert<T, N>(s, v);
+ test_insert<T, N>(s, l);
+
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+ stable_vector<T> bsv(ss.begin(), ss.end());
+ vector<T> bv(ss.begin(), ss.end());
+ test_insert<T, N>(s, bv);
+ test_insert<T, N>(s, bsv);
+#endif
+}
+
+template <typename T>
+void test_capacity_0_nd()
+{
+ varray<T, 10> v(5u, T(0));
+
+ //varray<T, 0, bad_alloc_strategy<T> > s;
+ varray<T, 0> s;
+ BOOST_CHECK(s.size() == 0);
+ BOOST_CHECK(s.capacity() == 0);
+#ifndef BOOST_NO_EXCEPTIONS
+ BOOST_CHECK_THROW(s.at(0), std::out_of_range);
+ //BOOST_CHECK_THROW(s.resize(5u, T(0)), std::bad_alloc);
+ //BOOST_CHECK_THROW(s.push_back(T(0)), std::bad_alloc);
+ //BOOST_CHECK_THROW(s.insert(s.end(), T(0)), std::bad_alloc);
+ //BOOST_CHECK_THROW(s.insert(s.end(), 5u, T(0)), std::bad_alloc);
+ //BOOST_CHECK_THROW(s.insert(s.end(), v.begin(), v.end()), std::bad_alloc);
+ //BOOST_CHECK_THROW(s.assign(v.begin(), v.end()), std::bad_alloc);
+ //BOOST_CHECK_THROW(s.assign(5u, T(0)), std::bad_alloc);
+ //try{
+ // varray<T, 0, bad_alloc_strategy<T> > s2(v.begin(), v.end());
+ // BOOST_CHECK(false);
+ //}catch(std::bad_alloc &){}
+ //try{
+ // varray<T, 0, bad_alloc_strategy<T> > s1(5u, T(0));
+ // BOOST_CHECK(false);
+ //}catch(std::bad_alloc &){}
+#endif // BOOST_NO_EXCEPTIONS
+}
+
+template <typename T, size_t N>
+void test_exceptions_nd()
+{
+ varray<T, N> v(N, T(0));
+ //varray<T, N/2, bad_alloc_strategy<T> > s(N/2, T(0));
+ varray<T, N/2> s(N/2, T(0));
+
+#ifndef BOOST_NO_EXCEPTIONS
+ /*BOOST_CHECK_THROW(s.resize(N, T(0)), std::bad_alloc);
+ BOOST_CHECK_THROW(s.push_back(T(0)), std::bad_alloc);
+ BOOST_CHECK_THROW(s.insert(s.end(), T(0)), std::bad_alloc);
+ BOOST_CHECK_THROW(s.insert(s.end(), N, T(0)), std::bad_alloc);
+ BOOST_CHECK_THROW(s.insert(s.end(), v.begin(), v.end()), std::bad_alloc);
+ BOOST_CHECK_THROW(s.assign(v.begin(), v.end()), std::bad_alloc);
+ BOOST_CHECK_THROW(s.assign(N, T(0)), std::bad_alloc);
+ try{
+ container_detail::varray<T, N/2, bad_alloc_strategy<T> > s2(v.begin(), v.end());
+ BOOST_CHECK(false);
+ }catch(std::bad_alloc &){}
+ try{
+ container_detail::varray<T, N/2, bad_alloc_strategy<T> > s1(N, T(0));
+ BOOST_CHECK(false);
+ }catch(std::bad_alloc &){}*/
+#endif // BOOST_NO_EXCEPTIONS
+}
+
+template <typename T, size_t N>
+void test_swap_and_move_nd()
+{
+ {
+ varray<T, N> v1, v2, v3, v4;
+ varray<T, N> s1, s2;
+ //varray<T, N, bad_alloc_strategy<T> > s4;
+ varray<T, N> s4;
+
+ for (size_t i = 0 ; i < N ; ++i )
+ {
+ v1.push_back(T(i));
+ v2.push_back(T(i));
+ v3.push_back(T(i));
+ v4.push_back(T(i));
+ }
+ for (size_t i = 0 ; i < N/2 ; ++i )
+ {
+ s1.push_back(T(100 + i));
+ s2.push_back(T(100 + i));
+ s4.push_back(T(100 + i));
+ }
+
+ s1.swap(v1);
+ s2 = boost::move(v2);
+ varray<T, N> s3(boost::move(v3));
+ s4.swap(v4);
+
+ BOOST_CHECK(v1.size() == N/2);
+ BOOST_CHECK(s1.size() == N);
+ BOOST_CHECK(v2.size() == N); // objects aren't destroyed
+ BOOST_CHECK(s2.size() == N);
+ BOOST_CHECK(v3.size() == N); // objects aren't destroyed
+ BOOST_CHECK(s3.size() == N);
+ BOOST_CHECK(v4.size() == N/2);
+ BOOST_CHECK(s4.size() == N);
+ for (size_t i = 0 ; i < N/2 ; ++i )
+ {
+ BOOST_CHECK(v1[i] == T(100 + i));
+ BOOST_CHECK(v4[i] == T(100 + i));
+ }
+ for (size_t i = 0 ; i < N ; ++i )
+ {
+ BOOST_CHECK(s1[i] == T(i));
+ BOOST_CHECK(s2[i] == T(i));
+ BOOST_CHECK(s3[i] == T(i));
+ BOOST_CHECK(s4[i] == T(i));
+ }
+ }
+ {
+ varray<T, N> v1, v2, v3;
+ varray<T, N/2> s1, s2;
+
+ for (size_t i = 0 ; i < N/2 ; ++i )
+ {
+ v1.push_back(T(i));
+ v2.push_back(T(i));
+ v3.push_back(T(i));
+ }
+ for (size_t i = 0 ; i < N/3 ; ++i )
+ {
+ s1.push_back(T(100 + i));
+ s2.push_back(T(100 + i));
+ }
+
+ s1.swap(v1);
+ s2 = boost::move(v2);
+ varray<T, N/2> s3(boost::move(v3));
+
+ BOOST_CHECK(v1.size() == N/3);
+ BOOST_CHECK(s1.size() == N/2);
+ BOOST_CHECK(v2.size() == N/2); // objects aren't destroyed
+ BOOST_CHECK(s2.size() == N/2);
+ BOOST_CHECK(v3.size() == N/2); // objects aren't destroyed
+ BOOST_CHECK(s3.size() == N/2);
+ for (size_t i = 0 ; i < N/3 ; ++i )
+ BOOST_CHECK(v1[i] == T(100 + i));
+ for (size_t i = 0 ; i < N/2 ; ++i )
+ {
+ BOOST_CHECK(s1[i] == T(i));
+ BOOST_CHECK(s2[i] == T(i));
+ BOOST_CHECK(s3[i] == T(i));
+ }
+ }
+ {
+ varray<T, N> v(N, T(0));
+ //varray<T, N/2, bad_alloc_strategy<T> > s(N/2, T(1));
+ varray<T, N/2> s(N/2, T(1));
+#ifndef BOOST_NO_EXCEPTIONS
+ //BOOST_CHECK_THROW(s.swap(v), std::bad_alloc);
+ //v.resize(N, T(0));
+ //BOOST_CHECK_THROW(s = boost::move(v), std::bad_alloc);
+ //v.resize(N, T(0));
+ //try {
+ // varray<T, N/2, bad_alloc_strategy<T> > s2(boost::move(v));
+ // BOOST_CHECK(false);
+ //} catch (std::bad_alloc &) {}
+#endif // BOOST_NO_EXCEPTIONS
+ }
+}
+
+template <typename T, size_t N>
+void test_emplace_0p()
+{
+ //emplace_back()
+ {
+ //varray<T, N, bad_alloc_strategy<T> > v;
+ varray<T, N> v;
+
+ for (int i = 0 ; i < int(N) ; ++i )
+ v.emplace_back();
+ BOOST_CHECK(v.size() == N);
+#ifndef BOOST_NO_EXCEPTIONS
+ //BOOST_CHECK_THROW(v.emplace_back(), std::bad_alloc);
+#endif
+ }
+}
+
+template <typename T, size_t N>
+void test_emplace_2p()
+{
+ //emplace_back(pos, int, int)
+ {
+ //varray<T, N, bad_alloc_strategy<T> > v;
+ varray<T, N> v;
+
+ for (int i = 0 ; i < int(N) ; ++i )
+ v.emplace_back(i, 100 + i);
+ BOOST_CHECK(v.size() == N);
+#ifndef BOOST_NO_EXCEPTIONS
+ //BOOST_CHECK_THROW(v.emplace_back(N, 100 + N), std::bad_alloc);
+#endif
+ BOOST_CHECK(v.size() == N);
+ for (int i = 0 ; i < int(N) ; ++i )
+ BOOST_CHECK(v[i] == T(i, 100 + i));
+ }
+
+ // emplace(pos, int, int)
+ {
+ //typedef typename varray<T, N, bad_alloc_strategy<T> >::iterator It;
+ typedef typename varray<T, N>::iterator It;
+
+ int h = N / 2;
+
+ //varray<T, N, bad_alloc_strategy<T> > v;
+ varray<T, N> v;
+ for ( int i = 0 ; i < h ; ++i )
+ v.emplace_back(i, 100 + i);
+
+ for ( int i = 0 ; i <= h ; ++i )
+ {
+ //varray<T, N, bad_alloc_strategy<T> > vv(v);
+ varray<T, N> vv(v);
+ It it = vv.emplace(vv.begin() + i, i+100, i+200);
+ BOOST_CHECK(vv.begin() + i == it);
+ BOOST_CHECK(vv.size() == size_t(h+1));
+ for ( int j = 0 ; j < i ; ++j )
+ BOOST_CHECK(vv[j] == T(j, j+100));
+ BOOST_CHECK(vv[i] == T(i+100, i+200));
+ for ( int j = 0 ; j < h-i ; ++j )
+ BOOST_CHECK(vv[j+i+1] == T(j+i, j+i+100));
+ }
+ }
+}
+
+template <typename T, size_t N>
+void test_sv_elem(T const& t)
+{
+ //typedef varray<T, N, bad_alloc_strategy<T> > V;
+ typedef varray<T, N> V;
+
+ //varray<V, N, bad_alloc_strategy<V> > v;
+ varray<V, N> v;
+
+ v.push_back(V(N/2, t));
+ V vvv(N/2, t);
+ v.push_back(boost::move(vvv));
+ v.insert(v.begin(), V(N/2, t));
+ v.insert(v.end(), V(N/2, t));
+ v.emplace_back(N/2, t);
+}
+
+int test_main(int, char* [])
+{
+ BOOST_CHECK(counting_value::count() == 0);
+
+ test_ctor_ndc<size_t, 10>();
+ test_ctor_ndc<value_ndc, 10>();
+ test_ctor_ndc<counting_value, 10>();
+ BOOST_CHECK(counting_value::count() == 0);
+ test_ctor_ndc<shptr_value, 10>();
+ test_ctor_ndc<copy_movable, 10>();
+
+ test_ctor_nc<size_t, 10>(5);
+ test_ctor_nc<value_nc, 10>(5);
+ test_ctor_nc<counting_value, 10>(5);
+ BOOST_CHECK(counting_value::count() == 0);
+ test_ctor_nc<shptr_value, 10>(5);
+ test_ctor_nc<copy_movable, 10>(5);
+
+ test_ctor_nd<size_t, 10>(5, 1);
+ test_ctor_nd<value_nd, 10>(5, value_nd(1));
+ test_ctor_nd<counting_value, 10>(5, counting_value(1));
+ BOOST_CHECK(counting_value::count() == 0);
+ test_ctor_nd<shptr_value, 10>(5, shptr_value(1));
+ test_ctor_nd<copy_movable, 10>(5, produce());
+
+ test_resize_nc<size_t, 10>(5);
+ test_resize_nc<value_nc, 10>(5);
+ test_resize_nc<counting_value, 10>(5);
+ BOOST_CHECK(counting_value::count() == 0);
+ test_resize_nc<shptr_value, 10>(5);
+ test_resize_nc<copy_movable, 10>(5);
+
+ test_resize_nd<size_t, 10>(5, 1);
+ test_resize_nd<value_nd, 10>(5, value_nd(1));
+ test_resize_nd<counting_value, 10>(5, counting_value(1));
+ BOOST_CHECK(counting_value::count() == 0);
+ test_resize_nd<shptr_value, 10>(5, shptr_value(1));
+ test_resize_nd<copy_movable, 10>(5, produce());
+
+ test_push_back_nd<size_t, 10>();
+ test_push_back_nd<value_nd, 10>();
+ test_push_back_nd<counting_value, 10>();
+ BOOST_CHECK(counting_value::count() == 0);
+ test_push_back_nd<shptr_value, 10>();
+ test_push_back_nd<copy_movable, 10>();
+
+ test_pop_back_nd<size_t, 10>();
+ test_pop_back_nd<value_nd, 10>();
+ test_pop_back_nd<counting_value, 10>();
+ BOOST_CHECK(counting_value::count() == 0);
+ test_pop_back_nd<shptr_value, 10>();
+ test_pop_back_nd<copy_movable, 10>();
+
+ test_copy_and_assign_nd<size_t, 10>(1);
+ test_copy_and_assign_nd<value_nd, 10>(value_nd(1));
+ test_copy_and_assign_nd<counting_value, 10>(counting_value(1));
+ BOOST_CHECK(counting_value::count() == 0);
+ test_copy_and_assign_nd<shptr_value, 10>(shptr_value(1));
+ test_copy_and_assign_nd<copy_movable, 10>(produce());
+
+ test_iterators_nd<size_t, 10>();
+ test_iterators_nd<value_nd, 10>();
+ test_iterators_nd<counting_value, 10>();
+ BOOST_CHECK(counting_value::count() == 0);
+ test_iterators_nd<shptr_value, 10>();
+ test_iterators_nd<copy_movable, 10>();
+
+ test_erase_nd<size_t, 10>();
+ test_erase_nd<value_nd, 10>();
+ test_erase_nd<counting_value, 10>();
+ BOOST_CHECK(counting_value::count() == 0);
+ test_erase_nd<shptr_value, 10>();
+ test_erase_nd<copy_movable, 10>();
+
+ test_insert_nd<size_t, 10>(50);
+ test_insert_nd<value_nd, 10>(value_nd(50));
+ test_insert_nd<counting_value, 10>(counting_value(50));
+ BOOST_CHECK(counting_value::count() == 0);
+ test_insert_nd<shptr_value, 10>(shptr_value(50));
+ test_insert_nd<copy_movable, 10>(produce());
+
+ test_capacity_0_nd<size_t>();
+ test_capacity_0_nd<value_nd>();
+ test_capacity_0_nd<counting_value>();
+ BOOST_CHECK(counting_value::count() == 0);
+ test_capacity_0_nd<shptr_value>();
+ test_capacity_0_nd<copy_movable>();
+
+ test_exceptions_nd<size_t, 10>();
+ test_exceptions_nd<value_nd, 10>();
+ test_exceptions_nd<counting_value, 10>();
+ BOOST_CHECK(counting_value::count() == 0);
+ test_exceptions_nd<shptr_value, 10>();
+ test_exceptions_nd<copy_movable, 10>();
+
+ test_swap_and_move_nd<size_t, 10>();
+ test_swap_and_move_nd<value_nd, 10>();
+ test_swap_and_move_nd<counting_value, 10>();
+ BOOST_CHECK(counting_value::count() == 0);
+ test_swap_and_move_nd<shptr_value, 10>();
+ test_swap_and_move_nd<copy_movable, 10>();
+
+ test_emplace_0p<counting_value, 10>();
+ BOOST_CHECK(counting_value::count() == 0);
+
+ test_emplace_2p<counting_value, 10>();
+ BOOST_CHECK(counting_value::count() == 0);
+
+ test_sv_elem<size_t, 10>(50);
+ test_sv_elem<value_nd, 10>(value_nd(50));
+ test_sv_elem<counting_value, 10>(counting_value(50));
+ BOOST_CHECK(counting_value::count() == 0);
+ test_sv_elem<shptr_value, 10>(shptr_value(50));
+ test_sv_elem<copy_movable, 10>(copy_movable(50));
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/varray_old.cpp b/src/boost/libs/geometry/index/test/varray_old.cpp
new file mode 100644
index 00000000..37840f96
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/varray_old.cpp
@@ -0,0 +1,490 @@
+// Boost.Geometry Index
+// Unit Test
+
+// 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/test/included/test_exec_monitor.hpp>
+#include <boost/test/impl/execution_monitor.ipp>
+
+#include <boost/geometry/index/detail/varray.hpp>
+
+using namespace boost::geometry::index::detail;
+
+class value_ndc
+{
+public:
+ explicit value_ndc(int a) : aa(a) {}
+ ~value_ndc() {}
+ bool operator==(value_ndc const& v) const { return aa == v.aa; }
+private:
+ value_ndc(value_ndc const&) {}
+ value_ndc & operator=(value_ndc const&) { return *this; }
+ int aa;
+};
+
+class value_nd
+{
+public:
+ explicit value_nd(int a) : aa(a) {}
+ ~value_nd() {}
+ bool operator==(value_nd const& v) const { return aa == v.aa; }
+private:
+ int aa;
+};
+
+class value_nc
+{
+public:
+ explicit value_nc(int a = 0) : aa(a) {}
+ ~value_nc() {}
+ bool operator==(value_nc const& v) const { return aa == v.aa; }
+private:
+ value_nc(value_nc const&) {}
+ value_nc & operator=(value_ndc const&) { return *this; }
+ int aa;
+};
+
+class counting_value
+{
+public:
+ explicit counting_value(int a = 0) : aa(a) { ++c(); }
+ counting_value(counting_value const& v) : aa(v.aa) { ++c(); }
+ counting_value & operator=(counting_value const& v) { aa = v.aa; return *this; }
+ ~counting_value() { --c(); }
+ bool operator==(counting_value const& v) const { return aa == v.aa; }
+ static size_t count() { return c(); }
+private:
+ static size_t & c() { static size_t co = 0; return co; }
+ int aa;
+};
+
+template <typename T, size_t N>
+void test_ctor_ndc()
+{
+ varray<T, N> s;
+ BOOST_CHECK(s.size() == 0);
+ BOOST_CHECK(s.capacity() == N);
+ BOOST_CHECK_THROW( s.at(0), std::out_of_range );
+}
+
+template <typename T, size_t N>
+void test_ctor_nc(size_t n)
+{
+ varray<T, N> s(n);
+ BOOST_CHECK(s.size() == n);
+ BOOST_CHECK(s.capacity() == N);
+ BOOST_CHECK_THROW( s.at(n), std::out_of_range );
+ if ( !boost::has_trivial_constructor<T>::value )
+ {
+ for ( size_t i = 0 ; i < n ; ++i )
+ BOOST_CHECK(T() == s[i]);
+ }
+}
+
+template <typename T, size_t N>
+void test_ctor_nd(size_t n, T const& v)
+{
+ varray<T, N> s(n, v);
+ BOOST_CHECK(s.size() == n);
+ BOOST_CHECK(s.capacity() == N);
+ BOOST_CHECK_THROW( s.at(n), std::out_of_range );
+ if ( 1 < n )
+ {
+ BOOST_CHECK(v == s[0]);
+ BOOST_CHECK(v == s.at(0));
+ BOOST_CHECK(v == s[1]);
+ BOOST_CHECK(v == s.at(1));
+ s[0] = T(10);
+ BOOST_CHECK(T(10) == s[0]);
+ BOOST_CHECK(T(10) == s.at(0));
+ s.at(1) = T(20);
+ BOOST_CHECK(T(20) == s[1]);
+ BOOST_CHECK(T(20) == s.at(1));
+ }
+}
+
+template <typename T, size_t N>
+void test_resize_nc(size_t n)
+{
+ varray<T, N> s;
+
+ s.resize(n);
+ BOOST_CHECK(s.size() == n);
+ BOOST_CHECK(s.capacity() == N);
+ BOOST_CHECK_THROW( s.at(n), std::out_of_range );
+
+ if ( !boost::has_trivial_constructor<T>::value )
+ {
+ for ( size_t i = 0 ; i < n ; ++i )
+ BOOST_CHECK(T() == s[i]);
+ }
+}
+
+template <typename T, size_t N>
+void test_resize_nd(size_t n, T const& v)
+{
+ varray<T, N> s;
+
+ s.resize(n, v);
+ BOOST_CHECK(s.size() == n);
+ BOOST_CHECK(s.capacity() == N);
+ BOOST_CHECK_THROW( s.at(n), std::out_of_range );
+ if ( 1 < n )
+ {
+ BOOST_CHECK(v == s[0]);
+ BOOST_CHECK(v == s.at(0));
+ BOOST_CHECK(v == s[1]);
+ BOOST_CHECK(v == s.at(1));
+ s[0] = T(10);
+ BOOST_CHECK(T(10) == s[0]);
+ BOOST_CHECK(T(10) == s.at(0));
+ s.at(1) = T(20);
+ BOOST_CHECK(T(20) == s[1]);
+ BOOST_CHECK(T(20) == s.at(1));
+ }
+}
+
+template <typename T, size_t N>
+void test_push_back_nd()
+{
+ varray<T, N> s;
+
+ BOOST_CHECK(s.size() == 0);
+ BOOST_CHECK_THROW( s.at(0), std::out_of_range );
+
+ for ( size_t i = 0 ; i < N ; ++i )
+ {
+ s.push_back(T(i));
+ BOOST_CHECK(s.size() == i + 1);
+ BOOST_CHECK_THROW( s.at(i + 1), std::out_of_range );
+ BOOST_CHECK(T(i) == s.at(i));
+ BOOST_CHECK(T(i) == s[i]);
+ BOOST_CHECK(T(i) == s.back());
+ BOOST_CHECK(T(0) == s.front());
+ }
+}
+
+template <typename T, size_t N>
+void test_pop_back_nd()
+{
+ varray<T, N> s;
+
+ for ( size_t i = 0 ; i < N ; ++i )
+ s.push_back(T(i));
+
+ for ( size_t i = N ; i > 1 ; --i )
+ {
+ s.pop_back();
+ BOOST_CHECK(s.size() == i - 1);
+ BOOST_CHECK_THROW( s.at(i - 1), std::out_of_range );
+ BOOST_CHECK(T(i - 2) == s.at(i - 2));
+ BOOST_CHECK(T(i - 2) == s[i - 2]);
+ BOOST_CHECK(T(i - 2) == s.back());
+ BOOST_CHECK(T(0) == s.front());
+ }
+}
+
+template <typename It1, typename It2>
+void test_compare_ranges(It1 first1, It1 last1, It2 first2, It2 last2)
+{
+ BOOST_CHECK(std::distance(first1, last1) == std::distance(first2, last2));
+ for ( ; first1 != last1 && first2 != last2 ; ++first1, ++first2 )
+ BOOST_CHECK(*first1 == *first2);
+}
+
+template <typename T, size_t N>
+void test_copy_and_assign_nd(T const& val)
+{
+ varray<T, N> s;
+ std::vector<T> v;
+ std::list<T> l;
+
+ for ( size_t i = 0 ; i < N ; ++i )
+ {
+ s.push_back(T(i));
+ v.push_back(T(i));
+ l.push_back(T(i));
+ }
+ // copy ctor
+ {
+ varray<T, N> s1(s);
+ BOOST_CHECK(s.size() == s1.size());
+ test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end());
+ }
+ // copy assignment
+ {
+ varray<T, N> s1;
+ BOOST_CHECK(0 == s1.size());
+ s1 = s;
+ BOOST_CHECK(s.size() == s1.size());
+ test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end());
+ }
+ // ctor(Iter, Iter)
+ {
+ varray<T, N> s1(s.begin(), s.end());
+ BOOST_CHECK(s.size() == s1.size());
+ test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end());
+ }
+ {
+ varray<T, N> s1(v.begin(), v.end());
+ BOOST_CHECK(v.size() == s1.size());
+ test_compare_ranges(v.begin(), v.end(), s1.begin(), s1.end());
+ }
+ {
+ varray<T, N> s1(l.begin(), l.end());
+ BOOST_CHECK(l.size() == s1.size());
+ test_compare_ranges(l.begin(), l.end(), s1.begin(), s1.end());
+ }
+ // assign(Iter, Iter)
+ {
+ varray<T, N> s1;
+ BOOST_CHECK(0 == s1.size());
+ s1.assign(s.begin(), s.end());
+ BOOST_CHECK(s.size() == s1.size());
+ test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end());
+ }
+ {
+ varray<T, N> s1;
+ BOOST_CHECK(0 == s1.size());
+ s1.assign(v.begin(), v.end());
+ BOOST_CHECK(v.size() == s1.size());
+ test_compare_ranges(v.begin(), v.end(), s1.begin(), s1.end());
+ }
+ {
+ varray<T, N> s1;
+ BOOST_CHECK(0 == s1.size());
+ s1.assign(l.begin(), l.end());
+ BOOST_CHECK(l.size() == s1.size());
+ test_compare_ranges(l.begin(), l.end(), s1.begin(), s1.end());
+ }
+ // assign(N, V)
+ {
+ varray<T, N> s1(s);
+ test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end());
+ std::vector<T> a(N, val);
+ s1.assign(N, val);
+ test_compare_ranges(a.begin(), a.end(), s1.begin(), s1.end());
+ }
+}
+
+template <typename T, size_t N>
+void test_iterators_nd()
+{
+ varray<T, N> s;
+ std::vector<T> v;
+
+ for ( size_t i = 0 ; i < N ; ++i )
+ {
+ s.push_back(T(i));
+ v.push_back(T(i));
+ }
+
+ test_compare_ranges(s.begin(), s.end(), v.begin(), v.end());
+ test_compare_ranges(s.rbegin(), s.rend(), v.rbegin(), v.rend());
+
+ s.assign(v.rbegin(), v.rend());
+
+ test_compare_ranges(s.begin(), s.end(), v.rbegin(), v.rend());
+ test_compare_ranges(s.rbegin(), s.rend(), v.begin(), v.end());
+}
+
+template <typename T, size_t N>
+void test_erase_nd()
+{
+ varray<T, N> s;
+
+ for ( size_t i = 0 ; i < N ; ++i )
+ s.push_back(T(i));
+
+ // erase(pos)
+ {
+ for ( size_t i = 0 ; i < N ; ++i )
+ {
+ varray<T, N> s1(s);
+ s1.erase(s1.begin() + i);
+ BOOST_CHECK(s1.size() == N - 1);
+ for ( size_t j = 0 ; j < i ; ++j )
+ BOOST_CHECK(s1[j] == T(j));
+ for ( size_t j = i+1 ; j < N ; ++j )
+ BOOST_CHECK(s1[j-1] == T(j));
+ }
+ }
+ // erase(first, last)
+ {
+ size_t n = N/3;
+ for ( size_t i = 0 ; i <= N ; ++i )
+ {
+ varray<T, N> s1(s);
+ size_t removed = i + n < N ? n : N - i;
+ s1.erase(s1.begin() + i, s1.begin() + i + removed);
+ BOOST_CHECK(s1.size() == N - removed);
+ for ( size_t j = 0 ; j < i ; ++j )
+ BOOST_CHECK(s1[j] == T(j));
+ for ( size_t j = i+n ; j < N ; ++j )
+ BOOST_CHECK(s1[j-n] == T(j));
+ }
+ }
+}
+
+template <typename T, size_t N>
+void test_insert_nd(T const& val)
+{
+ size_t h = N/2;
+
+ varray<T, N> s, ss;
+ std::vector<T> v;
+ std::list<T> l;
+
+ for ( size_t i = 0 ; i < h ; ++i )
+ {
+ s.push_back(T(i));
+ ss.push_back(T(100 + i));
+ v.push_back(T(100 + i));
+ l.push_back(T(100 + i));
+ }
+
+ // insert(pos, val)
+ {
+ for ( size_t i = 0 ; i <= h ; ++i )
+ {
+ varray<T, N> s1(s);
+ s1.insert(s1.begin() + i, val);
+ BOOST_CHECK(s1.size() == h+1);
+ for ( size_t j = 0 ; j < i ; ++j )
+ BOOST_CHECK(s1[j] == T(j));
+ BOOST_CHECK(s1[i] == val);
+ for ( size_t j = 0 ; j < h-i ; ++j )
+ BOOST_CHECK(s1[j+i+1] == T(j+i));
+ }
+ }
+ // insert(pos, n, val)
+ {
+ size_t n = size_t(h/1.5f);
+ for ( size_t i = 0 ; i <= h ; ++i )
+ {
+ varray<T, N> s1(s);
+ s1.insert(s1.begin() + i, n, val);
+ BOOST_CHECK(s1.size() == h+n);
+ for ( size_t j = 0 ; j < i ; ++j )
+ BOOST_CHECK(s1[j] == T(j));
+ for ( size_t j = 0 ; j < n ; ++j )
+ BOOST_CHECK(s1[j+i] == val);
+ for ( size_t j = 0 ; j < h-i ; ++j )
+ BOOST_CHECK(s1[j+i+n] == T(j+i));
+ }
+ }
+ // insert(pos, first, last)
+ {
+ size_t n = size_t(h/1.5f);
+ for ( size_t i = 0 ; i <= h ; ++i )
+ {
+ varray<T, N> s1(s);
+ s1.insert(s1.begin() + i, ss.begin(), ss.begin() + n);
+ BOOST_CHECK(s1.size() == h+n);
+ for ( size_t j = 0 ; j < i ; ++j )
+ BOOST_CHECK(s1[j] == T(j));
+ for ( size_t j = 0 ; j < n ; ++j )
+ BOOST_CHECK(s1[j+i] == T(100 + j));
+ for ( size_t j = 0 ; j < h-i ; ++j )
+ BOOST_CHECK(s1[j+i+n] == T(j+i));
+ }
+ }
+ {
+ size_t n = size_t(h/1.5f);
+ for ( size_t i = 0 ; i <= h ; ++i )
+ {
+ varray<T, N> s1(s);
+ s1.insert(s1.begin() + i, v.begin(), v.begin() + n);
+ BOOST_CHECK(s1.size() == h+n);
+ for ( size_t j = 0 ; j < i ; ++j )
+ BOOST_CHECK(s1[j] == T(j));
+ for ( size_t j = 0 ; j < n ; ++j )
+ BOOST_CHECK(s1[j+i] == T(100 + j));
+ for ( size_t j = 0 ; j < h-i ; ++j )
+ BOOST_CHECK(s1[j+i+n] == T(j+i));
+ }
+ }
+ {
+ size_t n = size_t(h/1.5f);
+ for ( size_t i = 0 ; i <= h ; ++i )
+ {
+ varray<T, N> s1(s);
+ typename std::list<T>::iterator it = l.begin();
+ std::advance(it, n);
+ s1.insert(s1.begin() + i, l.begin(), it);
+ BOOST_CHECK(s1.size() == h+n);
+ for ( size_t j = 0 ; j < i ; ++j )
+ BOOST_CHECK(s1[j] == T(j));
+ for ( size_t j = 0 ; j < n ; ++j )
+ BOOST_CHECK(s1[j+i] == T(100 + j));
+ for ( size_t j = 0 ; j < h-i ; ++j )
+ BOOST_CHECK(s1[j+i+n] == T(j+i));
+ }
+ }
+}
+
+int test_main(int, char* [])
+{
+ BOOST_CHECK(counting_value::count() == 0);
+
+ test_ctor_ndc<int, 10>();
+ test_ctor_ndc<value_ndc, 10>();
+ test_ctor_ndc<counting_value, 10>();
+ BOOST_CHECK(counting_value::count() == 0);
+
+ test_ctor_nc<int, 10>(5);
+ test_ctor_nc<value_nc, 10>(5);
+ test_ctor_nc<counting_value, 10>(5);
+ BOOST_CHECK(counting_value::count() == 0);
+
+ test_ctor_nd<int, 10>(5, 1);
+ test_ctor_nd<value_nd, 10>(5, value_nd(1));
+ test_ctor_nd<counting_value, 10>(5, counting_value(1));
+ BOOST_CHECK(counting_value::count() == 0);
+
+ test_resize_nc<int, 10>(5);
+ test_resize_nc<value_nc, 10>(5);
+ test_resize_nc<counting_value, 10>(5);
+ BOOST_CHECK(counting_value::count() == 0);
+
+ test_resize_nd<int, 10>(5, 1);
+ test_resize_nd<value_nd, 10>(5, value_nd(1));
+ test_resize_nd<counting_value, 10>(5, counting_value(1));
+ BOOST_CHECK(counting_value::count() == 0);
+
+ test_push_back_nd<int, 10>();
+ test_push_back_nd<value_nd, 10>();
+ test_push_back_nd<counting_value, 10>();
+ BOOST_CHECK(counting_value::count() == 0);
+
+ test_pop_back_nd<int, 10>();
+ test_pop_back_nd<value_nd, 10>();
+ test_pop_back_nd<counting_value, 10>();
+ BOOST_CHECK(counting_value::count() == 0);
+
+ test_copy_and_assign_nd<int, 10>(1);
+ test_copy_and_assign_nd<value_nd, 10>(value_nd(1));
+ test_copy_and_assign_nd<counting_value, 10>(counting_value(1));
+ BOOST_CHECK(counting_value::count() == 0);
+
+ test_iterators_nd<int, 10>();
+ test_iterators_nd<value_nd, 10>();
+ test_iterators_nd<counting_value, 10>();
+ BOOST_CHECK(counting_value::count() == 0);
+
+ test_erase_nd<int, 10>();
+ test_erase_nd<value_nd, 10>();
+ test_erase_nd<counting_value, 10>();
+ BOOST_CHECK(counting_value::count() == 0);
+
+ test_insert_nd<int, 10>(50);
+ test_insert_nd<value_nd, 10>(value_nd(50));
+ test_insert_nd<counting_value, 10>(counting_value(50));
+ BOOST_CHECK(counting_value::count() == 0);
+
+ return 0;
+}
diff --git a/src/boost/libs/geometry/index/test/varray_test.hpp b/src/boost/libs/geometry/index/test/varray_test.hpp
new file mode 100644
index 00000000..4136db7f
--- /dev/null
+++ b/src/boost/libs/geometry/index/test/varray_test.hpp
@@ -0,0 +1,97 @@
+// Boost.Geometry.Index varray
+// Unit Test
+
+// Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland.
+// Copyright (c) 2012-2013 Andrew Hundt.
+
+// 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_TEST_VARRAY_TEST_HPP
+#define BOOST_GEOMETRY_INDEX_TEST_VARRAY_TEST_HPP
+
+#include <boost/geometry/index/detail/varray.hpp>
+
+#include <boost/shared_ptr.hpp>
+#include "movable.hpp"
+
+class value_ndc
+{
+public:
+ explicit value_ndc(size_t a) : aa(a) {}
+ ~value_ndc() {}
+ bool operator==(value_ndc const& v) const { return aa == v.aa; }
+ bool operator<(value_ndc const& v) const { return aa < v.aa; }
+private:
+ value_ndc(value_ndc const&) {}
+ value_ndc & operator=(value_ndc const&) { return *this; }
+ size_t aa;
+};
+
+class value_nd
+{
+public:
+ explicit value_nd(size_t a) : aa(a) {}
+ ~value_nd() {}
+ bool operator==(value_nd const& v) const { return aa == v.aa; }
+ bool operator<(value_nd const& v) const { return aa < v.aa; }
+private:
+ size_t aa;
+};
+
+class value_nc
+{
+public:
+ explicit value_nc(size_t a = 0) : aa(a) {}
+ ~value_nc() {}
+ bool operator==(value_nc const& v) const { return aa == v.aa; }
+ bool operator<(value_nc const& v) const { return aa < v.aa; }
+private:
+ value_nc(value_nc const&) {}
+ value_nc & operator=(value_ndc const&) { return *this; }
+ size_t aa;
+};
+
+class counting_value
+{
+ BOOST_COPYABLE_AND_MOVABLE(counting_value)
+
+public:
+ explicit counting_value(size_t a = 0, size_t b = 0) : aa(a), bb(b) { ++c(); }
+ counting_value(counting_value const& v) : aa(v.aa), bb(v.bb) { ++c(); }
+ counting_value(BOOST_RV_REF(counting_value) p) : aa(p.aa), bb(p.bb) { p.aa = 0; p.bb = 0; ++c(); } // Move constructor
+ counting_value& operator=(BOOST_RV_REF(counting_value) p) { aa = p.aa; p.aa = 0; bb = p.bb; p.bb = 0; return *this; } // Move assignment
+ counting_value& operator=(BOOST_COPY_ASSIGN_REF(counting_value) p) { aa = p.aa; bb = p.bb; return *this; } // Copy assignment
+ ~counting_value() { --c(); }
+ bool operator==(counting_value const& v) const { return aa == v.aa && bb == v.bb; }
+ bool operator<(counting_value const& v) const { return aa < v.aa || ( aa == v.aa && bb < v.bb ); }
+ static size_t count() { return c(); }
+
+private:
+ static size_t & c() { static size_t co = 0; return co; }
+ size_t aa, bb;
+};
+
+namespace boost {
+
+template <>
+struct has_nothrow_move<counting_value>
+{
+ static const bool value = true;
+};
+
+}
+
+class shptr_value
+{
+ typedef boost::shared_ptr<size_t> Ptr;
+public:
+ explicit shptr_value(size_t a = 0) : m_ptr(new size_t(a)) {}
+ bool operator==(shptr_value const& v) const { return *m_ptr == *(v.m_ptr); }
+ bool operator<(shptr_value const& v) const { return *m_ptr < *(v.m_ptr); }
+private:
+ boost::shared_ptr<size_t> m_ptr;
+};
+
+#endif // BOOST_GEOMETRY_INDEX_TEST_VARRAY_TEST_HPP