From 6e1347948166711dd718246e99329c3b073f0fbb Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 21 Nov 2012 16:06:34 +0000 Subject: [PATCH 01/10] docs fixed [SVN r81459] --- doc/html/geometry_index/r_tree/spatial_queries.html | 12 ++++++------ doc/html/index.html | 2 +- doc/rtree/spatial_query.qbk | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/doc/html/geometry_index/r_tree/spatial_queries.html b/doc/html/geometry_index/r_tree/spatial_queries.html index 0262793d6..910bf2c5b 100644 --- a/doc/html/geometry_index/r_tree/spatial_queries.html +++ b/doc/html/geometry_index/r_tree/spatial_queries.html @@ -74,12 +74,12 @@ of Boost.Geometry algorithms.

-
rt.query(box, std::back_inserter(result)); // default case - intersects
-rt.query(index::intersects(box), std::back_inserter(result)); // the same as default
-rt.query(index::covered_by(box), std::back_inserter(result));
-rt.query(index::disjont(box), std::back_inserter(result));
-rt.query(index::overlaps(box), std::back_inserter(result));
-rt.query(index::within(box), std::back_inserter(result));
+
rt.spatial_query(box, std::back_inserter(result));                    // default case - intersects
+rt.spatial_query(index::intersects(box), std::back_inserter(result)); // the same as default
+rt.spatial_query(index::covered_by(box), std::back_inserter(result));
+rt.spatial_query(index::disjont(box), std::back_inserter(result));
+rt.spatial_query(index::overlaps(box), std::back_inserter(result));
+rt.spatial_query(index::within(box), std::back_inserter(result));
 

All predicates may be negated, e.g.: diff --git a/doc/html/index.html b/doc/html/index.html index 6ffb17abf..034989275 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -56,7 +56,7 @@ - +

Last revised: November 20, 2012 at 22:42:04 GMT

Last revised: November 21, 2012 at 16:05:59 GMT


diff --git a/doc/rtree/spatial_query.qbk b/doc/rtree/spatial_query.qbk index dbd7cd55a..6013a73fc 100644 --- a/doc/rtree/spatial_query.qbk +++ b/doc/rtree/spatial_query.qbk @@ -39,12 +39,12 @@ Use of pipe operator generating a range It is possible to define other relations between queried `__value__`s and region/regions of interest. Names of predicates corresponds to names of __boost_geometry__ algorithms. - rt.query(box, std::back_inserter(result)); // default case - intersects - rt.query(index::intersects(box), std::back_inserter(result)); // the same as default - rt.query(index::covered_by(box), std::back_inserter(result)); - rt.query(index::disjont(box), std::back_inserter(result)); - rt.query(index::overlaps(box), std::back_inserter(result)); - rt.query(index::within(box), std::back_inserter(result)); + rt.spatial_query(box, std::back_inserter(result)); // default case - intersects + rt.spatial_query(index::intersects(box), std::back_inserter(result)); // the same as default + rt.spatial_query(index::covered_by(box), std::back_inserter(result)); + rt.spatial_query(index::disjont(box), std::back_inserter(result)); + rt.spatial_query(index::overlaps(box), std::back_inserter(result)); + rt.spatial_query(index::within(box), std::back_inserter(result)); All predicates may be negated, e.g.: From b42b3e3c9f681b358d765410c66caae366499979 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 22 Nov 2012 01:54:21 +0000 Subject: [PATCH 02/10] nearest and query visitors renamed. [SVN r81471] --- .../geometry/extensions/index/rtree/rtree.hpp | 14 ++++++------- .../{nearest.hpp => nearest_query.hpp} | 20 +++++++++---------- .../visitors/{query.hpp => spatial_query.hpp} | 12 +++++------ 3 files changed, 23 insertions(+), 23 deletions(-) rename include/boost/geometry/extensions/index/rtree/visitors/{nearest.hpp => nearest_query.hpp} (95%) rename include/boost/geometry/extensions/index/rtree/visitors/{query.hpp => spatial_query.hpp} (87%) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 8020cdaf5..0c75c9b18 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -36,8 +36,8 @@ #include #include #include -#include -#include +#include +#include #include #include @@ -346,7 +346,7 @@ public: template inline size_type spatial_query(Predicates const& pred, OutIter out_it) const { - detail::rtree::visitors::query + detail::rtree::visitors::spatial_query find_v(m_translator, pred, out_it); detail::rtree::apply_visitor(find_v, *m_root); @@ -749,7 +749,7 @@ private: typedef typename detail::point_relation::type point_relation; typedef typename detail::relation::value_type point_type; - typedef detail::rtree::visitors::nearest_one< + typedef detail::rtree::visitors::nearest_query_result_one< value_type, translator_type, point_type @@ -757,7 +757,7 @@ private: result_type result; - detail::rtree::visitors::nearest< + detail::rtree::visitors::nearest_query< value_type, options_type, translator_type, @@ -784,7 +784,7 @@ private: typedef typename detail::point_relation::type point_relation; typedef typename detail::relation::value_type point_type; - typedef detail::rtree::visitors::nearest_k< + typedef detail::rtree::visitors::nearest_query_result_k< value_type, translator_type, point_type @@ -792,7 +792,7 @@ private: result_type result(k); - detail::rtree::visitors::nearest< + detail::rtree::visitors::nearest_query< value_type, options_type, translator_type, diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp similarity index 95% rename from include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp rename to include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp index f11d64f4b..54b81d8bf 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp @@ -1,6 +1,6 @@ // Boost.Geometry Index // -// R-tree k nearest neighbour querying visitor implementation +// R-tree k nearest neighbour query visitor implementation // // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // @@ -8,8 +8,8 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_NEAREST_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_NEAREST_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_NEAREST_QUERY_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_NEAREST_QUERY_HPP #include @@ -25,7 +25,7 @@ namespace detail { namespace rtree { namespace visitors { // - well not with this algorithm of storing k-th neighbor template -struct nearest_one +struct nearest_query_result_one { public: typedef typename geometry::default_distance_result< @@ -33,7 +33,7 @@ public: typename translator::indexable_type::type >::type distance_type; - inline nearest_one() + inline nearest_query_result_one() : m_comp_dist((std::numeric_limits::max)()) {} @@ -68,7 +68,7 @@ private: }; template -struct nearest_k +struct nearest_query_result_k { public: typedef typename geometry::default_distance_result< @@ -76,7 +76,7 @@ public: typename translator::indexable_type::type >::type distance_type; - inline explicit nearest_k(size_t k) + inline explicit nearest_query_result_k(size_t k) : m_count(k) { BOOST_GEOMETRY_INDEX_ASSERT(0 < m_count, "Number of neighbors should be greater than 0"); @@ -156,7 +156,7 @@ template < typename Predicates, typename Result > -class nearest +class nearest_query : public rtree::visitor::type , index::nonassignable { @@ -183,7 +183,7 @@ public: rtree::value_tag > value_distances_predicates_check; - inline nearest(parameters_type const& parameters, Translator const& translator, DistancesPredicates const& dist_pred, Predicates const& pred, Result & r) + inline nearest_query(parameters_type const& parameters, Translator const& translator, DistancesPredicates const& dist_pred, Predicates const& pred, Result & r) : m_parameters(parameters), m_translator(translator) , m_dist_pred(dist_pred), m_pred(pred) , m_result(r) @@ -337,4 +337,4 @@ private: }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_NEAREST_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_NEAREST_QUERY_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/query.hpp b/include/boost/geometry/extensions/index/rtree/visitors/spatial_query.hpp similarity index 87% rename from include/boost/geometry/extensions/index/rtree/visitors/query.hpp rename to include/boost/geometry/extensions/index/rtree/visitors/spatial_query.hpp index 689e525aa..10926f2f2 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/query.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/spatial_query.hpp @@ -1,6 +1,6 @@ // Boost.Geometry Index // -// R-tree querying visitor implementation +// R-tree spatial query visitor implementation // // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // @@ -8,8 +8,8 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_QUERY_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_QUERY_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_SPATIAL_QUERY_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_SPATIAL_QUERY_HPP #include @@ -20,7 +20,7 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { template -struct query +struct spatial_query : public rtree::visitor::type , index::nonassignable { @@ -28,7 +28,7 @@ struct query typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; - inline query(Translator const& t, Predicates const& p, OutIter out_it) + inline spatial_query(Translator const& t, Predicates const& p, OutIter out_it) : tr(t), pred(p), out_iter(out_it), found_count(0) {} @@ -78,4 +78,4 @@ struct query }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_QUERY_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_SPATIAL_QUERY_HPP From 0ccbb1fe0c37eac7f9b8aac331deaae8b0c688d1 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 22 Nov 2012 11:28:21 +0000 Subject: [PATCH 03/10] some of warnings fixed. [SVN r81481] --- .../extensions/index/rtree/node/node.hpp | 6 +++--- .../extensions/index/rtree/options.hpp | 19 +++++++++++++++---- .../index/rtree/visitors/destroy.hpp | 2 +- test/rtree/test_rtree.hpp | 2 +- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/node/node.hpp b/include/boost/geometry/extensions/index/rtree/node/node.hpp index 0b87589fb..87f5d9d0a 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node.hpp @@ -109,9 +109,9 @@ struct destroy_elements } } - inline static void apply(typename leaf::elements_type::iterator first, - typename leaf::elements_type::iterator last, - Allocators &) + inline static void apply(typename leaf::elements_type::iterator /*first*/, + typename leaf::elements_type::iterator /*last*/, + Allocators & /*allocators*/) {} }; diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/rtree/options.hpp index 87d26a02f..0893f65c9 100644 --- a/include/boost/geometry/extensions/index/rtree/options.hpp +++ b/include/boost/geometry/extensions/index/rtree/options.hpp @@ -148,19 +148,30 @@ private: size_t min_elements; }; +namespace detail { + +inline size_t default_rstar_reinserted_elements() +{ + return (std::numeric_limits::max)(); +}; + +} // namespace options::detail + class rstar { public: - static const size_t default_reinserted_elements = -1; - rstar(size_t max_elements_, size_t min_elements_, size_t overlap_cost_threshold_ = 0, - size_t reinserted_elements_ = default_reinserted_elements) + size_t reinserted_elements_ = detail::default_rstar_reinserted_elements()) : max_elements(max_elements_) , min_elements(min_elements_) , overlap_cost_threshold(overlap_cost_threshold_) - , reinserted_elements(default_reinserted_elements == reinserted_elements_ ? (max_elements_ * 3) / 10 : reinserted_elements_) + , reinserted_elements( + detail::default_rstar_reinserted_elements() == reinserted_elements_ ? + (max_elements_ * 3) / 10 : + reinserted_elements_ + ) {} size_t get_max_elements() const { return max_elements; } diff --git a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp index 567e66d84..0d60fae83 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp @@ -52,7 +52,7 @@ public: rtree::destroy_node::apply(m_allocators, node_to_destroy); } - inline void operator()(leaf & l) + inline void operator()(leaf & BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(l)) { BOOST_GEOMETRY_INDEX_ASSERT(&l == rtree::get(m_current_node), "invalid pointers"); diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index d7bf83b6f..b33468cf3 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -327,7 +327,7 @@ template <> struct test_overlap_impl { template - static void apply(bgi::rtree const& tree, std::vector const& input, Box const& qbox) + static void apply(bgi::rtree const& /*tree*/, std::vector const& /*input*/, Box const& /*qbox*/) {} }; From e5766cf57e6e1a2a8e06db9cb8a67183ca0f46e6 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 22 Nov 2012 14:45:32 +0000 Subject: [PATCH 04/10] Fixed nullptr dereference errors. [SVN r81483] --- .../index/rtree/node/dynamic_visitor.hpp | 1 + .../geometry/extensions/index/rtree/rtree.hpp | 44 +++++++++++++------ test/rtree/test_rtree.hpp | 28 ++++++++++-- 3 files changed, 56 insertions(+), 17 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp b/include/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp index 7058057e4..1c9962540 100644 --- a/include/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp @@ -84,6 +84,7 @@ inline Derived * get(dynamic_node * n) template inline void apply_visitor(Visitor &v, Visitable & n) { + assert(&n); n.apply_visitor(v); } diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 0c75c9b18..b9fa0e9a3 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -175,7 +175,7 @@ public: { //TODO use Boost.Container allocator_traits_type::select_on_container_copy_construction() - this->raw_copy(src, *this, m_allocators); + this->raw_copy(src, *this, false); } /*! @@ -191,7 +191,7 @@ public: , m_leafs_level(0) , m_root(0) { - this->raw_copy(src, *this, m_allocators); + this->raw_copy(src, *this, false); } /*! @@ -225,7 +225,8 @@ public: //TODO use Boost.Container allocator_traits_type::propagate_on_container_move_assignment - this->raw_copy(src, *this, m_allocators); + // It uses m_allocators + this->raw_copy(src, *this, true); return *this; } @@ -259,7 +260,8 @@ public: } else { - this->raw_copy(src, *this, m_allocators); + // It uses m_allocators + this->raw_copy(src, *this, true); } return *this; @@ -346,6 +348,9 @@ public: template inline size_type spatial_query(Predicates const& pred, OutIter out_it) const { + if ( !m_root ) + return 0; + detail::rtree::visitors::spatial_query find_v(m_translator, pred, out_it); @@ -580,7 +585,8 @@ private: template inline void apply_visitor(Visitor & visitor) const { - detail::rtree::apply_visitor(visitor, *m_root); + if ( m_root ) + detail::rtree::apply_visitor(visitor, *m_root); } /*! @@ -710,16 +716,27 @@ private: /*! Copy the R-tree i.e. whole nodes structure, values and other attributes. + It uses destination's allocators to create the new structure. \note Exception-safety: strong. \param src The source R-tree. \param dst The destination R-tree. */ - inline void raw_copy(rtree const& src, rtree & dst, allocators_type & allocators) const + inline void raw_copy(rtree const& src, rtree & dst, bool copy_all_internals) const { - detail::rtree::visitors::copy copy_v(allocators); - detail::rtree::apply_visitor(copy_v, *src.m_root); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) + detail::rtree::visitors::copy copy_v(dst.m_allocators); + + if ( src.m_root ) + detail::rtree::apply_visitor(copy_v, *src.m_root); // MAY THROW (V, E: alloc, copy, N: alloc) + + if ( copy_all_internals ) + { + dst.m_translator = src.m_translator; // MAY THROW + + dst.m_parameters = src.m_parameters; + //dst.m_allocators = dst.m_allocators; + } if ( dst.m_root ) { @@ -728,11 +745,6 @@ private: dst.m_root = 0; } - dst.m_translator = src.m_translator; - - dst.m_parameters = src.m_parameters; - dst.m_allocators = allocators; - dst.m_root = copy_v.result; dst.m_values_count = src.m_values_count; dst.m_leafs_level = src.m_leafs_level; @@ -746,6 +758,9 @@ private: template inline size_type raw_nearest_one(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const { + if ( !m_root ) + return 0; + typedef typename detail::point_relation::type point_relation; typedef typename detail::relation::value_type point_type; @@ -781,6 +796,9 @@ private: template inline size_type raw_nearest_k(DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) const { + if ( !m_root ) + return 0; + typedef typename detail::point_relation::type point_relation; typedef typename detail::relation::value_type point_type; diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index b33468cf3..a5a8e65f8 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -260,7 +260,8 @@ template void test_spatial_query(Rtree & rtree, Predicates const& pred, std::vector const& expected_output) { BOOST_CHECK( bgi::are_levels_ok(rtree) ); - BOOST_CHECK( bgi::are_boxes_ok(rtree) ); + if ( !rtree.empty() ) + BOOST_CHECK( bgi::are_boxes_ok(rtree) ); std::vector output; size_t n = rtree.spatial_query(pred, std::back_inserter(output)); @@ -481,7 +482,9 @@ void test_nearest_query_k(Rtree const& rtree, std::vector const& input, P // caluclate biggest distance std::sort(test_output.begin(), test_output.end(), TestNearestKLess()); - D biggest_d = test_output.back().first; + D biggest_d = 0; + if ( !test_output.empty() ) + biggest_d = test_output.back().first; // transform test output to vector of values std::vector expected_output(test_output.size()); @@ -534,14 +537,13 @@ void test_copy_assignment_move(bgi::rtree const& tree, Box const& q { size_t s = tree.size(); - BOOST_CHECK(s); - std::vector expected_output; tree.spatial_query(qbox, std::back_inserter(expected_output)); // copy constructor bgi::rtree t1(tree); + BOOST_CHECK(tree.empty() == t1.empty()); BOOST_CHECK(tree.size() == t1.size()); std::vector output; @@ -551,6 +553,7 @@ void test_copy_assignment_move(bgi::rtree const& tree, Box const& q // copying assignment operator t1 = tree; + BOOST_CHECK(tree.empty() == t1.empty()); BOOST_CHECK(tree.size() == t1.size()); output.clear(); @@ -609,6 +612,8 @@ void test_rtree_by_value(Parameters const& parameters) typedef bgi::rtree Tree; typedef typename Tree::box_type B; + // not empty tree test + Tree tree(parameters); std::vector input; B qbox; @@ -632,6 +637,21 @@ void test_rtree_by_value(Parameters const& parameters) test_copy_assignment_move(tree, qbox); test_remove(tree, qbox); + + // empty tree test + + Tree empty_tree(parameters); + std::vector empty_input; + + test_intersects_and_disjoint(empty_tree, empty_input, qbox); + test_covered_by(empty_tree, empty_input, qbox); + test_overlaps(empty_tree, empty_input, qbox); + //test_touches(empty_tree, empty_input, qbox); + test_within(empty_tree, empty_input, qbox); + test_nearest_query(empty_tree, empty_input, pt); + test_nearest_query_k(empty_tree, empty_input, pt, 10); + test_nearest_query_not_found(empty_tree, generate_outside_point

