// 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 #include #include #include #include #include template 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 shmem_alloc; typedef bgi::rtree, shmem_alloc> Tree; Tree * tree = segment.construct("Tree")(parameters, bgi::translator::def(), shmem_alloc(segment.get_segment_manager())); typedef typename Tree::bounds_type B; std::vector input; B qbox; generate_rtree(*tree, input, qbox); test_intersects(*tree, input, qbox); test_disjoint(*tree, input, qbox); test_covered_by(*tree, input, qbox); test_overlaps(*tree, input, qbox); //test_touches(*tree, input, qbox); test_within(*tree, input, qbox); typedef typename bgi::detail::traits::point_type::type P; P pt; bg::centroid(qbox, pt); test_nearest_query_k(*tree, input, pt, 10); test_nearest_query_not_found(*tree, generate_outside_point

::apply()); segment.destroy_ptr(tree); } int test_main(int, char* []) { typedef bg::model::point P2d; typedef bg::model::box B2d; typedef std::pair PB2d; //test_rtree_interprocess(bgi::linear<32, 8>()); test_rtree_interprocess(bgi::runtime::linear(32, 8)); /*test_rtree_interprocess(bgi::quadratic<32, 8>()); test_rtree_interprocess(bgi::runtime::quadratic(32, 8)); test_rtree_interprocess(bgi::rstar<32, 8>()); test_rtree_interprocess(bgi::runtime::rstar(32, 8)); typedef bg::model::point P3f; typedef bg::model::box B3f; typedef std::pair PB3f; test_rtree_interprocess(bgi::linear<32, 8>()); test_rtree_interprocess(bgi::runtime::linear(32, 8)); test_rtree_interprocess(bgi::quadratic<32, 8>()); test_rtree_interprocess(bgi::runtime::quadratic(32, 8)); test_rtree_interprocess(bgi::rstar<32, 8>()); test_rtree_interprocess(bgi::runtime::rstar(32, 8));*/ return 0; }