diff --git a/index/example/benchmark_experimental.cpp b/index/example/benchmark_experimental.cpp index f9673307a..da288581d 100644 --- a/index/example/benchmark_experimental.cpp +++ b/index/example/benchmark_experimental.cpp @@ -27,6 +27,23 @@ typedef bg::model::point P; typedef bg::model::box

B; typedef bg::model::linestring

LS; typedef bg::model::segment

S; +typedef B V; +//typedef P V; + +template +struct generate_value {}; + +template <> +struct generate_value +{ + 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

+{ + static inline P apply(float x, float y) { return P(x, y); } +}; template void mycopy(I1 first, I2 last, O o) @@ -62,7 +79,7 @@ int main() float max_val = static_cast(values_count / 2); std::vector< std::pair > coords; - std::vector values; + std::vector values; //randomize values { @@ -79,20 +96,20 @@ int main() float x = rnd(); float y = rnd(); coords.push_back(std::make_pair(x, y)); - values.push_back(B(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f))); + values.push_back(generate_value::apply(x, y)); } std::cout << "randomized\n"; } - //typedef bgi::rtree > RT; - //typedef bgi::rtree > RT; - typedef bgi::rtree > RT; + //typedef bgi::rtree > RT; + //typedef bgi::rtree > RT; + typedef bgi::rtree > RT; std::cout << "sizeof rtree: " << sizeof(RT) << std::endl; for (;;) { - std::vector result; + std::vector result; result.reserve(100); B result_one; @@ -220,14 +237,14 @@ int main() && !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))) + !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 && !o) " << queries_count << " found " << temp << '\n'; + std::cout << time << " - query(i && !w && !c) " << queries_count << " found " << temp << '\n'; } result.clear(); @@ -366,9 +383,8 @@ int main() { 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); + + t.remove(generate_value::apply(x, y)); } dur_t time = clock_t::now() - start; std::cout << time << " - remove " << values_count / 10 << '\n'; diff --git a/index/example/glut_vis.cpp b/index/example/glut_vis.cpp index 3c6bda5aa..d6a434707 100644 --- a/index/example/glut_vis.cpp +++ b/index/example/glut_vis.cpp @@ -337,36 +337,38 @@ void query_multi_poly() void search() { + namespace d = bgi::detail; + if ( query_mode == qm_knn ) query_knn(); else if ( query_mode == qm_c ) - query< bgi::detail::covered_by >(); + query< d::spatial_predicate >(); else if ( query_mode == qm_d ) - query< bgi::detail::disjoint >(); + query< d::spatial_predicate >(); else if ( query_mode == qm_i ) - query< bgi::detail::intersects >(); + query< d::spatial_predicate >(); else if ( query_mode == qm_o ) - query< bgi::detail::overlaps >(); + query< d::spatial_predicate >(); else if ( query_mode == qm_w ) - query< bgi::detail::within >(); + query< d::spatial_predicate >(); else if ( query_mode == qm_nc ) - query< bgi::detail::not_covered_by >(); + query< d::spatial_predicate >(); else if ( query_mode == qm_nd ) - query< bgi::detail::not_disjoint >(); + query< d::spatial_predicate >(); else if ( query_mode == qm_ni ) - query< bgi::detail::not_intersects >(); + query< d::spatial_predicate >(); else if ( query_mode == qm_no ) - query< bgi::detail::not_overlaps >(); + query< d::spatial_predicate >(); else if ( query_mode == qm_nw ) - query< bgi::detail::not_within >(); + query< d::spatial_predicate >(); else if ( query_mode == qm_all ) - query< bgi::detail::intersects >(); + query< d::spatial_predicate >(); else if ( query_mode == qm_ri ) - query_ring< bgi::detail::intersects >(); + query_ring< d::spatial_predicate >(); else if ( query_mode == qm_pi ) - query_poly< bgi::detail::intersects >(); + query_poly< d::spatial_predicate >(); else if ( query_mode == qm_mpi ) - query_multi_poly< bgi::detail::intersects >(); + query_multi_poly< d::spatial_predicate >(); else if ( query_mode == qm_path ) query_path(); diff --git a/index/test/rtree/test_rtree.hpp b/index/test/rtree/test_rtree.hpp index 5350f9ace..71557897c 100644 --- a/index/test/rtree/test_rtree.hpp +++ b/index/test/rtree/test_rtree.hpp @@ -579,7 +579,7 @@ value_outside() typedef typename Rtree::value_type V; typedef typename Rtree::indexable_type I; - return value_outside_impl::value>::apply(); + return value_outside_impl::value>::apply(); } template @@ -588,7 +588,7 @@ void rtree(Rtree & tree, Elements & input, Box & qbox) typedef typename Rtree::indexable_type I; generate::input< - bgi::detail::traits::dimension::value + bg::dimension::value >::apply(input, qbox); tree.insert(input.begin(), input.end()); @@ -772,7 +772,7 @@ template void contains(Rtree const& tree, std::vector const& input, Box const& qbox) { contains_impl< - typename bgi::detail::traits::tag< + typename bg::tag< typename Rtree::indexable_type >::type >::apply(tree, input, qbox); @@ -838,7 +838,7 @@ template void covers(Rtree const& tree, std::vector const& input, Box const& qbox) { covers_impl< - typename bgi::detail::traits::tag< + typename bg::tag< typename Rtree::indexable_type >::type >::apply(tree, input, qbox); @@ -882,7 +882,7 @@ template void overlaps(Rtree const& tree, std::vector const& input, Box const& qbox) { overlaps_impl< - typename bgi::detail::traits::tag< + typename bg::tag< typename Rtree::indexable_type >::type >::apply(tree, input, qbox); @@ -1425,7 +1425,7 @@ void queries(Rtree const& tree, std::vector const& input, Box const& qbox basictest::covers(tree, input, qbox); #endif - typedef typename bgi::detail::traits::point_type::type P; + typedef typename bg::point_type::type P; P pt; bg::centroid(qbox, pt);