::apply(), 1, 3); + test_copy_assignment_move(empty_tree, qbox); } // run all tests for one Algorithm for some number of rtrees From 80be48d155d54d77aa26281174ae3d339f5171fe Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 24 Nov 2012 19:54:36 +0000 Subject: [PATCH 05/10] Added rtree::swap() method. Added requirement 'Nonthrowing copy constructor of the Translator'. [SVN r81512] --- doc/html/geometry_index/introduction.html | 2 +- doc/html/geometry_index/r_tree.html | 2 +- .../r_tree/creation_and_modification.html | 6 +- .../r_tree/exception_safety.html | 56 ++++++++++--------- .../geometry_index/r_tree/introduction.html | 2 +- .../r_tree/nearest_neighbours_queries.html | 2 +- .../r_tree/rtree_quickstart.html | 4 +- .../r_tree/spatial_queries.html | 2 +- doc/html/index.html | 4 +- doc/rtree/exception_safety.qbk | 15 ++--- .../geometry/extensions/index/rtree/rtree.hpp | 42 +++++++++----- test/rtree/test_rtree.hpp | 36 +++++++++--- 12 files changed, 107 insertions(+), 66 deletions(-) diff --git a/doc/html/geometry_index/introduction.html b/doc/html/geometry_index/introduction.html index aea9c9dc7..dd8b1efc4 100644 --- a/doc/html/geometry_index/introduction.html +++ b/doc/html/geometry_index/introduction.html @@ -3,7 +3,7 @@ Introduction - + diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html index 610c173c3..f204ae1ba 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -3,7 +3,7 @@ R-tree - + diff --git a/doc/html/geometry_index/r_tree/creation_and_modification.html b/doc/html/geometry_index/r_tree/creation_and_modification.html index 50c29f984..09a46b6b3 100644 --- a/doc/html/geometry_index/r_tree/creation_and_modification.html +++ b/doc/html/geometry_index/r_tree/creation_and_modification.html @@ -3,7 +3,7 @@ Creation and modification - + @@ -51,7 +51,7 @@

rtree<Value, Parameters, Translator, Allocator>
 
-
    +
    • Value - type of object which will be stored in the container.
    • @@ -89,7 +89,7 @@ std::pair<...>, pointer, iterator or smart pointer.

      -
        +
        • Indexable = Point | Box diff --git a/doc/html/geometry_index/r_tree/exception_safety.html b/doc/html/geometry_index/r_tree/exception_safety.html index 0d19fcbb5..bbb02dfc4 100644 --- a/doc/html/geometry_index/r_tree/exception_safety.html +++ b/doc/html/geometry_index/r_tree/exception_safety.html @@ -3,7 +3,7 @@ Exception safety - + @@ -28,7 +28,7 @@

          In order to be exception-safe the R-tree requires:

          -
            +
            • Nonthrowing destructor of the Value.
            • @@ -36,7 +36,11 @@ Exception-safe copy constructor of the Value.
            • - Exception-safe copy constructor of the CoordinateType. + Exception-safe copy constructor of the CoordinateType + used in the Indexable. +
            • +
            • + Nonthrowing copy constructor of the Translator.
            @@ -65,8 +69,7 @@ @@ -139,8 +142,7 @@ @@ -153,7 +155,19 @@ + + + + @@ -293,7 +307,8 @@ @@ -335,23 +350,14 @@

            - nothrow (default) or strong - [a] + nothrow

            - nothrow (default) or strong - [b] + nothrow

            nothrow or strong - [c] + [a] +

            +
            +

            + swap(rtree &) +

            +
            +

            + nothrow

            - nothrow + nothrow or strong + [b]

            -

            [a] - nothrow - if Translator - has nonthrowing copy constructor (default), strong - - if Translator - has throwing copy constructor +

            [a] + nothrow - if allocators are equal, strong - if allocators aren't equal

            -

            [b] - nothrow - if Translator - has nonthrowing copy constructor (default), strong - - if Translator - has throwing copy constructor -

            -

            [c] - nothrow - if allocators are equal and Translator has nonthrowing - copy constructor (default), strong - - if allocators aren't equal or Translator - has throwing copy constructor +

            [b] + nothrow - if CoordinateType + has nonthrowing copy ctor, strong + - if CoordinateType + has throwing copy ctor

            diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index ec8a37d4a..68a64d201 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -3,7 +3,7 @@ Introduction - + diff --git a/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html b/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html index 6a2482203..304962a7f 100644 --- a/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html +++ b/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html @@ -3,7 +3,7 @@ Nearest neighbours queries - + diff --git a/doc/html/geometry_index/r_tree/rtree_quickstart.html b/doc/html/geometry_index/r_tree/rtree_quickstart.html index 34499d5f8..039a6a09b 100644 --- a/doc/html/geometry_index/r_tree/rtree_quickstart.html +++ b/doc/html/geometry_index/r_tree/rtree_quickstart.html @@ -3,7 +3,7 @@ Quick Start - + @@ -109,7 +109,7 @@

            - More + More

            More information about the R-tree implementation, other algorithms and queries diff --git a/doc/html/geometry_index/r_tree/spatial_queries.html b/doc/html/geometry_index/r_tree/spatial_queries.html index 910bf2c5b..2c7c62057 100644 --- a/doc/html/geometry_index/r_tree/spatial_queries.html +++ b/doc/html/geometry_index/r_tree/spatial_queries.html @@ -3,7 +3,7 @@ Spatial queries - + diff --git a/doc/html/index.html b/doc/html/index.html index 034989275..cd2958d14 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -3,7 +3,7 @@ Chapter 1. Geometry Index - + @@ -56,7 +56,7 @@

        - +

        Last revised: November 21, 2012 at 16:05:59 GMT

        Last revised: November 24, 2012 at 19:48:27 GMT


        diff --git a/doc/rtree/exception_safety.qbk b/doc/rtree/exception_safety.qbk index f98ec3c15..9ef8e3d7d 100644 --- a/doc/rtree/exception_safety.qbk +++ b/doc/rtree/exception_safety.qbk @@ -14,22 +14,22 @@ In order to be exception-safe the __rtree__ requires: * Nonthrowing destructor of the `__value__`. * Exception-safe copy constructor of the `__value__`. -* Exception-safe copy constructor of the `CoordinateType`. +* Exception-safe copy constructor of the `CoordinateType` used in the `Indexable`. +* Nonthrowing copy constructor of the `Translator`. [table [[Operation] [exception-safety]] -[[`rtree()`] [ /nothrow (default)/ or *strong* -[footnote /nothrow/ - if `Translator` has nonthrowing copy constructor (default), *strong* - if `Translator` has throwing copy constructor]]] +[[`rtree()`] [ /nothrow/ ]] [[`rtree(first, last)`] [ *strong* ]] [[`~rtree()`] [ /nothrow/ ]] [[][]] [[`rtree(rtree const&)`] [ *strong* ]] [[`operator=(rtree const&)`] [ *strong* ]] [[][]] -[[`rtree(rtree &&)`] [ /nothrow (default)/ or *strong* -[footnote /nothrow/ - if `Translator` has nonthrowing copy constructor (default), *strong* - if `Translator` has throwing copy constructor]]] +[[`rtree(rtree &&)`] [ /nothrow/ ]] [[`operator=(rtree &&)`] [ /nothrow/ or *strong* -[footnote /nothrow/ - if allocators are equal and `Translator` has nonthrowing copy constructor (default), *strong* - if allocators aren't equal or `Translator` has throwing copy constructor]]] +[footnote /nothrow/ - if allocators are equal, *strong* - if allocators aren't equal]]] +[[`swap(rtree &)`] [ /nothrow/ ]] [[][]] [[`insert(__value__)`] [ basic ]] [[`insert(first, last)`] [ basic ]] @@ -42,7 +42,8 @@ In order to be exception-safe the __rtree__ requires: [[`size()`] [ /nothrow/ ]] [[`empty()`] [ /nothrow/ ]] [[`clear()`] [ /nothrow/ ]] -[[`box()`] [ /nothrow/ ]] +[[`box()`] [ /nothrow/ or *strong* +[footnote /nothrow/ - if `CoordinateType` has nonthrowing copy ctor, *strong* - if `CoordinateType` has throwing copy ctor]]] [[`get_allocator()`] [ /nothrow/ ]] [[`parameters()`] [ /nothrow/ ]] [[`translator()`] [ /nothrow/ ]] diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index b9fa0e9a3..452ee8a1b 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -103,15 +103,14 @@ public: /*! The constructor. - \note Exception-safety: nothrow (if translator has nonthrowing copy ctor), - strong (if translator has throwing copy ctor) + \note Exception-safety: nothrow \param parameters The parameters object. \param translator The translator object. \param allocator The allocator object. */ inline explicit rtree(Parameters parameters = Parameters(), translator_type const& translator = translator_type(), Allocator allocator = Allocator()) - : m_translator(translator) // MAY THROW (copy) + : m_translator(translator) // SHOULDN'T THROW , m_parameters(parameters) , m_allocators(allocator) , m_values_count(0) @@ -132,7 +131,7 @@ public: */ template inline rtree(Iterator first, Iterator last, Parameters parameters = Parameters(), translator_type const& translator = translator_type(), Allocator allocator = std::allocator()) - : m_translator(translator) // MAY THROW (copy) + : m_translator(translator) // SHOULDN'T THROW , m_parameters(parameters) , m_allocators(allocator) , m_values_count(0) @@ -166,7 +165,7 @@ public: \note Exception-safety: strong */ inline rtree(rtree const& src) - : m_translator(src.m_translator) // MAY THROW (copy) + : m_translator(src.m_translator) // SHOULDN'T THROW , m_parameters(src.m_parameters) , m_allocators(src.m_allocators) , m_values_count(0) @@ -184,7 +183,7 @@ public: \note Exception-safety: strong */ inline rtree(rtree const& src, Allocator const& allocator) - : m_translator(src.m_translator) // MAY THROW (copy) + : m_translator(src.m_translator) // SHOULDN'T THROW , m_parameters(src.m_parameters) , m_allocators(allocator) , m_values_count(0) @@ -197,11 +196,10 @@ public: /*! The moving constructor. - \note Exception-safety: nothrow (if translator has nonthrowing copy ctor), - strong (if translator has throwing copy ctor) + \note Exception-safety: nothrow */ inline rtree(BOOST_RV_REF(rtree) src) - : m_translator(src.m_translator) // MAY THROW (copy) + : m_translator(src.m_translator) // SHOULDN'T THROW , m_parameters(src.m_parameters) , m_allocators(src.m_allocators) , m_values_count(src.m_values_count) @@ -234,8 +232,8 @@ public: /*! The moving assignment. - \note Exception-safety: nothrow (if allocators are equal and translator has nonthrowing copy ctor), - strong (if allocators aren't equal or translator has throwing copy ctor) + \note Exception-safety: nothrow (if allocators are equal), + strong (if allocators aren't equal) */ inline rtree & operator=(BOOST_RV_REF(rtree) src) { @@ -246,7 +244,7 @@ public: if ( m_allocators.allocator == src.m_allocators.allocator ) { - m_translator = src.m_translator; // MAY THROW (copy) + m_translator = src.m_translator; // SHOULDN'T THROW m_parameters = src.m_parameters; //m_allocators = src.m_allocators; @@ -267,6 +265,24 @@ public: return *this; } + /*! + Swaps two rtrees. + + \note Exception-safety: nothrow + + \param other The other rtree. + */ + void swap(rtree & other) + { + std::swap(m_translator, other.m_translator); // SHOULDN'T THROW + std::swap(m_parameters, other.m_parameters); + std::swap(m_allocators, other.m_allocators); + + std::swap(m_values_count, other.m_values_count); + std::swap(m_leafs_level, other.m_leafs_level); + std::swap(m_root, other.m_root); + } + /*! Insert a value to the index. @@ -732,7 +748,7 @@ private: if ( copy_all_internals ) { - dst.m_translator = src.m_translator; // MAY THROW + dst.m_translator = src.m_translator; // SHOULDN'T THROW dst.m_parameters = src.m_parameters; //dst.m_allocators = dst.m_allocators; diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index a5a8e65f8..d3ea2e8c4 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -533,7 +533,7 @@ void test_nearest_query_not_found(Rtree const& rtree, Point const& pt, Coordinat // rtree copying and moving template -void test_copy_assignment_move(bgi::rtree const& tree, Box const& qbox) +void test_copy_assignment_swap_move(bgi::rtree const& tree, Box const& qbox) { size_t s = tree.size(); @@ -560,25 +560,43 @@ void test_copy_assignment_move(bgi::rtree const& tree, Box const& q t1.spatial_query(qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t1, output, expected_output); - // moving constructor - bgi::rtree t2(boost::move(t1)); + bgi::rtree t2(tree.parameters()); + 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()); - BOOST_CHECK(t2.size() == s); - BOOST_CHECK(t1.size() == 0); + output.clear(); + t1.spatial_query(qbox, std::back_inserter(output)); + BOOST_CHECK(output.empty()); output.clear(); t2.spatial_query(qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t2, output, expected_output); + t2.swap(t1); + + // moving constructor + bgi::rtree t3(boost::move(t1)); + + BOOST_CHECK(t3.size() == s); + BOOST_CHECK(t1.size() == 0); + + output.clear(); + t3.spatial_query(qbox, std::back_inserter(output)); + test_exactly_the_same_outputs(t3, output, expected_output); // moving assignment operator - t1 = boost::move(t2); + t1 = boost::move(t3); BOOST_CHECK(t1.size() == s); - BOOST_CHECK(t2.size() == 0); + BOOST_CHECK(t3.size() == 0); output.clear(); t1.spatial_query(qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t1, output, expected_output); + + //TODO - test SWAP } // rtree removing @@ -634,7 +652,7 @@ void test_rtree_by_value(Parameters const& parameters) test_nearest_query_k(tree, input, pt, 10); test_nearest_query_not_found(tree, generate_outside_point

        ::apply(), 1, 3); - test_copy_assignment_move(tree, qbox); + test_copy_assignment_swap_move(tree, qbox); test_remove(tree, qbox); @@ -651,7 +669,7 @@ void test_rtree_by_value(Parameters const& parameters) test_nearest_query(empty_tree, empty_input, pt); test_nearest_query_k(empty_tree, empty_input, pt, 10); test_nearest_query_not_found(empty_tree, generate_outside_point

        ::apply(), 1, 3); - test_copy_assignment_move(empty_tree, qbox); + test_copy_assignment_swap_move(empty_tree, qbox); } // run all tests for one Algorithm for some number of rtrees From 5a6e87b146f491b1436736b53253f99c1ab732b9 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 24 Nov 2012 22:17:08 +0000 Subject: [PATCH 06/10] Pointers and Iterators types removed from the default Translator. [SVN r81523] --- .../r_tree/creation_and_modification.html | 25 +- .../r_tree/exception_safety.html | 7 +- doc/html/index.html | 2 +- doc/rtree/creation.qbk | 12 +- doc/rtree/exception_safety.qbk | 4 +- .../extensions/index/translator/def.hpp | 216 ++++++++++++------ .../extensions/index/translator/helpers.hpp | 1 + 7 files changed, 166 insertions(+), 101 deletions(-) diff --git a/doc/html/geometry_index/r_tree/creation_and_modification.html b/doc/html/geometry_index/r_tree/creation_and_modification.html index 09a46b6b3..003c41cdf 100644 --- a/doc/html/geometry_index/r_tree/creation_and_modification.html +++ b/doc/html/geometry_index/r_tree/creation_and_modification.html @@ -83,11 +83,10 @@ Indexables. Each type adapted to Point or Box concept is an Indexable. Default Translator - index::translator::def<Value> - is able to handle Point, - Box, - std::pair<...>, - pointer, iterator or smart pointer. + index::translator::def<Value> is able to handle Point, + Box + or std::pair<...> + Values.

        • @@ -95,16 +94,16 @@ | Box
        • - BasicValue = - Indexable | - std::pair<Indexable, T> | std::pair<T, Indexable> -
        • -
        • - Value = BasicValue - | BasicValue* | Iterator<BasicValue> - | SmartPtr<BasicValue> + Value = Indexable + | std::pair<Indexable, + T>
        +

        + If comparison of two Values is required, the default translator + compares both components of the std::pair<...>. If the second one is a Geometry, geometry::equals() function is used. For other types it + uses operator==(). +

        Examples of Value types:

        diff --git a/doc/html/geometry_index/r_tree/exception_safety.html b/doc/html/geometry_index/r_tree/exception_safety.html index bbb02dfc4..7307cace6 100644 --- a/doc/html/geometry_index/r_tree/exception_safety.html +++ b/doc/html/geometry_index/r_tree/exception_safety.html @@ -351,13 +351,12 @@

        [a] - nothrow - if allocators are equal, strong - if allocators aren't equal + nothrow - if allocators are equal, strong - otherwise

        [b] nothrow - if CoordinateType - has nonthrowing copy ctor, strong - - if CoordinateType - has throwing copy ctor + has nonthrowing copy constructor, strong + - otherwise

      diff --git a/doc/html/index.html b/doc/html/index.html index cd2958d14..37c643eb6 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -56,7 +56,7 @@
- +

Last revised: November 24, 2012 at 19:48:27 GMT

Last revised: November 24, 2012 at 22:04:48 GMT


diff --git a/doc/rtree/creation.qbk b/doc/rtree/creation.qbk index c83f23de8..3025132e5 100644 --- a/doc/rtree/creation.qbk +++ b/doc/rtree/creation.qbk @@ -31,13 +31,15 @@ __rtree__ may store `__value__`s of any type as long the `__translator__` is passed as parameter. It knows how to interpret those `__value__`s and extract an object understandable by the __rtree__. Those objects are called `__indexable__`s. Each type adapted to `__point__` or `__box__` concept is an `__indexable__`. -Default `__translator__` `index::translator::def` -is able to handle `__point__`, `__box__`, `std::pair<...>`, pointer, iterator -or smart pointer. +Default `__translator__` `index::translator::def<__value__>` +is able to handle `__point__`, `__box__` or `std::pair<...>` `__value__`s. * `__indexable__ = __point__ | __box__` -* `BasicValue = Indexable | std::pair<__indexable__, T> | std::pair` -* `__value__ = BasicValue | BasicValue* | Iterator | SmartPtr` +* `__value__ = Indexable | std::pair<__indexable__, T>` + +If comparison of two `__value__`s is required, the default translator compares +both components of the `std::pair<...>`. If the second one is a `Geometry`, +`geometry::equals()` function is used. For other types it uses `operator==()`. Examples of `__value__` types: diff --git a/doc/rtree/exception_safety.qbk b/doc/rtree/exception_safety.qbk index 9ef8e3d7d..3b9847480 100644 --- a/doc/rtree/exception_safety.qbk +++ b/doc/rtree/exception_safety.qbk @@ -28,7 +28,7 @@ In order to be exception-safe the __rtree__ requires: [[][]] [[`rtree(rtree &&)`] [ /nothrow/ ]] [[`operator=(rtree &&)`] [ /nothrow/ or *strong* -[footnote /nothrow/ - if allocators are equal, *strong* - if allocators aren't equal]]] +[footnote /nothrow/ - if allocators are equal, *strong* - otherwise]]] [[`swap(rtree &)`] [ /nothrow/ ]] [[][]] [[`insert(__value__)`] [ basic ]] @@ -43,7 +43,7 @@ In order to be exception-safe the __rtree__ requires: [[`empty()`] [ /nothrow/ ]] [[`clear()`] [ /nothrow/ ]] [[`box()`] [ /nothrow/ or *strong* -[footnote /nothrow/ - if `CoordinateType` has nonthrowing copy ctor, *strong* - if `CoordinateType` has throwing copy ctor]]] +[footnote /nothrow/ - if `CoordinateType` has nonthrowing copy constructor, *strong* - otherwise]]] [[`get_allocator()`] [ /nothrow/ ]] [[`parameters()`] [ /nothrow/ ]] [[`translator()`] [ /nothrow/ ]] diff --git a/include/boost/geometry/extensions/index/translator/def.hpp b/include/boost/geometry/extensions/index/translator/def.hpp index d880e2b13..5020a5b32 100644 --- a/include/boost/geometry/extensions/index/translator/def.hpp +++ b/include/boost/geometry/extensions/index/translator/def.hpp @@ -15,100 +15,164 @@ namespace boost { namespace geometry { namespace index { namespace translator { -namespace dispatch { - -// Distinguish between def, def and def - -// Geometry -template -struct def -{ - typedef typename detail::extract_indexable::type const& result_type; - - result_type operator()(Value const& v) const - { - return detail::extract_indexable::get(v); - } - - bool equals(Value const& v1, Value const& v2) const - { - return detail::equals::apply(v1, v2); - } -}; - -// Iterator -template -struct def -{ - typedef typename detail::extract_indexable::type const& result_type; - - result_type operator()(Value const& v) const - { - return detail::extract_indexable::get(*v); - } - - bool equals(Value const& v1, Value const& v2) const - { - return v1 == v2; - } -}; - -// SmartPtr -template -struct def -{ - typedef typename detail::extract_indexable::type const& result_type; - - result_type operator()(Value const& v) const - { - return detail::extract_indexable::get(*v); - } - - bool equals(Value const& v1, Value const& v2) const - { - return v1 == v2; - } -}; - -} // namespace dispatch +//namespace dispatch { +// +//// Distinguish between def, def and def +// +//// Geometry +//template +//struct def +//{ +// typedef typename detail::extract_indexable::type const& result_type; +// +// result_type operator()(Value const& v) const +// { +// return detail::extract_indexable::get(v); +// } +// +// bool equals(Value const& v1, Value const& v2) const +// { +// return detail::equals::apply(v1, v2); +// } +//}; +// +//// Iterator +//template +//struct def +//{ +// typedef typename detail::extract_indexable::type const& result_type; +// +// result_type operator()(Value const& v) const +// { +// return detail::extract_indexable::get(*v); +// } +// +// bool equals(Value const& v1, Value const& v2) const +// { +// return v1 == v2; +// } +//}; +// +//// SmartPtr +//template +//struct def +//{ +// typedef typename detail::extract_indexable::type const& result_type; +// +// result_type operator()(Value const& v) const +// { +// return detail::extract_indexable::get(*v); +// } +// +// bool equals(Value const& v1, Value const& v2) const +// { +// return v1 == v2; +// } +//}; +// +//} // namespace dispatch +// +///*! +//The default translator. It translates Value object to Indexable object. This is done in +//operator() which takes const reference to Value and returns const reference to Indexable. +// +//\tparam Value The Value type which the translator translates to Indexable. +//*/ +//template +//struct def +// : public dispatch::def +// < +// Value, +// detail::is_iterator::value, +// detail::is_smart_ptr::value +// > +//{ +//}; +// +///*! +//The default translator. It translates Value object to Indexable object. Since this is +//a specialization for pointers to Values operator() takes const ptr to Value and returns +//const reference to Indexable. +// +//\tparam Value The Value type which the translator translates to Indexable. +//*/ +//template +//struct def +//{ +// typedef typename detail::extract_indexable::type const& result_type; +// +// result_type operator()(const Value *v) const +// { +// return detail::extract_indexable::get(*v); +// } +// +// bool equals(const Value* v1, const Value* v2) const +// { +// return v1 == v2; +// } +//}; /*! -The default translator. It translates Value object to Indexable object. This is done in -operator() which takes const reference to Value and returns const reference to Indexable. +The default translator. It translates Value object to Indexable object. -\tparam Value The Value type which the translator translates to Indexable. +\tparam Value The Value type which may be translated directly to the Indexable. */ template struct def - : public dispatch::def - < - Value, - detail::is_iterator::value, - detail::is_smart_ptr::value - > { + BOOST_MPL_ASSERT_MSG( + (!detail::indexable_not_found_error< + typename traits::indexable_type::type + >::value), + NOT_VALID_INDEXABLE_TYPE, + (Value) + ); + + typedef Value const& result_type; + + result_type operator()(Value const& value) const + { + return value; + } + + bool equals(Value const& v1, Value const& v2) const + { + return geometry::equals(v1, v2); + } }; /*! -The default translator. It translates Value object to Indexable object. Since this is -a specialization for pointers to Values operator() takes const ptr to Value and returns -const reference to Indexable. +The default translator. This specialization translates from std::pair. -\tparam Value The Value type which the translator translates to Indexable. +\tparam Indexable The Indexable type. +\tparam Second The second type. */ -template -struct def +template +struct def< std::pair > { - typedef typename detail::extract_indexable::type const& result_type; + BOOST_MPL_ASSERT_MSG( + (!detail::indexable_not_found_error< + typename traits::indexable_type::type + >::value), + NOT_VALID_INDEXABLE_TYPE, + (Indexable) + ); - result_type operator()(const Value *v) const + typedef Indexable const& result_type; + + result_type operator()(std::pair const& value) const { - return detail::extract_indexable::get(*v); + return value.first; } - bool equals(const Value* v1, const Value* v2) const + bool equals(std::pair const& v1, std::pair const& v2) const { - return v1 == v2; + return geometry::equals(v1.first, v2.first) + && + dispatch::equals< + Second, + typename geometry::traits::tag::type + >::apply(v1.second, v2.second); } }; diff --git a/include/boost/geometry/extensions/index/translator/helpers.hpp b/include/boost/geometry/extensions/index/translator/helpers.hpp index 02610f31e..6f0ce2cfb 100644 --- a/include/boost/geometry/extensions/index/translator/helpers.hpp +++ b/include/boost/geometry/extensions/index/translator/helpers.hpp @@ -15,6 +15,7 @@ #include +#include #include #include From f7d7e88bbb2ad15a0a2f1f8adc5abcbe0b9b385c Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 25 Nov 2012 17:28:12 +0000 Subject: [PATCH 07/10] Modified glut_vis additional test and added generated rtree images. [SVN r81528] --- doc/rtree/images/disjoint.png | Bin 0 -> 2223 bytes doc/rtree/images/intersects.png | Bin 0 -> 2228 bytes doc/rtree/images/knn.png | Bin 0 -> 2774 bytes doc/rtree/images/knn_cover.png | Bin 0 -> 3072 bytes doc/rtree/images/knn_inters.png | Bin 0 -> 3058 bytes doc/rtree/images/linear.png | Bin 0 -> 2158 bytes doc/rtree/images/overlaps.png | Bin 0 -> 2209 bytes doc/rtree/images/quadratic.png | Bin 0 -> 2096 bytes doc/rtree/images/rstar.png | Bin 0 -> 2079 bytes doc/rtree/images/within.png | Bin 0 -> 2208 bytes .../index/rtree/visitors/gl_draw.hpp | 20 +++--- tests/additional_glut_vis.cpp | 59 +++++++++++++++--- 12 files changed, 62 insertions(+), 17 deletions(-) create mode 100644 doc/rtree/images/disjoint.png create mode 100644 doc/rtree/images/intersects.png create mode 100644 doc/rtree/images/knn.png create mode 100644 doc/rtree/images/knn_cover.png create mode 100644 doc/rtree/images/knn_inters.png create mode 100644 doc/rtree/images/linear.png create mode 100644 doc/rtree/images/overlaps.png create mode 100644 doc/rtree/images/quadratic.png create mode 100644 doc/rtree/images/rstar.png create mode 100644 doc/rtree/images/within.png diff --git a/doc/rtree/images/disjoint.png b/doc/rtree/images/disjoint.png new file mode 100644 index 0000000000000000000000000000000000000000..131a915865d2e57778ca9c8c7223640cbd0cb2b3 GIT binary patch literal 2223 zcmeAS@N?(olHy`uVBq!ia0y~yU^olH9Bd2>4AOhPWHK-?uqAoByDm3UZqra=!JHfq_9bGbEzKIX^cyHLrvL z1e}Xf6H8K46v{J8G8EiBeFIYTQrQ_8ID|c2978H@y}cVioKdKMYyG52sVAEX3NG+2D3oqX%wSma%vqS>_K&S!TK2u)8pKs{cV+(d zy0icPeB0fVw%7do$Mg5M{hrg7z>(JVaQTE~xx3ER{=dG;ZBC%T=hY9~9-+QqxKe(izs6Wzzcf#(= zHb(plBfV1B#mes}&on8>KFqp&XOKbm{L3c3m+xNAc<@hc#xs-kvKC+Fd{;m7>wxk9 zx{n(E26NaPCTD#+^NYdatk<ow$1}RvSeui+Ern9n+X_ zAd{h`Q0hU>v@}EYBS+@2J>__|Wch7BP0PDM&SBG<13BS5G^j z7v}QooyA$#-n`d-RUu)wABKm;GaY=QJLd@7qlGui7tfx-7V0nl{mzRtcZOG`2j?1# zFY2`DvVFhK#$qkcSF7yGvW+W+VyCJncd*Uw3}vvN^@Ew;%thFcp-#lXKB~j^%4-=> zw>)#J`*r&N&;AX+yk)*>hugF_zXGe?thwUfw%uy`>E?@JSBls+&7UX8Dsh=T&WaW&hh?-P>b%hQ69j zkut{n4);jyWPN(`sEO)^?UQ+g_x}%no_qV*=J(Bi*M9%~_vin-Bc*Zoe}CP{ayU~@ z{LHkAb-ms>OJDC&IM2A;vRuwSD0kEEcmJfGI+x#BdcFJWz6T~ZH>#buZ!F8a+_OzW zx%U4}``Fw!U$5_be&_S8Wq0ScO4rSLx!Q8pvK6Wfe!>$rUbG9*s#v|c$2Prp!?%=& zUe@}DGxbFL&g5K~`0~b;_i|+?yxw^|MFgXR>xp@x9$RFYxg$3PecM(zt1DvivU^+C zi7a4q@N*Zk;Coc)`~$LA(f zIiFv6%T<5wv`T3-%W}peCNKLRyq~HV%f{-rSz$(}CWnK`=8NwSBs!QlOfvL+_w(2B zU59^9$vInfV#C9o4@{0Ok@>y8UOsx&tWB1AMIW`7Yx-IQ^KCkD!Z#zlsABtp+YdKy zY`viSuIl{XjB`F$NsfL|w0}l!+Ukk2jH)}I_+6j9OZ&_G>(MXQ@e4k; zl8)@UYROyRro^Bi1@`jJY0%XR#ryfk|w)1C) z*2x4bNF}I7o3HJYEB){M+q5pHC8KZBg^w@X+gE;l+j7^SK-s43AkimszUJSt{u?&2O{T33J>R_}aaa(8d$EMd0|^-S)XkIx>mEPd`4ogZDV!}W}3_x44-my%|^h@AO7b~y{P zA#cFU%X8S;8J9<%^tcfJ$&9C9)`LTZ1>AGMWeGz|SLQ#<>U~Nb?5j#=g{CVl={%Te zwuAGaLg>BUX$K@H&R~1Wt@eT8fA)9zk4>dht2(~M>bEgf&r!M*cPw)GOl_vWIY&IS zzjvhx_^euZVA16-@t>cYl)U}LVYfhb&Dxr67mk={^c#L;^%Y*Io}$(QEuM+;_cc3&+KIqlNwS4V!-u)phm zXp(+=x9@U+%O*z0RXjJ|m@F+{a%uIS z$2Q9)V_D5>8JEv|{%v@XMTPnx1xgDOee!@E&3zd>1FL1mr zkeAxYd2fYBg#nL&Ly?q{X8kdN3Ryp&<~Nqrwi7Qeka##}>%0??+QOsjt>M`qHYc-J zMyvMv{__9%C@%y+Vj7^x>2jYjM1+@Q?B?x;?l)aq9zvQpV?qiq^SQ)J7=G+*xH%=)1p3CWZm2I sr@MTw&heLdxBb3mdKI;Vst04B^B_W%F@ literal 0 HcmV?d00001 diff --git a/doc/rtree/images/intersects.png b/doc/rtree/images/intersects.png new file mode 100644 index 0000000000000000000000000000000000000000..066a1dd80b711b4f58f9e085f7308cb575e83c9f GIT binary patch literal 2228 zcmeAS@N?(olHy`uVBq!ia0y~yU^olH9Bd2>4AOhPWHK-?u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xykak)PdCHnY9Y3 zmQUq>70g;3T5w4GK&H$My~~UTG8q*7{FoKy&as_j!E2&8!&bA~%A$8s)-^8o&qx^vRt7|YGQmlY;`Q*OKQy5NaPfbGuf!Y4BqNIrZL<$nb1%|(m?N1x6) z7TUN#D%4=z`>$p%uTQu=UusEwcY&Szee_@Luv^SiQ$ZU0Q}SBGAi{64BQzhc8xFVdQ&MBb@0Ogy;DgXcg literal 0 HcmV?d00001 diff --git a/doc/rtree/images/knn_inters.png b/doc/rtree/images/knn_inters.png new file mode 100644 index 0000000000000000000000000000000000000000..c32c6474cb62845f4283f2b890dc817096fcfa67 GIT binary patch literal 3058 zcmeAS@N?(olHy`uVBq!ia0y~yU^olH9Bd2>4AOhPWHK-?uqAoByDm3UUgaDT~?0z`!7z84^+AoS&PUnpeUA z0?tLLi6yBi3gww484B*6z5ywEsq734++m(Bjv*Dd-p-9ITWlcU>gxAiJ1NynyLnB| zzl_JnSa>;lmsZ#Rnp46i{rY9-)FqcTtb4tR;lONtImQE~|90$4j1-#}#M_g6&E7mS zS6-Z7@^Mnw=a<*FKK)y-D8W)3YT%{0R9*M+#Z@0a-T43bbNAM3Ja?LMrfHZ^k^bQW8izCg30pstU2gH3 z`TeizhmmpzADA#K&{{ihqaA}que#mV|MRZ1FDP7oadO>r1w(f8MGO=D9tR&(I>I#P zS(CPc#DPo(g}%!SPmYNmeR86+P)a~~M$Ae^KjyQ6R@0AVG89?yh8nFf^;vx`)8Zz( zX>01vozl~Dro93zQ*1Dc)AvnulVf+7M z-X2@K4wuc%x_;4{kH+6#a_--~f7$(8B@gatHO^dWvgl>7h9%pZ zoA+<*pXbFYVqN5D!nfRqMGGSf}j5LS#wj1r>6hA&Aw>f z)JyZG5NsUNBm1<$QJ+WxQ}JR!ih z$n#7!H_yWv5)Tz-#WXcmA6n^Q)1hW~TTEhy=A5pC_mPKMK=w zlcOR%Rcl zIL4y9KWy@41&I}Ra`P;Gb&XwCty8`yFEK^j@7N!;6PeFWdA&;iSa2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RscTQ2u(4$?ZzQ|2SHdcXcMqwO<~pRqRAI`z4@{L#-MF16#I?N@Fw*;wFN z7d-F!=JPiv9@k#(89UYRt5BZS{zg3(XTQl0m|M=A-|dhQ6Z&<{&AlnV4SGL+S;QLL zdwGuP-=o_SA6Q)Iy8Nc~@|%OYp0=z7l0~zW7D{yp^DOeznX@Q7!9&DH^(>bl?;%D1 zp1GG_c<#R*STnhz;%VA_{fiSGo5=RX7D>%F7L>6p<8GH(UR%ENiHVuHqk*`S>8h+q z*=H7J$!;!BOlB6(iH`jv=rbW9$^S#WQ~VKk4kzb51`kbMSgo{sU3)MkW=qiN+T|Ww zr(b+!vQ6!R^vbYzuI6Vmu9R-#T=psCz)O?<)RpTFFI!=gF6{5TPB_=;wy(tFMOSUk zXVo1M_R(56@$wWgzy6))9+sI--rZ94lJ8=OC9ep_b(OH2eUqIIeV}mKZEx)W|`+8>H$ZJb`-RAe#e3rx#0wvo>Xg9Ne+*`t2q0&hKuR zdhB2K%dYR{?z^q~lDLk2uU62jdRy)M)@D{Wvt7LP^@lR&GjsBq5(NA-d)~*fTYTFz z;W9(Y`OIw+7eth2?VCU6VE(hFZ5yo47H&MDE;r@Y=L)`F8_k|AlJByLW6amQKDE)O cf%^~Z(X+QUc}c8J1vR}rUHx3vIVCg!0I_t)UjP6A literal 0 HcmV?d00001 diff --git a/doc/rtree/images/linear.png b/doc/rtree/images/linear.png new file mode 100644 index 0000000000000000000000000000000000000000..a8cc786a0b99928136ed81c8bf9b987113f97dc2 GIT binary patch literal 2158 zcmeAS@N?(olHy`uVBq!ia0y~yU^olH9Bd2>4AOhPWHK-?uqAoByDm3bM;=^^LJ-U|^8V42dXl&d<$F%`0I5 z0q3IB#FEq$h4Rdj32(9ho^S(-=In|8L#RWdGnr%CewKPwV#Iw`REb=Lcs)>7U47&4n`Q@$YxvTOV%t zP|WV%|F2bRfB$aZa5j^pE#Y3_?z^l0@!qrj9q4Dgde{BecbiLAxc$2Qzxj~?&*%U5 zzjrS#T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uOJO@8#kx0w@(^tJMeOY~u-q#e*eSOtimQj@R`HPo^Ys2&{ zc@JdXdb)yhVeNHxORtl{-j=>kWn`zd_N>vZUGw%*#I2k;$AsT*YWbXPR{E@6^^X7J zPP3NuYTb`@&kYo$7MN{XHE(ZwN_uGgwWO$mSvrR{{TF-Zd3E~k5H9;}qx$71)utD2 zEdJc{SOXdirxHziAjc2jiIuVG1G-9*@aRM zSU{OmLD%=0iKhIez4j5S*Q(4f$_mgt&ur=Iba2WRfpazWOYbrT&b_?m?ycFMPJ8@S zu@Vp3vwxDz&s$vyUi_R2%PmvX=LmabsjrCbSetKBH0wx`Ztb#>e=QjvrO`@U|G(1VW!*V(%2uCbEM86Z@8>uRIZ}%MCRN* z;Te63Av<2$$$f55J$8Dj^e?+pj~LJ0Q*b^X-23>v)cgC_>Ly&~5w2gk#oFxR3TYLd zrRH~cM&6R0?Xg*)`2WA)=kr#jGhAeFVNP-VEX(-*eA<^8jhAx-&fLj9khXkft>RU? zr}FGpy*KwB;9G9ETYSQ0hL^=s3gvO1FYbFi`I|?PREX+~{f9hnD4)!<3f&wvV^!0# zf(5JjEB~4nDEK+6_`33JoPYRaX28>9(>DnyEO#tDR5*|A1P>^8c$|JV=h&I#DQ5q5 zzZLJue)IoM^PwuuwT0!Yn!efg9k)I^X|@2*!zWK#`u|=0%jf@B@StN z>t-I;(6X6bIPK$Mfw#Mkb_JiaVM{97fA*P}V|{&|O78X2yGvj1%FCQ*+))3MS={%2 U&0^tgv7n0E)78&qol`;+0BX0+=>Px# literal 0 HcmV?d00001 diff --git a/doc/rtree/images/rstar.png b/doc/rtree/images/rstar.png new file mode 100644 index 0000000000000000000000000000000000000000..45308b361820341eb2e19789c0054e291af2810b GIT binary patch literal 2079 zcmeAS@N?(olHy`uVBq!ia0y~yU^olH9Bd2>4AOhPWHK-?uqAoByDm3bLyeJGS;RFfhnwhD4M&=jZ08=9Msj zfOAo5Vo7R>LV0FMhJw4NZ$OG(Dmw!Md$XsDV@SoVw|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0xW=H_maQ-7*n95utEYN*+)w{&s5!%Q-hSEKFJhOcoIADWl`2n1X2V{K zvrz>S1+%UweDl0;zgUvZ!nf?9#ST_b>^qn+6dg6`Pd^{rRFSaVZ*q~E(=3TO&v?xh zC9a%$eB;bcC85g;st-Py_n`jlU;mop`%cwqe2w*QWh$PtC`9-1ipxEwjr#(#p2uD0 zXKWa^Pg^QRa@p*K4qVCNI%0HH;XxJH#k5AfJXNWHRJon zX13o<^eXxNv_;kCESr$9kAKrVmf)lX`g`@;F0ZkPo_b=_mwTbhk35eqisxA#dGns= zTqhslW#!YntsUPx)%>ZcUTrIKSwt+`zq3KtKHhh0hp+Y7$2`+-o!$4sr}EbQBOA9V`6c;b+vP8I6RO^S>KC2+?55t1 zr`#52S*BlJ`dcgA!G}3V_AeqOV8zQ!^~^Fxu@_7fomMSy7jag$(4j+-lZuYaxH z>-#JFgl!pbSA2M_ec#QccU$d>xYWLyp77rDZuf#Ri+z54Oa8ps$=6=vXZ%c!#n~eI zcds3k5^wG<;gS_zm;?)Q_j3Q=vwpMZ#Htz*4e1K-HLg4 m?E33nhrd>p>Ihdf|7X1U{rc)j0{0t14FykEKbLh*2~7Y&b^|K_ literal 0 HcmV?d00001 diff --git a/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp b/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp index 06cfb6c7c..cf8ec843a 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp @@ -122,17 +122,17 @@ struct gl_draw : public rtree::visitor const& tree, typedef typename rtree_type::box_type box_type; typedef typename rtree_type::allocators_type allocators_type; + if ( !tree.empty() ) + { + glColor3f(0.75f, 0.75f, 0.75f); + detail::rtree::visitors::detail::gl_draw_indexable(tree.box(), 0); + } + detail::rtree::visitors::gl_draw gl_draw_v(tree.translator(), level_first, level_last, z_coord_level_multiplier); diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp index cd8eb5cc7..647b72b6b 100644 --- a/tests/additional_glut_vis.cpp +++ b/tests/additional_glut_vis.cpp @@ -9,6 +9,8 @@ #include +#define BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE + #include #include @@ -31,9 +33,9 @@ std::vector vect; size_t found_count = 0; P search_point; -float min_distance = 20; +float min_distance = 10; float max_distance = 30; -size_t count = 10; +size_t count = 5; std::vector nearest_boxes; B search_box; @@ -50,11 +52,11 @@ void knn() search_point = P(x, y); nearest_boxes.clear(); - found_count = t.nearest( + found_count = t.nearest_query( bgi::bounded( search_point, - bgi::far(min_distance), - bgi::near(max_distance) + bgi::to_furthest(min_distance), + bgi::to_nearest(max_distance) ), count, std::back_inserter(nearest_boxes) @@ -87,13 +89,13 @@ void query() search_box = B(P(x - w, y - h), P(x + w, y + h)); nearest_boxes.clear(); - found_count = t.query(Predicate(search_box), std::back_inserter(nearest_boxes) ); + found_count = t.spatial_query(Predicate(search_box), std::back_inserter(nearest_boxes) ); } else { search_box = t.box(); nearest_boxes.clear(); - found_count = t.query(Predicate(search_box), std::back_inserter(nearest_boxes) ); + found_count = t.spatial_query(Predicate(search_box), std::back_inserter(nearest_boxes) ); } if ( found_count > 0 ) @@ -220,13 +222,23 @@ void resize(int w, int h) glViewport(0, 0, w, h); - gluPerspective(45, ratio, 1, 1000); + //gluPerspective(45, ratio, 1, 1000); + glOrtho(-150, 150, -150, 150, -150, 150); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - gluLookAt( + /*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); } void mouse(int button, int state, int x, int y) @@ -292,6 +304,33 @@ void keyboard(unsigned char key, int x, int y) { std::cout << "\n" << t << "\n"; } + else if ( current_line == "rand" ) + { + for ( size_t i = 0 ; i < 35 ; ++i ) + { + 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)); + + boost::geometry::index::insert(t, b); + vect.push_back(b); + + std::cout << "inserted: "; + bgi::detail::rtree::visitors::detail::print_indexable(std::cout, b); + std::cout << '\n'; + } + + std::cout << ( bgi::are_boxes_ok(t) ? "boxes OK\n" : "WRONG BOXES!\n" ); + std::cout << ( bgi::are_levels_ok(t) ? "levels OK\n" : "WRONG LEVELS!\n" ); + std::cout << "\n"; + + search_valid = false; + + glutPostRedisplay(); + } else { if ( current_line == "knn" ) @@ -338,7 +377,7 @@ int main(int argc, char **argv) glutInit(&argc, argv); glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA); glutInitWindowPosition(100,100); - glutInitWindowSize(800, 600); + glutInitWindowSize(600, 600); glutCreateWindow("boost::geometry::index::rtree GLUT test"); glutDisplayFunc(render_scene); From 7babc43f75c6257a79dd2acf4990e6f271f3d74d Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 25 Nov 2012 20:56:38 +0000 Subject: [PATCH 08/10] Rtree docs and sample modified. Rtree introduction expanded. Quickstart improved. [SVN r81539] --- doc/html/geometry_index/introduction.html | 2 +- doc/html/geometry_index/r_tree.html | 2 +- .../r_tree/creation_and_modification.html | 6 +- .../r_tree/exception_safety.html | 12 +- .../geometry_index/r_tree/introduction.html | 191 +++++++++++++++++- .../r_tree/nearest_neighbours_queries.html | 2 +- .../r_tree/rtree_quickstart.html | 89 +++++--- .../r_tree/spatial_queries.html | 2 +- doc/html/index.html | 4 +- doc/{rtree => }/images/disjoint.png | Bin doc/{rtree => }/images/intersects.png | Bin doc/{rtree => }/images/knn.png | Bin doc/{rtree => }/images/knn_cover.png | Bin doc/{rtree => }/images/knn_inters.png | Bin doc/{rtree => }/images/linear.png | Bin doc/{rtree => }/images/overlaps.png | Bin doc/{rtree => }/images/quadratic.png | Bin doc/{rtree => }/images/rstar.png | Bin doc/{rtree => }/images/within.png | Bin doc/rtree/introduction.qbk | 44 +++- doc/rtree/quickstart.qbk | 26 ++- doc/src/examples/rtree/quick_start.cpp | 42 +++- tests/additional_speed.cpp | 2 +- 23 files changed, 356 insertions(+), 68 deletions(-) rename doc/{rtree => }/images/disjoint.png (100%) rename doc/{rtree => }/images/intersects.png (100%) rename doc/{rtree => }/images/knn.png (100%) rename doc/{rtree => }/images/knn_cover.png (100%) rename doc/{rtree => }/images/knn_inters.png (100%) rename doc/{rtree => }/images/linear.png (100%) rename doc/{rtree => }/images/overlaps.png (100%) rename doc/{rtree => }/images/quadratic.png (100%) rename doc/{rtree => }/images/rstar.png (100%) rename doc/{rtree => }/images/within.png (100%) diff --git a/doc/html/geometry_index/introduction.html b/doc/html/geometry_index/introduction.html index dd8b1efc4..aea9c9dc7 100644 --- a/doc/html/geometry_index/introduction.html +++ b/doc/html/geometry_index/introduction.html @@ -3,7 +3,7 @@ Introduction - + diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html index f204ae1ba..610c173c3 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -3,7 +3,7 @@ R-tree - + diff --git a/doc/html/geometry_index/r_tree/creation_and_modification.html b/doc/html/geometry_index/r_tree/creation_and_modification.html index 003c41cdf..8725a9e0f 100644 --- a/doc/html/geometry_index/r_tree/creation_and_modification.html +++ b/doc/html/geometry_index/r_tree/creation_and_modification.html @@ -3,7 +3,7 @@ Creation and modification - + @@ -51,7 +51,7 @@

rtree<Value, Parameters, Translator, Allocator>
 
-
    +
    • Value - type of object which will be stored in the container.
    • @@ -88,7 +88,7 @@ or std::pair<...> Values.

      -
        +
        • Indexable = Point | Box diff --git a/doc/html/geometry_index/r_tree/exception_safety.html b/doc/html/geometry_index/r_tree/exception_safety.html index 7307cace6..6b34a74f4 100644 --- a/doc/html/geometry_index/r_tree/exception_safety.html +++ b/doc/html/geometry_index/r_tree/exception_safety.html @@ -3,7 +3,7 @@ Exception safety - + @@ -28,7 +28,7 @@

          In order to be exception-safe the R-tree requires:

          -
            +
            • Nonthrowing destructor of the Value.
            • @@ -155,7 +155,7 @@

              nothrow or strong - [a] + [a]

              @@ -308,7 +308,7 @@

              nothrow or strong - [b] + [b]

              @@ -350,10 +350,10 @@ -

              [a] +

              [a] nothrow - if allocators are equal, strong - otherwise

              -

              [b] +

              [b] nothrow - if CoordinateType has nonthrowing copy constructor, strong - otherwise diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index 68a64d201..d86263e93 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -3,7 +3,7 @@ Introduction - + @@ -27,12 +27,191 @@ Introduction

              - R-tree is a self-balancing search tree. Each tree's node store a box descring - the space occupied by children nodes. At the bottom of the structure, there - are leaf-nodes which contains values (geometric objects representations). - Minimal and maximal numbers of values/children which may be stored inside - each node are user defined. + R-tree is a tree data structure used for spatial searching. It was proposed + by Antonin Guttman in 1984 [1] as an expansion of B-tree for multi-dimensional data. It may + be used to store points or volumetric data in order to perform a spatial + query later. This query may return objects that are inside some area or are + close to some point in space.

              +

              + The R-tree structure is presented on the image below. Each R-tree's node + store a box descring the space occupied by its children nodes. At the bottom + of the structure, there are leaf-nodes which contains values (geometric objects + representations). +

              +

              + rstar +

              +

              + The number of maximum and mininimum node's elements must be specified by + the user. If the number of elements reaches it's maximum the new node is + created and elements are split between nodes. If the number of elements in + node is too small, the node is deleted and elements are reinserted into the + tree. +

              +

              + The R-tree is a self-balanced data structure. The key part of balancing algorithm + is node splitting algorithm mentioned before [2] [3]. Each algorithm would produce different splits so the internal + structure of a tree may be different for each one of them. In general more + complex algorithms analyses elements better and produces less overlapping + nodes. This is a "better" split because later, in the searching + process less nodes must be traversed in order to find desired obejcts. On + the other hand more complex analysis takes more time. In general faster inserting + will result in slower searching and vice versa. Example structures of trees + created by use of three different algorithms and operations time are presented + below. +

              +
              ++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
              + +

              + linear algorithm +

              +
              +

              + quadratic algorithm +

              +
              +

              + R*-tree +

              +
              +

              + Structure +

              +
              +

              + linear +

              +
              +

              + quadratic +

              +
              +

              + rstar +

              +
              +

              + 1M Values inserts +

              +
              +

              + 1.85s +

              +
              +

              + 3.10s +

              +
              +

              + 24.52s +

              +
              +

              + 1M spatial queries +

              +
              +

              + 8.60s +

              +
              +

              + 2.74s +

              +
              +

              + 1.31s +

              +
              +

              + 100k knn queries +

              +
              +

              + 3.49s +

              +
              +

              + 1.59s +

              +
              +

              + 0.84s +

              +
              +

              + Key features of this implementation of the R-tree are: +

              +
                +
              • + three different creation algorithms - linear, quadratic or rstar, +
              • +
              • + parameters (including maximal and minimal number of elements) may be + passed as compile- or run-time parameters - compile-time version is faster, +
              • +
              • + capable to store arbitrary Value type, +
              • +
              • + sophisticated queries - e.g. search for 5 nearest values intersecting + some region but not within the other one. +
              • +
              +
              +

              +

              [1] + Guttman, A. (1984). R-Trees: A Dynamic Index Structure for Spatial + Searching footnote +

              +

              [2] + Greene, D. (1989). An implementation and performance analysis + of spatial data access methods +

              +

              [3] + Beckmann, N.; Kriegel, H. P.; Schneider, R.; Seeger, B. (1990). The + R*-tree: an efficient and robust access method for points and rectangles +

              +
            diff --git a/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html b/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html index 304962a7f..6a2482203 100644 --- a/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html +++ b/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html @@ -3,7 +3,7 @@ Nearest neighbours queries - + diff --git a/doc/html/geometry_index/r_tree/rtree_quickstart.html b/doc/html/geometry_index/r_tree/rtree_quickstart.html index 039a6a09b..5e2471181 100644 --- a/doc/html/geometry_index/r_tree/rtree_quickstart.html +++ b/doc/html/geometry_index/r_tree/rtree_quickstart.html @@ -3,7 +3,7 @@ Quick Start - + @@ -35,23 +35,32 @@

            -
            #include <vector>
            -
            -#include <boost/geometry.hpp>
            +
            #include <boost/geometry.hpp>
             #include <boost/geometry/geometries/point_xy.hpp>
             #include <boost/geometry/geometries/box.hpp>
             
             #include <boost/geometry/extensions/index/rtree/rtree.hpp>
             
            +// to store queries results
            +#include <vector>
            +
            +// just for output
            +#include <iostream>
            +#include <boost/foreach.hpp>
            +
             namespace bg = boost::geometry;
             namespace bgi = boost::geometry::index;
             

            - It is possible to store user-defined types in the R-tree. To keep it simple - we will use predefined Point - and Box. + Typically you'll store e.g. std::pair<Box, MyGeometryId> in the R-tree. MyGeometryId + will be some indentifier of a complex Geometry + stored in other container, e.g. index type of a Polygon + stored in the vector or an iterator of list of Rings. + To keep it simple to define Value + we will use predefined Box + and unsigned int.

            @@ -62,54 +71,86 @@

            - R-tree may be created using various algorithm and parameters. In this example - we will use quadratic algorithm. Maximum number of elements in nodes are - set to 32, minimum to 8. + R-tree may be created using various algorithm and parameters. You should + choose the algorithm you'll find the best for your purpose. In this example + we will use quadratic algorithm. Parameters are passed as template parameters. + Maximum number of elements in nodes are set to 32, minimum to 8.

            -
            bgi::rtree< value, bgi::quadratic<32, 8> > rtree;
            +
            // create the rtree using default constructor
            +bgi::rtree< value, bgi::quadratic<32, 8> > rtree;
             

            - Inserting values into the R-tree may be done by calling insert() method. + Typically Values will be + generated in a loop from e.g. Polygons + stored in some other container. In this case Box + objects will probably be created with geometry::make_envelope() function. But to keep it simple lets just + generate some boxes manually and insert them into the R-tree by using insert() + method.

            -
            // create some box
            -// this typically will be an envelope of some geometry
            -box b(point(0, 0), point(10, 10));
            -// insert new value
            -rtree.insert(std::make_pair(b, 0));
            +
            // create some values
            +for ( unsigned i = 0 ; i < 10 ; ++i )
            +{
            +    // create a box
            +    box b(point(i, i), point(i + 0.5f, i + 0.5f));
            +    // insert new value
            +    rtree.insert(std::make_pair(b, i));
            +}
             

            There are various types of spatial queries that may be performed, they can - be even combined together in one call. For simplicity, default one is used. + be even combined together in one call. For simplicity, we use the default + one. The following query return values intersecting a box. The sequence of + Values in the result is not + specified.

            -
            // find values intersecting a box
            -std::vector<value> result;
            -rtree.spatial_query(b, std::back_inserter(result));
            +
            // find values intersecting some area defined by a box
            +box query_box(point(0, 0), point(5, 5));
            +std::vector<value> result_s;
            +rtree.spatial_query(query_box, std::back_inserter(result_s));
             

            - Default k-nearest neighbors query may be performed as follows. + Other type of query is k-nearest neighbor search. It returns some number + of values nearest to some point in space. The default knn query may be performed + as follows. The sequence of Values + in the result is not specified.

            // find 5 nearest values to a point
            -rtree.nearest_query(point(0, 0), 5, std::back_inserter(result));
            +std::vector<value> result_n;
            +rtree.nearest_query(point(0, 0), 5, std::back_inserter(result_n));
            +
            +

            +

            +

            + At the end we'll print results. +

            +

            +

            +
            std::cout << "spatial query result:" << std::endl;
            +BOOST_FOREACH(value const& v, result_s)
            +    std::cout << bg::wkt<box>(v.first) << " - " << v.second << std::endl;
            +std::cout << "knn query result:" << std::endl;
            +BOOST_FOREACH(value const& v, result_n)
            +    std::cout << bg::wkt<box>(v.first) << " - " << v.second << std::endl;
             

            - More + More

            More information about the R-tree implementation, other algorithms and queries diff --git a/doc/html/geometry_index/r_tree/spatial_queries.html b/doc/html/geometry_index/r_tree/spatial_queries.html index 2c7c62057..910bf2c5b 100644 --- a/doc/html/geometry_index/r_tree/spatial_queries.html +++ b/doc/html/geometry_index/r_tree/spatial_queries.html @@ -3,7 +3,7 @@ Spatial queries - + diff --git a/doc/html/index.html b/doc/html/index.html index 37c643eb6..d8aade2bd 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -3,7 +3,7 @@ Chapter 1. Geometry Index - + @@ -56,7 +56,7 @@

            - +

            Last revised: November 24, 2012 at 22:04:48 GMT

            Last revised: November 25, 2012 at 20:52:29 GMT


            diff --git a/doc/rtree/images/disjoint.png b/doc/images/disjoint.png similarity index 100% rename from doc/rtree/images/disjoint.png rename to doc/images/disjoint.png diff --git a/doc/rtree/images/intersects.png b/doc/images/intersects.png similarity index 100% rename from doc/rtree/images/intersects.png rename to doc/images/intersects.png diff --git a/doc/rtree/images/knn.png b/doc/images/knn.png similarity index 100% rename from doc/rtree/images/knn.png rename to doc/images/knn.png diff --git a/doc/rtree/images/knn_cover.png b/doc/images/knn_cover.png similarity index 100% rename from doc/rtree/images/knn_cover.png rename to doc/images/knn_cover.png diff --git a/doc/rtree/images/knn_inters.png b/doc/images/knn_inters.png similarity index 100% rename from doc/rtree/images/knn_inters.png rename to doc/images/knn_inters.png diff --git a/doc/rtree/images/linear.png b/doc/images/linear.png similarity index 100% rename from doc/rtree/images/linear.png rename to doc/images/linear.png diff --git a/doc/rtree/images/overlaps.png b/doc/images/overlaps.png similarity index 100% rename from doc/rtree/images/overlaps.png rename to doc/images/overlaps.png diff --git a/doc/rtree/images/quadratic.png b/doc/images/quadratic.png similarity index 100% rename from doc/rtree/images/quadratic.png rename to doc/images/quadratic.png diff --git a/doc/rtree/images/rstar.png b/doc/images/rstar.png similarity index 100% rename from doc/rtree/images/rstar.png rename to doc/images/rstar.png diff --git a/doc/rtree/images/within.png b/doc/images/within.png similarity index 100% rename from doc/rtree/images/within.png rename to doc/images/within.png diff --git a/doc/rtree/introduction.qbk b/doc/rtree/introduction.qbk index dc283360f..95e13a022 100644 --- a/doc/rtree/introduction.qbk +++ b/doc/rtree/introduction.qbk @@ -10,9 +10,45 @@ [section Introduction] -__rtree__ is a self-balancing search tree. Each tree's node store a box descring the space occupied by children nodes. -At the bottom of the structure, there are leaf-nodes which contains values -(geometric objects representations). Minimal and maximal numbers of values/children -which may be stored inside each node are user defined. +__rtree__ is a tree data structure used for spatial searching. It was proposed by +Antonin Guttman in 1984 [footnote Guttman, A. (1984). /R-Trees: A Dynamic Index Structure for Spatial Searching/ footnote] +as an expansion of B-tree for multi-dimensional data. It may be used to store points or volumetric data in order to +perform a spatial query later. This query may return objects that are inside some area or are close to some point in space. + +The __rtree__ structure is presented on the image below. Each __rtree__'s node store a box descring the space occupied by +its children nodes. At the bottom of the structure, there are leaf-nodes which contains values +(geometric objects representations). + +[$../images/rstar.png] + +The number of maximum and mininimum node's elements must be specified by the user. If the number of elements reaches it's maximum +the new node is created and elements are split between nodes. If the number of elements in node is too small, the node is deleted +and elements are reinserted into the tree. + +The __rtree__ is a self-balanced data structure. The key part of balancing algorithm is node splitting algorithm mentioned before +[footnote Greene, D. (1989). /An implementation and performance analysis of spatial data access methods/ ] +[footnote Beckmann, N.; Kriegel, H. P.; Schneider, R.; Seeger, B. (1990). /The R*-tree: an efficient and robust access method for points and rectangles/ ]. +Each algorithm would produce different splits so the internal structure of a tree may be different for each one of them. +In general more complex algorithms analyses elements better and produces less overlapping nodes. This is a "better" split because +later, in the searching process less nodes must be traversed in order to find desired obejcts. On the other hand more complex analysis +takes more time. In general faster inserting will result in slower searching and vice versa. Example structures of trees created by use +of three different algorithms and operations time are presented below. + +[table +[[] [linear algorithm] [quadratic algorithm] [R*-tree]] +[[*Structure*][[$../images/linear.png]] [[$../images/quadratic.png]] [[$../images/rstar.png]]] +[[*1M Values inserts*] [1.85s] [3.10s] [24.52s]] +[[*1M spatial queries*][8.60s] [2.74s] [1.31s]] +[[*100k knn queries*] [3.49s] [1.59s] [0.84s]] +] + +Key features of this implementation of the __rtree__ are: + +* three different creation algorithms - linear, quadratic or rstar, +* parameters (including maximal and minimal number of elements) may be passed as compile- or run-time parameters - compile-time version is faster, +* capable to store arbitrary __value__ type, +* sophisticated queries - e.g. search for 5 nearest values intersecting some region but not within the other one. [endsect] + + diff --git a/doc/rtree/quickstart.qbk b/doc/rtree/quickstart.qbk index 822aa43d7..0f28622b8 100644 --- a/doc/rtree/quickstart.qbk +++ b/doc/rtree/quickstart.qbk @@ -17,29 +17,41 @@ The code below assumes that following files are included and namespaces used. [rtree_quickstart_include] -It is possible to store user-defined types in the R-tree. To keep it simple we will -use predefined __point__ and __box__. +Typically you'll store e.g. `std::pair` in the __rtree__. `MyGeometryId` +will be some indentifier of a complex `Geometry` stored in other container, e.g. index type +of a `Polygon` stored in the vector or an iterator of list of `Ring`s. To keep it simple to +define `Value` we will use predefined __box__ and unsigned int. [rtree_quickstart_valuetype] -R-tree may be created using various algorithm and parameters. In this example we will -use quadratic algorithm. Maximum number of elements in nodes are set to 32, minimum to 8. +R-tree may be created using various algorithm and parameters. You should choose the algorithm you'll +find the best for your purpose. In this example we will use quadratic algorithm. Parameters are +passed as template parameters. Maximum number of elements in nodes are set to 32, minimum to 8. [rtree_quickstart_create] -Inserting values into the R-tree may be done by calling insert() method. +Typically `Value`s will be generated in a loop from e.g. `Polygon`s stored in some other container. +In this case `Box` objects will probably be created with `geometry::make_envelope()` function. +But to keep it simple lets just generate some boxes manually and insert them into the R-tree by +using `insert()` method. [rtree_quickstart_insert] There are various types of spatial queries that may be performed, they can be even combined together -in one call. For simplicity, default one is used. +in one call. For simplicity, we use the default one. The following query return values intersecting +a box. The sequence of `Values` in the result is not specified. [rtree_quickstart_spatial_query] -Default k-nearest neighbors query may be performed as follows. +Other type of query is k-nearest neighbor search. It returns some number of values nearest to some point +in space. The default knn query may be performed as follows. The sequence of `Values` in the result is not specified. [rtree_quickstart_nearest_query] +At the end we'll print results. + +[rtree_quickstart_output] + [h3 More] More information about the R-tree implementation, other algorithms and queries may be found in other parts of this documentation. diff --git a/doc/src/examples/rtree/quick_start.cpp b/doc/src/examples/rtree/quick_start.cpp index 99f9fdd39..33eb2147f 100644 --- a/doc/src/examples/rtree/quick_start.cpp +++ b/doc/src/examples/rtree/quick_start.cpp @@ -10,14 +10,19 @@ //[rtree_quickstart_include -#include - #include #include #include #include +// to store queries results +#include + +// just for output +#include +#include + namespace bg = boost::geometry; namespace bgi = boost::geometry::index; //] @@ -31,26 +36,41 @@ int main(void) //] //[rtree_quickstart_create + // create the rtree using default constructor bgi::rtree< value, bgi::quadratic<32, 8> > rtree; //] //[rtree_quickstart_insert - // create some box - // this typically will be an envelope of some geometry - box b(point(0, 0), point(10, 10)); - // insert new value - rtree.insert(std::make_pair(b, 0)); + // create some values + for ( unsigned i = 0 ; i < 10 ; ++i ) + { + // create a box + box b(point(i, i), point(i + 0.5f, i + 0.5f)); + // insert new value + rtree.insert(std::make_pair(b, i)); + } //] //[rtree_quickstart_spatial_query - // find values intersecting a box - std::vector result; - rtree.spatial_query(b, std::back_inserter(result)); + // find values intersecting some area defined by a box + box query_box(point(0, 0), point(5, 5)); + std::vector result_s; + rtree.spatial_query(query_box, std::back_inserter(result_s)); //] //[rtree_quickstart_nearest_query // find 5 nearest values to a point - rtree.nearest_query(point(0, 0), 5, std::back_inserter(result)); + std::vector result_n; + rtree.nearest_query(point(0, 0), 5, std::back_inserter(result_n)); + //] + + //[rtree_quickstart_output + std::cout << "spatial query result:" << std::endl; + BOOST_FOREACH(value const& v, result_s) + std::cout << bg::wkt(v.first) << " - " << v.second << std::endl; + std::cout << "knn query result:" << std::endl; + BOOST_FOREACH(value const& v, result_n) + std::cout << bg::wkt(v.first) << " - " << v.second << std::endl; //] return 0; diff --git a/tests/additional_speed.cpp b/tests/additional_speed.cpp index 5744e457b..71d669b90 100644 --- a/tests/additional_speed.cpp +++ b/tests/additional_speed.cpp @@ -21,7 +21,7 @@ int main() namespace bgi = bg::index; size_t values_count = 1000000; - size_t queries_count = 100000; + size_t queries_count = 1000000; std::vector< std::pair > coords; From 73e797440874aefd5c10a504dcb3cf70df2279fe Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 25 Nov 2012 21:26:00 +0000 Subject: [PATCH 09/10] Added basic description and images of spatial and knn queries [SVN r81540] --- .../geometry_index/r_tree/introduction.html | 2 +- .../r_tree/nearest_neighbours_queries.html | 49 +++++++++++++ .../r_tree/spatial_queries.html | 70 +++++++++++++++++++ doc/html/index.html | 2 +- doc/rtree/introduction.qbk | 6 +- doc/rtree/nearest_query.qbk | 11 +++ doc/rtree/spatial_query.qbk | 9 +++ 7 files changed, 144 insertions(+), 5 deletions(-) diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index d86263e93..22f3d92c0 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -201,7 +201,7 @@

            [1] Guttman, A. (1984). R-Trees: A Dynamic Index Structure for Spatial - Searching footnote + Searching

            [2] Greene, D. (1989). An implementation and performance analysis diff --git a/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html b/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html index 6a2482203..497577ccc 100644 --- a/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html +++ b/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html @@ -37,6 +37,55 @@

            Using spatial predicates
            +

            + Nearest neighbours queries returns Values + which are closest to some point in space. Additionally it is possible to + pass distance predicates in order to define how the distance to the Value should be calculated or minimal and + maximal distances. The examples of some knn queries may be found in the table + below. All queries returns 5 closest Values. + The query point, region and result Values are orange. +

            +
            +++++ + + + + + + + + + + +
            +

            + Basic knn query +

            +
            +

            + knn in a ring (Value's furthest point) +

            +
            +

            + knn in a ring (Value's closest point) +

            +
            +

            + knn +

            +
            +

            + knn_inters +

            +
            +

            + knn_cover +

            +
            +

            + Spatial queries returns Values + which meets some predicates. For instance it may be used to retrieve Values + intersecting some area or are within some other area. The examples of some + basic queries may be found in the table below. The query region and result + Values are orange. +

            +
            +++++++ + + + + + + + + + + + + + + +
            +

            + intersects (default) +

            +
            +

            + covered_by +

            +
            +

            + disjoint +

            +
            +

            + overlaps +

            +
            +

            + within +

            +
            +

            + intersects +

            +
            +

            + within +

            +
            +

            + disjoint +

            +
            +

            + overlaps +

            +
            +

            + within +

            +
            - +

            Last revised: November 25, 2012 at 20:52:29 GMT

            Last revised: November 25, 2012 at 21:23:52 GMT


            diff --git a/doc/rtree/introduction.qbk b/doc/rtree/introduction.qbk index 95e13a022..9ac62a7db 100644 --- a/doc/rtree/introduction.qbk +++ b/doc/rtree/introduction.qbk @@ -11,7 +11,7 @@ [section Introduction] __rtree__ is a tree data structure used for spatial searching. It was proposed by -Antonin Guttman in 1984 [footnote Guttman, A. (1984). /R-Trees: A Dynamic Index Structure for Spatial Searching/ footnote] +Antonin Guttman in 1984 [footnote Guttman, A. (1984). /R-Trees: A Dynamic Index Structure for Spatial Searching/] as an expansion of B-tree for multi-dimensional data. It may be used to store points or volumetric data in order to perform a spatial query later. This query may return objects that are inside some area or are close to some point in space. @@ -26,8 +26,8 @@ the new node is created and elements are split between nodes. If the number of e and elements are reinserted into the tree. The __rtree__ is a self-balanced data structure. The key part of balancing algorithm is node splitting algorithm mentioned before -[footnote Greene, D. (1989). /An implementation and performance analysis of spatial data access methods/ ] -[footnote Beckmann, N.; Kriegel, H. P.; Schneider, R.; Seeger, B. (1990). /The R*-tree: an efficient and robust access method for points and rectangles/ ]. +[footnote Greene, D. (1989). /An implementation and performance analysis of spatial data access methods/] +[footnote Beckmann, N.; Kriegel, H. P.; Schneider, R.; Seeger, B. (1990). /The R*-tree: an efficient and robust access method for points and rectangles/]. Each algorithm would produce different splits so the internal structure of a tree may be different for each one of them. In general more complex algorithms analyses elements better and produces less overlapping nodes. This is a "better" split because later, in the searching process less nodes must be traversed in order to find desired obejcts. On the other hand more complex analysis diff --git a/doc/rtree/nearest_query.qbk b/doc/rtree/nearest_query.qbk index d5eb85748..d3ba7fc69 100644 --- a/doc/rtree/nearest_query.qbk +++ b/doc/rtree/nearest_query.qbk @@ -10,6 +10,17 @@ [section Nearest neighbours queries] +Nearest neighbours queries returns `Value`s which are closest to some point in space. +Additionally it is possible to pass distance predicates in order to define how the distance +to the `Value` should be calculated or minimal and maximal distances. The examples of some knn +queries may be found in the table below. All queries returns 5 closest `Values`. +The query point, region and result Values are orange. + +[table +[[Basic knn query] [knn in a ring (Value's furthest point)] [knn in a ring (Value's closest point)]] +[[[$../images/knn.png]] [[$../images/knn_inters.png]] [[$../images/knn_cover.png]]] +] + [section k nearest neighbours] There are three ways of performing knn queries. Following queries returns diff --git a/doc/rtree/spatial_query.qbk b/doc/rtree/spatial_query.qbk index 6013a73fc..198c56b15 100644 --- a/doc/rtree/spatial_query.qbk +++ b/doc/rtree/spatial_query.qbk @@ -10,6 +10,15 @@ [section Spatial queries] +Spatial queries returns `Value`s which meets some predicates. For instance it may be used to +retrieve Values intersecting some area or are within some other area. The examples of some +basic queries may be found in the table below. The query region and result `Value`s are orange. + +[table +[[intersects (default)] [covered_by] [disjoint] [overlaps] [within]] +[[[$../images/intersects.png]] [[$../images/within.png]] [[$../images/disjoint.png]] [[$../images/overlaps.png]] [[$../images/within.png]]] +] + [section Basic queries] There are three ways to perform a spatial query. Following queries returns From bad91b8f317dc632fa4c6c14babc906554491824 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 25 Nov 2012 21:35:20 +0000 Subject: [PATCH 10/10] Small change in docs. [SVN r81541] --- doc/html/geometry_index/r_tree/introduction.html | 2 +- doc/html/index.html | 2 +- doc/rtree/introduction.qbk | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index 22f3d92c0..4f362b0d4 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -51,7 +51,7 @@

            The R-tree is a self-balanced data structure. The key part of balancing algorithm - is node splitting algorithm mentioned before [2] [3]. Each algorithm would produce different splits so the internal + is node splitting algorithm [2] [3]. Each algorithm would produce different splits so the internal structure of a tree may be different for each one of them. In general more complex algorithms analyses elements better and produces less overlapping nodes. This is a "better" split because later, in the searching diff --git a/doc/html/index.html b/doc/html/index.html index 670972d1d..6a7d9f32b 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -56,7 +56,7 @@

            - +

            Last revised: November 25, 2012 at 21:23:52 GMT

            Last revised: November 25, 2012 at 21:34:09 GMT


            diff --git a/doc/rtree/introduction.qbk b/doc/rtree/introduction.qbk index 9ac62a7db..d3482b919 100644 --- a/doc/rtree/introduction.qbk +++ b/doc/rtree/introduction.qbk @@ -25,7 +25,7 @@ The number of maximum and mininimum node's elements must be specified by the use the new node is created and elements are split between nodes. If the number of elements in node is too small, the node is deleted and elements are reinserted into the tree. -The __rtree__ is a self-balanced data structure. The key part of balancing algorithm is node splitting algorithm mentioned before +The __rtree__ is a self-balanced data structure. The key part of balancing algorithm is node splitting algorithm [footnote Greene, D. (1989). /An implementation and performance analysis of spatial data access methods/] [footnote Beckmann, N.; Kriegel, H. P.; Schneider, R.; Seeger, B. (1990). /The R*-tree: an efficient and robust access method for points and rectangles/]. Each algorithm would produce different splits so the internal structure of a tree may be different for each one of them.